@elementor/editor-variables 3.35.2 → 3.35.4
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.js
CHANGED
|
@@ -47,14 +47,14 @@ var import_editor_panels2 = require("@elementor/editor-panels");
|
|
|
47
47
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
48
48
|
|
|
49
49
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
50
|
-
var
|
|
51
|
-
var
|
|
50
|
+
var React14 = __toESM(require("react"));
|
|
51
|
+
var import_react13 = require("react");
|
|
52
52
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
53
53
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
54
54
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
55
55
|
var import_icons5 = require("@elementor/icons");
|
|
56
|
-
var
|
|
57
|
-
var
|
|
56
|
+
var import_ui14 = require("@elementor/ui");
|
|
57
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
58
58
|
|
|
59
59
|
// src/utils/tracking.ts
|
|
60
60
|
var import_events = require("@elementor/events");
|
|
@@ -1061,44 +1061,85 @@ var useVariablesManagerState = () => {
|
|
|
1061
1061
|
};
|
|
1062
1062
|
|
|
1063
1063
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1064
|
-
var
|
|
1065
|
-
var
|
|
1066
|
-
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1064
|
+
var React7 = __toESM(require("react"));
|
|
1065
|
+
var import_react7 = require("react");
|
|
1067
1066
|
var import_icons2 = require("@elementor/icons");
|
|
1068
|
-
var
|
|
1069
|
-
var
|
|
1070
|
-
var
|
|
1071
|
-
|
|
1072
|
-
// src/sync/license-info.ts
|
|
1073
|
-
function getLicenseInfo() {
|
|
1074
|
-
const extendedWindow = window;
|
|
1075
|
-
return {
|
|
1076
|
-
hasPro: !!extendedWindow.elementorPro
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1067
|
+
var import_ui7 = require("@elementor/ui");
|
|
1068
|
+
var import_utils2 = require("@elementor/utils");
|
|
1069
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1079
1070
|
|
|
1080
1071
|
// src/hooks/use-quota-permissions.ts
|
|
1081
1072
|
var useQuotaPermissions = (variableType) => {
|
|
1082
|
-
const quotaConfig =
|
|
1073
|
+
const quotaConfig = {
|
|
1074
|
+
...window.ElementorVariablesQuotaConfig ?? {},
|
|
1075
|
+
...window.ElementorVariablesQuotaConfigExtended ?? {}
|
|
1076
|
+
};
|
|
1077
|
+
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1083
1078
|
const limit = quotaConfig[variableType] || 0;
|
|
1084
|
-
const
|
|
1079
|
+
const hasPermission = hasLegacySupport || limit > 0;
|
|
1085
1080
|
return {
|
|
1086
|
-
canAdd: () =>
|
|
1087
|
-
canEdit: () =>
|
|
1081
|
+
canAdd: () => hasPermission,
|
|
1082
|
+
canEdit: () => hasPermission
|
|
1088
1083
|
};
|
|
1089
1084
|
};
|
|
1090
1085
|
|
|
1086
|
+
// src/components/ui/variable-promotion-chip.tsx
|
|
1087
|
+
var React6 = __toESM(require("react"));
|
|
1088
|
+
var import_react6 = require("react");
|
|
1089
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1090
|
+
var import_ui6 = require("@elementor/ui");
|
|
1091
|
+
var import_utils = require("@elementor/utils");
|
|
1092
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
1093
|
+
var VariablePromotionChip = (0, import_react6.forwardRef)(
|
|
1094
|
+
({ variableType, upgradeUrl }, ref) => {
|
|
1095
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
1096
|
+
(0, import_editor_ui2.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
|
|
1097
|
+
const toggle = () => setIsOpen((prev) => !prev);
|
|
1098
|
+
(0, import_react6.useImperativeHandle)(ref, () => ({ toggle }), []);
|
|
1099
|
+
const title = (0, import_i18n7.sprintf)(
|
|
1100
|
+
/* translators: %s: Variable Type. */
|
|
1101
|
+
(0, import_i18n7.__)("%s variables", "elementor"),
|
|
1102
|
+
(0, import_utils.capitalize)(variableType)
|
|
1103
|
+
);
|
|
1104
|
+
const content = (0, import_i18n7.sprintf)(
|
|
1105
|
+
/* translators: %s: Variable Type. */
|
|
1106
|
+
(0, import_i18n7.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1107
|
+
variableType
|
|
1108
|
+
);
|
|
1109
|
+
return /* @__PURE__ */ React6.createElement(
|
|
1110
|
+
import_editor_ui2.PromotionPopover,
|
|
1111
|
+
{
|
|
1112
|
+
open: isOpen,
|
|
1113
|
+
title,
|
|
1114
|
+
content,
|
|
1115
|
+
ctaText: (0, import_i18n7.__)("Upgrade now", "elementor"),
|
|
1116
|
+
ctaUrl: upgradeUrl,
|
|
1117
|
+
onClose: (e) => {
|
|
1118
|
+
e.stopPropagation();
|
|
1119
|
+
setIsOpen(false);
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
/* @__PURE__ */ React6.createElement(
|
|
1123
|
+
import_ui6.Box,
|
|
1124
|
+
{
|
|
1125
|
+
onClick: (e) => {
|
|
1126
|
+
e.stopPropagation();
|
|
1127
|
+
toggle();
|
|
1128
|
+
},
|
|
1129
|
+
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1130
|
+
},
|
|
1131
|
+
/* @__PURE__ */ React6.createElement(import_editor_ui2.PromotionChip, null)
|
|
1132
|
+
)
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
);
|
|
1136
|
+
|
|
1091
1137
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1092
1138
|
var SIZE = "tiny";
|
|
1093
|
-
var VariableManagerCreateMenu = ({
|
|
1094
|
-
|
|
1095
|
-
onCreate,
|
|
1096
|
-
disabled,
|
|
1097
|
-
menuState
|
|
1098
|
-
}) => {
|
|
1099
|
-
const buttonRef = (0, import_react6.useRef)(null);
|
|
1139
|
+
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1140
|
+
const buttonRef = (0, import_react7.useRef)(null);
|
|
1100
1141
|
const variableTypes = getVariableTypes();
|
|
1101
|
-
const menuOptionConfigs = (0,
|
|
1142
|
+
const menuOptionConfigs = (0, import_react7.useMemo)(
|
|
1102
1143
|
() => Object.entries(variableTypes).filter(([, variable]) => !!variable.defaultValue).map(([key, variable]) => ({
|
|
1103
1144
|
key,
|
|
1104
1145
|
propTypeKey: variable.propTypeUtil.key,
|
|
@@ -1108,18 +1149,17 @@ var VariableManagerCreateMenu = ({
|
|
|
1108
1149
|
})),
|
|
1109
1150
|
[variableTypes]
|
|
1110
1151
|
);
|
|
1111
|
-
return /* @__PURE__ */
|
|
1112
|
-
|
|
1152
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
1153
|
+
import_ui7.IconButton,
|
|
1113
1154
|
{
|
|
1114
|
-
...(0,
|
|
1155
|
+
...(0, import_ui7.bindTrigger)(menuState),
|
|
1115
1156
|
ref: buttonRef,
|
|
1116
|
-
disabled,
|
|
1117
1157
|
size: SIZE,
|
|
1118
|
-
"aria-label": (0,
|
|
1158
|
+
"aria-label": (0, import_i18n8.__)("Add variable", "elementor")
|
|
1119
1159
|
},
|
|
1120
|
-
/* @__PURE__ */
|
|
1121
|
-
), /* @__PURE__ */
|
|
1122
|
-
|
|
1160
|
+
/* @__PURE__ */ React7.createElement(import_icons2.PlusIcon, { fontSize: SIZE })
|
|
1161
|
+
), /* @__PURE__ */ React7.createElement(
|
|
1162
|
+
import_ui7.Menu,
|
|
1123
1163
|
{
|
|
1124
1164
|
disablePortal: true,
|
|
1125
1165
|
MenuListProps: {
|
|
@@ -1128,7 +1168,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1128
1168
|
PaperProps: {
|
|
1129
1169
|
elevation: 6
|
|
1130
1170
|
},
|
|
1131
|
-
...(0,
|
|
1171
|
+
...(0, import_ui7.bindMenu)(menuState),
|
|
1132
1172
|
anchorEl: buttonRef.current,
|
|
1133
1173
|
anchorOrigin: {
|
|
1134
1174
|
vertical: "bottom",
|
|
@@ -1140,7 +1180,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1140
1180
|
},
|
|
1141
1181
|
"data-testid": "variable-manager-create-menu"
|
|
1142
1182
|
},
|
|
1143
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1183
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React7.createElement(
|
|
1144
1184
|
MenuOption,
|
|
1145
1185
|
{
|
|
1146
1186
|
key: config.key,
|
|
@@ -1158,15 +1198,13 @@ var MenuOption = ({
|
|
|
1158
1198
|
onCreate,
|
|
1159
1199
|
onClose
|
|
1160
1200
|
}) => {
|
|
1161
|
-
const
|
|
1201
|
+
const promotionRef = (0, import_react7.useRef)(null);
|
|
1162
1202
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1163
|
-
const displayName = (0,
|
|
1203
|
+
const displayName = (0, import_utils2.capitalize)(config.variableType);
|
|
1164
1204
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
1165
1205
|
const handleClick = () => {
|
|
1166
1206
|
if (isDisabled) {
|
|
1167
|
-
|
|
1168
|
-
setIsPopoverOpen(true);
|
|
1169
|
-
}
|
|
1207
|
+
promotionRef.current?.toggle();
|
|
1170
1208
|
return;
|
|
1171
1209
|
}
|
|
1172
1210
|
const defaultName = getDefaultName(variables, config.key, config.variableType);
|
|
@@ -1174,29 +1212,13 @@ var MenuOption = ({
|
|
|
1174
1212
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1175
1213
|
onClose();
|
|
1176
1214
|
};
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
(0, import_i18n7.__)("%s variables", "elementor"),
|
|
1180
|
-
(0, import_utils.capitalize)(config.variableType)
|
|
1181
|
-
);
|
|
1182
|
-
const content = (0, import_i18n7.sprintf)(
|
|
1183
|
-
/* translators: %s: Variable Type. */
|
|
1184
|
-
(0, import_i18n7.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1185
|
-
config.variableType
|
|
1186
|
-
);
|
|
1187
|
-
return /* @__PURE__ */ React6.createElement(import_ui6.MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, (0, import_react6.createElement)(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React6.createElement(import_ui6.Typography, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React6.createElement(
|
|
1188
|
-
import_editor_ui2.PromotionPopover,
|
|
1215
|
+
return /* @__PURE__ */ React7.createElement(import_ui7.MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, (0, import_react7.createElement)(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React7.createElement(import_ui7.Typography, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React7.createElement(
|
|
1216
|
+
VariablePromotionChip,
|
|
1189
1217
|
{
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1195
|
-
onClose: () => {
|
|
1196
|
-
setIsPopoverOpen(false);
|
|
1197
|
-
}
|
|
1198
|
-
},
|
|
1199
|
-
/* @__PURE__ */ React6.createElement(import_editor_ui2.PromotionChip, null)
|
|
1218
|
+
variableType: config.variableType,
|
|
1219
|
+
upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1220
|
+
ref: promotionRef
|
|
1221
|
+
}
|
|
1200
1222
|
));
|
|
1201
1223
|
};
|
|
1202
1224
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1211,23 +1233,52 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1211
1233
|
};
|
|
1212
1234
|
|
|
1213
1235
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1214
|
-
var
|
|
1215
|
-
var
|
|
1236
|
+
var React13 = __toESM(require("react"));
|
|
1237
|
+
var import_react12 = require("react");
|
|
1238
|
+
var import_ui13 = require("@elementor/ui");
|
|
1239
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1240
|
+
|
|
1241
|
+
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1242
|
+
var React8 = __toESM(require("react"));
|
|
1243
|
+
var import_ui8 = require("@elementor/ui");
|
|
1244
|
+
var VariableTableCell = ({
|
|
1245
|
+
children,
|
|
1246
|
+
isHeader,
|
|
1247
|
+
width,
|
|
1248
|
+
maxWidth,
|
|
1249
|
+
align,
|
|
1250
|
+
noPadding,
|
|
1251
|
+
sx
|
|
1252
|
+
}) => {
|
|
1253
|
+
const baseSx = {
|
|
1254
|
+
maxWidth: maxWidth ?? 150,
|
|
1255
|
+
cursor: "initial",
|
|
1256
|
+
typography: "caption",
|
|
1257
|
+
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1258
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1259
|
+
...width && { width },
|
|
1260
|
+
...sx
|
|
1261
|
+
};
|
|
1262
|
+
return /* @__PURE__ */ React8.createElement(import_ui8.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1266
|
+
var React12 = __toESM(require("react"));
|
|
1267
|
+
var import_react11 = require("react");
|
|
1216
1268
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1217
1269
|
var import_icons4 = require("@elementor/icons");
|
|
1218
|
-
var
|
|
1219
|
-
var import_i18n8 = require("@wordpress/i18n");
|
|
1270
|
+
var import_ui12 = require("@elementor/ui");
|
|
1220
1271
|
|
|
1221
1272
|
// src/components/fields/label-field.tsx
|
|
1222
|
-
var
|
|
1223
|
-
var
|
|
1273
|
+
var React9 = __toESM(require("react"));
|
|
1274
|
+
var import_react8 = require("react");
|
|
1224
1275
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1225
|
-
var
|
|
1276
|
+
var import_ui9 = require("@elementor/ui");
|
|
1226
1277
|
function isLabelEqual(a, b) {
|
|
1227
1278
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1228
1279
|
}
|
|
1229
1280
|
var useLabelError = (initialError) => {
|
|
1230
|
-
const [error, setError] = (0,
|
|
1281
|
+
const [error, setError] = (0, import_react8.useState)(initialError ?? { value: "", message: "" });
|
|
1231
1282
|
return {
|
|
1232
1283
|
labelFieldError: error,
|
|
1233
1284
|
setLabelFieldError: setError
|
|
@@ -1246,9 +1297,9 @@ var LabelField = ({
|
|
|
1246
1297
|
variables,
|
|
1247
1298
|
onKeyDown
|
|
1248
1299
|
}) => {
|
|
1249
|
-
const [label, setLabel] = (0,
|
|
1250
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
1251
|
-
const fieldRef = (0,
|
|
1300
|
+
const [label, setLabel] = (0, import_react8.useState)(value);
|
|
1301
|
+
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
|
1302
|
+
const fieldRef = (0, import_react8.useRef)(null);
|
|
1252
1303
|
const handleChange = (newValue) => {
|
|
1253
1304
|
setLabel(newValue);
|
|
1254
1305
|
const errorMsg2 = validateLabel(newValue, variables);
|
|
@@ -1261,8 +1312,8 @@ var LabelField = ({
|
|
|
1261
1312
|
errorMsg = error.message;
|
|
1262
1313
|
}
|
|
1263
1314
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1264
|
-
const textField = /* @__PURE__ */
|
|
1265
|
-
|
|
1315
|
+
const textField = /* @__PURE__ */ React9.createElement(
|
|
1316
|
+
import_ui9.TextField,
|
|
1266
1317
|
{
|
|
1267
1318
|
ref: fieldRef,
|
|
1268
1319
|
id: id2,
|
|
@@ -1282,7 +1333,7 @@ var LabelField = ({
|
|
|
1282
1333
|
);
|
|
1283
1334
|
if (showWarningInfotip) {
|
|
1284
1335
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1285
|
-
return /* @__PURE__ */
|
|
1336
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1286
1337
|
import_editor_ui3.WarningInfotip,
|
|
1287
1338
|
{
|
|
1288
1339
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1298,84 +1349,6 @@ var LabelField = ({
|
|
|
1298
1349
|
return textField;
|
|
1299
1350
|
};
|
|
1300
1351
|
|
|
1301
|
-
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1302
|
-
var React8 = __toESM(require("react"));
|
|
1303
|
-
var import_react8 = require("react");
|
|
1304
|
-
var import_icons3 = require("@elementor/icons");
|
|
1305
|
-
var import_ui8 = require("@elementor/ui");
|
|
1306
|
-
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1307
|
-
const menuState = (0, import_ui8.usePopupState)({
|
|
1308
|
-
variant: "popover"
|
|
1309
|
-
});
|
|
1310
|
-
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(import_ui8.IconButton, { ...(0, import_ui8.bindTrigger)(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React8.createElement(import_icons3.DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React8.createElement(
|
|
1311
|
-
import_ui8.Menu,
|
|
1312
|
-
{
|
|
1313
|
-
disablePortal: true,
|
|
1314
|
-
MenuListProps: {
|
|
1315
|
-
dense: true
|
|
1316
|
-
},
|
|
1317
|
-
PaperProps: {
|
|
1318
|
-
elevation: 6
|
|
1319
|
-
},
|
|
1320
|
-
...(0, import_ui8.bindMenu)(menuState),
|
|
1321
|
-
anchorEl: menuState.anchorEl,
|
|
1322
|
-
anchorOrigin: {
|
|
1323
|
-
vertical: "bottom",
|
|
1324
|
-
horizontal: "right"
|
|
1325
|
-
},
|
|
1326
|
-
transformOrigin: {
|
|
1327
|
-
vertical: "top",
|
|
1328
|
-
horizontal: "right"
|
|
1329
|
-
},
|
|
1330
|
-
open: menuState.isOpen,
|
|
1331
|
-
onClose: menuState.close
|
|
1332
|
-
},
|
|
1333
|
-
menuActions.map((action) => /* @__PURE__ */ React8.createElement(
|
|
1334
|
-
import_ui8.MenuItem,
|
|
1335
|
-
{
|
|
1336
|
-
key: action.name,
|
|
1337
|
-
onClick: () => {
|
|
1338
|
-
action.onClick?.(itemId);
|
|
1339
|
-
menuState.close();
|
|
1340
|
-
},
|
|
1341
|
-
sx: {
|
|
1342
|
-
color: action.color,
|
|
1343
|
-
gap: 1
|
|
1344
|
-
}
|
|
1345
|
-
},
|
|
1346
|
-
action.icon && (0, import_react8.createElement)(action.icon, {
|
|
1347
|
-
fontSize: "inherit"
|
|
1348
|
-
}),
|
|
1349
|
-
" ",
|
|
1350
|
-
action.name
|
|
1351
|
-
))
|
|
1352
|
-
));
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1356
|
-
var React9 = __toESM(require("react"));
|
|
1357
|
-
var import_ui9 = require("@elementor/ui");
|
|
1358
|
-
var VariableTableCell = ({
|
|
1359
|
-
children,
|
|
1360
|
-
isHeader,
|
|
1361
|
-
width,
|
|
1362
|
-
maxWidth,
|
|
1363
|
-
align,
|
|
1364
|
-
noPadding,
|
|
1365
|
-
sx
|
|
1366
|
-
}) => {
|
|
1367
|
-
const baseSx = {
|
|
1368
|
-
maxWidth: maxWidth ?? 150,
|
|
1369
|
-
cursor: "initial",
|
|
1370
|
-
typography: "caption",
|
|
1371
|
-
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1372
|
-
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1373
|
-
...width && { width },
|
|
1374
|
-
...sx
|
|
1375
|
-
};
|
|
1376
|
-
return /* @__PURE__ */ React9.createElement(import_ui9.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1379
1352
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1380
1353
|
var React10 = __toESM(require("react"));
|
|
1381
1354
|
var import_react9 = require("react");
|
|
@@ -1391,7 +1364,8 @@ var VariableEditableCell = React10.memo(
|
|
|
1391
1364
|
onRowRef,
|
|
1392
1365
|
onAutoEditComplete,
|
|
1393
1366
|
gap = 1,
|
|
1394
|
-
fieldType
|
|
1367
|
+
fieldType,
|
|
1368
|
+
disabled = false
|
|
1395
1369
|
}) => {
|
|
1396
1370
|
const [value, setValue] = (0, import_react9.useState)(initialValue);
|
|
1397
1371
|
const [isEditing, setIsEditing] = (0, import_react9.useState)(false);
|
|
@@ -1409,15 +1383,21 @@ var VariableEditableCell = React10.memo(
|
|
|
1409
1383
|
onRowRef?.(rowRef?.current);
|
|
1410
1384
|
}, [onRowRef]);
|
|
1411
1385
|
(0, import_react9.useEffect)(() => {
|
|
1412
|
-
if (autoEdit && !isEditing) {
|
|
1386
|
+
if (autoEdit && !isEditing && !disabled) {
|
|
1413
1387
|
setIsEditing(true);
|
|
1414
1388
|
onAutoEditComplete?.();
|
|
1415
1389
|
}
|
|
1416
|
-
}, [autoEdit, isEditing, onAutoEditComplete]);
|
|
1390
|
+
}, [autoEdit, isEditing, onAutoEditComplete, disabled]);
|
|
1417
1391
|
const handleDoubleClick = () => {
|
|
1392
|
+
if (disabled) {
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1418
1395
|
setIsEditing(true);
|
|
1419
1396
|
};
|
|
1420
1397
|
const handleKeyDown = (event) => {
|
|
1398
|
+
if (disabled) {
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1421
1401
|
if (event.key === "Enter") {
|
|
1422
1402
|
handleSave();
|
|
1423
1403
|
} else if (event.key === "Escape") {
|
|
@@ -1483,9 +1463,9 @@ var VariableEditableCell = React10.memo(
|
|
|
1483
1463
|
gap,
|
|
1484
1464
|
onDoubleClick: handleDoubleClick,
|
|
1485
1465
|
onKeyDown: handleKeyDown,
|
|
1486
|
-
tabIndex: 0,
|
|
1466
|
+
tabIndex: disabled ? -1 : 0,
|
|
1487
1467
|
role: "button",
|
|
1488
|
-
"aria-label": "Double click or press Space to edit"
|
|
1468
|
+
"aria-label": disabled ? "" : "Double click or press Space to edit"
|
|
1489
1469
|
},
|
|
1490
1470
|
prefixElement,
|
|
1491
1471
|
children
|
|
@@ -1493,6 +1473,243 @@ var VariableEditableCell = React10.memo(
|
|
|
1493
1473
|
}
|
|
1494
1474
|
);
|
|
1495
1475
|
|
|
1476
|
+
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1477
|
+
var React11 = __toESM(require("react"));
|
|
1478
|
+
var import_react10 = require("react");
|
|
1479
|
+
var import_icons3 = require("@elementor/icons");
|
|
1480
|
+
var import_ui11 = require("@elementor/ui");
|
|
1481
|
+
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1482
|
+
const menuState = (0, import_ui11.usePopupState)({
|
|
1483
|
+
variant: "popover"
|
|
1484
|
+
});
|
|
1485
|
+
const triggerProps = (0, import_ui11.bindTrigger)(menuState);
|
|
1486
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1487
|
+
import_ui11.IconButton,
|
|
1488
|
+
{
|
|
1489
|
+
...triggerProps,
|
|
1490
|
+
disabled,
|
|
1491
|
+
size: "tiny",
|
|
1492
|
+
onClick: (e) => {
|
|
1493
|
+
e.stopPropagation();
|
|
1494
|
+
triggerProps.onClick?.(e);
|
|
1495
|
+
}
|
|
1496
|
+
},
|
|
1497
|
+
/* @__PURE__ */ React11.createElement(import_icons3.DotsVerticalIcon, { fontSize: "tiny" })
|
|
1498
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1499
|
+
import_ui11.Menu,
|
|
1500
|
+
{
|
|
1501
|
+
disablePortal: true,
|
|
1502
|
+
MenuListProps: {
|
|
1503
|
+
dense: true
|
|
1504
|
+
},
|
|
1505
|
+
PaperProps: {
|
|
1506
|
+
elevation: 6
|
|
1507
|
+
},
|
|
1508
|
+
...(0, import_ui11.bindMenu)(menuState),
|
|
1509
|
+
anchorEl: menuState.anchorEl,
|
|
1510
|
+
anchorOrigin: {
|
|
1511
|
+
vertical: "bottom",
|
|
1512
|
+
horizontal: "right"
|
|
1513
|
+
},
|
|
1514
|
+
transformOrigin: {
|
|
1515
|
+
vertical: "top",
|
|
1516
|
+
horizontal: "right"
|
|
1517
|
+
},
|
|
1518
|
+
open: menuState.isOpen,
|
|
1519
|
+
onClose: menuState.close
|
|
1520
|
+
},
|
|
1521
|
+
menuActions.map((action) => /* @__PURE__ */ React11.createElement(
|
|
1522
|
+
import_ui11.MenuItem,
|
|
1523
|
+
{
|
|
1524
|
+
key: action.name,
|
|
1525
|
+
onClick: (e) => {
|
|
1526
|
+
e.stopPropagation();
|
|
1527
|
+
action.onClick?.(itemId);
|
|
1528
|
+
menuState.close();
|
|
1529
|
+
},
|
|
1530
|
+
sx: {
|
|
1531
|
+
color: action.color,
|
|
1532
|
+
gap: 1
|
|
1533
|
+
}
|
|
1534
|
+
},
|
|
1535
|
+
action.icon && (0, import_react10.createElement)(action.icon, {
|
|
1536
|
+
fontSize: "inherit"
|
|
1537
|
+
}),
|
|
1538
|
+
" ",
|
|
1539
|
+
action.name
|
|
1540
|
+
))
|
|
1541
|
+
));
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1545
|
+
var VariableRow = (props) => {
|
|
1546
|
+
const {
|
|
1547
|
+
row,
|
|
1548
|
+
variables,
|
|
1549
|
+
handleOnChange,
|
|
1550
|
+
autoEditVariableId,
|
|
1551
|
+
onAutoEditComplete,
|
|
1552
|
+
onFieldError,
|
|
1553
|
+
menuActions,
|
|
1554
|
+
handleRowRef,
|
|
1555
|
+
itemProps,
|
|
1556
|
+
showDropIndication,
|
|
1557
|
+
triggerProps,
|
|
1558
|
+
itemStyle,
|
|
1559
|
+
triggerStyle,
|
|
1560
|
+
isDragged,
|
|
1561
|
+
dropPosition,
|
|
1562
|
+
setTriggerRef,
|
|
1563
|
+
isSorting
|
|
1564
|
+
} = props;
|
|
1565
|
+
const promotionRef = (0, import_react11.useRef)(null);
|
|
1566
|
+
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1567
|
+
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1568
|
+
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1569
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1570
|
+
import_ui12.TableRow,
|
|
1571
|
+
{
|
|
1572
|
+
...itemProps,
|
|
1573
|
+
ref: itemProps.ref,
|
|
1574
|
+
selected: isDragged,
|
|
1575
|
+
sx: {
|
|
1576
|
+
...isDisabled && {
|
|
1577
|
+
"& td, & th": {
|
|
1578
|
+
color: "text.disabled"
|
|
1579
|
+
}
|
|
1580
|
+
},
|
|
1581
|
+
...showIndicationBefore && {
|
|
1582
|
+
"& td, & th": {
|
|
1583
|
+
borderTop: "2px solid",
|
|
1584
|
+
borderTopColor: "primary.main"
|
|
1585
|
+
}
|
|
1586
|
+
},
|
|
1587
|
+
...showIndicationAfter && {
|
|
1588
|
+
"& td, & th": {
|
|
1589
|
+
borderBottom: "2px solid",
|
|
1590
|
+
borderBottomColor: "primary.main"
|
|
1591
|
+
}
|
|
1592
|
+
},
|
|
1593
|
+
"&:hover, &:focus-within": {
|
|
1594
|
+
backgroundColor: "action.hover",
|
|
1595
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1596
|
+
opacity: 1
|
|
1597
|
+
}
|
|
1598
|
+
},
|
|
1599
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1600
|
+
opacity: 0
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
style: { ...itemStyle, ...triggerStyle },
|
|
1604
|
+
onClick: () => {
|
|
1605
|
+
if (isDisabled) {
|
|
1606
|
+
promotionRef.current?.toggle();
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
},
|
|
1610
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(import_ui12.IconButton, { size: "small", ref: setTriggerRef, ...triggerProps, disabled: isSorting, draggable: true }, /* @__PURE__ */ React12.createElement(import_icons4.GripVerticalIcon, { fontSize: "inherit" }))),
|
|
1611
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1612
|
+
VariableEditableCell,
|
|
1613
|
+
{
|
|
1614
|
+
initialValue: row.name,
|
|
1615
|
+
onChange: (value) => {
|
|
1616
|
+
if (value !== row.name && !isDisabled) {
|
|
1617
|
+
handleOnChange({
|
|
1618
|
+
...variables,
|
|
1619
|
+
[row.id]: { ...variables[row.id], label: value }
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
prefixElement: (0, import_react11.createElement)(row.icon, {
|
|
1624
|
+
fontSize: "inherit",
|
|
1625
|
+
color: isDisabled ? "disabled" : "inherit"
|
|
1626
|
+
}),
|
|
1627
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React12.createElement(
|
|
1628
|
+
LabelField,
|
|
1629
|
+
{
|
|
1630
|
+
id: "variable-label-" + row.id,
|
|
1631
|
+
size: "tiny",
|
|
1632
|
+
value,
|
|
1633
|
+
onChange,
|
|
1634
|
+
onErrorChange: (errorMsg) => {
|
|
1635
|
+
onValidationChange?.(errorMsg);
|
|
1636
|
+
onFieldError?.(!!errorMsg);
|
|
1637
|
+
},
|
|
1638
|
+
error,
|
|
1639
|
+
focusOnShow: true,
|
|
1640
|
+
selectOnShow: autoEditVariableId === row.id,
|
|
1641
|
+
showWarningInfotip: true,
|
|
1642
|
+
variables
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1645
|
+
autoEdit: autoEditVariableId === row.id && !isDisabled,
|
|
1646
|
+
onRowRef: handleRowRef(row.id),
|
|
1647
|
+
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1648
|
+
fieldType: "label",
|
|
1649
|
+
disabled: isDisabled
|
|
1650
|
+
},
|
|
1651
|
+
/* @__PURE__ */ React12.createElement(import_editor_ui4.EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1652
|
+
)),
|
|
1653
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1654
|
+
VariableEditableCell,
|
|
1655
|
+
{
|
|
1656
|
+
initialValue: row.value,
|
|
1657
|
+
onChange: (value) => {
|
|
1658
|
+
if (value !== row.value && !isDisabled) {
|
|
1659
|
+
handleOnChange({
|
|
1660
|
+
...variables,
|
|
1661
|
+
[row.id]: { ...variables[row.id], value }
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => row.valueField?.({
|
|
1666
|
+
value,
|
|
1667
|
+
onChange,
|
|
1668
|
+
onPropTypeKeyChange: (type) => {
|
|
1669
|
+
if (!isDisabled) {
|
|
1670
|
+
handleOnChange({
|
|
1671
|
+
...variables,
|
|
1672
|
+
[row.id]: { ...variables[row.id], type }
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
propTypeKey: row.type,
|
|
1677
|
+
onValidationChange: (errorMsg) => {
|
|
1678
|
+
onValidationChange?.(errorMsg);
|
|
1679
|
+
onFieldError?.(!!errorMsg);
|
|
1680
|
+
},
|
|
1681
|
+
error
|
|
1682
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1683
|
+
onRowRef: handleRowRef(row.id),
|
|
1684
|
+
gap: 0.25,
|
|
1685
|
+
fieldType: "value",
|
|
1686
|
+
disabled: isDisabled
|
|
1687
|
+
},
|
|
1688
|
+
row.startIcon && row.startIcon({ value: row.value }),
|
|
1689
|
+
/* @__PURE__ */ React12.createElement(
|
|
1690
|
+
import_editor_ui4.EllipsisWithTooltip,
|
|
1691
|
+
{
|
|
1692
|
+
title: row.value,
|
|
1693
|
+
sx: {
|
|
1694
|
+
border: "4px solid transparent",
|
|
1695
|
+
lineHeight: "1",
|
|
1696
|
+
pt: 0.25
|
|
1697
|
+
}
|
|
1698
|
+
},
|
|
1699
|
+
row.value
|
|
1700
|
+
)
|
|
1701
|
+
)),
|
|
1702
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { align: "right", noPadding: true, width: 16, maxWidth: 16, sx: { paddingInlineEnd: 1 } }, /* @__PURE__ */ React12.createElement(import_ui12.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end", alignItems: "center" }, isDisabled && /* @__PURE__ */ React12.createElement(
|
|
1703
|
+
VariablePromotionChip,
|
|
1704
|
+
{
|
|
1705
|
+
variableType: row.variableType,
|
|
1706
|
+
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1707
|
+
ref: promotionRef
|
|
1708
|
+
}
|
|
1709
|
+
), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1710
|
+
);
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1496
1713
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1497
1714
|
var VariablesManagerTable = ({
|
|
1498
1715
|
menuActions,
|
|
@@ -1502,9 +1719,9 @@ var VariablesManagerTable = ({
|
|
|
1502
1719
|
onAutoEditComplete,
|
|
1503
1720
|
onFieldError
|
|
1504
1721
|
}) => {
|
|
1505
|
-
const tableContainerRef = (0,
|
|
1506
|
-
const variableRowRefs = (0,
|
|
1507
|
-
(0,
|
|
1722
|
+
const tableContainerRef = (0, import_react12.useRef)(null);
|
|
1723
|
+
const variableRowRefs = (0, import_react12.useRef)(/* @__PURE__ */ new Map());
|
|
1724
|
+
(0, import_react12.useEffect)(() => {
|
|
1508
1725
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1509
1726
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
1510
1727
|
if (rowElement) {
|
|
@@ -1555,196 +1772,34 @@ var VariablesManagerTable = ({
|
|
|
1555
1772
|
});
|
|
1556
1773
|
handleOnChange(updatedVariables);
|
|
1557
1774
|
};
|
|
1558
|
-
return /* @__PURE__ */
|
|
1559
|
-
|
|
1775
|
+
return /* @__PURE__ */ React13.createElement(import_ui13.TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React13.createElement(import_ui13.Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React13.createElement(import_ui13.TableHead, null, /* @__PURE__ */ React13.createElement(import_ui13.TableRow, null, /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n9.__)("Name", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n9.__)("Value", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React13.createElement(import_ui13.TableBody, null, /* @__PURE__ */ React13.createElement(
|
|
1776
|
+
import_ui13.UnstableSortableProvider,
|
|
1560
1777
|
{
|
|
1561
1778
|
value: ids,
|
|
1562
1779
|
onChange: handleReorder,
|
|
1563
1780
|
variant: "static",
|
|
1564
1781
|
restrictAxis: true,
|
|
1565
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1782
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React13.createElement(import_ui13.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React13.createElement(import_ui13.TableBody, null, dragOverlayChildren))
|
|
1566
1783
|
},
|
|
1567
|
-
rows.map((row) => /* @__PURE__ */
|
|
1568
|
-
|
|
1784
|
+
rows.map((row) => /* @__PURE__ */ React13.createElement(
|
|
1785
|
+
import_ui13.UnstableSortableItem,
|
|
1569
1786
|
{
|
|
1570
1787
|
key: row.id,
|
|
1571
1788
|
id: row.id,
|
|
1572
|
-
render: (
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
import_ui11.TableRow,
|
|
1587
|
-
{
|
|
1588
|
-
...itemProps,
|
|
1589
|
-
ref: itemProps.ref,
|
|
1590
|
-
selected: isDragged,
|
|
1591
|
-
sx: {
|
|
1592
|
-
...showIndicationBefore && {
|
|
1593
|
-
"& td, & th": {
|
|
1594
|
-
borderTop: "2px solid",
|
|
1595
|
-
borderTopColor: "primary.main"
|
|
1596
|
-
}
|
|
1597
|
-
},
|
|
1598
|
-
...showIndicationAfter && {
|
|
1599
|
-
"& td, & th": {
|
|
1600
|
-
borderBottom: "2px solid",
|
|
1601
|
-
borderBottomColor: "primary.main"
|
|
1602
|
-
}
|
|
1603
|
-
},
|
|
1604
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1605
|
-
opacity: 0
|
|
1606
|
-
},
|
|
1607
|
-
"&:hover, &:focus-within": {
|
|
1608
|
-
backgroundColor: "action.hover",
|
|
1609
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1610
|
-
opacity: 1
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
},
|
|
1614
|
-
style: { ...itemStyle, ...triggerStyle }
|
|
1615
|
-
},
|
|
1616
|
-
/* @__PURE__ */ React11.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React11.createElement(
|
|
1617
|
-
import_ui11.IconButton,
|
|
1618
|
-
{
|
|
1619
|
-
size: "small",
|
|
1620
|
-
ref: setTriggerRef,
|
|
1621
|
-
...triggerProps,
|
|
1622
|
-
disabled: isSorting,
|
|
1623
|
-
draggable: true
|
|
1624
|
-
},
|
|
1625
|
-
/* @__PURE__ */ React11.createElement(import_icons4.GripVerticalIcon, { fontSize: "inherit" })
|
|
1626
|
-
)),
|
|
1627
|
-
/* @__PURE__ */ React11.createElement(VariableTableCell, null, /* @__PURE__ */ React11.createElement(
|
|
1628
|
-
VariableEditableCell,
|
|
1629
|
-
{
|
|
1630
|
-
initialValue: row.name,
|
|
1631
|
-
onChange: (value) => {
|
|
1632
|
-
if (value !== row.name) {
|
|
1633
|
-
handleOnChange({
|
|
1634
|
-
...variables,
|
|
1635
|
-
[row.id]: { ...variables[row.id], label: value }
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
},
|
|
1639
|
-
prefixElement: (0, import_react10.createElement)(row.icon, { fontSize: "inherit" }),
|
|
1640
|
-
editableElement: ({
|
|
1641
|
-
value,
|
|
1642
|
-
onChange,
|
|
1643
|
-
onValidationChange,
|
|
1644
|
-
error
|
|
1645
|
-
}) => /* @__PURE__ */ React11.createElement(
|
|
1646
|
-
LabelField,
|
|
1647
|
-
{
|
|
1648
|
-
id: "variable-label-" + row.id,
|
|
1649
|
-
size: "tiny",
|
|
1650
|
-
value,
|
|
1651
|
-
onChange,
|
|
1652
|
-
onErrorChange: (errorMsg) => {
|
|
1653
|
-
onValidationChange?.(errorMsg);
|
|
1654
|
-
onFieldError?.(!!errorMsg);
|
|
1655
|
-
},
|
|
1656
|
-
error,
|
|
1657
|
-
focusOnShow: true,
|
|
1658
|
-
selectOnShow: autoEditVariableId === row.id,
|
|
1659
|
-
showWarningInfotip: true,
|
|
1660
|
-
variables
|
|
1661
|
-
}
|
|
1662
|
-
),
|
|
1663
|
-
autoEdit: autoEditVariableId === row.id,
|
|
1664
|
-
onRowRef: handleRowRef(row.id),
|
|
1665
|
-
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1666
|
-
fieldType: "label"
|
|
1667
|
-
},
|
|
1668
|
-
/* @__PURE__ */ React11.createElement(
|
|
1669
|
-
import_editor_ui4.EllipsisWithTooltip,
|
|
1670
|
-
{
|
|
1671
|
-
title: row.name,
|
|
1672
|
-
sx: { border: "4px solid transparent" }
|
|
1673
|
-
},
|
|
1674
|
-
row.name
|
|
1675
|
-
)
|
|
1676
|
-
)),
|
|
1677
|
-
/* @__PURE__ */ React11.createElement(VariableTableCell, null, /* @__PURE__ */ React11.createElement(
|
|
1678
|
-
VariableEditableCell,
|
|
1679
|
-
{
|
|
1680
|
-
initialValue: row.value,
|
|
1681
|
-
onChange: (value) => {
|
|
1682
|
-
if (value !== row.value) {
|
|
1683
|
-
handleOnChange({
|
|
1684
|
-
...variables,
|
|
1685
|
-
[row.id]: { ...variables[row.id], value }
|
|
1686
|
-
});
|
|
1687
|
-
}
|
|
1688
|
-
},
|
|
1689
|
-
editableElement: ({
|
|
1690
|
-
value,
|
|
1691
|
-
onChange,
|
|
1692
|
-
onValidationChange,
|
|
1693
|
-
error
|
|
1694
|
-
}) => row.valueField?.({
|
|
1695
|
-
value,
|
|
1696
|
-
onChange,
|
|
1697
|
-
onPropTypeKeyChange: (type) => {
|
|
1698
|
-
handleOnChange({
|
|
1699
|
-
...variables,
|
|
1700
|
-
[row.id]: { ...variables[row.id], type }
|
|
1701
|
-
});
|
|
1702
|
-
},
|
|
1703
|
-
propTypeKey: row.type,
|
|
1704
|
-
onValidationChange: (errorMsg) => {
|
|
1705
|
-
onValidationChange?.(errorMsg);
|
|
1706
|
-
onFieldError?.(!!errorMsg);
|
|
1707
|
-
},
|
|
1708
|
-
error
|
|
1709
|
-
}) ?? /* @__PURE__ */ React11.createElement(React11.Fragment, null),
|
|
1710
|
-
onRowRef: handleRowRef(row.id),
|
|
1711
|
-
gap: 0.25,
|
|
1712
|
-
fieldType: "value"
|
|
1713
|
-
},
|
|
1714
|
-
row.startIcon && row.startIcon({ value: row.value }),
|
|
1715
|
-
/* @__PURE__ */ React11.createElement(
|
|
1716
|
-
import_editor_ui4.EllipsisWithTooltip,
|
|
1717
|
-
{
|
|
1718
|
-
title: row.value,
|
|
1719
|
-
sx: {
|
|
1720
|
-
border: "4px solid transparent",
|
|
1721
|
-
lineHeight: "1",
|
|
1722
|
-
pt: 0.25
|
|
1723
|
-
}
|
|
1724
|
-
},
|
|
1725
|
-
row.value
|
|
1726
|
-
)
|
|
1727
|
-
)),
|
|
1728
|
-
/* @__PURE__ */ React11.createElement(
|
|
1729
|
-
VariableTableCell,
|
|
1730
|
-
{
|
|
1731
|
-
align: "right",
|
|
1732
|
-
noPadding: true,
|
|
1733
|
-
width: 16,
|
|
1734
|
-
maxWidth: 16,
|
|
1735
|
-
sx: { paddingInlineEnd: 1 }
|
|
1736
|
-
},
|
|
1737
|
-
/* @__PURE__ */ React11.createElement(import_ui11.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React11.createElement(
|
|
1738
|
-
VariableEditMenu,
|
|
1739
|
-
{
|
|
1740
|
-
menuActions,
|
|
1741
|
-
disabled: isSorting,
|
|
1742
|
-
itemId: row.id
|
|
1743
|
-
}
|
|
1744
|
-
))
|
|
1745
|
-
)
|
|
1746
|
-
);
|
|
1747
|
-
}
|
|
1789
|
+
render: (props) => /* @__PURE__ */ React13.createElement(
|
|
1790
|
+
VariableRow,
|
|
1791
|
+
{
|
|
1792
|
+
...props,
|
|
1793
|
+
row,
|
|
1794
|
+
variables,
|
|
1795
|
+
handleOnChange,
|
|
1796
|
+
autoEditVariableId,
|
|
1797
|
+
onAutoEditComplete,
|
|
1798
|
+
onFieldError,
|
|
1799
|
+
menuActions,
|
|
1800
|
+
handleRowRef
|
|
1801
|
+
}
|
|
1802
|
+
)
|
|
1748
1803
|
}
|
|
1749
1804
|
))
|
|
1750
1805
|
))));
|
|
@@ -1774,7 +1829,7 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1774
1829
|
function VariablesManagerPanel() {
|
|
1775
1830
|
const { close: closePanel } = usePanelActions();
|
|
1776
1831
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui5.useDialog)();
|
|
1777
|
-
const createMenuState = (0,
|
|
1832
|
+
const createMenuState = (0, import_ui14.usePopupState)({
|
|
1778
1833
|
variant: "popover"
|
|
1779
1834
|
});
|
|
1780
1835
|
const {
|
|
@@ -1793,8 +1848,8 @@ function VariablesManagerPanel() {
|
|
|
1793
1848
|
} = useVariablesManagerState();
|
|
1794
1849
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1795
1850
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1796
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
1797
|
-
const [serverError, setServerError] = (0,
|
|
1851
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react13.useState)(null);
|
|
1852
|
+
const [serverError, setServerError] = (0, import_react13.useState)(null);
|
|
1798
1853
|
usePreventUnload(isDirty);
|
|
1799
1854
|
const handleClosePanel = () => {
|
|
1800
1855
|
if (isDirty) {
|
|
@@ -1803,7 +1858,7 @@ function VariablesManagerPanel() {
|
|
|
1803
1858
|
}
|
|
1804
1859
|
closePanel();
|
|
1805
1860
|
};
|
|
1806
|
-
const handleCreateVariable = (0,
|
|
1861
|
+
const handleCreateVariable = (0, import_react13.useCallback)(
|
|
1807
1862
|
(type, defaultName, defaultValue) => {
|
|
1808
1863
|
const newId = createVariable2(type, defaultName, defaultValue);
|
|
1809
1864
|
if (newId) {
|
|
@@ -1837,45 +1892,48 @@ function VariablesManagerPanel() {
|
|
|
1837
1892
|
setIsSaving(false);
|
|
1838
1893
|
}
|
|
1839
1894
|
};
|
|
1840
|
-
const handleDeleteVariableWithConfirmation = (0,
|
|
1895
|
+
const handleDeleteVariableWithConfirmation = (0, import_react13.useCallback)(
|
|
1841
1896
|
(itemId) => {
|
|
1842
1897
|
handleDeleteVariable(itemId);
|
|
1843
1898
|
setDeleteConfirmation(null);
|
|
1844
1899
|
},
|
|
1845
1900
|
[handleDeleteVariable]
|
|
1846
1901
|
);
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1902
|
+
const buildMenuActions = (0, import_react13.useCallback)(
|
|
1903
|
+
() => [
|
|
1904
|
+
{
|
|
1905
|
+
name: (0, import_i18n10.__)("Delete", "elementor"),
|
|
1906
|
+
icon: import_icons5.TrashIcon,
|
|
1907
|
+
color: "error.main",
|
|
1908
|
+
onClick: (itemId) => {
|
|
1909
|
+
const variable = variables[itemId];
|
|
1910
|
+
if (variable) {
|
|
1911
|
+
setDeleteConfirmation({ id: itemId, label: variable.label });
|
|
1912
|
+
const variableTypeOptions = getVariableType(variable.type);
|
|
1913
|
+
trackVariablesManagerEvent({ action: "delete", varType: variableTypeOptions?.variableType });
|
|
1914
|
+
}
|
|
1858
1915
|
}
|
|
1859
1916
|
}
|
|
1860
|
-
|
|
1861
|
-
|
|
1917
|
+
],
|
|
1918
|
+
[variables]
|
|
1919
|
+
);
|
|
1862
1920
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1863
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ React14.createElement(import_editor_ui5.ThemeProvider, null, /* @__PURE__ */ React14.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React14.createElement(
|
|
1864
1922
|
import_editor_panels.PanelHeader,
|
|
1865
1923
|
{
|
|
1866
1924
|
sx: {
|
|
1867
1925
|
height: "unset"
|
|
1868
1926
|
}
|
|
1869
1927
|
},
|
|
1870
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ React14.createElement(import_ui14.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React14.createElement(import_ui14.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React14.createElement(import_ui14.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n10.__)("Variables Manager", "elementor"))), /* @__PURE__ */ React14.createElement(import_ui14.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React14.createElement(
|
|
1871
1929
|
VariableManagerCreateMenu,
|
|
1872
1930
|
{
|
|
1873
1931
|
onCreate: handleCreateVariable,
|
|
1874
1932
|
variables,
|
|
1875
1933
|
menuState: createMenuState
|
|
1876
1934
|
}
|
|
1877
|
-
), /* @__PURE__ */
|
|
1878
|
-
|
|
1935
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1936
|
+
import_ui14.CloseButton,
|
|
1879
1937
|
{
|
|
1880
1938
|
"aria-label": "Close",
|
|
1881
1939
|
slotProps: { icon: { fontSize: SIZE } },
|
|
@@ -1883,19 +1941,19 @@ function VariablesManagerPanel() {
|
|
|
1883
1941
|
handleClosePanel();
|
|
1884
1942
|
}
|
|
1885
1943
|
}
|
|
1886
|
-
))), /* @__PURE__ */
|
|
1944
|
+
))), /* @__PURE__ */ React14.createElement(import_ui14.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(
|
|
1887
1945
|
import_editor_ui5.SearchField,
|
|
1888
1946
|
{
|
|
1889
1947
|
sx: {
|
|
1890
1948
|
display: "flex",
|
|
1891
1949
|
flex: 1
|
|
1892
1950
|
},
|
|
1893
|
-
placeholder: (0,
|
|
1951
|
+
placeholder: (0, import_i18n10.__)("Search", "elementor"),
|
|
1894
1952
|
value: searchValue,
|
|
1895
1953
|
onSearch: handleSearch
|
|
1896
1954
|
}
|
|
1897
|
-
)), /* @__PURE__ */
|
|
1898
|
-
), /* @__PURE__ */
|
|
1955
|
+
)), /* @__PURE__ */ React14.createElement(import_ui14.Divider, { sx: { width: "100%" } }))
|
|
1956
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1899
1957
|
import_editor_panels.PanelBody,
|
|
1900
1958
|
{
|
|
1901
1959
|
sx: {
|
|
@@ -1904,10 +1962,10 @@ function VariablesManagerPanel() {
|
|
|
1904
1962
|
height: "100%"
|
|
1905
1963
|
}
|
|
1906
1964
|
},
|
|
1907
|
-
hasVariables && /* @__PURE__ */
|
|
1965
|
+
hasVariables && /* @__PURE__ */ React14.createElement(
|
|
1908
1966
|
VariablesManagerTable,
|
|
1909
1967
|
{
|
|
1910
|
-
menuActions,
|
|
1968
|
+
menuActions: buildMenuActions,
|
|
1911
1969
|
variables,
|
|
1912
1970
|
onChange: handleOnChange,
|
|
1913
1971
|
autoEditVariableId,
|
|
@@ -1915,43 +1973,43 @@ function VariablesManagerPanel() {
|
|
|
1915
1973
|
onFieldError: setIsSaveDisabled
|
|
1916
1974
|
}
|
|
1917
1975
|
),
|
|
1918
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
1976
|
+
!hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
1919
1977
|
NoSearchResults,
|
|
1920
1978
|
{
|
|
1921
1979
|
searchValue,
|
|
1922
1980
|
onClear: () => handleSearch(""),
|
|
1923
|
-
icon: /* @__PURE__ */
|
|
1981
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" })
|
|
1924
1982
|
}
|
|
1925
1983
|
),
|
|
1926
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
1984
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
1927
1985
|
EmptyState,
|
|
1928
1986
|
{
|
|
1929
|
-
title: (0,
|
|
1930
|
-
message: (0,
|
|
1987
|
+
title: (0, import_i18n10.__)("Create your first variable", "elementor"),
|
|
1988
|
+
message: (0, import_i18n10.__)(
|
|
1931
1989
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1932
1990
|
"elementor"
|
|
1933
1991
|
),
|
|
1934
|
-
icon: /* @__PURE__ */
|
|
1992
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" }),
|
|
1935
1993
|
onAdd: createMenuState.open
|
|
1936
1994
|
}
|
|
1937
1995
|
)
|
|
1938
|
-
), /* @__PURE__ */
|
|
1939
|
-
|
|
1996
|
+
), /* @__PURE__ */ React14.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
1997
|
+
import_ui14.Infotip,
|
|
1940
1998
|
{
|
|
1941
1999
|
placement: "right",
|
|
1942
2000
|
open: !!serverError,
|
|
1943
|
-
content: serverError ? /* @__PURE__ */
|
|
1944
|
-
|
|
2001
|
+
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
2002
|
+
import_ui14.Alert,
|
|
1945
2003
|
{
|
|
1946
2004
|
severity: serverError.severity ?? "error",
|
|
1947
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2005
|
+
action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(import_ui14.AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
1948
2006
|
onClose: !serverError.action?.label ? () => {
|
|
1949
2007
|
setServerError(null);
|
|
1950
2008
|
setIsSaveDisabled(false);
|
|
1951
2009
|
} : void 0,
|
|
1952
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2010
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(import_icons5.AlertTriangleFilledIcon, null)
|
|
1953
2011
|
},
|
|
1954
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ React14.createElement(import_ui14.AlertTitle, null, serverError.message),
|
|
1955
2013
|
serverError.action?.message
|
|
1956
2014
|
) : null,
|
|
1957
2015
|
arrow: false,
|
|
@@ -1966,8 +2024,8 @@ function VariablesManagerPanel() {
|
|
|
1966
2024
|
}
|
|
1967
2025
|
}
|
|
1968
2026
|
},
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
|
|
2027
|
+
/* @__PURE__ */ React14.createElement(
|
|
2028
|
+
import_ui14.Button,
|
|
1971
2029
|
{
|
|
1972
2030
|
fullWidth: true,
|
|
1973
2031
|
size: "small",
|
|
@@ -1977,9 +2035,9 @@ function VariablesManagerPanel() {
|
|
|
1977
2035
|
onClick: handleSaveClick,
|
|
1978
2036
|
loading: isSaving
|
|
1979
2037
|
},
|
|
1980
|
-
(0,
|
|
2038
|
+
(0, import_i18n10.__)("Save changes", "elementor")
|
|
1981
2039
|
)
|
|
1982
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2040
|
+
))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
1983
2041
|
DeleteConfirmationDialog,
|
|
1984
2042
|
{
|
|
1985
2043
|
open: true,
|
|
@@ -1987,19 +2045,19 @@ function VariablesManagerPanel() {
|
|
|
1987
2045
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1988
2046
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1989
2047
|
}
|
|
1990
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
2048
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n10.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.SaveChangesDialog.ContentText, null, (0, import_i18n10.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
|
|
1991
2049
|
import_editor_ui5.SaveChangesDialog.Actions,
|
|
1992
2050
|
{
|
|
1993
2051
|
actions: {
|
|
1994
2052
|
discard: {
|
|
1995
|
-
label: (0,
|
|
2053
|
+
label: (0, import_i18n10.__)("Discard", "elementor"),
|
|
1996
2054
|
action: () => {
|
|
1997
2055
|
closeSaveChangesDialog();
|
|
1998
2056
|
closePanel();
|
|
1999
2057
|
}
|
|
2000
2058
|
},
|
|
2001
2059
|
confirm: {
|
|
2002
|
-
label: (0,
|
|
2060
|
+
label: (0, import_i18n10.__)("Save", "elementor"),
|
|
2003
2061
|
action: async () => {
|
|
2004
2062
|
const result = await handleSaveClick();
|
|
2005
2063
|
closeSaveChangesDialog();
|
|
@@ -2013,7 +2071,7 @@ function VariablesManagerPanel() {
|
|
|
2013
2071
|
)));
|
|
2014
2072
|
}
|
|
2015
2073
|
var usePreventUnload = (isDirty) => {
|
|
2016
|
-
(0,
|
|
2074
|
+
(0, import_react13.useEffect)(() => {
|
|
2017
2075
|
const handleBeforeUnload = (event) => {
|
|
2018
2076
|
if (isDirty) {
|
|
2019
2077
|
event.preventDefault();
|
|
@@ -2027,15 +2085,15 @@ var usePreventUnload = (isDirty) => {
|
|
|
2027
2085
|
};
|
|
2028
2086
|
|
|
2029
2087
|
// src/controls/variable-control.tsx
|
|
2030
|
-
var
|
|
2088
|
+
var React33 = __toESM(require("react"));
|
|
2031
2089
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
2032
2090
|
|
|
2033
2091
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2034
|
-
var
|
|
2035
|
-
var
|
|
2092
|
+
var import_react20 = require("react");
|
|
2093
|
+
var React24 = __toESM(require("react"));
|
|
2036
2094
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2037
2095
|
var import_icons12 = require("@elementor/icons");
|
|
2038
|
-
var
|
|
2096
|
+
var import_ui24 = require("@elementor/ui");
|
|
2039
2097
|
|
|
2040
2098
|
// src/utils/unlink-variable.ts
|
|
2041
2099
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2054,32 +2112,32 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2054
2112
|
}
|
|
2055
2113
|
|
|
2056
2114
|
// src/components/variable-selection-popover.tsx
|
|
2057
|
-
var
|
|
2058
|
-
var
|
|
2115
|
+
var React22 = __toESM(require("react"));
|
|
2116
|
+
var import_react19 = require("react");
|
|
2059
2117
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
2060
2118
|
|
|
2061
2119
|
// src/context/variable-selection-popover.context.tsx
|
|
2062
|
-
var
|
|
2063
|
-
var
|
|
2064
|
-
var
|
|
2065
|
-
var PopoverContentRefContext = (0,
|
|
2120
|
+
var React15 = __toESM(require("react"));
|
|
2121
|
+
var import_react14 = require("react");
|
|
2122
|
+
var import_ui15 = require("@elementor/ui");
|
|
2123
|
+
var PopoverContentRefContext = (0, import_react14.createContext)(null);
|
|
2066
2124
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2067
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2068
|
-
return /* @__PURE__ */
|
|
2125
|
+
const [anchorRef, setAnchorRef] = (0, import_react14.useState)(null);
|
|
2126
|
+
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(import_ui15.Box, { ref: setAnchorRef }, children));
|
|
2069
2127
|
};
|
|
2070
2128
|
var usePopoverContentRef = () => {
|
|
2071
|
-
return (0,
|
|
2129
|
+
return (0, import_react14.useContext)(PopoverContentRefContext);
|
|
2072
2130
|
};
|
|
2073
2131
|
|
|
2074
2132
|
// src/components/variable-creation.tsx
|
|
2075
|
-
var
|
|
2076
|
-
var
|
|
2133
|
+
var React17 = __toESM(require("react"));
|
|
2134
|
+
var import_react15 = require("react");
|
|
2077
2135
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2078
2136
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
2079
2137
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2080
2138
|
var import_icons6 = require("@elementor/icons");
|
|
2081
|
-
var
|
|
2082
|
-
var
|
|
2139
|
+
var import_ui17 = require("@elementor/ui");
|
|
2140
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
2083
2141
|
|
|
2084
2142
|
// src/hooks/use-initial-value.ts
|
|
2085
2143
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -2122,10 +2180,10 @@ var unwrapValue = (input) => {
|
|
|
2122
2180
|
};
|
|
2123
2181
|
|
|
2124
2182
|
// src/components/ui/form-field.tsx
|
|
2125
|
-
var
|
|
2126
|
-
var
|
|
2183
|
+
var React16 = __toESM(require("react"));
|
|
2184
|
+
var import_ui16 = require("@elementor/ui");
|
|
2127
2185
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2128
|
-
return /* @__PURE__ */
|
|
2186
|
+
return /* @__PURE__ */ React16.createElement(import_ui16.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(import_ui16.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(import_ui16.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(import_ui16.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, null, noticeMsg)));
|
|
2129
2187
|
};
|
|
2130
2188
|
|
|
2131
2189
|
// src/components/variable-creation.tsx
|
|
@@ -2135,11 +2193,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2135
2193
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2136
2194
|
const { propType } = (0, import_editor_controls4.useBoundProp)();
|
|
2137
2195
|
const initialValue = useInitialValue();
|
|
2138
|
-
const [value, setValue] = (0,
|
|
2139
|
-
const [label, setLabel] = (0,
|
|
2140
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2141
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2142
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2196
|
+
const [value, setValue] = (0, import_react15.useState)(initialValue);
|
|
2197
|
+
const [label, setLabel] = (0, import_react15.useState)("");
|
|
2198
|
+
const [errorMessage, setErrorMessage] = (0, import_react15.useState)("");
|
|
2199
|
+
const [valueFieldError, setValueFieldError] = (0, import_react15.useState)("");
|
|
2200
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react15.useState)(propTypeUtil.key);
|
|
2143
2201
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2144
2202
|
const resetFields = () => {
|
|
2145
2203
|
setValue("");
|
|
@@ -2196,22 +2254,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2196
2254
|
handleCreateAndTrack();
|
|
2197
2255
|
}
|
|
2198
2256
|
};
|
|
2199
|
-
return /* @__PURE__ */
|
|
2257
|
+
return /* @__PURE__ */ React17.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2200
2258
|
import_editor_ui6.PopoverHeader,
|
|
2201
2259
|
{
|
|
2202
|
-
icon: /* @__PURE__ */
|
|
2203
|
-
title: (0,
|
|
2260
|
+
icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(import_ui17.IconButton, { size: SIZE2, "aria-label": (0, import_i18n11.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React17.createElement(import_icons6.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2261
|
+
title: (0, import_i18n11.__)("Create variable", "elementor"),
|
|
2204
2262
|
onClose: closePopover
|
|
2205
2263
|
}
|
|
2206
|
-
), /* @__PURE__ */
|
|
2264
|
+
), /* @__PURE__ */ React17.createElement(import_ui17.Divider, null), /* @__PURE__ */ React17.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2207
2265
|
FormField,
|
|
2208
2266
|
{
|
|
2209
2267
|
id: "variable-label",
|
|
2210
|
-
label: (0,
|
|
2268
|
+
label: (0, import_i18n11.__)("Name", "elementor"),
|
|
2211
2269
|
errorMsg: labelFieldError?.message,
|
|
2212
2270
|
noticeMsg: labelHint(label)
|
|
2213
2271
|
},
|
|
2214
|
-
/* @__PURE__ */
|
|
2272
|
+
/* @__PURE__ */ React17.createElement(
|
|
2215
2273
|
LabelField,
|
|
2216
2274
|
{
|
|
2217
2275
|
id: "variable-label",
|
|
@@ -2230,7 +2288,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2230
2288
|
onKeyDown: handleKeyDown
|
|
2231
2289
|
}
|
|
2232
2290
|
)
|
|
2233
|
-
), ValueField && /* @__PURE__ */
|
|
2291
|
+
), ValueField && /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n11.__)("Value", "elementor") }, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React17.createElement(
|
|
2234
2292
|
ValueField,
|
|
2235
2293
|
{
|
|
2236
2294
|
value,
|
|
@@ -2244,8 +2302,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2244
2302
|
propType,
|
|
2245
2303
|
onKeyDown: handleKeyDown
|
|
2246
2304
|
}
|
|
2247
|
-
))), errorMessage && /* @__PURE__ */
|
|
2248
|
-
|
|
2305
|
+
))), errorMessage && /* @__PURE__ */ React17.createElement(import_ui17.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React17.createElement(import_ui17.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React17.createElement(
|
|
2306
|
+
import_ui17.Button,
|
|
2249
2307
|
{
|
|
2250
2308
|
id: "create-variable-button",
|
|
2251
2309
|
size: "small",
|
|
@@ -2253,81 +2311,81 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2253
2311
|
disabled: isSubmitDisabled,
|
|
2254
2312
|
onClick: handleCreateAndTrack
|
|
2255
2313
|
},
|
|
2256
|
-
(0,
|
|
2314
|
+
(0, import_i18n11.__)("Create", "elementor")
|
|
2257
2315
|
)));
|
|
2258
2316
|
};
|
|
2259
2317
|
|
|
2260
2318
|
// src/components/variable-edit.tsx
|
|
2261
|
-
var
|
|
2262
|
-
var
|
|
2319
|
+
var React19 = __toESM(require("react"));
|
|
2320
|
+
var import_react17 = require("react");
|
|
2263
2321
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2264
2322
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2265
2323
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
2266
2324
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2267
2325
|
var import_icons8 = require("@elementor/icons");
|
|
2268
|
-
var
|
|
2269
|
-
var
|
|
2326
|
+
var import_ui19 = require("@elementor/ui");
|
|
2327
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2270
2328
|
|
|
2271
2329
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2272
|
-
var
|
|
2273
|
-
var
|
|
2330
|
+
var React18 = __toESM(require("react"));
|
|
2331
|
+
var import_react16 = require("react");
|
|
2274
2332
|
var import_icons7 = require("@elementor/icons");
|
|
2275
|
-
var
|
|
2276
|
-
var
|
|
2333
|
+
var import_ui18 = require("@elementor/ui");
|
|
2334
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
2277
2335
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2278
2336
|
var EditConfirmationDialog = ({
|
|
2279
2337
|
closeDialog,
|
|
2280
2338
|
onConfirm,
|
|
2281
2339
|
onSuppressMessage
|
|
2282
2340
|
}) => {
|
|
2283
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2341
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react16.useState)(false);
|
|
2284
2342
|
const handleSave = () => {
|
|
2285
2343
|
if (dontShowAgain) {
|
|
2286
2344
|
onSuppressMessage?.();
|
|
2287
2345
|
}
|
|
2288
2346
|
onConfirm?.();
|
|
2289
2347
|
};
|
|
2290
|
-
return /* @__PURE__ */
|
|
2348
|
+
return /* @__PURE__ */ React18.createElement(import_ui18.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React18.createElement(import_ui18.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React18.createElement(import_icons7.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n12.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React18.createElement(import_ui18.DialogContent, null, /* @__PURE__ */ React18.createElement(import_ui18.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n12.__)(
|
|
2291
2349
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2292
2350
|
"elementor"
|
|
2293
|
-
))), /* @__PURE__ */
|
|
2294
|
-
|
|
2351
|
+
))), /* @__PURE__ */ React18.createElement(import_ui18.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(
|
|
2352
|
+
import_ui18.FormControlLabel,
|
|
2295
2353
|
{
|
|
2296
|
-
control: /* @__PURE__ */
|
|
2297
|
-
|
|
2354
|
+
control: /* @__PURE__ */ React18.createElement(
|
|
2355
|
+
import_ui18.Checkbox,
|
|
2298
2356
|
{
|
|
2299
2357
|
checked: dontShowAgain,
|
|
2300
2358
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2301
2359
|
size: "small"
|
|
2302
2360
|
}
|
|
2303
2361
|
),
|
|
2304
|
-
label: /* @__PURE__ */
|
|
2362
|
+
label: /* @__PURE__ */ React18.createElement(import_ui18.Typography, { variant: "body2" }, (0, import_i18n12.__)("Don't show me again", "elementor"))
|
|
2305
2363
|
}
|
|
2306
|
-
), /* @__PURE__ */
|
|
2364
|
+
), /* @__PURE__ */ React18.createElement("div", null, /* @__PURE__ */ React18.createElement(import_ui18.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n12.__)("Keep editing", "elementor")), /* @__PURE__ */ React18.createElement(import_ui18.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n12.__)("Save", "elementor")))));
|
|
2307
2365
|
};
|
|
2308
2366
|
|
|
2309
2367
|
// src/components/variable-edit.tsx
|
|
2310
2368
|
var SIZE3 = "tiny";
|
|
2311
|
-
var DELETE_LABEL = (0,
|
|
2369
|
+
var DELETE_LABEL = (0, import_i18n13.__)("Delete variable", "elementor");
|
|
2312
2370
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2313
2371
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2314
2372
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2315
2373
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2316
2374
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2317
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2318
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2319
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2320
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2375
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react17.useState)(false);
|
|
2376
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react17.useState)(false);
|
|
2377
|
+
const [errorMessage, setErrorMessage] = (0, import_react17.useState)("");
|
|
2378
|
+
const [valueFieldError, setValueFieldError] = (0, import_react17.useState)("");
|
|
2321
2379
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2322
2380
|
const variable = useVariable(editId);
|
|
2323
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2381
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react17.useState)(variable?.type ?? propTypeUtil.key);
|
|
2324
2382
|
if (!variable) {
|
|
2325
2383
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2326
2384
|
}
|
|
2327
2385
|
const userPermissions = usePermissions();
|
|
2328
|
-
const [value, setValue] = (0,
|
|
2329
|
-
const [label, setLabel] = (0,
|
|
2330
|
-
(0,
|
|
2386
|
+
const [value, setValue] = (0, import_react17.useState)(() => variable.value);
|
|
2387
|
+
const [label, setLabel] = (0, import_react17.useState)(() => variable.label);
|
|
2388
|
+
(0, import_react17.useEffect)(() => {
|
|
2331
2389
|
styleVariablesRepository.update({
|
|
2332
2390
|
[editId]: {
|
|
2333
2391
|
...variable,
|
|
@@ -2389,7 +2447,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2389
2447
|
const actions = [];
|
|
2390
2448
|
if (userPermissions.canDelete()) {
|
|
2391
2449
|
actions.push(
|
|
2392
|
-
/* @__PURE__ */
|
|
2450
|
+
/* @__PURE__ */ React19.createElement(import_ui19.Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React19.createElement(import_ui19.IconButton, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React19.createElement(import_icons8.TrashIcon, { fontSize: SIZE3 })))
|
|
2393
2451
|
);
|
|
2394
2452
|
}
|
|
2395
2453
|
const hasEmptyFields = () => {
|
|
@@ -2414,31 +2472,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2414
2472
|
handleUpdate();
|
|
2415
2473
|
}
|
|
2416
2474
|
};
|
|
2417
|
-
return /* @__PURE__ */
|
|
2475
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React19.createElement(
|
|
2418
2476
|
import_editor_ui7.PopoverHeader,
|
|
2419
2477
|
{
|
|
2420
|
-
title: (0,
|
|
2478
|
+
title: (0, import_i18n13.__)("Edit variable", "elementor"),
|
|
2421
2479
|
onClose,
|
|
2422
|
-
icon: /* @__PURE__ */
|
|
2423
|
-
|
|
2480
|
+
icon: /* @__PURE__ */ React19.createElement(React19.Fragment, null, onGoBack && /* @__PURE__ */ React19.createElement(
|
|
2481
|
+
import_ui19.IconButton,
|
|
2424
2482
|
{
|
|
2425
2483
|
size: SIZE3,
|
|
2426
|
-
"aria-label": (0,
|
|
2484
|
+
"aria-label": (0, import_i18n13.__)("Go Back", "elementor"),
|
|
2427
2485
|
onClick: onGoBack
|
|
2428
2486
|
},
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
), /* @__PURE__ */
|
|
2487
|
+
/* @__PURE__ */ React19.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
2488
|
+
), /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2431
2489
|
actions
|
|
2432
2490
|
}
|
|
2433
|
-
), /* @__PURE__ */
|
|
2491
|
+
), /* @__PURE__ */ React19.createElement(import_ui19.Divider, null), /* @__PURE__ */ React19.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React19.createElement(
|
|
2434
2492
|
FormField,
|
|
2435
2493
|
{
|
|
2436
2494
|
id: "variable-label",
|
|
2437
|
-
label: (0,
|
|
2495
|
+
label: (0, import_i18n13.__)("Name", "elementor"),
|
|
2438
2496
|
errorMsg: labelFieldError?.message,
|
|
2439
2497
|
noticeMsg: labelHint(label)
|
|
2440
2498
|
},
|
|
2441
|
-
/* @__PURE__ */
|
|
2499
|
+
/* @__PURE__ */ React19.createElement(
|
|
2442
2500
|
LabelField,
|
|
2443
2501
|
{
|
|
2444
2502
|
id: "variable-label",
|
|
@@ -2457,7 +2515,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2457
2515
|
onKeyDown: handleKeyDown
|
|
2458
2516
|
}
|
|
2459
2517
|
)
|
|
2460
|
-
), ValueField && /* @__PURE__ */
|
|
2518
|
+
), ValueField && /* @__PURE__ */ React19.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n13.__)("Value", "elementor") }, /* @__PURE__ */ React19.createElement(import_ui19.Typography, { variant: "h5" }, /* @__PURE__ */ React19.createElement(
|
|
2461
2519
|
ValueField,
|
|
2462
2520
|
{
|
|
2463
2521
|
propTypeKey: variable.type,
|
|
@@ -2472,7 +2530,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2472
2530
|
onValidationChange: setValueFieldError,
|
|
2473
2531
|
propType
|
|
2474
2532
|
}
|
|
2475
|
-
))), errorMessage && /* @__PURE__ */
|
|
2533
|
+
))), errorMessage && /* @__PURE__ */ React19.createElement(import_ui19.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React19.createElement(import_ui19.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React19.createElement(import_ui19.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n13.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2476
2534
|
DeleteConfirmationDialog,
|
|
2477
2535
|
{
|
|
2478
2536
|
open: true,
|
|
@@ -2480,7 +2538,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2480
2538
|
onConfirm: handleDelete,
|
|
2481
2539
|
closeDialog: closeDeleteDialog()
|
|
2482
2540
|
}
|
|
2483
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2541
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React19.createElement(
|
|
2484
2542
|
EditConfirmationDialog,
|
|
2485
2543
|
{
|
|
2486
2544
|
closeDialog: closeEditDialog(),
|
|
@@ -2491,26 +2549,27 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2491
2549
|
};
|
|
2492
2550
|
|
|
2493
2551
|
// src/components/variables-selection.tsx
|
|
2494
|
-
var
|
|
2495
|
-
var
|
|
2552
|
+
var import_react18 = require("react");
|
|
2553
|
+
var React21 = __toESM(require("react"));
|
|
2496
2554
|
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
2497
2555
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2556
|
+
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2498
2557
|
var import_icons10 = require("@elementor/icons");
|
|
2499
|
-
var
|
|
2500
|
-
var
|
|
2558
|
+
var import_ui22 = require("@elementor/ui");
|
|
2559
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2501
2560
|
|
|
2502
2561
|
// src/components/ui/menu-item-content.tsx
|
|
2503
|
-
var
|
|
2562
|
+
var React20 = __toESM(require("react"));
|
|
2504
2563
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2505
2564
|
var import_icons9 = require("@elementor/icons");
|
|
2506
|
-
var
|
|
2507
|
-
var
|
|
2565
|
+
var import_ui20 = require("@elementor/ui");
|
|
2566
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2508
2567
|
var SIZE4 = "tiny";
|
|
2509
|
-
var EDIT_LABEL = (0,
|
|
2510
|
-
var MenuItemContent = ({ item }) => {
|
|
2568
|
+
var EDIT_LABEL = (0, import_i18n14.__)("Edit variable", "elementor");
|
|
2569
|
+
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2511
2570
|
const onEdit = item.onEdit;
|
|
2512
|
-
return /* @__PURE__ */
|
|
2513
|
-
|
|
2571
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(import_ui20.ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React20.createElement(
|
|
2572
|
+
import_ui20.Box,
|
|
2514
2573
|
{
|
|
2515
2574
|
sx: {
|
|
2516
2575
|
flex: 1,
|
|
@@ -2520,30 +2579,30 @@ var MenuItemContent = ({ item }) => {
|
|
|
2520
2579
|
gap: 1
|
|
2521
2580
|
}
|
|
2522
2581
|
},
|
|
2523
|
-
/* @__PURE__ */
|
|
2582
|
+
/* @__PURE__ */ React20.createElement(
|
|
2524
2583
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2525
2584
|
{
|
|
2526
2585
|
title: item.label || item.value,
|
|
2527
|
-
as:
|
|
2586
|
+
as: import_ui20.Typography,
|
|
2528
2587
|
variant: "caption",
|
|
2529
|
-
color: "text.primary",
|
|
2588
|
+
color: disabled ? "text.disabled" : "text.primary",
|
|
2530
2589
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2531
2590
|
maxWidth: "50%"
|
|
2532
2591
|
}
|
|
2533
2592
|
),
|
|
2534
|
-
item.secondaryText && /* @__PURE__ */
|
|
2593
|
+
item.secondaryText && /* @__PURE__ */ React20.createElement(
|
|
2535
2594
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2536
2595
|
{
|
|
2537
2596
|
title: item.secondaryText,
|
|
2538
|
-
as:
|
|
2597
|
+
as: import_ui20.Typography,
|
|
2539
2598
|
variant: "caption",
|
|
2540
|
-
color: "text.tertiary",
|
|
2599
|
+
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2541
2600
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2542
2601
|
maxWidth: "50%"
|
|
2543
2602
|
}
|
|
2544
2603
|
)
|
|
2545
|
-
), !!onEdit && /* @__PURE__ */
|
|
2546
|
-
|
|
2604
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React20.createElement(import_ui20.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2605
|
+
import_ui20.IconButton,
|
|
2547
2606
|
{
|
|
2548
2607
|
sx: { mx: 1, opacity: "0" },
|
|
2549
2608
|
onClick: (e) => {
|
|
@@ -2552,13 +2611,13 @@ var MenuItemContent = ({ item }) => {
|
|
|
2552
2611
|
},
|
|
2553
2612
|
"aria-label": EDIT_LABEL
|
|
2554
2613
|
},
|
|
2555
|
-
/* @__PURE__ */
|
|
2614
|
+
/* @__PURE__ */ React20.createElement(import_icons9.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2556
2615
|
)));
|
|
2557
2616
|
};
|
|
2558
2617
|
|
|
2559
2618
|
// src/components/ui/styled-menu-list.tsx
|
|
2560
|
-
var
|
|
2561
|
-
var VariablesStyledMenuList = (0,
|
|
2619
|
+
var import_ui21 = require("@elementor/ui");
|
|
2620
|
+
var VariablesStyledMenuList = (0, import_ui21.styled)(import_ui21.MenuList)(({ theme, disabled }) => ({
|
|
2562
2621
|
"& > li": {
|
|
2563
2622
|
height: 32,
|
|
2564
2623
|
width: "100%",
|
|
@@ -2569,13 +2628,15 @@ var VariablesStyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ t
|
|
|
2569
2628
|
...theme.typography.caption,
|
|
2570
2629
|
lineHeight: "inherit",
|
|
2571
2630
|
padding: theme.spacing(0.5, 1, 0.5, 2),
|
|
2572
|
-
|
|
2573
|
-
|
|
2631
|
+
...!disabled && {
|
|
2632
|
+
"&:hover, &:focus": {
|
|
2633
|
+
backgroundColor: theme.palette.action.hover
|
|
2634
|
+
},
|
|
2635
|
+
cursor: "pointer"
|
|
2574
2636
|
},
|
|
2575
2637
|
'&[aria-selected="true"]': {
|
|
2576
2638
|
backgroundColor: theme.palette.action.selected
|
|
2577
2639
|
},
|
|
2578
|
-
cursor: "pointer",
|
|
2579
2640
|
textOverflow: "ellipsis",
|
|
2580
2641
|
position: "absolute",
|
|
2581
2642
|
top: 0,
|
|
@@ -2590,12 +2651,13 @@ var VariablesStyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ t
|
|
|
2590
2651
|
|
|
2591
2652
|
// src/components/variables-selection.tsx
|
|
2592
2653
|
var SIZE5 = "tiny";
|
|
2593
|
-
var CREATE_LABEL = (0,
|
|
2594
|
-
var MANAGER_LABEL = (0,
|
|
2654
|
+
var CREATE_LABEL = (0, import_i18n15.__)("Create variable", "elementor");
|
|
2655
|
+
var MANAGER_LABEL = (0, import_i18n15.__)("Variables Manager", "elementor");
|
|
2656
|
+
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license-panel-${variableType}-variable`;
|
|
2595
2657
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2596
2658
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2597
2659
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2598
|
-
const [searchValue, setSearchValue] = (0,
|
|
2660
|
+
const [searchValue, setSearchValue] = (0, import_react18.useState)("");
|
|
2599
2661
|
const {
|
|
2600
2662
|
list: variables,
|
|
2601
2663
|
hasMatches: hasSearchResults,
|
|
@@ -2622,8 +2684,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2622
2684
|
const actions = [];
|
|
2623
2685
|
if (onAdd) {
|
|
2624
2686
|
actions.push(
|
|
2625
|
-
/* @__PURE__ */
|
|
2626
|
-
|
|
2687
|
+
/* @__PURE__ */ React21.createElement(import_ui22.Tooltip, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React21.createElement("span", null, /* @__PURE__ */ React21.createElement(
|
|
2688
|
+
import_ui22.IconButton,
|
|
2627
2689
|
{
|
|
2628
2690
|
id: "add-variable-button",
|
|
2629
2691
|
size: SIZE5,
|
|
@@ -2631,7 +2693,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2631
2693
|
"aria-label": CREATE_LABEL,
|
|
2632
2694
|
disabled
|
|
2633
2695
|
},
|
|
2634
|
-
/* @__PURE__ */
|
|
2696
|
+
/* @__PURE__ */ React21.createElement(import_icons10.PlusIcon, { fontSize: SIZE5 })
|
|
2635
2697
|
)))
|
|
2636
2698
|
);
|
|
2637
2699
|
}
|
|
@@ -2645,24 +2707,24 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2645
2707
|
});
|
|
2646
2708
|
};
|
|
2647
2709
|
actions.push(
|
|
2648
|
-
/* @__PURE__ */
|
|
2649
|
-
|
|
2710
|
+
/* @__PURE__ */ React21.createElement(import_ui22.Tooltip, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2711
|
+
import_ui22.IconButton,
|
|
2650
2712
|
{
|
|
2651
2713
|
id: "variables-manager-button",
|
|
2652
2714
|
size: SIZE5,
|
|
2653
2715
|
onClick: handleOpenManager,
|
|
2654
2716
|
"aria-label": MANAGER_LABEL
|
|
2655
2717
|
},
|
|
2656
|
-
/* @__PURE__ */
|
|
2718
|
+
/* @__PURE__ */ React21.createElement(import_icons10.SettingsIcon, { fontSize: SIZE5 })
|
|
2657
2719
|
))
|
|
2658
2720
|
);
|
|
2659
2721
|
}
|
|
2660
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2722
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2661
2723
|
const items = variables.map(({ value, label, key }) => ({
|
|
2662
2724
|
type: "item",
|
|
2663
2725
|
value: key,
|
|
2664
2726
|
label,
|
|
2665
|
-
icon: /* @__PURE__ */
|
|
2727
|
+
icon: /* @__PURE__ */ React21.createElement(StartIcon, { value }),
|
|
2666
2728
|
secondaryText: value,
|
|
2667
2729
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2668
2730
|
}));
|
|
@@ -2672,80 +2734,91 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2672
2734
|
const handleClearSearch = () => {
|
|
2673
2735
|
setSearchValue("");
|
|
2674
2736
|
};
|
|
2675
|
-
return /* @__PURE__ */
|
|
2737
|
+
return /* @__PURE__ */ React21.createElement(import_editor_editing_panel4.PopoverBody, null, /* @__PURE__ */ React21.createElement(
|
|
2676
2738
|
import_editor_ui9.PopoverHeader,
|
|
2677
2739
|
{
|
|
2678
|
-
title: (0,
|
|
2679
|
-
icon: /* @__PURE__ */
|
|
2740
|
+
title: (0, import_i18n15.__)("Variables", "elementor"),
|
|
2741
|
+
icon: /* @__PURE__ */ React21.createElement(import_icons10.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
2680
2742
|
onClose: closePopover,
|
|
2681
2743
|
actions
|
|
2682
2744
|
}
|
|
2683
|
-
), hasVariables && /* @__PURE__ */
|
|
2745
|
+
), hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2684
2746
|
import_editor_ui9.SearchField,
|
|
2685
2747
|
{
|
|
2686
2748
|
value: searchValue,
|
|
2687
2749
|
onSearch: handleSearch,
|
|
2688
|
-
placeholder: (0,
|
|
2750
|
+
placeholder: (0, import_i18n15.__)("Search", "elementor")
|
|
2689
2751
|
}
|
|
2690
|
-
), /* @__PURE__ */
|
|
2752
|
+
), /* @__PURE__ */ React21.createElement(import_ui22.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2691
2753
|
import_editor_ui9.PopoverMenuList,
|
|
2692
2754
|
{
|
|
2693
2755
|
items,
|
|
2694
|
-
onSelect:
|
|
2756
|
+
onSelect: disabled ? () => {
|
|
2757
|
+
} : handleSetVariable,
|
|
2695
2758
|
onClose: () => {
|
|
2696
2759
|
},
|
|
2697
2760
|
selectedValue: variable,
|
|
2698
2761
|
"data-testid": `${variableType}-variables-list`,
|
|
2699
|
-
menuListTemplate: VariablesStyledMenuList,
|
|
2700
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2762
|
+
menuListTemplate: (props) => /* @__PURE__ */ React21.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2763
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React21.createElement(MenuItemContent, { item, disabled })
|
|
2764
|
+
}
|
|
2765
|
+
), disabled && /* @__PURE__ */ React21.createElement(
|
|
2766
|
+
import_editor_ui10.PromotionAlert,
|
|
2767
|
+
{
|
|
2768
|
+
message: (0, import_i18n15.sprintf)(
|
|
2769
|
+
/* translators: %s: Variable Type. */
|
|
2770
|
+
(0, import_i18n15.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2771
|
+
variableType
|
|
2772
|
+
),
|
|
2773
|
+
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2701
2774
|
}
|
|
2702
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2775
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2703
2776
|
NoSearchResults,
|
|
2704
2777
|
{
|
|
2705
2778
|
searchValue,
|
|
2706
2779
|
onClear: handleClearSearch,
|
|
2707
|
-
icon: /* @__PURE__ */
|
|
2780
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2708
2781
|
}
|
|
2709
|
-
), disabled && /* @__PURE__ */
|
|
2782
|
+
), disabled && !hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2710
2783
|
EmptyState,
|
|
2711
2784
|
{
|
|
2712
|
-
title: (0,
|
|
2785
|
+
title: (0, import_i18n15.sprintf)(
|
|
2713
2786
|
/* translators: %s: Variable Type. */
|
|
2714
|
-
(0,
|
|
2787
|
+
(0, import_i18n15.__)("No %s variables yet", "elementor"),
|
|
2715
2788
|
variableType
|
|
2716
2789
|
),
|
|
2717
|
-
message: (0,
|
|
2790
|
+
message: (0, import_i18n15.sprintf)(
|
|
2718
2791
|
/* translators: %s: Variable Type. */
|
|
2719
|
-
(0,
|
|
2792
|
+
(0, import_i18n15.__)("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2720
2793
|
variableType
|
|
2721
2794
|
),
|
|
2722
|
-
icon: /* @__PURE__ */
|
|
2795
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2723
2796
|
},
|
|
2724
2797
|
emptyState
|
|
2725
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2798
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2726
2799
|
EmptyState,
|
|
2727
2800
|
{
|
|
2728
|
-
title: (0,
|
|
2801
|
+
title: (0, import_i18n15.sprintf)(
|
|
2729
2802
|
/* translators: %s: Variable Type. */
|
|
2730
|
-
(0,
|
|
2803
|
+
(0, import_i18n15.__)("Create your first %s variable", "elementor"),
|
|
2731
2804
|
variableType
|
|
2732
2805
|
),
|
|
2733
|
-
message: (0,
|
|
2806
|
+
message: (0, import_i18n15.__)(
|
|
2734
2807
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2735
2808
|
"elementor"
|
|
2736
2809
|
),
|
|
2737
|
-
icon: /* @__PURE__ */
|
|
2810
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2738
2811
|
onAdd
|
|
2739
2812
|
}
|
|
2740
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2813
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2741
2814
|
EmptyState,
|
|
2742
2815
|
{
|
|
2743
|
-
title: (0,
|
|
2744
|
-
message: (0,
|
|
2816
|
+
title: (0, import_i18n15.__)("No compatible variables", "elementor"),
|
|
2817
|
+
message: (0, import_i18n15.__)(
|
|
2745
2818
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2746
2819
|
"elementor"
|
|
2747
2820
|
),
|
|
2748
|
-
icon: /* @__PURE__ */
|
|
2821
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2749
2822
|
onAdd
|
|
2750
2823
|
}
|
|
2751
2824
|
));
|
|
@@ -2756,13 +2829,13 @@ var VIEW_LIST = "list";
|
|
|
2756
2829
|
var VIEW_ADD = "add";
|
|
2757
2830
|
var VIEW_EDIT = "edit";
|
|
2758
2831
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2759
|
-
const [currentView, setCurrentView] = (0,
|
|
2760
|
-
const [editId, setEditId] = (0,
|
|
2832
|
+
const [currentView, setCurrentView] = (0, import_react19.useState)(VIEW_LIST);
|
|
2833
|
+
const [editId, setEditId] = (0, import_react19.useState)("");
|
|
2761
2834
|
const { open } = usePanelActions();
|
|
2762
2835
|
const onSettingsAvailable = (0, import_editor_v1_adapters2.isExperimentActive)("e_variables_manager") ? () => {
|
|
2763
2836
|
open();
|
|
2764
2837
|
} : void 0;
|
|
2765
|
-
return /* @__PURE__ */
|
|
2838
|
+
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2766
2839
|
propTypeKey,
|
|
2767
2840
|
currentView,
|
|
2768
2841
|
selectedVariable,
|
|
@@ -2809,7 +2882,7 @@ function RenderView(props) {
|
|
|
2809
2882
|
}
|
|
2810
2883
|
};
|
|
2811
2884
|
if (VIEW_LIST === props.currentView) {
|
|
2812
|
-
return /* @__PURE__ */
|
|
2885
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2813
2886
|
VariablesSelection,
|
|
2814
2887
|
{
|
|
2815
2888
|
closePopover: handlers.onClose,
|
|
@@ -2821,10 +2894,10 @@ function RenderView(props) {
|
|
|
2821
2894
|
);
|
|
2822
2895
|
}
|
|
2823
2896
|
if (VIEW_ADD === props.currentView) {
|
|
2824
|
-
return /* @__PURE__ */
|
|
2897
|
+
return /* @__PURE__ */ React22.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2825
2898
|
}
|
|
2826
2899
|
if (VIEW_EDIT === props.currentView) {
|
|
2827
|
-
return /* @__PURE__ */
|
|
2900
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2828
2901
|
VariableEdit,
|
|
2829
2902
|
{
|
|
2830
2903
|
editId: props.editId,
|
|
@@ -2838,26 +2911,26 @@ function RenderView(props) {
|
|
|
2838
2911
|
}
|
|
2839
2912
|
|
|
2840
2913
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2841
|
-
var
|
|
2914
|
+
var React23 = __toESM(require("react"));
|
|
2842
2915
|
var import_icons11 = require("@elementor/icons");
|
|
2843
|
-
var
|
|
2844
|
-
var
|
|
2916
|
+
var import_ui23 = require("@elementor/ui");
|
|
2917
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2845
2918
|
var SIZE6 = "tiny";
|
|
2846
|
-
var UNLINK_LABEL = (0,
|
|
2919
|
+
var UNLINK_LABEL = (0, import_i18n16.__)("Unlink variable", "elementor");
|
|
2847
2920
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2848
2921
|
const actions = [];
|
|
2849
2922
|
if (onUnlink) {
|
|
2850
2923
|
actions.push(
|
|
2851
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ React23.createElement(import_ui23.Tooltip, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React23.createElement(import_ui23.IconButton, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React23.createElement(import_icons11.DetachIcon, { fontSize: SIZE6 })))
|
|
2852
2925
|
);
|
|
2853
2926
|
}
|
|
2854
|
-
return /* @__PURE__ */
|
|
2855
|
-
|
|
2927
|
+
return /* @__PURE__ */ React23.createElement(import_ui23.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React23.createElement(
|
|
2928
|
+
import_ui23.UnstableTag,
|
|
2856
2929
|
{
|
|
2857
2930
|
fullWidth: true,
|
|
2858
2931
|
showActionsOnHover: true,
|
|
2859
|
-
startIcon: /* @__PURE__ */
|
|
2860
|
-
label: /* @__PURE__ */
|
|
2932
|
+
startIcon: /* @__PURE__ */ React23.createElement(import_ui23.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
2933
|
+
label: /* @__PURE__ */ React23.createElement(import_ui23.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React23.createElement(import_ui23.Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
2861
2934
|
actions,
|
|
2862
2935
|
...props
|
|
2863
2936
|
}
|
|
@@ -2868,24 +2941,24 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2868
2941
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
2869
2942
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
2870
2943
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
2871
|
-
const anchorRef = (0,
|
|
2872
|
-
const popupId = (0,
|
|
2873
|
-
const popupState = (0,
|
|
2944
|
+
const anchorRef = (0, import_react20.useRef)(null);
|
|
2945
|
+
const popupId = (0, import_react20.useId)();
|
|
2946
|
+
const popupState = (0, import_ui24.usePopupState)({
|
|
2874
2947
|
variant: "popover",
|
|
2875
2948
|
popupId: `elementor-variables-list-${popupId}`
|
|
2876
2949
|
});
|
|
2877
2950
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
2878
2951
|
const StartIcon = startIcon || (() => null);
|
|
2879
|
-
return /* @__PURE__ */
|
|
2952
|
+
return /* @__PURE__ */ React24.createElement(import_ui24.Box, { ref: anchorRef }, /* @__PURE__ */ React24.createElement(
|
|
2880
2953
|
AssignedTag,
|
|
2881
2954
|
{
|
|
2882
2955
|
label: variable.label,
|
|
2883
|
-
startIcon: /* @__PURE__ */
|
|
2956
|
+
startIcon: /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(import_icons12.ColorFilterIcon, { fontSize: SIZE6 }), /* @__PURE__ */ React24.createElement(StartIcon, { value: variable.value })),
|
|
2884
2957
|
onUnlink: unlinkVariable,
|
|
2885
|
-
...(0,
|
|
2958
|
+
...(0, import_ui24.bindTrigger)(popupState)
|
|
2886
2959
|
}
|
|
2887
|
-
), /* @__PURE__ */
|
|
2888
|
-
|
|
2960
|
+
), /* @__PURE__ */ React24.createElement(
|
|
2961
|
+
import_ui24.Popover,
|
|
2889
2962
|
{
|
|
2890
2963
|
disableScrollLock: true,
|
|
2891
2964
|
anchorEl: anchorRef.current,
|
|
@@ -2894,9 +2967,9 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2894
2967
|
PaperProps: {
|
|
2895
2968
|
sx: { my: 1 }
|
|
2896
2969
|
},
|
|
2897
|
-
...(0,
|
|
2970
|
+
...(0, import_ui24.bindPopover)(popupState)
|
|
2898
2971
|
},
|
|
2899
|
-
/* @__PURE__ */
|
|
2972
|
+
/* @__PURE__ */ React24.createElement(
|
|
2900
2973
|
VariableSelectionPopover,
|
|
2901
2974
|
{
|
|
2902
2975
|
selectedVariable: variable,
|
|
@@ -2908,20 +2981,20 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2908
2981
|
};
|
|
2909
2982
|
|
|
2910
2983
|
// src/components/ui/variable/deleted-variable.tsx
|
|
2911
|
-
var
|
|
2912
|
-
var
|
|
2984
|
+
var React28 = __toESM(require("react"));
|
|
2985
|
+
var import_react22 = require("react");
|
|
2913
2986
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
2914
|
-
var
|
|
2915
|
-
var
|
|
2987
|
+
var import_ui28 = require("@elementor/ui");
|
|
2988
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2916
2989
|
|
|
2917
2990
|
// src/components/variable-restore.tsx
|
|
2918
|
-
var
|
|
2919
|
-
var
|
|
2991
|
+
var React25 = __toESM(require("react"));
|
|
2992
|
+
var import_react21 = require("react");
|
|
2920
2993
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
2921
2994
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
2922
|
-
var
|
|
2923
|
-
var
|
|
2924
|
-
var
|
|
2995
|
+
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
2996
|
+
var import_ui25 = require("@elementor/ui");
|
|
2997
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2925
2998
|
var SIZE7 = "tiny";
|
|
2926
2999
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
2927
3000
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -2931,11 +3004,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2931
3004
|
if (!variable) {
|
|
2932
3005
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2933
3006
|
}
|
|
2934
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2935
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2936
|
-
const [label, setLabel] = (0,
|
|
2937
|
-
const [value, setValue] = (0,
|
|
2938
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
3007
|
+
const [errorMessage, setErrorMessage] = (0, import_react21.useState)("");
|
|
3008
|
+
const [valueFieldError, setValueFieldError] = (0, import_react21.useState)("");
|
|
3009
|
+
const [label, setLabel] = (0, import_react21.useState)(variable.label);
|
|
3010
|
+
const [value, setValue] = (0, import_react21.useState)(variable.value);
|
|
3011
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react21.useState)(variable?.type ?? propTypeUtil.key);
|
|
2939
3012
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
2940
3013
|
value: variable.label,
|
|
2941
3014
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -2981,22 +3054,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2981
3054
|
handleRestore();
|
|
2982
3055
|
}
|
|
2983
3056
|
};
|
|
2984
|
-
return /* @__PURE__ */
|
|
2985
|
-
|
|
3057
|
+
return /* @__PURE__ */ React25.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React25.createElement(import_editor_editing_panel5.PopoverBody, { height: "auto" }, /* @__PURE__ */ React25.createElement(
|
|
3058
|
+
import_editor_ui11.PopoverHeader,
|
|
2986
3059
|
{
|
|
2987
|
-
icon: /* @__PURE__ */
|
|
2988
|
-
title: (0,
|
|
3060
|
+
icon: /* @__PURE__ */ React25.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3061
|
+
title: (0, import_i18n17.__)("Restore variable", "elementor"),
|
|
2989
3062
|
onClose
|
|
2990
3063
|
}
|
|
2991
|
-
), /* @__PURE__ */
|
|
3064
|
+
), /* @__PURE__ */ React25.createElement(import_ui25.Divider, null), /* @__PURE__ */ React25.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React25.createElement(
|
|
2992
3065
|
FormField,
|
|
2993
3066
|
{
|
|
2994
3067
|
id: "variable-label",
|
|
2995
|
-
label: (0,
|
|
3068
|
+
label: (0, import_i18n17.__)("Name", "elementor"),
|
|
2996
3069
|
errorMsg: labelFieldError?.message,
|
|
2997
3070
|
noticeMsg: labelHint(label)
|
|
2998
3071
|
},
|
|
2999
|
-
/* @__PURE__ */
|
|
3072
|
+
/* @__PURE__ */ React25.createElement(
|
|
3000
3073
|
LabelField,
|
|
3001
3074
|
{
|
|
3002
3075
|
id: "variable-label",
|
|
@@ -3015,7 +3088,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3015
3088
|
onKeyDown: handleKeyDown
|
|
3016
3089
|
}
|
|
3017
3090
|
)
|
|
3018
|
-
), ValueField && /* @__PURE__ */
|
|
3091
|
+
), ValueField && /* @__PURE__ */ React25.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n17.__)("Value", "elementor") }, /* @__PURE__ */ React25.createElement(import_ui25.Typography, { variant: "h5" }, /* @__PURE__ */ React25.createElement(
|
|
3019
3092
|
ValueField,
|
|
3020
3093
|
{
|
|
3021
3094
|
propTypeKey,
|
|
@@ -3030,25 +3103,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3030
3103
|
propType,
|
|
3031
3104
|
onKeyDown: handleKeyDown
|
|
3032
3105
|
}
|
|
3033
|
-
))), errorMessage && /* @__PURE__ */
|
|
3106
|
+
))), errorMessage && /* @__PURE__ */ React25.createElement(import_ui25.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React25.createElement(import_ui25.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React25.createElement(import_ui25.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n17.__)("Restore", "elementor")))));
|
|
3034
3107
|
};
|
|
3035
3108
|
|
|
3036
3109
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3037
|
-
var
|
|
3038
|
-
var
|
|
3039
|
-
var
|
|
3110
|
+
var React26 = __toESM(require("react"));
|
|
3111
|
+
var import_ui26 = require("@elementor/ui");
|
|
3112
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
3040
3113
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3041
|
-
return /* @__PURE__ */
|
|
3042
|
-
|
|
3114
|
+
return /* @__PURE__ */ React26.createElement(import_ui26.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React26.createElement(
|
|
3115
|
+
import_ui26.Alert,
|
|
3043
3116
|
{
|
|
3044
3117
|
variant: "standard",
|
|
3045
3118
|
severity: "warning",
|
|
3046
3119
|
onClose,
|
|
3047
|
-
action: /* @__PURE__ */
|
|
3120
|
+
action: /* @__PURE__ */ React26.createElement(React26.Fragment, null, onUnlink && /* @__PURE__ */ React26.createElement(import_ui26.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n18.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React26.createElement(import_ui26.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n18.__)("Restore", "elementor"))),
|
|
3048
3121
|
sx: { maxWidth: 300 }
|
|
3049
3122
|
},
|
|
3050
|
-
/* @__PURE__ */
|
|
3051
|
-
/* @__PURE__ */
|
|
3123
|
+
/* @__PURE__ */ React26.createElement(import_ui26.AlertTitle, null, (0, import_i18n18.__)("Deleted variable", "elementor")),
|
|
3124
|
+
/* @__PURE__ */ React26.createElement(import_ui26.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n18.__)("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React26.createElement(import_ui26.Typography, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", (0, import_i18n18.__)(
|
|
3052
3125
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3053
3126
|
"elementor"
|
|
3054
3127
|
))
|
|
@@ -3056,14 +3129,14 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3056
3129
|
};
|
|
3057
3130
|
|
|
3058
3131
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3059
|
-
var
|
|
3132
|
+
var React27 = __toESM(require("react"));
|
|
3060
3133
|
var import_icons13 = require("@elementor/icons");
|
|
3061
|
-
var
|
|
3062
|
-
var WarningVariableTag =
|
|
3134
|
+
var import_ui27 = require("@elementor/ui");
|
|
3135
|
+
var WarningVariableTag = React27.forwardRef(
|
|
3063
3136
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3064
3137
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3065
|
-
return /* @__PURE__ */
|
|
3066
|
-
|
|
3138
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3139
|
+
import_ui27.Chip,
|
|
3067
3140
|
{
|
|
3068
3141
|
ref,
|
|
3069
3142
|
size: "tiny",
|
|
@@ -3071,8 +3144,8 @@ var WarningVariableTag = React25.forwardRef(
|
|
|
3071
3144
|
shape: "rounded",
|
|
3072
3145
|
variant: "standard",
|
|
3073
3146
|
onClick,
|
|
3074
|
-
icon: /* @__PURE__ */
|
|
3075
|
-
label: /* @__PURE__ */
|
|
3147
|
+
icon: /* @__PURE__ */ React27.createElement(import_icons13.AlertTriangleFilledIcon, null),
|
|
3148
|
+
label: /* @__PURE__ */ React27.createElement(import_ui27.Tooltip, { title: displayText, placement: "top" }, /* @__PURE__ */ React27.createElement(import_ui27.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3076
3149
|
sx: {
|
|
3077
3150
|
height: (theme) => theme.spacing(3.5),
|
|
3078
3151
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3091,12 +3164,12 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3091
3164
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3092
3165
|
const boundProp = (0, import_editor_controls8.useBoundProp)();
|
|
3093
3166
|
const userPermissions = usePermissions();
|
|
3094
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3167
|
+
const [showInfotip, setShowInfotip] = (0, import_react22.useState)(false);
|
|
3095
3168
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3096
3169
|
const closeInfotip = () => setShowInfotip(false);
|
|
3097
|
-
const deletedChipAnchorRef = (0,
|
|
3098
|
-
const popupId = (0,
|
|
3099
|
-
const popupState = (0,
|
|
3170
|
+
const deletedChipAnchorRef = (0, import_react22.useRef)(null);
|
|
3171
|
+
const popupId = (0, import_react22.useId)();
|
|
3172
|
+
const popupState = (0, import_ui28.usePopupState)({
|
|
3100
3173
|
variant: "popover",
|
|
3101
3174
|
popupId: `elementor-variables-restore-${popupId}`
|
|
3102
3175
|
});
|
|
@@ -3122,15 +3195,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3122
3195
|
const handleRestoreWithOverrides = () => {
|
|
3123
3196
|
popupState.close();
|
|
3124
3197
|
};
|
|
3125
|
-
return /* @__PURE__ */
|
|
3126
|
-
|
|
3198
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(import_ui28.Box, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React28.createElement(import_ui28.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
|
|
3199
|
+
import_ui28.Infotip,
|
|
3127
3200
|
{
|
|
3128
3201
|
color: "warning",
|
|
3129
3202
|
placement: "right-start",
|
|
3130
3203
|
open: showInfotip,
|
|
3131
3204
|
disableHoverListener: true,
|
|
3132
3205
|
onClose: closeInfotip,
|
|
3133
|
-
content: /* @__PURE__ */
|
|
3206
|
+
content: /* @__PURE__ */ React28.createElement(
|
|
3134
3207
|
DeletedVariableAlert,
|
|
3135
3208
|
{
|
|
3136
3209
|
onClose: closeInfotip,
|
|
@@ -3150,16 +3223,16 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3150
3223
|
}
|
|
3151
3224
|
}
|
|
3152
3225
|
},
|
|
3153
|
-
/* @__PURE__ */
|
|
3226
|
+
/* @__PURE__ */ React28.createElement(
|
|
3154
3227
|
WarningVariableTag,
|
|
3155
3228
|
{
|
|
3156
3229
|
label: variable.label,
|
|
3157
3230
|
onClick: toggleInfotip,
|
|
3158
|
-
suffix: (0,
|
|
3231
|
+
suffix: (0, import_i18n19.__)("deleted", "elementor")
|
|
3159
3232
|
}
|
|
3160
3233
|
)
|
|
3161
|
-
), /* @__PURE__ */
|
|
3162
|
-
|
|
3234
|
+
), /* @__PURE__ */ React28.createElement(
|
|
3235
|
+
import_ui28.Popover,
|
|
3163
3236
|
{
|
|
3164
3237
|
disableScrollLock: true,
|
|
3165
3238
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -3167,9 +3240,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3167
3240
|
PaperProps: {
|
|
3168
3241
|
sx: { my: 1 }
|
|
3169
3242
|
},
|
|
3170
|
-
...(0,
|
|
3243
|
+
...(0, import_ui28.bindPopover)(popupState)
|
|
3171
3244
|
},
|
|
3172
|
-
/* @__PURE__ */
|
|
3245
|
+
/* @__PURE__ */ React28.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React28.createElement(
|
|
3173
3246
|
VariableRestore,
|
|
3174
3247
|
{
|
|
3175
3248
|
variableId: variable.key ?? "",
|
|
@@ -3181,52 +3254,52 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3181
3254
|
};
|
|
3182
3255
|
|
|
3183
3256
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3184
|
-
var
|
|
3185
|
-
var
|
|
3257
|
+
var React30 = __toESM(require("react"));
|
|
3258
|
+
var import_react23 = require("react");
|
|
3186
3259
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3187
|
-
var
|
|
3188
|
-
var
|
|
3260
|
+
var import_ui30 = require("@elementor/ui");
|
|
3261
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
3189
3262
|
|
|
3190
3263
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3191
|
-
var
|
|
3192
|
-
var
|
|
3193
|
-
var
|
|
3264
|
+
var React29 = __toESM(require("react"));
|
|
3265
|
+
var import_ui29 = require("@elementor/ui");
|
|
3266
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
3194
3267
|
var i18n = {
|
|
3195
|
-
title: (0,
|
|
3196
|
-
message: (0,
|
|
3268
|
+
title: (0, import_i18n20.__)("Variable has changed", "elementor"),
|
|
3269
|
+
message: (0, import_i18n20.__)(
|
|
3197
3270
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3198
3271
|
"elementor"
|
|
3199
3272
|
),
|
|
3200
3273
|
buttons: {
|
|
3201
|
-
clear: (0,
|
|
3202
|
-
select: (0,
|
|
3274
|
+
clear: (0, import_i18n20.__)("Clear", "elementor"),
|
|
3275
|
+
select: (0, import_i18n20.__)("Select variable", "elementor")
|
|
3203
3276
|
}
|
|
3204
3277
|
};
|
|
3205
3278
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3206
|
-
return /* @__PURE__ */
|
|
3207
|
-
|
|
3279
|
+
return /* @__PURE__ */ React29.createElement(import_ui29.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
3280
|
+
import_ui29.Alert,
|
|
3208
3281
|
{
|
|
3209
3282
|
variant: "standard",
|
|
3210
3283
|
severity: "warning",
|
|
3211
3284
|
onClose,
|
|
3212
|
-
action: /* @__PURE__ */
|
|
3285
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(import_ui29.AlertAction, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React29.createElement(import_ui29.AlertAction, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3213
3286
|
sx: { maxWidth: 300 }
|
|
3214
3287
|
},
|
|
3215
|
-
/* @__PURE__ */
|
|
3216
|
-
/* @__PURE__ */
|
|
3288
|
+
/* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, i18n.title),
|
|
3289
|
+
/* @__PURE__ */ React29.createElement(import_ui29.Typography, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3217
3290
|
));
|
|
3218
3291
|
};
|
|
3219
3292
|
|
|
3220
3293
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3221
3294
|
var MismatchVariable = ({ variable }) => {
|
|
3222
3295
|
const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
|
|
3223
|
-
const anchorRef = (0,
|
|
3224
|
-
const popupId = (0,
|
|
3225
|
-
const popupState = (0,
|
|
3296
|
+
const anchorRef = (0, import_react23.useRef)(null);
|
|
3297
|
+
const popupId = (0, import_react23.useId)();
|
|
3298
|
+
const popupState = (0, import_ui30.usePopupState)({
|
|
3226
3299
|
variant: "popover",
|
|
3227
3300
|
popupId: `elementor-variables-list-${popupId}`
|
|
3228
3301
|
});
|
|
3229
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3302
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react23.useState)(false);
|
|
3230
3303
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3231
3304
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3232
3305
|
const triggerSelect = () => {
|
|
@@ -3239,15 +3312,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3239
3312
|
setValue(null);
|
|
3240
3313
|
};
|
|
3241
3314
|
const showClearButton = !!value;
|
|
3242
|
-
return /* @__PURE__ */
|
|
3243
|
-
|
|
3315
|
+
return /* @__PURE__ */ React30.createElement(import_ui30.Box, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React30.createElement(import_ui30.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React30.createElement(
|
|
3316
|
+
import_ui30.Infotip,
|
|
3244
3317
|
{
|
|
3245
3318
|
color: "warning",
|
|
3246
3319
|
placement: "right-start",
|
|
3247
3320
|
open: infotipVisible,
|
|
3248
3321
|
disableHoverListener: true,
|
|
3249
3322
|
onClose: closeInfotip,
|
|
3250
|
-
content: /* @__PURE__ */
|
|
3323
|
+
content: /* @__PURE__ */ React30.createElement(
|
|
3251
3324
|
MismatchVariableAlert,
|
|
3252
3325
|
{
|
|
3253
3326
|
onClose: closeInfotip,
|
|
@@ -3266,16 +3339,16 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3266
3339
|
}
|
|
3267
3340
|
}
|
|
3268
3341
|
},
|
|
3269
|
-
/* @__PURE__ */
|
|
3342
|
+
/* @__PURE__ */ React30.createElement(
|
|
3270
3343
|
WarningVariableTag,
|
|
3271
3344
|
{
|
|
3272
3345
|
label: variable.label,
|
|
3273
3346
|
onClick: toggleInfotip,
|
|
3274
|
-
suffix: (0,
|
|
3347
|
+
suffix: (0, import_i18n21.__)("changed", "elementor")
|
|
3275
3348
|
}
|
|
3276
3349
|
)
|
|
3277
|
-
), /* @__PURE__ */
|
|
3278
|
-
|
|
3350
|
+
), /* @__PURE__ */ React30.createElement(
|
|
3351
|
+
import_ui30.Popover,
|
|
3279
3352
|
{
|
|
3280
3353
|
disableScrollLock: true,
|
|
3281
3354
|
anchorEl: anchorRef.current,
|
|
@@ -3284,9 +3357,9 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3284
3357
|
PaperProps: {
|
|
3285
3358
|
sx: { my: 1 }
|
|
3286
3359
|
},
|
|
3287
|
-
...(0,
|
|
3360
|
+
...(0, import_ui30.bindPopover)(popupState)
|
|
3288
3361
|
},
|
|
3289
|
-
/* @__PURE__ */
|
|
3362
|
+
/* @__PURE__ */ React30.createElement(
|
|
3290
3363
|
VariableSelectionPopover,
|
|
3291
3364
|
{
|
|
3292
3365
|
selectedVariable: variable,
|
|
@@ -3298,28 +3371,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3298
3371
|
};
|
|
3299
3372
|
|
|
3300
3373
|
// src/components/ui/variable/missing-variable.tsx
|
|
3301
|
-
var
|
|
3302
|
-
var
|
|
3374
|
+
var React32 = __toESM(require("react"));
|
|
3375
|
+
var import_react24 = require("react");
|
|
3303
3376
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3304
|
-
var
|
|
3305
|
-
var
|
|
3377
|
+
var import_ui32 = require("@elementor/ui");
|
|
3378
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
3306
3379
|
|
|
3307
3380
|
// src/components/ui/missing-variable-alert.tsx
|
|
3308
|
-
var
|
|
3309
|
-
var
|
|
3310
|
-
var
|
|
3381
|
+
var React31 = __toESM(require("react"));
|
|
3382
|
+
var import_ui31 = require("@elementor/ui");
|
|
3383
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
3311
3384
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3312
|
-
return /* @__PURE__ */
|
|
3313
|
-
|
|
3385
|
+
return /* @__PURE__ */ React31.createElement(import_ui31.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React31.createElement(
|
|
3386
|
+
import_ui31.Alert,
|
|
3314
3387
|
{
|
|
3315
3388
|
variant: "standard",
|
|
3316
3389
|
severity: "warning",
|
|
3317
3390
|
onClose,
|
|
3318
|
-
action: /* @__PURE__ */
|
|
3391
|
+
action: /* @__PURE__ */ React31.createElement(React31.Fragment, null, onClear && /* @__PURE__ */ React31.createElement(import_ui31.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n22.__)("Clear", "elementor"))),
|
|
3319
3392
|
sx: { maxWidth: 300 }
|
|
3320
3393
|
},
|
|
3321
|
-
/* @__PURE__ */
|
|
3322
|
-
/* @__PURE__ */
|
|
3394
|
+
/* @__PURE__ */ React31.createElement(import_ui31.AlertTitle, null, (0, import_i18n22.__)("This variable is missing", "elementor")),
|
|
3395
|
+
/* @__PURE__ */ React31.createElement(import_ui31.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n22.__)(
|
|
3323
3396
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3324
3397
|
"elementor"
|
|
3325
3398
|
))
|
|
@@ -3329,19 +3402,19 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3329
3402
|
// src/components/ui/variable/missing-variable.tsx
|
|
3330
3403
|
var MissingVariable = () => {
|
|
3331
3404
|
const { setValue } = (0, import_editor_controls10.useBoundProp)();
|
|
3332
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3405
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react24.useState)(false);
|
|
3333
3406
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3334
3407
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3335
3408
|
const clearValue = () => setValue(null);
|
|
3336
|
-
return /* @__PURE__ */
|
|
3337
|
-
|
|
3409
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, infotipVisible && /* @__PURE__ */ React32.createElement(import_ui32.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React32.createElement(
|
|
3410
|
+
import_ui32.Infotip,
|
|
3338
3411
|
{
|
|
3339
3412
|
color: "warning",
|
|
3340
3413
|
placement: "right-start",
|
|
3341
3414
|
open: infotipVisible,
|
|
3342
3415
|
disableHoverListener: true,
|
|
3343
3416
|
onClose: closeInfotip,
|
|
3344
|
-
content: /* @__PURE__ */
|
|
3417
|
+
content: /* @__PURE__ */ React32.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3345
3418
|
slotProps: {
|
|
3346
3419
|
popper: {
|
|
3347
3420
|
modifiers: [
|
|
@@ -3353,7 +3426,7 @@ var MissingVariable = () => {
|
|
|
3353
3426
|
}
|
|
3354
3427
|
}
|
|
3355
3428
|
},
|
|
3356
|
-
/* @__PURE__ */
|
|
3429
|
+
/* @__PURE__ */ React32.createElement(WarningVariableTag, { label: (0, import_i18n23.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3357
3430
|
));
|
|
3358
3431
|
};
|
|
3359
3432
|
|
|
@@ -3363,37 +3436,37 @@ var VariableControl = () => {
|
|
|
3363
3436
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3364
3437
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3365
3438
|
if (!assignedVariable) {
|
|
3366
|
-
return /* @__PURE__ */
|
|
3439
|
+
return /* @__PURE__ */ React33.createElement(MissingVariable, null);
|
|
3367
3440
|
}
|
|
3368
3441
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3369
3442
|
if (assignedVariable?.deleted) {
|
|
3370
|
-
return /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ React33.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3371
3444
|
}
|
|
3372
3445
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3373
3446
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3374
|
-
return /* @__PURE__ */
|
|
3447
|
+
return /* @__PURE__ */ React33.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3375
3448
|
}
|
|
3376
|
-
return /* @__PURE__ */
|
|
3449
|
+
return /* @__PURE__ */ React33.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3377
3450
|
};
|
|
3378
3451
|
|
|
3379
3452
|
// src/hooks/use-prop-variable-action.tsx
|
|
3380
|
-
var
|
|
3453
|
+
var React34 = __toESM(require("react"));
|
|
3381
3454
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
3382
3455
|
var import_icons14 = require("@elementor/icons");
|
|
3383
|
-
var
|
|
3456
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3384
3457
|
var usePropVariableAction = () => {
|
|
3385
3458
|
const { propType, path } = (0, import_editor_editing_panel6.useBoundProp)();
|
|
3386
3459
|
const variable = resolveVariableFromPropType(propType);
|
|
3387
3460
|
return {
|
|
3388
3461
|
visible: Boolean(variable),
|
|
3389
3462
|
icon: import_icons14.ColorFilterIcon,
|
|
3390
|
-
title: (0,
|
|
3463
|
+
title: (0, import_i18n24.__)("Variables", "elementor"),
|
|
3391
3464
|
content: ({ close: closePopover }) => {
|
|
3392
3465
|
if (!variable) {
|
|
3393
3466
|
return null;
|
|
3394
3467
|
}
|
|
3395
3468
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3396
|
-
return /* @__PURE__ */
|
|
3469
|
+
return /* @__PURE__ */ React34.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3397
3470
|
}
|
|
3398
3471
|
};
|
|
3399
3472
|
};
|
|
@@ -3540,19 +3613,19 @@ function initMcp() {
|
|
|
3540
3613
|
}
|
|
3541
3614
|
|
|
3542
3615
|
// src/register-variable-types.tsx
|
|
3543
|
-
var
|
|
3616
|
+
var React37 = __toESM(require("react"));
|
|
3544
3617
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3545
|
-
var
|
|
3618
|
+
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3546
3619
|
var import_icons16 = require("@elementor/icons");
|
|
3547
3620
|
|
|
3548
3621
|
// src/components/fields/color-field.tsx
|
|
3549
|
-
var
|
|
3550
|
-
var
|
|
3551
|
-
var
|
|
3622
|
+
var React35 = __toESM(require("react"));
|
|
3623
|
+
var import_react25 = require("react");
|
|
3624
|
+
var import_ui33 = require("@elementor/ui");
|
|
3552
3625
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3553
|
-
const [color, setColor] = (0,
|
|
3554
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3555
|
-
const defaultRef = (0,
|
|
3626
|
+
const [color, setColor] = (0, import_react25.useState)(value);
|
|
3627
|
+
const [errorMessage, setErrorMessage] = (0, import_react25.useState)("");
|
|
3628
|
+
const defaultRef = (0, import_react25.useRef)(null);
|
|
3556
3629
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3557
3630
|
const handleChange = (newValue) => {
|
|
3558
3631
|
setColor(newValue);
|
|
@@ -3561,8 +3634,8 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3561
3634
|
onValidationChange?.(errorMsg);
|
|
3562
3635
|
onChange(errorMsg ? "" : newValue);
|
|
3563
3636
|
};
|
|
3564
|
-
return /* @__PURE__ */
|
|
3565
|
-
|
|
3637
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3638
|
+
import_ui33.UnstableColorField,
|
|
3566
3639
|
{
|
|
3567
3640
|
id: "color-variable-field",
|
|
3568
3641
|
size: "tiny",
|
|
@@ -3590,21 +3663,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3590
3663
|
};
|
|
3591
3664
|
|
|
3592
3665
|
// src/components/fields/font-field.tsx
|
|
3593
|
-
var
|
|
3594
|
-
var
|
|
3666
|
+
var React36 = __toESM(require("react"));
|
|
3667
|
+
var import_react26 = require("react");
|
|
3595
3668
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
3596
3669
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
3597
3670
|
var import_icons15 = require("@elementor/icons");
|
|
3598
|
-
var
|
|
3599
|
-
var
|
|
3671
|
+
var import_ui34 = require("@elementor/ui");
|
|
3672
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3600
3673
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3601
|
-
const [fontFamily, setFontFamily] = (0,
|
|
3602
|
-
const defaultRef = (0,
|
|
3674
|
+
const [fontFamily, setFontFamily] = (0, import_react26.useState)(value);
|
|
3675
|
+
const defaultRef = (0, import_react26.useRef)(null);
|
|
3603
3676
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3604
|
-
const fontPopoverState = (0,
|
|
3677
|
+
const fontPopoverState = (0, import_ui34.usePopupState)({ variant: "popover" });
|
|
3605
3678
|
const fontFamilies = (0, import_editor_editing_panel7.useFontFamilies)();
|
|
3606
3679
|
const sectionWidth = (0, import_editor_editing_panel7.useSectionWidth)();
|
|
3607
|
-
const mapFontSubs =
|
|
3680
|
+
const mapFontSubs = React36.useMemo(() => {
|
|
3608
3681
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3609
3682
|
label,
|
|
3610
3683
|
items: fonts
|
|
@@ -3620,28 +3693,28 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3620
3693
|
handleChange(newFontFamily);
|
|
3621
3694
|
fontPopoverState.close();
|
|
3622
3695
|
};
|
|
3623
|
-
const id2 = (0,
|
|
3624
|
-
return /* @__PURE__ */
|
|
3625
|
-
|
|
3696
|
+
const id2 = (0, import_react26.useId)();
|
|
3697
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3698
|
+
import_ui34.UnstableTag,
|
|
3626
3699
|
{
|
|
3627
3700
|
id: id2,
|
|
3628
3701
|
variant: "outlined",
|
|
3629
3702
|
label: fontFamily,
|
|
3630
|
-
endIcon: /* @__PURE__ */
|
|
3631
|
-
...(0,
|
|
3703
|
+
endIcon: /* @__PURE__ */ React36.createElement(import_icons15.ChevronDownIcon, { fontSize: "tiny" }),
|
|
3704
|
+
...(0, import_ui34.bindTrigger)(fontPopoverState),
|
|
3632
3705
|
fullWidth: true
|
|
3633
3706
|
}
|
|
3634
|
-
), /* @__PURE__ */
|
|
3635
|
-
|
|
3707
|
+
), /* @__PURE__ */ React36.createElement(
|
|
3708
|
+
import_ui34.Popover,
|
|
3636
3709
|
{
|
|
3637
3710
|
disablePortal: true,
|
|
3638
3711
|
disableScrollLock: true,
|
|
3639
3712
|
anchorEl: anchorRef,
|
|
3640
3713
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3641
3714
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3642
|
-
...(0,
|
|
3715
|
+
...(0, import_ui34.bindPopover)(fontPopoverState)
|
|
3643
3716
|
},
|
|
3644
|
-
/* @__PURE__ */
|
|
3717
|
+
/* @__PURE__ */ React36.createElement(
|
|
3645
3718
|
import_editor_controls12.ItemSelector,
|
|
3646
3719
|
{
|
|
3647
3720
|
id: "font-family-variables-selector",
|
|
@@ -3650,7 +3723,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3650
3723
|
onItemChange: handleFontFamilyChange,
|
|
3651
3724
|
onClose: fontPopoverState.close,
|
|
3652
3725
|
sectionWidth,
|
|
3653
|
-
title: (0,
|
|
3726
|
+
title: (0, import_i18n25.__)("Font family", "elementor"),
|
|
3654
3727
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3655
3728
|
onDebounce: import_editor_controls12.enqueueFont,
|
|
3656
3729
|
icon: import_icons15.TextIcon
|
|
@@ -3679,7 +3752,7 @@ function registerVariableTypes() {
|
|
|
3679
3752
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3680
3753
|
fallbackPropTypeUtil: import_editor_props5.colorPropTypeUtil,
|
|
3681
3754
|
variableType: "color",
|
|
3682
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3755
|
+
startIcon: ({ value }) => /* @__PURE__ */ React37.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3683
3756
|
defaultValue: "#ffffff"
|
|
3684
3757
|
});
|
|
3685
3758
|
registerVariableType({
|
|
@@ -3699,7 +3772,7 @@ function registerVariableTypes() {
|
|
|
3699
3772
|
styleTransformer: EmptyTransformer,
|
|
3700
3773
|
variableType: "size",
|
|
3701
3774
|
selectionFilter: () => [],
|
|
3702
|
-
emptyState: /* @__PURE__ */
|
|
3775
|
+
emptyState: /* @__PURE__ */ React37.createElement(import_editor_ui12.CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3703
3776
|
};
|
|
3704
3777
|
registerVariableType({
|
|
3705
3778
|
...sizePromotions,
|
|
@@ -3713,10 +3786,10 @@ function registerVariableTypes() {
|
|
|
3713
3786
|
}
|
|
3714
3787
|
|
|
3715
3788
|
// src/renderers/style-variables-renderer.tsx
|
|
3716
|
-
var
|
|
3717
|
-
var
|
|
3789
|
+
var React38 = __toESM(require("react"));
|
|
3790
|
+
var import_react27 = require("react");
|
|
3718
3791
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
3719
|
-
var
|
|
3792
|
+
var import_ui35 = require("@elementor/ui");
|
|
3720
3793
|
var VARIABLES_WRAPPER = "body";
|
|
3721
3794
|
function StyleVariablesRenderer() {
|
|
3722
3795
|
const container = usePortalContainer();
|
|
@@ -3727,14 +3800,14 @@ function StyleVariablesRenderer() {
|
|
|
3727
3800
|
}
|
|
3728
3801
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3729
3802
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3730
|
-
return /* @__PURE__ */
|
|
3803
|
+
return /* @__PURE__ */ React38.createElement(import_ui35.Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3731
3804
|
}
|
|
3732
3805
|
function usePortalContainer() {
|
|
3733
3806
|
return (0, import_editor_v1_adapters3.__privateUseListenTo)((0, import_editor_v1_adapters3.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters3.getCanvasIframeDocument)()?.head);
|
|
3734
3807
|
}
|
|
3735
3808
|
function useStyleVariables() {
|
|
3736
|
-
const [variables, setVariables] = (0,
|
|
3737
|
-
(0,
|
|
3809
|
+
const [variables, setVariables] = (0, import_react27.useState)({});
|
|
3810
|
+
(0, import_react27.useEffect)(() => {
|
|
3738
3811
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3739
3812
|
return () => {
|
|
3740
3813
|
unsubscribe();
|
|
@@ -3757,22 +3830,22 @@ var import_editor_controls13 = require("@elementor/editor-controls");
|
|
|
3757
3830
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
3758
3831
|
|
|
3759
3832
|
// src/components/variables-repeater-item-slot.tsx
|
|
3760
|
-
var
|
|
3833
|
+
var React39 = __toESM(require("react"));
|
|
3761
3834
|
var useColorVariable = (value) => {
|
|
3762
3835
|
const variableId = value?.value?.color?.value;
|
|
3763
3836
|
return useVariable(variableId || "");
|
|
3764
3837
|
};
|
|
3765
3838
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3766
3839
|
const colorVariable = useColorVariable(value);
|
|
3767
|
-
return /* @__PURE__ */
|
|
3840
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3768
3841
|
};
|
|
3769
3842
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3770
3843
|
const colorVariable = useColorVariable(value);
|
|
3771
|
-
return /* @__PURE__ */
|
|
3844
|
+
return /* @__PURE__ */ React39.createElement("span", null, colorVariable?.label);
|
|
3772
3845
|
};
|
|
3773
3846
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3774
3847
|
const colorVariable = useColorVariable(value);
|
|
3775
|
-
return /* @__PURE__ */
|
|
3848
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3776
3849
|
};
|
|
3777
3850
|
|
|
3778
3851
|
// src/repeater-injections.ts
|