@elementor/editor-variables 3.35.3 → 3.35.5
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 +776 -703
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +650 -579
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/ui/menu-item-content.tsx +12 -6
- package/src/components/ui/styled-menu-list.tsx +7 -5
- 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-panel.tsx +18 -15
- package/src/components/variables-manager/variables-manager-table.tsx +18 -189
- package/src/components/variables-selection.tsx +28 -12
- package/src/hooks/use-quota-permissions.ts +10 -11
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
|
5
5
|
import { isTransformable as isTransformable2 } from "@elementor/editor-props";
|
|
6
6
|
|
|
7
7
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
8
|
-
import * as
|
|
8
|
+
import * as React14 from "react";
|
|
9
9
|
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState6 } from "react";
|
|
10
10
|
import {
|
|
11
11
|
__createPanel as createPanel,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
Stack as Stack6,
|
|
30
30
|
usePopupState as usePopupState2
|
|
31
31
|
} from "@elementor/ui";
|
|
32
|
-
import { __ as
|
|
32
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
33
33
|
|
|
34
34
|
// src/utils/tracking.ts
|
|
35
35
|
import { getMixpanel } from "@elementor/events";
|
|
@@ -1036,41 +1036,82 @@ var useVariablesManagerState = () => {
|
|
|
1036
1036
|
};
|
|
1037
1037
|
|
|
1038
1038
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1039
|
-
import * as
|
|
1040
|
-
import { createElement as
|
|
1041
|
-
import { PromotionChip, PromotionPopover } from "@elementor/editor-ui";
|
|
1039
|
+
import * as React7 from "react";
|
|
1040
|
+
import { createElement as createElement8, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
1042
1041
|
import { PlusIcon } from "@elementor/icons";
|
|
1043
1042
|
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography5 } from "@elementor/ui";
|
|
1044
|
-
import { capitalize } from "@elementor/utils";
|
|
1045
|
-
import { __ as
|
|
1046
|
-
|
|
1047
|
-
// src/sync/license-info.ts
|
|
1048
|
-
function getLicenseInfo() {
|
|
1049
|
-
const extendedWindow = window;
|
|
1050
|
-
return {
|
|
1051
|
-
hasPro: !!extendedWindow.elementorPro
|
|
1052
|
-
};
|
|
1053
|
-
}
|
|
1043
|
+
import { capitalize as capitalize2 } from "@elementor/utils";
|
|
1044
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
1054
1045
|
|
|
1055
1046
|
// src/hooks/use-quota-permissions.ts
|
|
1056
1047
|
var useQuotaPermissions = (variableType) => {
|
|
1057
|
-
const quotaConfig =
|
|
1048
|
+
const quotaConfig = {
|
|
1049
|
+
...window.ElementorVariablesQuotaConfig ?? {},
|
|
1050
|
+
...window.ElementorVariablesQuotaConfigExtended ?? {}
|
|
1051
|
+
};
|
|
1052
|
+
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1058
1053
|
const limit = quotaConfig[variableType] || 0;
|
|
1059
|
-
const
|
|
1054
|
+
const hasPermission = hasLegacySupport || limit > 0;
|
|
1060
1055
|
return {
|
|
1061
|
-
canAdd: () =>
|
|
1062
|
-
canEdit: () =>
|
|
1056
|
+
canAdd: () => hasPermission,
|
|
1057
|
+
canEdit: () => hasPermission
|
|
1063
1058
|
};
|
|
1064
1059
|
};
|
|
1065
1060
|
|
|
1061
|
+
// src/components/ui/variable-promotion-chip.tsx
|
|
1062
|
+
import * as React6 from "react";
|
|
1063
|
+
import { forwardRef, useImperativeHandle, useState as useState3 } from "react";
|
|
1064
|
+
import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
|
|
1065
|
+
import { Box } from "@elementor/ui";
|
|
1066
|
+
import { capitalize } from "@elementor/utils";
|
|
1067
|
+
import { __ as __7, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
1068
|
+
var VariablePromotionChip = forwardRef(
|
|
1069
|
+
({ variableType, upgradeUrl }, ref) => {
|
|
1070
|
+
const [isOpen, setIsOpen] = useState3(false);
|
|
1071
|
+
useCanvasClickHandler(isOpen, () => setIsOpen(false));
|
|
1072
|
+
const toggle = () => setIsOpen((prev) => !prev);
|
|
1073
|
+
useImperativeHandle(ref, () => ({ toggle }), []);
|
|
1074
|
+
const title = sprintf2(
|
|
1075
|
+
/* translators: %s: Variable Type. */
|
|
1076
|
+
__7("%s variables", "elementor"),
|
|
1077
|
+
capitalize(variableType)
|
|
1078
|
+
);
|
|
1079
|
+
const content = sprintf2(
|
|
1080
|
+
/* translators: %s: Variable Type. */
|
|
1081
|
+
__7("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1082
|
+
variableType
|
|
1083
|
+
);
|
|
1084
|
+
return /* @__PURE__ */ React6.createElement(
|
|
1085
|
+
PromotionPopover,
|
|
1086
|
+
{
|
|
1087
|
+
open: isOpen,
|
|
1088
|
+
title,
|
|
1089
|
+
content,
|
|
1090
|
+
ctaText: __7("Upgrade now", "elementor"),
|
|
1091
|
+
ctaUrl: upgradeUrl,
|
|
1092
|
+
onClose: (e) => {
|
|
1093
|
+
e.stopPropagation();
|
|
1094
|
+
setIsOpen(false);
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
/* @__PURE__ */ React6.createElement(
|
|
1098
|
+
Box,
|
|
1099
|
+
{
|
|
1100
|
+
onClick: (e) => {
|
|
1101
|
+
e.stopPropagation();
|
|
1102
|
+
toggle();
|
|
1103
|
+
},
|
|
1104
|
+
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1105
|
+
},
|
|
1106
|
+
/* @__PURE__ */ React6.createElement(PromotionChip, null)
|
|
1107
|
+
)
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
);
|
|
1111
|
+
|
|
1066
1112
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1067
1113
|
var SIZE = "tiny";
|
|
1068
|
-
var VariableManagerCreateMenu = ({
|
|
1069
|
-
variables,
|
|
1070
|
-
onCreate,
|
|
1071
|
-
disabled,
|
|
1072
|
-
menuState
|
|
1073
|
-
}) => {
|
|
1114
|
+
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1074
1115
|
const buttonRef = useRef2(null);
|
|
1075
1116
|
const variableTypes = getVariableTypes();
|
|
1076
1117
|
const menuOptionConfigs = useMemo2(
|
|
@@ -1083,17 +1124,16 @@ var VariableManagerCreateMenu = ({
|
|
|
1083
1124
|
})),
|
|
1084
1125
|
[variableTypes]
|
|
1085
1126
|
);
|
|
1086
|
-
return /* @__PURE__ */
|
|
1127
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
1087
1128
|
IconButton,
|
|
1088
1129
|
{
|
|
1089
1130
|
...bindTrigger(menuState),
|
|
1090
1131
|
ref: buttonRef,
|
|
1091
|
-
disabled,
|
|
1092
1132
|
size: SIZE,
|
|
1093
|
-
"aria-label":
|
|
1133
|
+
"aria-label": __8("Add variable", "elementor")
|
|
1094
1134
|
},
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
), /* @__PURE__ */
|
|
1135
|
+
/* @__PURE__ */ React7.createElement(PlusIcon, { fontSize: SIZE })
|
|
1136
|
+
), /* @__PURE__ */ React7.createElement(
|
|
1097
1137
|
Menu,
|
|
1098
1138
|
{
|
|
1099
1139
|
disablePortal: true,
|
|
@@ -1115,7 +1155,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1115
1155
|
},
|
|
1116
1156
|
"data-testid": "variable-manager-create-menu"
|
|
1117
1157
|
},
|
|
1118
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1158
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React7.createElement(
|
|
1119
1159
|
MenuOption,
|
|
1120
1160
|
{
|
|
1121
1161
|
key: config.key,
|
|
@@ -1133,15 +1173,13 @@ var MenuOption = ({
|
|
|
1133
1173
|
onCreate,
|
|
1134
1174
|
onClose
|
|
1135
1175
|
}) => {
|
|
1136
|
-
const
|
|
1176
|
+
const promotionRef = useRef2(null);
|
|
1137
1177
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1138
|
-
const displayName =
|
|
1178
|
+
const displayName = capitalize2(config.variableType);
|
|
1139
1179
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
1140
1180
|
const handleClick = () => {
|
|
1141
1181
|
if (isDisabled) {
|
|
1142
|
-
|
|
1143
|
-
setIsPopoverOpen(true);
|
|
1144
|
-
}
|
|
1182
|
+
promotionRef.current?.toggle();
|
|
1145
1183
|
return;
|
|
1146
1184
|
}
|
|
1147
1185
|
const defaultName = getDefaultName(variables, config.key, config.variableType);
|
|
@@ -1149,29 +1187,13 @@ var MenuOption = ({
|
|
|
1149
1187
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1150
1188
|
onClose();
|
|
1151
1189
|
};
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
__7("%s variables", "elementor"),
|
|
1155
|
-
capitalize(config.variableType)
|
|
1156
|
-
);
|
|
1157
|
-
const content = sprintf2(
|
|
1158
|
-
/* translators: %s: Variable Type. */
|
|
1159
|
-
__7("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1160
|
-
config.variableType
|
|
1161
|
-
);
|
|
1162
|
-
return /* @__PURE__ */ React6.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, createElement7(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React6.createElement(Typography5, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React6.createElement(
|
|
1163
|
-
PromotionPopover,
|
|
1190
|
+
return /* @__PURE__ */ React7.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, createElement8(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React7.createElement(Typography5, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React7.createElement(
|
|
1191
|
+
VariablePromotionChip,
|
|
1164
1192
|
{
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1170
|
-
onClose: () => {
|
|
1171
|
-
setIsPopoverOpen(false);
|
|
1172
|
-
}
|
|
1173
|
-
},
|
|
1174
|
-
/* @__PURE__ */ React6.createElement(PromotionChip, null)
|
|
1193
|
+
variableType: config.variableType,
|
|
1194
|
+
upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1195
|
+
ref: promotionRef
|
|
1196
|
+
}
|
|
1175
1197
|
));
|
|
1176
1198
|
};
|
|
1177
1199
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1186,25 +1208,52 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1186
1208
|
};
|
|
1187
1209
|
|
|
1188
1210
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1189
|
-
import * as
|
|
1190
|
-
import {
|
|
1191
|
-
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1192
|
-
import { GripVerticalIcon } from "@elementor/icons";
|
|
1211
|
+
import * as React13 from "react";
|
|
1212
|
+
import { useEffect as useEffect2, useRef as useRef6 } from "react";
|
|
1193
1213
|
import {
|
|
1194
|
-
IconButton as IconButton3,
|
|
1195
|
-
Stack as Stack5,
|
|
1196
1214
|
Table,
|
|
1197
1215
|
TableBody,
|
|
1198
1216
|
TableContainer,
|
|
1199
1217
|
TableHead,
|
|
1200
|
-
TableRow,
|
|
1218
|
+
TableRow as TableRow2,
|
|
1201
1219
|
UnstableSortableItem,
|
|
1202
1220
|
UnstableSortableProvider
|
|
1203
1221
|
} from "@elementor/ui";
|
|
1204
|
-
import { __ as
|
|
1222
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
1223
|
+
|
|
1224
|
+
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1225
|
+
import * as React8 from "react";
|
|
1226
|
+
import { TableCell } from "@elementor/ui";
|
|
1227
|
+
var VariableTableCell = ({
|
|
1228
|
+
children,
|
|
1229
|
+
isHeader,
|
|
1230
|
+
width,
|
|
1231
|
+
maxWidth,
|
|
1232
|
+
align,
|
|
1233
|
+
noPadding,
|
|
1234
|
+
sx
|
|
1235
|
+
}) => {
|
|
1236
|
+
const baseSx = {
|
|
1237
|
+
maxWidth: maxWidth ?? 150,
|
|
1238
|
+
cursor: "initial",
|
|
1239
|
+
typography: "caption",
|
|
1240
|
+
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1241
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1242
|
+
...width && { width },
|
|
1243
|
+
...sx
|
|
1244
|
+
};
|
|
1245
|
+
return /* @__PURE__ */ React8.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1249
|
+
import * as React12 from "react";
|
|
1250
|
+
import { createElement as createElement15, useRef as useRef5 } from "react";
|
|
1251
|
+
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1252
|
+
import { GripVerticalIcon } from "@elementor/icons";
|
|
1253
|
+
import { IconButton as IconButton3, Stack as Stack5, TableRow } from "@elementor/ui";
|
|
1205
1254
|
|
|
1206
1255
|
// src/components/fields/label-field.tsx
|
|
1207
|
-
import * as
|
|
1256
|
+
import * as React9 from "react";
|
|
1208
1257
|
import { useRef as useRef3, useState as useState4 } from "react";
|
|
1209
1258
|
import { WarningInfotip } from "@elementor/editor-ui";
|
|
1210
1259
|
import { TextField } from "@elementor/ui";
|
|
@@ -1246,7 +1295,7 @@ var LabelField = ({
|
|
|
1246
1295
|
errorMsg = error.message;
|
|
1247
1296
|
}
|
|
1248
1297
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1249
|
-
const textField = /* @__PURE__ */
|
|
1298
|
+
const textField = /* @__PURE__ */ React9.createElement(
|
|
1250
1299
|
TextField,
|
|
1251
1300
|
{
|
|
1252
1301
|
ref: fieldRef,
|
|
@@ -1267,7 +1316,7 @@ var LabelField = ({
|
|
|
1267
1316
|
);
|
|
1268
1317
|
if (showWarningInfotip) {
|
|
1269
1318
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1270
|
-
return /* @__PURE__ */
|
|
1319
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1271
1320
|
WarningInfotip,
|
|
1272
1321
|
{
|
|
1273
1322
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1283,84 +1332,6 @@ var LabelField = ({
|
|
|
1283
1332
|
return textField;
|
|
1284
1333
|
};
|
|
1285
1334
|
|
|
1286
|
-
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1287
|
-
import * as React8 from "react";
|
|
1288
|
-
import { createElement as createElement10 } from "react";
|
|
1289
|
-
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1290
|
-
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1291
|
-
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1292
|
-
const menuState = usePopupState({
|
|
1293
|
-
variant: "popover"
|
|
1294
|
-
});
|
|
1295
|
-
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(IconButton2, { ...bindTrigger2(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React8.createElement(DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React8.createElement(
|
|
1296
|
-
Menu2,
|
|
1297
|
-
{
|
|
1298
|
-
disablePortal: true,
|
|
1299
|
-
MenuListProps: {
|
|
1300
|
-
dense: true
|
|
1301
|
-
},
|
|
1302
|
-
PaperProps: {
|
|
1303
|
-
elevation: 6
|
|
1304
|
-
},
|
|
1305
|
-
...bindMenu2(menuState),
|
|
1306
|
-
anchorEl: menuState.anchorEl,
|
|
1307
|
-
anchorOrigin: {
|
|
1308
|
-
vertical: "bottom",
|
|
1309
|
-
horizontal: "right"
|
|
1310
|
-
},
|
|
1311
|
-
transformOrigin: {
|
|
1312
|
-
vertical: "top",
|
|
1313
|
-
horizontal: "right"
|
|
1314
|
-
},
|
|
1315
|
-
open: menuState.isOpen,
|
|
1316
|
-
onClose: menuState.close
|
|
1317
|
-
},
|
|
1318
|
-
menuActions.map((action) => /* @__PURE__ */ React8.createElement(
|
|
1319
|
-
MenuItem2,
|
|
1320
|
-
{
|
|
1321
|
-
key: action.name,
|
|
1322
|
-
onClick: () => {
|
|
1323
|
-
action.onClick?.(itemId);
|
|
1324
|
-
menuState.close();
|
|
1325
|
-
},
|
|
1326
|
-
sx: {
|
|
1327
|
-
color: action.color,
|
|
1328
|
-
gap: 1
|
|
1329
|
-
}
|
|
1330
|
-
},
|
|
1331
|
-
action.icon && createElement10(action.icon, {
|
|
1332
|
-
fontSize: "inherit"
|
|
1333
|
-
}),
|
|
1334
|
-
" ",
|
|
1335
|
-
action.name
|
|
1336
|
-
))
|
|
1337
|
-
));
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
|
-
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1341
|
-
import * as React9 from "react";
|
|
1342
|
-
import { TableCell } from "@elementor/ui";
|
|
1343
|
-
var VariableTableCell = ({
|
|
1344
|
-
children,
|
|
1345
|
-
isHeader,
|
|
1346
|
-
width,
|
|
1347
|
-
maxWidth,
|
|
1348
|
-
align,
|
|
1349
|
-
noPadding,
|
|
1350
|
-
sx
|
|
1351
|
-
}) => {
|
|
1352
|
-
const baseSx = {
|
|
1353
|
-
maxWidth: maxWidth ?? 150,
|
|
1354
|
-
cursor: "initial",
|
|
1355
|
-
typography: "caption",
|
|
1356
|
-
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1357
|
-
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1358
|
-
...width && { width },
|
|
1359
|
-
...sx
|
|
1360
|
-
};
|
|
1361
|
-
return /* @__PURE__ */ React9.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1362
|
-
};
|
|
1363
|
-
|
|
1364
1335
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1365
1336
|
import * as React10 from "react";
|
|
1366
1337
|
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as useState5 } from "react";
|
|
@@ -1376,7 +1347,8 @@ var VariableEditableCell = React10.memo(
|
|
|
1376
1347
|
onRowRef,
|
|
1377
1348
|
onAutoEditComplete,
|
|
1378
1349
|
gap = 1,
|
|
1379
|
-
fieldType
|
|
1350
|
+
fieldType,
|
|
1351
|
+
disabled = false
|
|
1380
1352
|
}) => {
|
|
1381
1353
|
const [value, setValue] = useState5(initialValue);
|
|
1382
1354
|
const [isEditing, setIsEditing] = useState5(false);
|
|
@@ -1394,15 +1366,21 @@ var VariableEditableCell = React10.memo(
|
|
|
1394
1366
|
onRowRef?.(rowRef?.current);
|
|
1395
1367
|
}, [onRowRef]);
|
|
1396
1368
|
useEffect(() => {
|
|
1397
|
-
if (autoEdit && !isEditing) {
|
|
1369
|
+
if (autoEdit && !isEditing && !disabled) {
|
|
1398
1370
|
setIsEditing(true);
|
|
1399
1371
|
onAutoEditComplete?.();
|
|
1400
1372
|
}
|
|
1401
|
-
}, [autoEdit, isEditing, onAutoEditComplete]);
|
|
1373
|
+
}, [autoEdit, isEditing, onAutoEditComplete, disabled]);
|
|
1402
1374
|
const handleDoubleClick = () => {
|
|
1375
|
+
if (disabled) {
|
|
1376
|
+
return;
|
|
1377
|
+
}
|
|
1403
1378
|
setIsEditing(true);
|
|
1404
1379
|
};
|
|
1405
1380
|
const handleKeyDown = (event) => {
|
|
1381
|
+
if (disabled) {
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1406
1384
|
if (event.key === "Enter") {
|
|
1407
1385
|
handleSave();
|
|
1408
1386
|
} else if (event.key === "Escape") {
|
|
@@ -1468,9 +1446,9 @@ var VariableEditableCell = React10.memo(
|
|
|
1468
1446
|
gap,
|
|
1469
1447
|
onDoubleClick: handleDoubleClick,
|
|
1470
1448
|
onKeyDown: handleKeyDown,
|
|
1471
|
-
tabIndex: 0,
|
|
1449
|
+
tabIndex: disabled ? -1 : 0,
|
|
1472
1450
|
role: "button",
|
|
1473
|
-
"aria-label": "Double click or press Space to edit"
|
|
1451
|
+
"aria-label": disabled ? "" : "Double click or press Space to edit"
|
|
1474
1452
|
},
|
|
1475
1453
|
prefixElement,
|
|
1476
1454
|
children
|
|
@@ -1478,6 +1456,243 @@ var VariableEditableCell = React10.memo(
|
|
|
1478
1456
|
}
|
|
1479
1457
|
);
|
|
1480
1458
|
|
|
1459
|
+
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1460
|
+
import * as React11 from "react";
|
|
1461
|
+
import { createElement as createElement13 } from "react";
|
|
1462
|
+
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1463
|
+
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1464
|
+
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1465
|
+
const menuState = usePopupState({
|
|
1466
|
+
variant: "popover"
|
|
1467
|
+
});
|
|
1468
|
+
const triggerProps = bindTrigger2(menuState);
|
|
1469
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1470
|
+
IconButton2,
|
|
1471
|
+
{
|
|
1472
|
+
...triggerProps,
|
|
1473
|
+
disabled,
|
|
1474
|
+
size: "tiny",
|
|
1475
|
+
onClick: (e) => {
|
|
1476
|
+
e.stopPropagation();
|
|
1477
|
+
triggerProps.onClick?.(e);
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
/* @__PURE__ */ React11.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
1481
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1482
|
+
Menu2,
|
|
1483
|
+
{
|
|
1484
|
+
disablePortal: true,
|
|
1485
|
+
MenuListProps: {
|
|
1486
|
+
dense: true
|
|
1487
|
+
},
|
|
1488
|
+
PaperProps: {
|
|
1489
|
+
elevation: 6
|
|
1490
|
+
},
|
|
1491
|
+
...bindMenu2(menuState),
|
|
1492
|
+
anchorEl: menuState.anchorEl,
|
|
1493
|
+
anchorOrigin: {
|
|
1494
|
+
vertical: "bottom",
|
|
1495
|
+
horizontal: "right"
|
|
1496
|
+
},
|
|
1497
|
+
transformOrigin: {
|
|
1498
|
+
vertical: "top",
|
|
1499
|
+
horizontal: "right"
|
|
1500
|
+
},
|
|
1501
|
+
open: menuState.isOpen,
|
|
1502
|
+
onClose: menuState.close
|
|
1503
|
+
},
|
|
1504
|
+
menuActions.map((action) => /* @__PURE__ */ React11.createElement(
|
|
1505
|
+
MenuItem2,
|
|
1506
|
+
{
|
|
1507
|
+
key: action.name,
|
|
1508
|
+
onClick: (e) => {
|
|
1509
|
+
e.stopPropagation();
|
|
1510
|
+
action.onClick?.(itemId);
|
|
1511
|
+
menuState.close();
|
|
1512
|
+
},
|
|
1513
|
+
sx: {
|
|
1514
|
+
color: action.color,
|
|
1515
|
+
gap: 1
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
action.icon && createElement13(action.icon, {
|
|
1519
|
+
fontSize: "inherit"
|
|
1520
|
+
}),
|
|
1521
|
+
" ",
|
|
1522
|
+
action.name
|
|
1523
|
+
))
|
|
1524
|
+
));
|
|
1525
|
+
};
|
|
1526
|
+
|
|
1527
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1528
|
+
var VariableRow = (props) => {
|
|
1529
|
+
const {
|
|
1530
|
+
row,
|
|
1531
|
+
variables,
|
|
1532
|
+
handleOnChange,
|
|
1533
|
+
autoEditVariableId,
|
|
1534
|
+
onAutoEditComplete,
|
|
1535
|
+
onFieldError,
|
|
1536
|
+
menuActions,
|
|
1537
|
+
handleRowRef,
|
|
1538
|
+
itemProps,
|
|
1539
|
+
showDropIndication,
|
|
1540
|
+
triggerProps,
|
|
1541
|
+
itemStyle,
|
|
1542
|
+
triggerStyle,
|
|
1543
|
+
isDragged,
|
|
1544
|
+
dropPosition,
|
|
1545
|
+
setTriggerRef,
|
|
1546
|
+
isSorting
|
|
1547
|
+
} = props;
|
|
1548
|
+
const promotionRef = useRef5(null);
|
|
1549
|
+
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1550
|
+
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1551
|
+
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1552
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1553
|
+
TableRow,
|
|
1554
|
+
{
|
|
1555
|
+
...itemProps,
|
|
1556
|
+
ref: itemProps.ref,
|
|
1557
|
+
selected: isDragged,
|
|
1558
|
+
sx: {
|
|
1559
|
+
...isDisabled && {
|
|
1560
|
+
"& td, & th": {
|
|
1561
|
+
color: "text.disabled"
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
...showIndicationBefore && {
|
|
1565
|
+
"& td, & th": {
|
|
1566
|
+
borderTop: "2px solid",
|
|
1567
|
+
borderTopColor: "primary.main"
|
|
1568
|
+
}
|
|
1569
|
+
},
|
|
1570
|
+
...showIndicationAfter && {
|
|
1571
|
+
"& td, & th": {
|
|
1572
|
+
borderBottom: "2px solid",
|
|
1573
|
+
borderBottomColor: "primary.main"
|
|
1574
|
+
}
|
|
1575
|
+
},
|
|
1576
|
+
"&:hover, &:focus-within": {
|
|
1577
|
+
backgroundColor: "action.hover",
|
|
1578
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1579
|
+
opacity: 1
|
|
1580
|
+
}
|
|
1581
|
+
},
|
|
1582
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1583
|
+
opacity: 0
|
|
1584
|
+
}
|
|
1585
|
+
},
|
|
1586
|
+
style: { ...itemStyle, ...triggerStyle },
|
|
1587
|
+
onClick: () => {
|
|
1588
|
+
if (isDisabled) {
|
|
1589
|
+
promotionRef.current?.toggle();
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
},
|
|
1593
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(IconButton3, { size: "small", ref: setTriggerRef, ...triggerProps, disabled: isSorting, draggable: true }, /* @__PURE__ */ React12.createElement(GripVerticalIcon, { fontSize: "inherit" }))),
|
|
1594
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1595
|
+
VariableEditableCell,
|
|
1596
|
+
{
|
|
1597
|
+
initialValue: row.name,
|
|
1598
|
+
onChange: (value) => {
|
|
1599
|
+
if (value !== row.name && !isDisabled) {
|
|
1600
|
+
handleOnChange({
|
|
1601
|
+
...variables,
|
|
1602
|
+
[row.id]: { ...variables[row.id], label: value }
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
},
|
|
1606
|
+
prefixElement: createElement15(row.icon, {
|
|
1607
|
+
fontSize: "inherit",
|
|
1608
|
+
color: isDisabled ? "disabled" : "inherit"
|
|
1609
|
+
}),
|
|
1610
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React12.createElement(
|
|
1611
|
+
LabelField,
|
|
1612
|
+
{
|
|
1613
|
+
id: "variable-label-" + row.id,
|
|
1614
|
+
size: "tiny",
|
|
1615
|
+
value,
|
|
1616
|
+
onChange,
|
|
1617
|
+
onErrorChange: (errorMsg) => {
|
|
1618
|
+
onValidationChange?.(errorMsg);
|
|
1619
|
+
onFieldError?.(!!errorMsg);
|
|
1620
|
+
},
|
|
1621
|
+
error,
|
|
1622
|
+
focusOnShow: true,
|
|
1623
|
+
selectOnShow: autoEditVariableId === row.id,
|
|
1624
|
+
showWarningInfotip: true,
|
|
1625
|
+
variables
|
|
1626
|
+
}
|
|
1627
|
+
),
|
|
1628
|
+
autoEdit: autoEditVariableId === row.id && !isDisabled,
|
|
1629
|
+
onRowRef: handleRowRef(row.id),
|
|
1630
|
+
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1631
|
+
fieldType: "label",
|
|
1632
|
+
disabled: isDisabled
|
|
1633
|
+
},
|
|
1634
|
+
/* @__PURE__ */ React12.createElement(EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1635
|
+
)),
|
|
1636
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1637
|
+
VariableEditableCell,
|
|
1638
|
+
{
|
|
1639
|
+
initialValue: row.value,
|
|
1640
|
+
onChange: (value) => {
|
|
1641
|
+
if (value !== row.value && !isDisabled) {
|
|
1642
|
+
handleOnChange({
|
|
1643
|
+
...variables,
|
|
1644
|
+
[row.id]: { ...variables[row.id], value }
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
},
|
|
1648
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => row.valueField?.({
|
|
1649
|
+
value,
|
|
1650
|
+
onChange,
|
|
1651
|
+
onPropTypeKeyChange: (type) => {
|
|
1652
|
+
if (!isDisabled) {
|
|
1653
|
+
handleOnChange({
|
|
1654
|
+
...variables,
|
|
1655
|
+
[row.id]: { ...variables[row.id], type }
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
},
|
|
1659
|
+
propTypeKey: row.type,
|
|
1660
|
+
onValidationChange: (errorMsg) => {
|
|
1661
|
+
onValidationChange?.(errorMsg);
|
|
1662
|
+
onFieldError?.(!!errorMsg);
|
|
1663
|
+
},
|
|
1664
|
+
error
|
|
1665
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1666
|
+
onRowRef: handleRowRef(row.id),
|
|
1667
|
+
gap: 0.25,
|
|
1668
|
+
fieldType: "value",
|
|
1669
|
+
disabled: isDisabled
|
|
1670
|
+
},
|
|
1671
|
+
row.startIcon && row.startIcon({ value: row.value }),
|
|
1672
|
+
/* @__PURE__ */ React12.createElement(
|
|
1673
|
+
EllipsisWithTooltip,
|
|
1674
|
+
{
|
|
1675
|
+
title: row.value,
|
|
1676
|
+
sx: {
|
|
1677
|
+
border: "4px solid transparent",
|
|
1678
|
+
lineHeight: "1",
|
|
1679
|
+
pt: 0.25
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
row.value
|
|
1683
|
+
)
|
|
1684
|
+
)),
|
|
1685
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { align: "right", noPadding: true, width: 16, maxWidth: 16, sx: { paddingInlineEnd: 1 } }, /* @__PURE__ */ React12.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end", alignItems: "center" }, isDisabled && /* @__PURE__ */ React12.createElement(
|
|
1686
|
+
VariablePromotionChip,
|
|
1687
|
+
{
|
|
1688
|
+
variableType: row.variableType,
|
|
1689
|
+
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1690
|
+
ref: promotionRef
|
|
1691
|
+
}
|
|
1692
|
+
), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1693
|
+
);
|
|
1694
|
+
};
|
|
1695
|
+
|
|
1481
1696
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1482
1697
|
var VariablesManagerTable = ({
|
|
1483
1698
|
menuActions,
|
|
@@ -1487,8 +1702,8 @@ var VariablesManagerTable = ({
|
|
|
1487
1702
|
onAutoEditComplete,
|
|
1488
1703
|
onFieldError
|
|
1489
1704
|
}) => {
|
|
1490
|
-
const tableContainerRef =
|
|
1491
|
-
const variableRowRefs =
|
|
1705
|
+
const tableContainerRef = useRef6(null);
|
|
1706
|
+
const variableRowRefs = useRef6(/* @__PURE__ */ new Map());
|
|
1492
1707
|
useEffect2(() => {
|
|
1493
1708
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1494
1709
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
@@ -1540,196 +1755,34 @@ var VariablesManagerTable = ({
|
|
|
1540
1755
|
});
|
|
1541
1756
|
handleOnChange(updatedVariables);
|
|
1542
1757
|
};
|
|
1543
|
-
return /* @__PURE__ */
|
|
1758
|
+
return /* @__PURE__ */ React13.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React13.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React13.createElement(TableHead, null, /* @__PURE__ */ React13.createElement(TableRow2, null, /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, __9("Name", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, __9("Value", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React13.createElement(TableBody, null, /* @__PURE__ */ React13.createElement(
|
|
1544
1759
|
UnstableSortableProvider,
|
|
1545
1760
|
{
|
|
1546
1761
|
value: ids,
|
|
1547
1762
|
onChange: handleReorder,
|
|
1548
1763
|
variant: "static",
|
|
1549
1764
|
restrictAxis: true,
|
|
1550
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1765
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React13.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React13.createElement(TableBody, null, dragOverlayChildren))
|
|
1551
1766
|
},
|
|
1552
|
-
rows.map((row) => /* @__PURE__ */
|
|
1767
|
+
rows.map((row) => /* @__PURE__ */ React13.createElement(
|
|
1553
1768
|
UnstableSortableItem,
|
|
1554
1769
|
{
|
|
1555
1770
|
key: row.id,
|
|
1556
1771
|
id: row.id,
|
|
1557
|
-
render: (
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
TableRow,
|
|
1572
|
-
{
|
|
1573
|
-
...itemProps,
|
|
1574
|
-
ref: itemProps.ref,
|
|
1575
|
-
selected: isDragged,
|
|
1576
|
-
sx: {
|
|
1577
|
-
...showIndicationBefore && {
|
|
1578
|
-
"& td, & th": {
|
|
1579
|
-
borderTop: "2px solid",
|
|
1580
|
-
borderTopColor: "primary.main"
|
|
1581
|
-
}
|
|
1582
|
-
},
|
|
1583
|
-
...showIndicationAfter && {
|
|
1584
|
-
"& td, & th": {
|
|
1585
|
-
borderBottom: "2px solid",
|
|
1586
|
-
borderBottomColor: "primary.main"
|
|
1587
|
-
}
|
|
1588
|
-
},
|
|
1589
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1590
|
-
opacity: 0
|
|
1591
|
-
},
|
|
1592
|
-
"&:hover, &:focus-within": {
|
|
1593
|
-
backgroundColor: "action.hover",
|
|
1594
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1595
|
-
opacity: 1
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
},
|
|
1599
|
-
style: { ...itemStyle, ...triggerStyle }
|
|
1600
|
-
},
|
|
1601
|
-
/* @__PURE__ */ React11.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React11.createElement(
|
|
1602
|
-
IconButton3,
|
|
1603
|
-
{
|
|
1604
|
-
size: "small",
|
|
1605
|
-
ref: setTriggerRef,
|
|
1606
|
-
...triggerProps,
|
|
1607
|
-
disabled: isSorting,
|
|
1608
|
-
draggable: true
|
|
1609
|
-
},
|
|
1610
|
-
/* @__PURE__ */ React11.createElement(GripVerticalIcon, { fontSize: "inherit" })
|
|
1611
|
-
)),
|
|
1612
|
-
/* @__PURE__ */ React11.createElement(VariableTableCell, null, /* @__PURE__ */ React11.createElement(
|
|
1613
|
-
VariableEditableCell,
|
|
1614
|
-
{
|
|
1615
|
-
initialValue: row.name,
|
|
1616
|
-
onChange: (value) => {
|
|
1617
|
-
if (value !== row.name) {
|
|
1618
|
-
handleOnChange({
|
|
1619
|
-
...variables,
|
|
1620
|
-
[row.id]: { ...variables[row.id], label: value }
|
|
1621
|
-
});
|
|
1622
|
-
}
|
|
1623
|
-
},
|
|
1624
|
-
prefixElement: createElement14(row.icon, { fontSize: "inherit" }),
|
|
1625
|
-
editableElement: ({
|
|
1626
|
-
value,
|
|
1627
|
-
onChange,
|
|
1628
|
-
onValidationChange,
|
|
1629
|
-
error
|
|
1630
|
-
}) => /* @__PURE__ */ React11.createElement(
|
|
1631
|
-
LabelField,
|
|
1632
|
-
{
|
|
1633
|
-
id: "variable-label-" + row.id,
|
|
1634
|
-
size: "tiny",
|
|
1635
|
-
value,
|
|
1636
|
-
onChange,
|
|
1637
|
-
onErrorChange: (errorMsg) => {
|
|
1638
|
-
onValidationChange?.(errorMsg);
|
|
1639
|
-
onFieldError?.(!!errorMsg);
|
|
1640
|
-
},
|
|
1641
|
-
error,
|
|
1642
|
-
focusOnShow: true,
|
|
1643
|
-
selectOnShow: autoEditVariableId === row.id,
|
|
1644
|
-
showWarningInfotip: true,
|
|
1645
|
-
variables
|
|
1646
|
-
}
|
|
1647
|
-
),
|
|
1648
|
-
autoEdit: autoEditVariableId === row.id,
|
|
1649
|
-
onRowRef: handleRowRef(row.id),
|
|
1650
|
-
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1651
|
-
fieldType: "label"
|
|
1652
|
-
},
|
|
1653
|
-
/* @__PURE__ */ React11.createElement(
|
|
1654
|
-
EllipsisWithTooltip,
|
|
1655
|
-
{
|
|
1656
|
-
title: row.name,
|
|
1657
|
-
sx: { border: "4px solid transparent" }
|
|
1658
|
-
},
|
|
1659
|
-
row.name
|
|
1660
|
-
)
|
|
1661
|
-
)),
|
|
1662
|
-
/* @__PURE__ */ React11.createElement(VariableTableCell, null, /* @__PURE__ */ React11.createElement(
|
|
1663
|
-
VariableEditableCell,
|
|
1664
|
-
{
|
|
1665
|
-
initialValue: row.value,
|
|
1666
|
-
onChange: (value) => {
|
|
1667
|
-
if (value !== row.value) {
|
|
1668
|
-
handleOnChange({
|
|
1669
|
-
...variables,
|
|
1670
|
-
[row.id]: { ...variables[row.id], value }
|
|
1671
|
-
});
|
|
1672
|
-
}
|
|
1673
|
-
},
|
|
1674
|
-
editableElement: ({
|
|
1675
|
-
value,
|
|
1676
|
-
onChange,
|
|
1677
|
-
onValidationChange,
|
|
1678
|
-
error
|
|
1679
|
-
}) => row.valueField?.({
|
|
1680
|
-
value,
|
|
1681
|
-
onChange,
|
|
1682
|
-
onPropTypeKeyChange: (type) => {
|
|
1683
|
-
handleOnChange({
|
|
1684
|
-
...variables,
|
|
1685
|
-
[row.id]: { ...variables[row.id], type }
|
|
1686
|
-
});
|
|
1687
|
-
},
|
|
1688
|
-
propTypeKey: row.type,
|
|
1689
|
-
onValidationChange: (errorMsg) => {
|
|
1690
|
-
onValidationChange?.(errorMsg);
|
|
1691
|
-
onFieldError?.(!!errorMsg);
|
|
1692
|
-
},
|
|
1693
|
-
error
|
|
1694
|
-
}) ?? /* @__PURE__ */ React11.createElement(React11.Fragment, null),
|
|
1695
|
-
onRowRef: handleRowRef(row.id),
|
|
1696
|
-
gap: 0.25,
|
|
1697
|
-
fieldType: "value"
|
|
1698
|
-
},
|
|
1699
|
-
row.startIcon && row.startIcon({ value: row.value }),
|
|
1700
|
-
/* @__PURE__ */ React11.createElement(
|
|
1701
|
-
EllipsisWithTooltip,
|
|
1702
|
-
{
|
|
1703
|
-
title: row.value,
|
|
1704
|
-
sx: {
|
|
1705
|
-
border: "4px solid transparent",
|
|
1706
|
-
lineHeight: "1",
|
|
1707
|
-
pt: 0.25
|
|
1708
|
-
}
|
|
1709
|
-
},
|
|
1710
|
-
row.value
|
|
1711
|
-
)
|
|
1712
|
-
)),
|
|
1713
|
-
/* @__PURE__ */ React11.createElement(
|
|
1714
|
-
VariableTableCell,
|
|
1715
|
-
{
|
|
1716
|
-
align: "right",
|
|
1717
|
-
noPadding: true,
|
|
1718
|
-
width: 16,
|
|
1719
|
-
maxWidth: 16,
|
|
1720
|
-
sx: { paddingInlineEnd: 1 }
|
|
1721
|
-
},
|
|
1722
|
-
/* @__PURE__ */ React11.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React11.createElement(
|
|
1723
|
-
VariableEditMenu,
|
|
1724
|
-
{
|
|
1725
|
-
menuActions,
|
|
1726
|
-
disabled: isSorting,
|
|
1727
|
-
itemId: row.id
|
|
1728
|
-
}
|
|
1729
|
-
))
|
|
1730
|
-
)
|
|
1731
|
-
);
|
|
1732
|
-
}
|
|
1772
|
+
render: (props) => /* @__PURE__ */ React13.createElement(
|
|
1773
|
+
VariableRow,
|
|
1774
|
+
{
|
|
1775
|
+
...props,
|
|
1776
|
+
row,
|
|
1777
|
+
variables,
|
|
1778
|
+
handleOnChange,
|
|
1779
|
+
autoEditVariableId,
|
|
1780
|
+
onAutoEditComplete,
|
|
1781
|
+
onFieldError,
|
|
1782
|
+
menuActions,
|
|
1783
|
+
handleRowRef
|
|
1784
|
+
}
|
|
1785
|
+
)
|
|
1733
1786
|
}
|
|
1734
1787
|
))
|
|
1735
1788
|
))));
|
|
@@ -1829,37 +1882,40 @@ function VariablesManagerPanel() {
|
|
|
1829
1882
|
},
|
|
1830
1883
|
[handleDeleteVariable]
|
|
1831
1884
|
);
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1885
|
+
const buildMenuActions = useCallback5(
|
|
1886
|
+
() => [
|
|
1887
|
+
{
|
|
1888
|
+
name: __10("Delete", "elementor"),
|
|
1889
|
+
icon: TrashIcon,
|
|
1890
|
+
color: "error.main",
|
|
1891
|
+
onClick: (itemId) => {
|
|
1892
|
+
const variable = variables[itemId];
|
|
1893
|
+
if (variable) {
|
|
1894
|
+
setDeleteConfirmation({ id: itemId, label: variable.label });
|
|
1895
|
+
const variableTypeOptions = getVariableType(variable.type);
|
|
1896
|
+
trackVariablesManagerEvent({ action: "delete", varType: variableTypeOptions?.variableType });
|
|
1897
|
+
}
|
|
1843
1898
|
}
|
|
1844
1899
|
}
|
|
1845
|
-
|
|
1846
|
-
|
|
1900
|
+
],
|
|
1901
|
+
[variables]
|
|
1902
|
+
);
|
|
1847
1903
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1848
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ React14.createElement(ThemeProvider, null, /* @__PURE__ */ React14.createElement(Panel, null, /* @__PURE__ */ React14.createElement(
|
|
1849
1905
|
PanelHeader,
|
|
1850
1906
|
{
|
|
1851
1907
|
sx: {
|
|
1852
1908
|
height: "unset"
|
|
1853
1909
|
}
|
|
1854
1910
|
},
|
|
1855
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "inherit" }), __10("Variables Manager", "elementor"))), /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React14.createElement(
|
|
1856
1912
|
VariableManagerCreateMenu,
|
|
1857
1913
|
{
|
|
1858
1914
|
onCreate: handleCreateVariable,
|
|
1859
1915
|
variables,
|
|
1860
1916
|
menuState: createMenuState
|
|
1861
1917
|
}
|
|
1862
|
-
), /* @__PURE__ */
|
|
1918
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1863
1919
|
CloseButton,
|
|
1864
1920
|
{
|
|
1865
1921
|
"aria-label": "Close",
|
|
@@ -1868,19 +1924,19 @@ function VariablesManagerPanel() {
|
|
|
1868
1924
|
handleClosePanel();
|
|
1869
1925
|
}
|
|
1870
1926
|
}
|
|
1871
|
-
))), /* @__PURE__ */
|
|
1927
|
+
))), /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(
|
|
1872
1928
|
SearchField,
|
|
1873
1929
|
{
|
|
1874
1930
|
sx: {
|
|
1875
1931
|
display: "flex",
|
|
1876
1932
|
flex: 1
|
|
1877
1933
|
},
|
|
1878
|
-
placeholder:
|
|
1934
|
+
placeholder: __10("Search", "elementor"),
|
|
1879
1935
|
value: searchValue,
|
|
1880
1936
|
onSearch: handleSearch
|
|
1881
1937
|
}
|
|
1882
|
-
)), /* @__PURE__ */
|
|
1883
|
-
), /* @__PURE__ */
|
|
1938
|
+
)), /* @__PURE__ */ React14.createElement(Divider, { sx: { width: "100%" } }))
|
|
1939
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1884
1940
|
PanelBody,
|
|
1885
1941
|
{
|
|
1886
1942
|
sx: {
|
|
@@ -1889,10 +1945,10 @@ function VariablesManagerPanel() {
|
|
|
1889
1945
|
height: "100%"
|
|
1890
1946
|
}
|
|
1891
1947
|
},
|
|
1892
|
-
hasVariables && /* @__PURE__ */
|
|
1948
|
+
hasVariables && /* @__PURE__ */ React14.createElement(
|
|
1893
1949
|
VariablesManagerTable,
|
|
1894
1950
|
{
|
|
1895
|
-
menuActions,
|
|
1951
|
+
menuActions: buildMenuActions,
|
|
1896
1952
|
variables,
|
|
1897
1953
|
onChange: handleOnChange,
|
|
1898
1954
|
autoEditVariableId,
|
|
@@ -1900,43 +1956,43 @@ function VariablesManagerPanel() {
|
|
|
1900
1956
|
onFieldError: setIsSaveDisabled
|
|
1901
1957
|
}
|
|
1902
1958
|
),
|
|
1903
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
1959
|
+
!hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
1904
1960
|
NoSearchResults,
|
|
1905
1961
|
{
|
|
1906
1962
|
searchValue,
|
|
1907
1963
|
onClear: () => handleSearch(""),
|
|
1908
|
-
icon: /* @__PURE__ */
|
|
1964
|
+
icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" })
|
|
1909
1965
|
}
|
|
1910
1966
|
),
|
|
1911
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
1967
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
1912
1968
|
EmptyState,
|
|
1913
1969
|
{
|
|
1914
|
-
title:
|
|
1915
|
-
message:
|
|
1970
|
+
title: __10("Create your first variable", "elementor"),
|
|
1971
|
+
message: __10(
|
|
1916
1972
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1917
1973
|
"elementor"
|
|
1918
1974
|
),
|
|
1919
|
-
icon: /* @__PURE__ */
|
|
1975
|
+
icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" }),
|
|
1920
1976
|
onAdd: createMenuState.open
|
|
1921
1977
|
}
|
|
1922
1978
|
)
|
|
1923
|
-
), /* @__PURE__ */
|
|
1979
|
+
), /* @__PURE__ */ React14.createElement(PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
1924
1980
|
Infotip,
|
|
1925
1981
|
{
|
|
1926
1982
|
placement: "right",
|
|
1927
1983
|
open: !!serverError,
|
|
1928
|
-
content: serverError ? /* @__PURE__ */
|
|
1984
|
+
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
1929
1985
|
Alert,
|
|
1930
1986
|
{
|
|
1931
1987
|
severity: serverError.severity ?? "error",
|
|
1932
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
1988
|
+
action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
1933
1989
|
onClose: !serverError.action?.label ? () => {
|
|
1934
1990
|
setServerError(null);
|
|
1935
1991
|
setIsSaveDisabled(false);
|
|
1936
1992
|
} : void 0,
|
|
1937
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
1993
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(AlertTriangleFilledIcon2, null)
|
|
1938
1994
|
},
|
|
1939
|
-
/* @__PURE__ */
|
|
1995
|
+
/* @__PURE__ */ React14.createElement(AlertTitle, null, serverError.message),
|
|
1940
1996
|
serverError.action?.message
|
|
1941
1997
|
) : null,
|
|
1942
1998
|
arrow: false,
|
|
@@ -1951,7 +2007,7 @@ function VariablesManagerPanel() {
|
|
|
1951
2007
|
}
|
|
1952
2008
|
}
|
|
1953
2009
|
},
|
|
1954
|
-
/* @__PURE__ */
|
|
2010
|
+
/* @__PURE__ */ React14.createElement(
|
|
1955
2011
|
Button2,
|
|
1956
2012
|
{
|
|
1957
2013
|
fullWidth: true,
|
|
@@ -1962,9 +2018,9 @@ function VariablesManagerPanel() {
|
|
|
1962
2018
|
onClick: handleSaveClick,
|
|
1963
2019
|
loading: isSaving
|
|
1964
2020
|
},
|
|
1965
|
-
|
|
2021
|
+
__10("Save changes", "elementor")
|
|
1966
2022
|
)
|
|
1967
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2023
|
+
))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
1968
2024
|
DeleteConfirmationDialog,
|
|
1969
2025
|
{
|
|
1970
2026
|
open: true,
|
|
@@ -1972,19 +2028,19 @@ function VariablesManagerPanel() {
|
|
|
1972
2028
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1973
2029
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1974
2030
|
}
|
|
1975
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
2031
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __10("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.ContentText, null, __10("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
|
|
1976
2032
|
SaveChangesDialog.Actions,
|
|
1977
2033
|
{
|
|
1978
2034
|
actions: {
|
|
1979
2035
|
discard: {
|
|
1980
|
-
label:
|
|
2036
|
+
label: __10("Discard", "elementor"),
|
|
1981
2037
|
action: () => {
|
|
1982
2038
|
closeSaveChangesDialog();
|
|
1983
2039
|
closePanel();
|
|
1984
2040
|
}
|
|
1985
2041
|
},
|
|
1986
2042
|
confirm: {
|
|
1987
|
-
label:
|
|
2043
|
+
label: __10("Save", "elementor"),
|
|
1988
2044
|
action: async () => {
|
|
1989
2045
|
const result = await handleSaveClick();
|
|
1990
2046
|
closeSaveChangesDialog();
|
|
@@ -2012,15 +2068,15 @@ var usePreventUnload = (isDirty) => {
|
|
|
2012
2068
|
};
|
|
2013
2069
|
|
|
2014
2070
|
// src/controls/variable-control.tsx
|
|
2015
|
-
import * as
|
|
2071
|
+
import * as React33 from "react";
|
|
2016
2072
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
|
|
2017
2073
|
|
|
2018
2074
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2019
|
-
import { useId, useRef as
|
|
2020
|
-
import * as
|
|
2075
|
+
import { useId, useRef as useRef7 } from "react";
|
|
2076
|
+
import * as React24 from "react";
|
|
2021
2077
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
2022
2078
|
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
2023
|
-
import { bindPopover, bindTrigger as bindTrigger3, Box as
|
|
2079
|
+
import { bindPopover, bindTrigger as bindTrigger3, Box as Box5, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
2024
2080
|
|
|
2025
2081
|
// src/utils/unlink-variable.ts
|
|
2026
2082
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2039,32 +2095,32 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2039
2095
|
}
|
|
2040
2096
|
|
|
2041
2097
|
// src/components/variable-selection-popover.tsx
|
|
2042
|
-
import * as
|
|
2098
|
+
import * as React22 from "react";
|
|
2043
2099
|
import { useState as useState12 } from "react";
|
|
2044
2100
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
2045
2101
|
|
|
2046
2102
|
// src/context/variable-selection-popover.context.tsx
|
|
2047
|
-
import * as
|
|
2103
|
+
import * as React15 from "react";
|
|
2048
2104
|
import { createContext as createContext2, useContext as useContext2, useState as useState7 } from "react";
|
|
2049
|
-
import { Box } from "@elementor/ui";
|
|
2105
|
+
import { Box as Box2 } from "@elementor/ui";
|
|
2050
2106
|
var PopoverContentRefContext = createContext2(null);
|
|
2051
2107
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2052
2108
|
const [anchorRef, setAnchorRef] = useState7(null);
|
|
2053
|
-
return /* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(Box2, { ref: setAnchorRef }, children));
|
|
2054
2110
|
};
|
|
2055
2111
|
var usePopoverContentRef = () => {
|
|
2056
2112
|
return useContext2(PopoverContentRefContext);
|
|
2057
2113
|
};
|
|
2058
2114
|
|
|
2059
2115
|
// src/components/variable-creation.tsx
|
|
2060
|
-
import * as
|
|
2116
|
+
import * as React17 from "react";
|
|
2061
2117
|
import { useState as useState8 } from "react";
|
|
2062
2118
|
import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
2063
2119
|
import { PopoverBody } from "@elementor/editor-editing-panel";
|
|
2064
2120
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
2065
2121
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
2066
2122
|
import { Button as Button3, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography6 } from "@elementor/ui";
|
|
2067
|
-
import { __ as
|
|
2123
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
2068
2124
|
|
|
2069
2125
|
// src/hooks/use-initial-value.ts
|
|
2070
2126
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
@@ -2107,10 +2163,10 @@ var unwrapValue = (input) => {
|
|
|
2107
2163
|
};
|
|
2108
2164
|
|
|
2109
2165
|
// src/components/ui/form-field.tsx
|
|
2110
|
-
import * as
|
|
2166
|
+
import * as React16 from "react";
|
|
2111
2167
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
2112
2168
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2113
|
-
return /* @__PURE__ */
|
|
2169
|
+
return /* @__PURE__ */ React16.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(FormHelperText, null, noticeMsg)));
|
|
2114
2170
|
};
|
|
2115
2171
|
|
|
2116
2172
|
// src/components/variable-creation.tsx
|
|
@@ -2181,22 +2237,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2181
2237
|
handleCreateAndTrack();
|
|
2182
2238
|
}
|
|
2183
2239
|
};
|
|
2184
|
-
return /* @__PURE__ */
|
|
2240
|
+
return /* @__PURE__ */ React17.createElement(PopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2185
2241
|
PopoverHeader,
|
|
2186
2242
|
{
|
|
2187
|
-
icon: /* @__PURE__ */
|
|
2188
|
-
title:
|
|
2243
|
+
icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(IconButton4, { size: SIZE2, "aria-label": __11("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React17.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2244
|
+
title: __11("Create variable", "elementor"),
|
|
2189
2245
|
onClose: closePopover
|
|
2190
2246
|
}
|
|
2191
|
-
), /* @__PURE__ */
|
|
2247
|
+
), /* @__PURE__ */ React17.createElement(Divider2, null), /* @__PURE__ */ React17.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2192
2248
|
FormField,
|
|
2193
2249
|
{
|
|
2194
2250
|
id: "variable-label",
|
|
2195
|
-
label:
|
|
2251
|
+
label: __11("Name", "elementor"),
|
|
2196
2252
|
errorMsg: labelFieldError?.message,
|
|
2197
2253
|
noticeMsg: labelHint(label)
|
|
2198
2254
|
},
|
|
2199
|
-
/* @__PURE__ */
|
|
2255
|
+
/* @__PURE__ */ React17.createElement(
|
|
2200
2256
|
LabelField,
|
|
2201
2257
|
{
|
|
2202
2258
|
id: "variable-label",
|
|
@@ -2215,7 +2271,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2215
2271
|
onKeyDown: handleKeyDown
|
|
2216
2272
|
}
|
|
2217
2273
|
)
|
|
2218
|
-
), ValueField && /* @__PURE__ */
|
|
2274
|
+
), ValueField && /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: __11("Value", "elementor") }, /* @__PURE__ */ React17.createElement(Typography6, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React17.createElement(
|
|
2219
2275
|
ValueField,
|
|
2220
2276
|
{
|
|
2221
2277
|
value,
|
|
@@ -2229,7 +2285,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2229
2285
|
propType,
|
|
2230
2286
|
onKeyDown: handleKeyDown
|
|
2231
2287
|
}
|
|
2232
|
-
))), errorMessage && /* @__PURE__ */
|
|
2288
|
+
))), errorMessage && /* @__PURE__ */ React17.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React17.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React17.createElement(
|
|
2233
2289
|
Button3,
|
|
2234
2290
|
{
|
|
2235
2291
|
id: "create-variable-button",
|
|
@@ -2238,12 +2294,12 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2238
2294
|
disabled: isSubmitDisabled,
|
|
2239
2295
|
onClick: handleCreateAndTrack
|
|
2240
2296
|
},
|
|
2241
|
-
|
|
2297
|
+
__11("Create", "elementor")
|
|
2242
2298
|
)));
|
|
2243
2299
|
};
|
|
2244
2300
|
|
|
2245
2301
|
// src/components/variable-edit.tsx
|
|
2246
|
-
import * as
|
|
2302
|
+
import * as React19 from "react";
|
|
2247
2303
|
import { useEffect as useEffect4, useState as useState10 } from "react";
|
|
2248
2304
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
2249
2305
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
@@ -2251,10 +2307,10 @@ import { PopoverBody as PopoverBody2 } from "@elementor/editor-editing-panel";
|
|
|
2251
2307
|
import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
2252
2308
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
2253
2309
|
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Tooltip, Typography as Typography8 } from "@elementor/ui";
|
|
2254
|
-
import { __ as
|
|
2310
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2255
2311
|
|
|
2256
2312
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2257
|
-
import * as
|
|
2313
|
+
import * as React18 from "react";
|
|
2258
2314
|
import { useState as useState9 } from "react";
|
|
2259
2315
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2260
2316
|
import {
|
|
@@ -2268,7 +2324,7 @@ import {
|
|
|
2268
2324
|
FormControlLabel,
|
|
2269
2325
|
Typography as Typography7
|
|
2270
2326
|
} from "@elementor/ui";
|
|
2271
|
-
import { __ as
|
|
2327
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
2272
2328
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2273
2329
|
var EditConfirmationDialog = ({
|
|
2274
2330
|
closeDialog,
|
|
@@ -2282,13 +2338,13 @@ var EditConfirmationDialog = ({
|
|
|
2282
2338
|
}
|
|
2283
2339
|
onConfirm?.();
|
|
2284
2340
|
};
|
|
2285
|
-
return /* @__PURE__ */
|
|
2341
|
+
return /* @__PURE__ */ React18.createElement(Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React18.createElement(DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React18.createElement(AlertTriangleFilledIcon3, { color: "secondary" }), __12("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React18.createElement(DialogContent, null, /* @__PURE__ */ React18.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __12(
|
|
2286
2342
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2287
2343
|
"elementor"
|
|
2288
|
-
))), /* @__PURE__ */
|
|
2344
|
+
))), /* @__PURE__ */ React18.createElement(DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(
|
|
2289
2345
|
FormControlLabel,
|
|
2290
2346
|
{
|
|
2291
|
-
control: /* @__PURE__ */
|
|
2347
|
+
control: /* @__PURE__ */ React18.createElement(
|
|
2292
2348
|
Checkbox,
|
|
2293
2349
|
{
|
|
2294
2350
|
checked: dontShowAgain,
|
|
@@ -2296,14 +2352,14 @@ var EditConfirmationDialog = ({
|
|
|
2296
2352
|
size: "small"
|
|
2297
2353
|
}
|
|
2298
2354
|
),
|
|
2299
|
-
label: /* @__PURE__ */
|
|
2355
|
+
label: /* @__PURE__ */ React18.createElement(Typography7, { variant: "body2" }, __12("Don't show me again", "elementor"))
|
|
2300
2356
|
}
|
|
2301
|
-
), /* @__PURE__ */
|
|
2357
|
+
), /* @__PURE__ */ React18.createElement("div", null, /* @__PURE__ */ React18.createElement(Button4, { color: "secondary", onClick: closeDialog }, __12("Keep editing", "elementor")), /* @__PURE__ */ React18.createElement(Button4, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __12("Save", "elementor")))));
|
|
2302
2358
|
};
|
|
2303
2359
|
|
|
2304
2360
|
// src/components/variable-edit.tsx
|
|
2305
2361
|
var SIZE3 = "tiny";
|
|
2306
|
-
var DELETE_LABEL =
|
|
2362
|
+
var DELETE_LABEL = __13("Delete variable", "elementor");
|
|
2307
2363
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2308
2364
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2309
2365
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
@@ -2384,7 +2440,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2384
2440
|
const actions = [];
|
|
2385
2441
|
if (userPermissions.canDelete()) {
|
|
2386
2442
|
actions.push(
|
|
2387
|
-
/* @__PURE__ */
|
|
2443
|
+
/* @__PURE__ */ React19.createElement(Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React19.createElement(IconButton5, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React19.createElement(TrashIcon2, { fontSize: SIZE3 })))
|
|
2388
2444
|
);
|
|
2389
2445
|
}
|
|
2390
2446
|
const hasEmptyFields = () => {
|
|
@@ -2409,31 +2465,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2409
2465
|
handleUpdate();
|
|
2410
2466
|
}
|
|
2411
2467
|
};
|
|
2412
|
-
return /* @__PURE__ */
|
|
2468
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(PopoverBody2, { height: "auto" }, /* @__PURE__ */ React19.createElement(
|
|
2413
2469
|
PopoverHeader2,
|
|
2414
2470
|
{
|
|
2415
|
-
title:
|
|
2471
|
+
title: __13("Edit variable", "elementor"),
|
|
2416
2472
|
onClose,
|
|
2417
|
-
icon: /* @__PURE__ */
|
|
2473
|
+
icon: /* @__PURE__ */ React19.createElement(React19.Fragment, null, onGoBack && /* @__PURE__ */ React19.createElement(
|
|
2418
2474
|
IconButton5,
|
|
2419
2475
|
{
|
|
2420
2476
|
size: SIZE3,
|
|
2421
|
-
"aria-label":
|
|
2477
|
+
"aria-label": __13("Go Back", "elementor"),
|
|
2422
2478
|
onClick: onGoBack
|
|
2423
2479
|
},
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
), /* @__PURE__ */
|
|
2480
|
+
/* @__PURE__ */ React19.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
2481
|
+
), /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2426
2482
|
actions
|
|
2427
2483
|
}
|
|
2428
|
-
), /* @__PURE__ */
|
|
2484
|
+
), /* @__PURE__ */ React19.createElement(Divider3, null), /* @__PURE__ */ React19.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React19.createElement(
|
|
2429
2485
|
FormField,
|
|
2430
2486
|
{
|
|
2431
2487
|
id: "variable-label",
|
|
2432
|
-
label:
|
|
2488
|
+
label: __13("Name", "elementor"),
|
|
2433
2489
|
errorMsg: labelFieldError?.message,
|
|
2434
2490
|
noticeMsg: labelHint(label)
|
|
2435
2491
|
},
|
|
2436
|
-
/* @__PURE__ */
|
|
2492
|
+
/* @__PURE__ */ React19.createElement(
|
|
2437
2493
|
LabelField,
|
|
2438
2494
|
{
|
|
2439
2495
|
id: "variable-label",
|
|
@@ -2452,7 +2508,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2452
2508
|
onKeyDown: handleKeyDown
|
|
2453
2509
|
}
|
|
2454
2510
|
)
|
|
2455
|
-
), ValueField && /* @__PURE__ */
|
|
2511
|
+
), ValueField && /* @__PURE__ */ React19.createElement(FormField, { errorMsg: valueFieldError, label: __13("Value", "elementor") }, /* @__PURE__ */ React19.createElement(Typography8, { variant: "h5" }, /* @__PURE__ */ React19.createElement(
|
|
2456
2512
|
ValueField,
|
|
2457
2513
|
{
|
|
2458
2514
|
propTypeKey: variable.type,
|
|
@@ -2467,7 +2523,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2467
2523
|
onValidationChange: setValueFieldError,
|
|
2468
2524
|
propType
|
|
2469
2525
|
}
|
|
2470
|
-
))), errorMessage && /* @__PURE__ */
|
|
2526
|
+
))), errorMessage && /* @__PURE__ */ React19.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React19.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React19.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __13("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2471
2527
|
DeleteConfirmationDialog,
|
|
2472
2528
|
{
|
|
2473
2529
|
open: true,
|
|
@@ -2475,7 +2531,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2475
2531
|
onConfirm: handleDelete,
|
|
2476
2532
|
closeDialog: closeDeleteDialog()
|
|
2477
2533
|
}
|
|
2478
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2534
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React19.createElement(
|
|
2479
2535
|
EditConfirmationDialog,
|
|
2480
2536
|
{
|
|
2481
2537
|
closeDialog: closeEditDialog(),
|
|
@@ -2486,26 +2542,27 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2486
2542
|
};
|
|
2487
2543
|
|
|
2488
2544
|
// src/components/variables-selection.tsx
|
|
2489
|
-
import * as React19 from "react";
|
|
2490
2545
|
import { useState as useState11 } from "react";
|
|
2546
|
+
import * as React21 from "react";
|
|
2491
2547
|
import { PopoverBody as PopoverBody3 } from "@elementor/editor-editing-panel";
|
|
2492
2548
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, SearchField as SearchField2 } from "@elementor/editor-ui";
|
|
2549
|
+
import { PromotionAlert } from "@elementor/editor-ui";
|
|
2493
2550
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2494
2551
|
import { Divider as Divider4, IconButton as IconButton7, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
2495
|
-
import { __ as
|
|
2552
|
+
import { __ as __15, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
2496
2553
|
|
|
2497
2554
|
// src/components/ui/menu-item-content.tsx
|
|
2498
|
-
import * as
|
|
2555
|
+
import * as React20 from "react";
|
|
2499
2556
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2500
2557
|
import { EditIcon } from "@elementor/icons";
|
|
2501
|
-
import { Box as
|
|
2502
|
-
import { __ as
|
|
2558
|
+
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography9 } from "@elementor/ui";
|
|
2559
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2503
2560
|
var SIZE4 = "tiny";
|
|
2504
|
-
var EDIT_LABEL =
|
|
2505
|
-
var MenuItemContent = ({ item }) => {
|
|
2561
|
+
var EDIT_LABEL = __14("Edit variable", "elementor");
|
|
2562
|
+
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2506
2563
|
const onEdit = item.onEdit;
|
|
2507
|
-
return /* @__PURE__ */
|
|
2508
|
-
|
|
2564
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React20.createElement(
|
|
2565
|
+
Box3,
|
|
2509
2566
|
{
|
|
2510
2567
|
sx: {
|
|
2511
2568
|
flex: 1,
|
|
@@ -2515,29 +2572,29 @@ var MenuItemContent = ({ item }) => {
|
|
|
2515
2572
|
gap: 1
|
|
2516
2573
|
}
|
|
2517
2574
|
},
|
|
2518
|
-
/* @__PURE__ */
|
|
2575
|
+
/* @__PURE__ */ React20.createElement(
|
|
2519
2576
|
EllipsisWithTooltip2,
|
|
2520
2577
|
{
|
|
2521
2578
|
title: item.label || item.value,
|
|
2522
2579
|
as: Typography9,
|
|
2523
2580
|
variant: "caption",
|
|
2524
|
-
color: "text.primary",
|
|
2581
|
+
color: disabled ? "text.disabled" : "text.primary",
|
|
2525
2582
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2526
2583
|
maxWidth: "50%"
|
|
2527
2584
|
}
|
|
2528
2585
|
),
|
|
2529
|
-
item.secondaryText && /* @__PURE__ */
|
|
2586
|
+
item.secondaryText && /* @__PURE__ */ React20.createElement(
|
|
2530
2587
|
EllipsisWithTooltip2,
|
|
2531
2588
|
{
|
|
2532
2589
|
title: item.secondaryText,
|
|
2533
2590
|
as: Typography9,
|
|
2534
2591
|
variant: "caption",
|
|
2535
|
-
color: "text.tertiary",
|
|
2592
|
+
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2536
2593
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2537
2594
|
maxWidth: "50%"
|
|
2538
2595
|
}
|
|
2539
2596
|
)
|
|
2540
|
-
), !!onEdit && /* @__PURE__ */
|
|
2597
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React20.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2541
2598
|
IconButton6,
|
|
2542
2599
|
{
|
|
2543
2600
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2547,13 +2604,13 @@ var MenuItemContent = ({ item }) => {
|
|
|
2547
2604
|
},
|
|
2548
2605
|
"aria-label": EDIT_LABEL
|
|
2549
2606
|
},
|
|
2550
|
-
/* @__PURE__ */
|
|
2607
|
+
/* @__PURE__ */ React20.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2551
2608
|
)));
|
|
2552
2609
|
};
|
|
2553
2610
|
|
|
2554
2611
|
// src/components/ui/styled-menu-list.tsx
|
|
2555
2612
|
import { MenuList, styled as styled2 } from "@elementor/ui";
|
|
2556
|
-
var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
2613
|
+
var VariablesStyledMenuList = styled2(MenuList)(({ theme, disabled }) => ({
|
|
2557
2614
|
"& > li": {
|
|
2558
2615
|
height: 32,
|
|
2559
2616
|
width: "100%",
|
|
@@ -2564,13 +2621,15 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
2564
2621
|
...theme.typography.caption,
|
|
2565
2622
|
lineHeight: "inherit",
|
|
2566
2623
|
padding: theme.spacing(0.5, 1, 0.5, 2),
|
|
2567
|
-
|
|
2568
|
-
|
|
2624
|
+
...!disabled && {
|
|
2625
|
+
"&:hover, &:focus": {
|
|
2626
|
+
backgroundColor: theme.palette.action.hover
|
|
2627
|
+
},
|
|
2628
|
+
cursor: "pointer"
|
|
2569
2629
|
},
|
|
2570
2630
|
'&[aria-selected="true"]': {
|
|
2571
2631
|
backgroundColor: theme.palette.action.selected
|
|
2572
2632
|
},
|
|
2573
|
-
cursor: "pointer",
|
|
2574
2633
|
textOverflow: "ellipsis",
|
|
2575
2634
|
position: "absolute",
|
|
2576
2635
|
top: 0,
|
|
@@ -2585,8 +2644,9 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
2585
2644
|
|
|
2586
2645
|
// src/components/variables-selection.tsx
|
|
2587
2646
|
var SIZE5 = "tiny";
|
|
2588
|
-
var CREATE_LABEL =
|
|
2589
|
-
var MANAGER_LABEL =
|
|
2647
|
+
var CREATE_LABEL = __15("Create variable", "elementor");
|
|
2648
|
+
var MANAGER_LABEL = __15("Variables Manager", "elementor");
|
|
2649
|
+
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license-panel-${variableType}-variable`;
|
|
2590
2650
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2591
2651
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2592
2652
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
@@ -2617,7 +2677,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2617
2677
|
const actions = [];
|
|
2618
2678
|
if (onAdd) {
|
|
2619
2679
|
actions.push(
|
|
2620
|
-
/* @__PURE__ */
|
|
2680
|
+
/* @__PURE__ */ React21.createElement(Tooltip3, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React21.createElement("span", null, /* @__PURE__ */ React21.createElement(
|
|
2621
2681
|
IconButton7,
|
|
2622
2682
|
{
|
|
2623
2683
|
id: "add-variable-button",
|
|
@@ -2626,7 +2686,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2626
2686
|
"aria-label": CREATE_LABEL,
|
|
2627
2687
|
disabled
|
|
2628
2688
|
},
|
|
2629
|
-
/* @__PURE__ */
|
|
2689
|
+
/* @__PURE__ */ React21.createElement(PlusIcon2, { fontSize: SIZE5 })
|
|
2630
2690
|
)))
|
|
2631
2691
|
);
|
|
2632
2692
|
}
|
|
@@ -2640,7 +2700,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2640
2700
|
});
|
|
2641
2701
|
};
|
|
2642
2702
|
actions.push(
|
|
2643
|
-
/* @__PURE__ */
|
|
2703
|
+
/* @__PURE__ */ React21.createElement(Tooltip3, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2644
2704
|
IconButton7,
|
|
2645
2705
|
{
|
|
2646
2706
|
id: "variables-manager-button",
|
|
@@ -2648,16 +2708,16 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2648
2708
|
onClick: handleOpenManager,
|
|
2649
2709
|
"aria-label": MANAGER_LABEL
|
|
2650
2710
|
},
|
|
2651
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ React21.createElement(SettingsIcon, { fontSize: SIZE5 })
|
|
2652
2712
|
))
|
|
2653
2713
|
);
|
|
2654
2714
|
}
|
|
2655
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2715
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2656
2716
|
const items = variables.map(({ value, label, key }) => ({
|
|
2657
2717
|
type: "item",
|
|
2658
2718
|
value: key,
|
|
2659
2719
|
label,
|
|
2660
|
-
icon: /* @__PURE__ */
|
|
2720
|
+
icon: /* @__PURE__ */ React21.createElement(StartIcon, { value }),
|
|
2661
2721
|
secondaryText: value,
|
|
2662
2722
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2663
2723
|
}));
|
|
@@ -2667,80 +2727,91 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2667
2727
|
const handleClearSearch = () => {
|
|
2668
2728
|
setSearchValue("");
|
|
2669
2729
|
};
|
|
2670
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ React21.createElement(PopoverBody3, null, /* @__PURE__ */ React21.createElement(
|
|
2671
2731
|
PopoverHeader3,
|
|
2672
2732
|
{
|
|
2673
|
-
title:
|
|
2674
|
-
icon: /* @__PURE__ */
|
|
2733
|
+
title: __15("Variables", "elementor"),
|
|
2734
|
+
icon: /* @__PURE__ */ React21.createElement(ColorFilterIcon2, { fontSize: SIZE5 }),
|
|
2675
2735
|
onClose: closePopover,
|
|
2676
2736
|
actions
|
|
2677
2737
|
}
|
|
2678
|
-
), hasVariables && /* @__PURE__ */
|
|
2738
|
+
), hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2679
2739
|
SearchField2,
|
|
2680
2740
|
{
|
|
2681
2741
|
value: searchValue,
|
|
2682
2742
|
onSearch: handleSearch,
|
|
2683
|
-
placeholder:
|
|
2743
|
+
placeholder: __15("Search", "elementor")
|
|
2684
2744
|
}
|
|
2685
|
-
), /* @__PURE__ */
|
|
2745
|
+
), /* @__PURE__ */ React21.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2686
2746
|
PopoverMenuList,
|
|
2687
2747
|
{
|
|
2688
2748
|
items,
|
|
2689
|
-
onSelect:
|
|
2749
|
+
onSelect: disabled ? () => {
|
|
2750
|
+
} : handleSetVariable,
|
|
2690
2751
|
onClose: () => {
|
|
2691
2752
|
},
|
|
2692
2753
|
selectedValue: variable,
|
|
2693
2754
|
"data-testid": `${variableType}-variables-list`,
|
|
2694
|
-
menuListTemplate: VariablesStyledMenuList,
|
|
2695
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2755
|
+
menuListTemplate: (props) => /* @__PURE__ */ React21.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2756
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React21.createElement(MenuItemContent, { item, disabled })
|
|
2757
|
+
}
|
|
2758
|
+
), disabled && /* @__PURE__ */ React21.createElement(
|
|
2759
|
+
PromotionAlert,
|
|
2760
|
+
{
|
|
2761
|
+
message: sprintf3(
|
|
2762
|
+
/* translators: %s: Variable Type. */
|
|
2763
|
+
__15("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2764
|
+
variableType
|
|
2765
|
+
),
|
|
2766
|
+
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2696
2767
|
}
|
|
2697
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2768
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2698
2769
|
NoSearchResults,
|
|
2699
2770
|
{
|
|
2700
2771
|
searchValue,
|
|
2701
2772
|
onClear: handleClearSearch,
|
|
2702
|
-
icon: /* @__PURE__ */
|
|
2773
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2703
2774
|
}
|
|
2704
|
-
), disabled && /* @__PURE__ */
|
|
2775
|
+
), disabled && !hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2705
2776
|
EmptyState,
|
|
2706
2777
|
{
|
|
2707
2778
|
title: sprintf3(
|
|
2708
2779
|
/* translators: %s: Variable Type. */
|
|
2709
|
-
|
|
2780
|
+
__15("No %s variables yet", "elementor"),
|
|
2710
2781
|
variableType
|
|
2711
2782
|
),
|
|
2712
2783
|
message: sprintf3(
|
|
2713
2784
|
/* translators: %s: Variable Type. */
|
|
2714
|
-
|
|
2785
|
+
__15("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2715
2786
|
variableType
|
|
2716
2787
|
),
|
|
2717
|
-
icon: /* @__PURE__ */
|
|
2788
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2718
2789
|
},
|
|
2719
2790
|
emptyState
|
|
2720
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2791
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2721
2792
|
EmptyState,
|
|
2722
2793
|
{
|
|
2723
2794
|
title: sprintf3(
|
|
2724
2795
|
/* translators: %s: Variable Type. */
|
|
2725
|
-
|
|
2796
|
+
__15("Create your first %s variable", "elementor"),
|
|
2726
2797
|
variableType
|
|
2727
2798
|
),
|
|
2728
|
-
message:
|
|
2799
|
+
message: __15(
|
|
2729
2800
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2730
2801
|
"elementor"
|
|
2731
2802
|
),
|
|
2732
|
-
icon: /* @__PURE__ */
|
|
2803
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2733
2804
|
onAdd
|
|
2734
2805
|
}
|
|
2735
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2806
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2736
2807
|
EmptyState,
|
|
2737
2808
|
{
|
|
2738
|
-
title:
|
|
2739
|
-
message:
|
|
2809
|
+
title: __15("No compatible variables", "elementor"),
|
|
2810
|
+
message: __15(
|
|
2740
2811
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2741
2812
|
"elementor"
|
|
2742
2813
|
),
|
|
2743
|
-
icon: /* @__PURE__ */
|
|
2814
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2744
2815
|
onAdd
|
|
2745
2816
|
}
|
|
2746
2817
|
));
|
|
@@ -2757,7 +2828,7 @@ var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable })
|
|
|
2757
2828
|
const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
|
|
2758
2829
|
open();
|
|
2759
2830
|
} : void 0;
|
|
2760
|
-
return /* @__PURE__ */
|
|
2831
|
+
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2761
2832
|
propTypeKey,
|
|
2762
2833
|
currentView,
|
|
2763
2834
|
selectedVariable,
|
|
@@ -2804,7 +2875,7 @@ function RenderView(props) {
|
|
|
2804
2875
|
}
|
|
2805
2876
|
};
|
|
2806
2877
|
if (VIEW_LIST === props.currentView) {
|
|
2807
|
-
return /* @__PURE__ */
|
|
2878
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2808
2879
|
VariablesSelection,
|
|
2809
2880
|
{
|
|
2810
2881
|
closePopover: handlers.onClose,
|
|
@@ -2816,10 +2887,10 @@ function RenderView(props) {
|
|
|
2816
2887
|
);
|
|
2817
2888
|
}
|
|
2818
2889
|
if (VIEW_ADD === props.currentView) {
|
|
2819
|
-
return /* @__PURE__ */
|
|
2890
|
+
return /* @__PURE__ */ React22.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2820
2891
|
}
|
|
2821
2892
|
if (VIEW_EDIT === props.currentView) {
|
|
2822
|
-
return /* @__PURE__ */
|
|
2893
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2823
2894
|
VariableEdit,
|
|
2824
2895
|
{
|
|
2825
2896
|
editId: props.editId,
|
|
@@ -2833,26 +2904,26 @@ function RenderView(props) {
|
|
|
2833
2904
|
}
|
|
2834
2905
|
|
|
2835
2906
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2836
|
-
import * as
|
|
2907
|
+
import * as React23 from "react";
|
|
2837
2908
|
import { DetachIcon } from "@elementor/icons";
|
|
2838
|
-
import { Box as
|
|
2839
|
-
import { __ as
|
|
2909
|
+
import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography10, UnstableTag as Tag } from "@elementor/ui";
|
|
2910
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2840
2911
|
var SIZE6 = "tiny";
|
|
2841
|
-
var UNLINK_LABEL =
|
|
2912
|
+
var UNLINK_LABEL = __16("Unlink variable", "elementor");
|
|
2842
2913
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2843
2914
|
const actions = [];
|
|
2844
2915
|
if (onUnlink) {
|
|
2845
2916
|
actions.push(
|
|
2846
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ React23.createElement(Tooltip4, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React23.createElement(IconButton8, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React23.createElement(DetachIcon, { fontSize: SIZE6 })))
|
|
2847
2918
|
);
|
|
2848
2919
|
}
|
|
2849
|
-
return /* @__PURE__ */
|
|
2920
|
+
return /* @__PURE__ */ React23.createElement(Tooltip4, { title: label, placement: "top" }, /* @__PURE__ */ React23.createElement(
|
|
2850
2921
|
Tag,
|
|
2851
2922
|
{
|
|
2852
2923
|
fullWidth: true,
|
|
2853
2924
|
showActionsOnHover: true,
|
|
2854
|
-
startIcon: /* @__PURE__ */
|
|
2855
|
-
label: /* @__PURE__ */
|
|
2925
|
+
startIcon: /* @__PURE__ */ React23.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
2926
|
+
label: /* @__PURE__ */ React23.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React23.createElement(Typography10, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
2856
2927
|
actions,
|
|
2857
2928
|
...props
|
|
2858
2929
|
}
|
|
@@ -2863,7 +2934,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2863
2934
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
2864
2935
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
2865
2936
|
const { setValue } = useBoundProp6();
|
|
2866
|
-
const anchorRef =
|
|
2937
|
+
const anchorRef = useRef7(null);
|
|
2867
2938
|
const popupId = useId();
|
|
2868
2939
|
const popupState = usePopupState3({
|
|
2869
2940
|
variant: "popover",
|
|
@@ -2871,15 +2942,15 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2871
2942
|
});
|
|
2872
2943
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
2873
2944
|
const StartIcon = startIcon || (() => null);
|
|
2874
|
-
return /* @__PURE__ */
|
|
2945
|
+
return /* @__PURE__ */ React24.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React24.createElement(
|
|
2875
2946
|
AssignedTag,
|
|
2876
2947
|
{
|
|
2877
2948
|
label: variable.label,
|
|
2878
|
-
startIcon: /* @__PURE__ */
|
|
2949
|
+
startIcon: /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(ColorFilterIcon3, { fontSize: SIZE6 }), /* @__PURE__ */ React24.createElement(StartIcon, { value: variable.value })),
|
|
2879
2950
|
onUnlink: unlinkVariable,
|
|
2880
2951
|
...bindTrigger3(popupState)
|
|
2881
2952
|
}
|
|
2882
|
-
), /* @__PURE__ */
|
|
2953
|
+
), /* @__PURE__ */ React24.createElement(
|
|
2883
2954
|
Popover,
|
|
2884
2955
|
{
|
|
2885
2956
|
disableScrollLock: true,
|
|
@@ -2891,7 +2962,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2891
2962
|
},
|
|
2892
2963
|
...bindPopover(popupState)
|
|
2893
2964
|
},
|
|
2894
|
-
/* @__PURE__ */
|
|
2965
|
+
/* @__PURE__ */ React24.createElement(
|
|
2895
2966
|
VariableSelectionPopover,
|
|
2896
2967
|
{
|
|
2897
2968
|
selectedVariable: variable,
|
|
@@ -2903,20 +2974,20 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2903
2974
|
};
|
|
2904
2975
|
|
|
2905
2976
|
// src/components/ui/variable/deleted-variable.tsx
|
|
2906
|
-
import * as
|
|
2907
|
-
import { useId as useId2, useRef as
|
|
2977
|
+
import * as React28 from "react";
|
|
2978
|
+
import { useId as useId2, useRef as useRef8, useState as useState14 } from "react";
|
|
2908
2979
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
2909
|
-
import { Backdrop, bindPopover as bindPopover2, Box as
|
|
2910
|
-
import { __ as
|
|
2980
|
+
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2981
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2911
2982
|
|
|
2912
2983
|
// src/components/variable-restore.tsx
|
|
2913
|
-
import * as
|
|
2984
|
+
import * as React25 from "react";
|
|
2914
2985
|
import { useState as useState13 } from "react";
|
|
2915
2986
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
2916
2987
|
import { PopoverBody as PopoverBody4 } from "@elementor/editor-editing-panel";
|
|
2917
2988
|
import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
|
|
2918
2989
|
import { Button as Button6, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
|
|
2919
|
-
import { __ as
|
|
2990
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
2920
2991
|
var SIZE7 = "tiny";
|
|
2921
2992
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
2922
2993
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -2976,22 +3047,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2976
3047
|
handleRestore();
|
|
2977
3048
|
}
|
|
2978
3049
|
};
|
|
2979
|
-
return /* @__PURE__ */
|
|
3050
|
+
return /* @__PURE__ */ React25.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React25.createElement(PopoverBody4, { height: "auto" }, /* @__PURE__ */ React25.createElement(
|
|
2980
3051
|
PopoverHeader4,
|
|
2981
3052
|
{
|
|
2982
|
-
icon: /* @__PURE__ */
|
|
2983
|
-
title:
|
|
3053
|
+
icon: /* @__PURE__ */ React25.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3054
|
+
title: __17("Restore variable", "elementor"),
|
|
2984
3055
|
onClose
|
|
2985
3056
|
}
|
|
2986
|
-
), /* @__PURE__ */
|
|
3057
|
+
), /* @__PURE__ */ React25.createElement(Divider5, null), /* @__PURE__ */ React25.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React25.createElement(
|
|
2987
3058
|
FormField,
|
|
2988
3059
|
{
|
|
2989
3060
|
id: "variable-label",
|
|
2990
|
-
label:
|
|
3061
|
+
label: __17("Name", "elementor"),
|
|
2991
3062
|
errorMsg: labelFieldError?.message,
|
|
2992
3063
|
noticeMsg: labelHint(label)
|
|
2993
3064
|
},
|
|
2994
|
-
/* @__PURE__ */
|
|
3065
|
+
/* @__PURE__ */ React25.createElement(
|
|
2995
3066
|
LabelField,
|
|
2996
3067
|
{
|
|
2997
3068
|
id: "variable-label",
|
|
@@ -3010,7 +3081,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3010
3081
|
onKeyDown: handleKeyDown
|
|
3011
3082
|
}
|
|
3012
3083
|
)
|
|
3013
|
-
), ValueField && /* @__PURE__ */
|
|
3084
|
+
), ValueField && /* @__PURE__ */ React25.createElement(FormField, { errorMsg: valueFieldError, label: __17("Value", "elementor") }, /* @__PURE__ */ React25.createElement(Typography11, { variant: "h5" }, /* @__PURE__ */ React25.createElement(
|
|
3014
3085
|
ValueField,
|
|
3015
3086
|
{
|
|
3016
3087
|
propTypeKey,
|
|
@@ -3025,25 +3096,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3025
3096
|
propType,
|
|
3026
3097
|
onKeyDown: handleKeyDown
|
|
3027
3098
|
}
|
|
3028
|
-
))), errorMessage && /* @__PURE__ */
|
|
3099
|
+
))), errorMessage && /* @__PURE__ */ React25.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React25.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React25.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __17("Restore", "elementor")))));
|
|
3029
3100
|
};
|
|
3030
3101
|
|
|
3031
3102
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3032
|
-
import * as
|
|
3103
|
+
import * as React26 from "react";
|
|
3033
3104
|
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as Typography12 } from "@elementor/ui";
|
|
3034
|
-
import { __ as
|
|
3105
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
3035
3106
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3036
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ React26.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React26.createElement(
|
|
3037
3108
|
Alert2,
|
|
3038
3109
|
{
|
|
3039
3110
|
variant: "standard",
|
|
3040
3111
|
severity: "warning",
|
|
3041
3112
|
onClose,
|
|
3042
|
-
action: /* @__PURE__ */
|
|
3113
|
+
action: /* @__PURE__ */ React26.createElement(React26.Fragment, null, onUnlink && /* @__PURE__ */ React26.createElement(AlertAction2, { variant: "contained", onClick: onUnlink }, __18("Unlink", "elementor")), onRestore && /* @__PURE__ */ React26.createElement(AlertAction2, { variant: "outlined", onClick: onRestore }, __18("Restore", "elementor"))),
|
|
3043
3114
|
sx: { maxWidth: 300 }
|
|
3044
3115
|
},
|
|
3045
|
-
/* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3116
|
+
/* @__PURE__ */ React26.createElement(AlertTitle2, null, __18("Deleted variable", "elementor")),
|
|
3117
|
+
/* @__PURE__ */ React26.createElement(Typography12, { variant: "body2", color: "textPrimary" }, __18("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React26.createElement(Typography12, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", __18(
|
|
3047
3118
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3048
3119
|
"elementor"
|
|
3049
3120
|
))
|
|
@@ -3051,13 +3122,13 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3051
3122
|
};
|
|
3052
3123
|
|
|
3053
3124
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3054
|
-
import * as
|
|
3125
|
+
import * as React27 from "react";
|
|
3055
3126
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon4 } from "@elementor/icons";
|
|
3056
|
-
import { Box as
|
|
3057
|
-
var WarningVariableTag =
|
|
3127
|
+
import { Box as Box6, Chip, Tooltip as Tooltip5, Typography as Typography13 } from "@elementor/ui";
|
|
3128
|
+
var WarningVariableTag = React27.forwardRef(
|
|
3058
3129
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3059
3130
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3060
|
-
return /* @__PURE__ */
|
|
3131
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3061
3132
|
Chip,
|
|
3062
3133
|
{
|
|
3063
3134
|
ref,
|
|
@@ -3066,8 +3137,8 @@ var WarningVariableTag = React25.forwardRef(
|
|
|
3066
3137
|
shape: "rounded",
|
|
3067
3138
|
variant: "standard",
|
|
3068
3139
|
onClick,
|
|
3069
|
-
icon: /* @__PURE__ */
|
|
3070
|
-
label: /* @__PURE__ */
|
|
3140
|
+
icon: /* @__PURE__ */ React27.createElement(AlertTriangleFilledIcon4, null),
|
|
3141
|
+
label: /* @__PURE__ */ React27.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React27.createElement(Box6, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React27.createElement(Typography13, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3071
3142
|
sx: {
|
|
3072
3143
|
height: (theme) => theme.spacing(3.5),
|
|
3073
3144
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3089,7 +3160,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3089
3160
|
const [showInfotip, setShowInfotip] = useState14(false);
|
|
3090
3161
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3091
3162
|
const closeInfotip = () => setShowInfotip(false);
|
|
3092
|
-
const deletedChipAnchorRef =
|
|
3163
|
+
const deletedChipAnchorRef = useRef8(null);
|
|
3093
3164
|
const popupId = useId2();
|
|
3094
3165
|
const popupState = usePopupState4({
|
|
3095
3166
|
variant: "popover",
|
|
@@ -3117,7 +3188,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3117
3188
|
const handleRestoreWithOverrides = () => {
|
|
3118
3189
|
popupState.close();
|
|
3119
3190
|
};
|
|
3120
|
-
return /* @__PURE__ */
|
|
3191
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Box7, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React28.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
|
|
3121
3192
|
Infotip2,
|
|
3122
3193
|
{
|
|
3123
3194
|
color: "warning",
|
|
@@ -3125,7 +3196,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3125
3196
|
open: showInfotip,
|
|
3126
3197
|
disableHoverListener: true,
|
|
3127
3198
|
onClose: closeInfotip,
|
|
3128
|
-
content: /* @__PURE__ */
|
|
3199
|
+
content: /* @__PURE__ */ React28.createElement(
|
|
3129
3200
|
DeletedVariableAlert,
|
|
3130
3201
|
{
|
|
3131
3202
|
onClose: closeInfotip,
|
|
@@ -3145,15 +3216,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3145
3216
|
}
|
|
3146
3217
|
}
|
|
3147
3218
|
},
|
|
3148
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ React28.createElement(
|
|
3149
3220
|
WarningVariableTag,
|
|
3150
3221
|
{
|
|
3151
3222
|
label: variable.label,
|
|
3152
3223
|
onClick: toggleInfotip,
|
|
3153
|
-
suffix:
|
|
3224
|
+
suffix: __19("deleted", "elementor")
|
|
3154
3225
|
}
|
|
3155
3226
|
)
|
|
3156
|
-
), /* @__PURE__ */
|
|
3227
|
+
), /* @__PURE__ */ React28.createElement(
|
|
3157
3228
|
Popover2,
|
|
3158
3229
|
{
|
|
3159
3230
|
disableScrollLock: true,
|
|
@@ -3164,7 +3235,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3164
3235
|
},
|
|
3165
3236
|
...bindPopover2(popupState)
|
|
3166
3237
|
},
|
|
3167
|
-
/* @__PURE__ */
|
|
3238
|
+
/* @__PURE__ */ React28.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React28.createElement(
|
|
3168
3239
|
VariableRestore,
|
|
3169
3240
|
{
|
|
3170
3241
|
variableId: variable.key ?? "",
|
|
@@ -3176,46 +3247,46 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3176
3247
|
};
|
|
3177
3248
|
|
|
3178
3249
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3179
|
-
import * as
|
|
3180
|
-
import { useId as useId3, useRef as
|
|
3250
|
+
import * as React30 from "react";
|
|
3251
|
+
import { useId as useId3, useRef as useRef9, useState as useState15 } from "react";
|
|
3181
3252
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
3182
|
-
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as
|
|
3183
|
-
import { __ as
|
|
3253
|
+
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box8, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
3254
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3184
3255
|
|
|
3185
3256
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3186
|
-
import * as
|
|
3257
|
+
import * as React29 from "react";
|
|
3187
3258
|
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as Typography14 } from "@elementor/ui";
|
|
3188
|
-
import { __ as
|
|
3259
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
3189
3260
|
var i18n = {
|
|
3190
|
-
title:
|
|
3191
|
-
message:
|
|
3261
|
+
title: __20("Variable has changed", "elementor"),
|
|
3262
|
+
message: __20(
|
|
3192
3263
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3193
3264
|
"elementor"
|
|
3194
3265
|
),
|
|
3195
3266
|
buttons: {
|
|
3196
|
-
clear:
|
|
3197
|
-
select:
|
|
3267
|
+
clear: __20("Clear", "elementor"),
|
|
3268
|
+
select: __20("Select variable", "elementor")
|
|
3198
3269
|
}
|
|
3199
3270
|
};
|
|
3200
3271
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3201
|
-
return /* @__PURE__ */
|
|
3272
|
+
return /* @__PURE__ */ React29.createElement(ClickAwayListener3, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
3202
3273
|
Alert3,
|
|
3203
3274
|
{
|
|
3204
3275
|
variant: "standard",
|
|
3205
3276
|
severity: "warning",
|
|
3206
3277
|
onClose,
|
|
3207
|
-
action: /* @__PURE__ */
|
|
3278
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3208
3279
|
sx: { maxWidth: 300 }
|
|
3209
3280
|
},
|
|
3210
|
-
/* @__PURE__ */
|
|
3211
|
-
/* @__PURE__ */
|
|
3281
|
+
/* @__PURE__ */ React29.createElement(AlertTitle3, null, i18n.title),
|
|
3282
|
+
/* @__PURE__ */ React29.createElement(Typography14, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3212
3283
|
));
|
|
3213
3284
|
};
|
|
3214
3285
|
|
|
3215
3286
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3216
3287
|
var MismatchVariable = ({ variable }) => {
|
|
3217
3288
|
const { setValue, value } = useBoundProp9();
|
|
3218
|
-
const anchorRef =
|
|
3289
|
+
const anchorRef = useRef9(null);
|
|
3219
3290
|
const popupId = useId3();
|
|
3220
3291
|
const popupState = usePopupState5({
|
|
3221
3292
|
variant: "popover",
|
|
@@ -3234,7 +3305,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3234
3305
|
setValue(null);
|
|
3235
3306
|
};
|
|
3236
3307
|
const showClearButton = !!value;
|
|
3237
|
-
return /* @__PURE__ */
|
|
3308
|
+
return /* @__PURE__ */ React30.createElement(Box8, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React30.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React30.createElement(
|
|
3238
3309
|
Infotip3,
|
|
3239
3310
|
{
|
|
3240
3311
|
color: "warning",
|
|
@@ -3242,7 +3313,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3242
3313
|
open: infotipVisible,
|
|
3243
3314
|
disableHoverListener: true,
|
|
3244
3315
|
onClose: closeInfotip,
|
|
3245
|
-
content: /* @__PURE__ */
|
|
3316
|
+
content: /* @__PURE__ */ React30.createElement(
|
|
3246
3317
|
MismatchVariableAlert,
|
|
3247
3318
|
{
|
|
3248
3319
|
onClose: closeInfotip,
|
|
@@ -3261,15 +3332,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3261
3332
|
}
|
|
3262
3333
|
}
|
|
3263
3334
|
},
|
|
3264
|
-
/* @__PURE__ */
|
|
3335
|
+
/* @__PURE__ */ React30.createElement(
|
|
3265
3336
|
WarningVariableTag,
|
|
3266
3337
|
{
|
|
3267
3338
|
label: variable.label,
|
|
3268
3339
|
onClick: toggleInfotip,
|
|
3269
|
-
suffix:
|
|
3340
|
+
suffix: __21("changed", "elementor")
|
|
3270
3341
|
}
|
|
3271
3342
|
)
|
|
3272
|
-
), /* @__PURE__ */
|
|
3343
|
+
), /* @__PURE__ */ React30.createElement(
|
|
3273
3344
|
Popover3,
|
|
3274
3345
|
{
|
|
3275
3346
|
disableScrollLock: true,
|
|
@@ -3281,7 +3352,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3281
3352
|
},
|
|
3282
3353
|
...bindPopover3(popupState)
|
|
3283
3354
|
},
|
|
3284
|
-
/* @__PURE__ */
|
|
3355
|
+
/* @__PURE__ */ React30.createElement(
|
|
3285
3356
|
VariableSelectionPopover,
|
|
3286
3357
|
{
|
|
3287
3358
|
selectedVariable: variable,
|
|
@@ -3293,28 +3364,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3293
3364
|
};
|
|
3294
3365
|
|
|
3295
3366
|
// src/components/ui/variable/missing-variable.tsx
|
|
3296
|
-
import * as
|
|
3367
|
+
import * as React32 from "react";
|
|
3297
3368
|
import { useState as useState16 } from "react";
|
|
3298
3369
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
3299
3370
|
import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
|
|
3300
|
-
import { __ as
|
|
3371
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3301
3372
|
|
|
3302
3373
|
// src/components/ui/missing-variable-alert.tsx
|
|
3303
|
-
import * as
|
|
3374
|
+
import * as React31 from "react";
|
|
3304
3375
|
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as Typography15 } from "@elementor/ui";
|
|
3305
|
-
import { __ as
|
|
3376
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
3306
3377
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3307
|
-
return /* @__PURE__ */
|
|
3378
|
+
return /* @__PURE__ */ React31.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React31.createElement(
|
|
3308
3379
|
Alert4,
|
|
3309
3380
|
{
|
|
3310
3381
|
variant: "standard",
|
|
3311
3382
|
severity: "warning",
|
|
3312
3383
|
onClose,
|
|
3313
|
-
action: /* @__PURE__ */
|
|
3384
|
+
action: /* @__PURE__ */ React31.createElement(React31.Fragment, null, onClear && /* @__PURE__ */ React31.createElement(AlertAction4, { variant: "contained", onClick: onClear }, __22("Clear", "elementor"))),
|
|
3314
3385
|
sx: { maxWidth: 300 }
|
|
3315
3386
|
},
|
|
3316
|
-
/* @__PURE__ */
|
|
3317
|
-
/* @__PURE__ */
|
|
3387
|
+
/* @__PURE__ */ React31.createElement(AlertTitle4, null, __22("This variable is missing", "elementor")),
|
|
3388
|
+
/* @__PURE__ */ React31.createElement(Typography15, { variant: "body2", color: "textPrimary" }, __22(
|
|
3318
3389
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3319
3390
|
"elementor"
|
|
3320
3391
|
))
|
|
@@ -3328,7 +3399,7 @@ var MissingVariable = () => {
|
|
|
3328
3399
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3329
3400
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3330
3401
|
const clearValue = () => setValue(null);
|
|
3331
|
-
return /* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, infotipVisible && /* @__PURE__ */ React32.createElement(Backdrop3, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React32.createElement(
|
|
3332
3403
|
Infotip4,
|
|
3333
3404
|
{
|
|
3334
3405
|
color: "warning",
|
|
@@ -3336,7 +3407,7 @@ var MissingVariable = () => {
|
|
|
3336
3407
|
open: infotipVisible,
|
|
3337
3408
|
disableHoverListener: true,
|
|
3338
3409
|
onClose: closeInfotip,
|
|
3339
|
-
content: /* @__PURE__ */
|
|
3410
|
+
content: /* @__PURE__ */ React32.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3340
3411
|
slotProps: {
|
|
3341
3412
|
popper: {
|
|
3342
3413
|
modifiers: [
|
|
@@ -3348,7 +3419,7 @@ var MissingVariable = () => {
|
|
|
3348
3419
|
}
|
|
3349
3420
|
}
|
|
3350
3421
|
},
|
|
3351
|
-
/* @__PURE__ */
|
|
3422
|
+
/* @__PURE__ */ React32.createElement(WarningVariableTag, { label: __23("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3352
3423
|
));
|
|
3353
3424
|
};
|
|
3354
3425
|
|
|
@@ -3358,37 +3429,37 @@ var VariableControl = () => {
|
|
|
3358
3429
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3359
3430
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3360
3431
|
if (!assignedVariable) {
|
|
3361
|
-
return /* @__PURE__ */
|
|
3432
|
+
return /* @__PURE__ */ React33.createElement(MissingVariable, null);
|
|
3362
3433
|
}
|
|
3363
3434
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3364
3435
|
if (assignedVariable?.deleted) {
|
|
3365
|
-
return /* @__PURE__ */
|
|
3436
|
+
return /* @__PURE__ */ React33.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3366
3437
|
}
|
|
3367
3438
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3368
3439
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3369
|
-
return /* @__PURE__ */
|
|
3440
|
+
return /* @__PURE__ */ React33.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3370
3441
|
}
|
|
3371
|
-
return /* @__PURE__ */
|
|
3442
|
+
return /* @__PURE__ */ React33.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3372
3443
|
};
|
|
3373
3444
|
|
|
3374
3445
|
// src/hooks/use-prop-variable-action.tsx
|
|
3375
|
-
import * as
|
|
3446
|
+
import * as React34 from "react";
|
|
3376
3447
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-editing-panel";
|
|
3377
3448
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
3378
|
-
import { __ as
|
|
3449
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3379
3450
|
var usePropVariableAction = () => {
|
|
3380
3451
|
const { propType, path } = useBoundProp12();
|
|
3381
3452
|
const variable = resolveVariableFromPropType(propType);
|
|
3382
3453
|
return {
|
|
3383
3454
|
visible: Boolean(variable),
|
|
3384
3455
|
icon: ColorFilterIcon4,
|
|
3385
|
-
title:
|
|
3456
|
+
title: __24("Variables", "elementor"),
|
|
3386
3457
|
content: ({ close: closePopover }) => {
|
|
3387
3458
|
if (!variable) {
|
|
3388
3459
|
return null;
|
|
3389
3460
|
}
|
|
3390
3461
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3391
|
-
return /* @__PURE__ */
|
|
3462
|
+
return /* @__PURE__ */ React34.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3392
3463
|
}
|
|
3393
3464
|
};
|
|
3394
3465
|
};
|
|
@@ -3535,19 +3606,19 @@ function initMcp() {
|
|
|
3535
3606
|
}
|
|
3536
3607
|
|
|
3537
3608
|
// src/register-variable-types.tsx
|
|
3538
|
-
import * as
|
|
3609
|
+
import * as React37 from "react";
|
|
3539
3610
|
import { colorPropTypeUtil, sizePropTypeUtil, stringPropTypeUtil } from "@elementor/editor-props";
|
|
3540
3611
|
import { CtaButton } from "@elementor/editor-ui";
|
|
3541
3612
|
import { BrushIcon, ExpandDiagonalIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
3542
3613
|
|
|
3543
3614
|
// src/components/fields/color-field.tsx
|
|
3544
|
-
import * as
|
|
3545
|
-
import { useRef as
|
|
3615
|
+
import * as React35 from "react";
|
|
3616
|
+
import { useRef as useRef10, useState as useState17 } from "react";
|
|
3546
3617
|
import { UnstableColorField } from "@elementor/ui";
|
|
3547
3618
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3548
3619
|
const [color, setColor] = useState17(value);
|
|
3549
3620
|
const [errorMessage, setErrorMessage] = useState17("");
|
|
3550
|
-
const defaultRef =
|
|
3621
|
+
const defaultRef = useRef10(null);
|
|
3551
3622
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3552
3623
|
const handleChange = (newValue) => {
|
|
3553
3624
|
setColor(newValue);
|
|
@@ -3556,7 +3627,7 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3556
3627
|
onValidationChange?.(errorMsg);
|
|
3557
3628
|
onChange(errorMsg ? "" : newValue);
|
|
3558
3629
|
};
|
|
3559
|
-
return /* @__PURE__ */
|
|
3630
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3560
3631
|
UnstableColorField,
|
|
3561
3632
|
{
|
|
3562
3633
|
id: "color-variable-field",
|
|
@@ -3585,21 +3656,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3585
3656
|
};
|
|
3586
3657
|
|
|
3587
3658
|
// src/components/fields/font-field.tsx
|
|
3588
|
-
import * as
|
|
3589
|
-
import { useId as useId4, useRef as
|
|
3659
|
+
import * as React36 from "react";
|
|
3660
|
+
import { useId as useId4, useRef as useRef11, useState as useState18 } from "react";
|
|
3590
3661
|
import { enqueueFont as enqueueFont2, ItemSelector } from "@elementor/editor-controls";
|
|
3591
3662
|
import { useFontFamilies, useSectionWidth } from "@elementor/editor-editing-panel";
|
|
3592
3663
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
3593
3664
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
3594
|
-
import { __ as
|
|
3665
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3595
3666
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3596
3667
|
const [fontFamily, setFontFamily] = useState18(value);
|
|
3597
|
-
const defaultRef =
|
|
3668
|
+
const defaultRef = useRef11(null);
|
|
3598
3669
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3599
3670
|
const fontPopoverState = usePopupState6({ variant: "popover" });
|
|
3600
3671
|
const fontFamilies = useFontFamilies();
|
|
3601
3672
|
const sectionWidth = useSectionWidth();
|
|
3602
|
-
const mapFontSubs =
|
|
3673
|
+
const mapFontSubs = React36.useMemo(() => {
|
|
3603
3674
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3604
3675
|
label,
|
|
3605
3676
|
items: fonts
|
|
@@ -3616,17 +3687,17 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3616
3687
|
fontPopoverState.close();
|
|
3617
3688
|
};
|
|
3618
3689
|
const id2 = useId4();
|
|
3619
|
-
return /* @__PURE__ */
|
|
3690
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3620
3691
|
UnstableTag,
|
|
3621
3692
|
{
|
|
3622
3693
|
id: id2,
|
|
3623
3694
|
variant: "outlined",
|
|
3624
3695
|
label: fontFamily,
|
|
3625
|
-
endIcon: /* @__PURE__ */
|
|
3696
|
+
endIcon: /* @__PURE__ */ React36.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
3626
3697
|
...bindTrigger4(fontPopoverState),
|
|
3627
3698
|
fullWidth: true
|
|
3628
3699
|
}
|
|
3629
|
-
), /* @__PURE__ */
|
|
3700
|
+
), /* @__PURE__ */ React36.createElement(
|
|
3630
3701
|
Popover4,
|
|
3631
3702
|
{
|
|
3632
3703
|
disablePortal: true,
|
|
@@ -3636,7 +3707,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3636
3707
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3637
3708
|
...bindPopover4(fontPopoverState)
|
|
3638
3709
|
},
|
|
3639
|
-
/* @__PURE__ */
|
|
3710
|
+
/* @__PURE__ */ React36.createElement(
|
|
3640
3711
|
ItemSelector,
|
|
3641
3712
|
{
|
|
3642
3713
|
id: "font-family-variables-selector",
|
|
@@ -3645,7 +3716,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3645
3716
|
onItemChange: handleFontFamilyChange,
|
|
3646
3717
|
onClose: fontPopoverState.close,
|
|
3647
3718
|
sectionWidth,
|
|
3648
|
-
title:
|
|
3719
|
+
title: __25("Font family", "elementor"),
|
|
3649
3720
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3650
3721
|
onDebounce: enqueueFont2,
|
|
3651
3722
|
icon: TextIcon
|
|
@@ -3674,7 +3745,7 @@ function registerVariableTypes() {
|
|
|
3674
3745
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3675
3746
|
fallbackPropTypeUtil: colorPropTypeUtil,
|
|
3676
3747
|
variableType: "color",
|
|
3677
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3748
|
+
startIcon: ({ value }) => /* @__PURE__ */ React37.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3678
3749
|
defaultValue: "#ffffff"
|
|
3679
3750
|
});
|
|
3680
3751
|
registerVariableType({
|
|
@@ -3694,7 +3765,7 @@ function registerVariableTypes() {
|
|
|
3694
3765
|
styleTransformer: EmptyTransformer,
|
|
3695
3766
|
variableType: "size",
|
|
3696
3767
|
selectionFilter: () => [],
|
|
3697
|
-
emptyState: /* @__PURE__ */
|
|
3768
|
+
emptyState: /* @__PURE__ */ React37.createElement(CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3698
3769
|
};
|
|
3699
3770
|
registerVariableType({
|
|
3700
3771
|
...sizePromotions,
|
|
@@ -3708,7 +3779,7 @@ function registerVariableTypes() {
|
|
|
3708
3779
|
}
|
|
3709
3780
|
|
|
3710
3781
|
// src/renderers/style-variables-renderer.tsx
|
|
3711
|
-
import * as
|
|
3782
|
+
import * as React38 from "react";
|
|
3712
3783
|
import { useEffect as useEffect5, useState as useState19 } from "react";
|
|
3713
3784
|
import {
|
|
3714
3785
|
__privateUseListenTo as useListenTo,
|
|
@@ -3726,7 +3797,7 @@ function StyleVariablesRenderer() {
|
|
|
3726
3797
|
}
|
|
3727
3798
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3728
3799
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3729
|
-
return /* @__PURE__ */
|
|
3800
|
+
return /* @__PURE__ */ React38.createElement(Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3730
3801
|
}
|
|
3731
3802
|
function usePortalContainer() {
|
|
3732
3803
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
@@ -3756,22 +3827,22 @@ import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elemen
|
|
|
3756
3827
|
import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
3757
3828
|
|
|
3758
3829
|
// src/components/variables-repeater-item-slot.tsx
|
|
3759
|
-
import * as
|
|
3830
|
+
import * as React39 from "react";
|
|
3760
3831
|
var useColorVariable = (value) => {
|
|
3761
3832
|
const variableId = value?.value?.color?.value;
|
|
3762
3833
|
return useVariable(variableId || "");
|
|
3763
3834
|
};
|
|
3764
3835
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3765
3836
|
const colorVariable = useColorVariable(value);
|
|
3766
|
-
return /* @__PURE__ */
|
|
3837
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3767
3838
|
};
|
|
3768
3839
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3769
3840
|
const colorVariable = useColorVariable(value);
|
|
3770
|
-
return /* @__PURE__ */
|
|
3841
|
+
return /* @__PURE__ */ React39.createElement("span", null, colorVariable?.label);
|
|
3771
3842
|
};
|
|
3772
3843
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3773
3844
|
const colorVariable = useColorVariable(value);
|
|
3774
|
-
return /* @__PURE__ */
|
|
3845
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3775
3846
|
};
|
|
3776
3847
|
|
|
3777
3848
|
// src/repeater-injections.ts
|