@elementor/editor-variables 4.0.0-564 → 4.0.0-573
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +520 -545
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -412
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-manager/variables-manager-panel.tsx +31 -3
- package/src/components/ui/stop-sync-confirmation-dialog.tsx +0 -77
package/dist/index.js
CHANGED
|
@@ -50,18 +50,18 @@ var import_editor_props7 = require("@elementor/editor-props");
|
|
|
50
50
|
var import_menus = require("@elementor/menus");
|
|
51
51
|
|
|
52
52
|
// src/components/open-panel-from-url.tsx
|
|
53
|
-
var
|
|
53
|
+
var import_react14 = require("react");
|
|
54
54
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
55
55
|
|
|
56
56
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
57
|
-
var
|
|
58
|
-
var
|
|
57
|
+
var React14 = __toESM(require("react"));
|
|
58
|
+
var import_react13 = require("react");
|
|
59
59
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
60
60
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
61
61
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
62
|
-
var
|
|
63
|
-
var
|
|
64
|
-
var
|
|
62
|
+
var import_icons5 = require("@elementor/icons");
|
|
63
|
+
var import_ui14 = require("@elementor/ui");
|
|
64
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
65
65
|
|
|
66
66
|
// src/utils/tracking.ts
|
|
67
67
|
var import_events = require("@elementor/events");
|
|
@@ -829,52 +829,14 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
829
829
|
);
|
|
830
830
|
};
|
|
831
831
|
|
|
832
|
-
// src/components/ui/stop-sync-confirmation-dialog.tsx
|
|
833
|
-
var React5 = __toESM(require("react"));
|
|
834
|
-
var import_react = require("react");
|
|
835
|
-
var import_icons2 = require("@elementor/icons");
|
|
836
|
-
var import_ui6 = require("@elementor/ui");
|
|
837
|
-
var import_i18n7 = require("@wordpress/i18n");
|
|
838
|
-
var StopSyncConfirmationDialog = ({
|
|
839
|
-
open,
|
|
840
|
-
closeDialog,
|
|
841
|
-
onConfirm,
|
|
842
|
-
onSuppressMessage
|
|
843
|
-
}) => {
|
|
844
|
-
const [dontShowAgain, setDontShowAgain] = (0, import_react.useState)(false);
|
|
845
|
-
const handleConfirm = () => {
|
|
846
|
-
if (dontShowAgain) {
|
|
847
|
-
onSuppressMessage?.();
|
|
848
|
-
}
|
|
849
|
-
onConfirm();
|
|
850
|
-
};
|
|
851
|
-
return /* @__PURE__ */ React5.createElement(import_ui6.Dialog, { open, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React5.createElement(import_ui6.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React5.createElement(import_icons2.BrushIcon, { color: "secondary" }), (0, import_i18n7.__)("Stop syncing variable color", "elementor")), /* @__PURE__ */ React5.createElement(import_ui6.DialogContent, null, /* @__PURE__ */ React5.createElement(import_ui6.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n7.__)(
|
|
852
|
-
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
853
|
-
"elementor"
|
|
854
|
-
))), /* @__PURE__ */ React5.createElement(import_ui6.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React5.createElement(
|
|
855
|
-
import_ui6.FormControlLabel,
|
|
856
|
-
{
|
|
857
|
-
control: /* @__PURE__ */ React5.createElement(
|
|
858
|
-
import_ui6.Checkbox,
|
|
859
|
-
{
|
|
860
|
-
checked: dontShowAgain,
|
|
861
|
-
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
862
|
-
size: "small"
|
|
863
|
-
}
|
|
864
|
-
),
|
|
865
|
-
label: /* @__PURE__ */ React5.createElement(import_ui6.Typography, { variant: "body2" }, (0, import_i18n7.__)("Don't show this again", "elementor"))
|
|
866
|
-
}
|
|
867
|
-
), /* @__PURE__ */ React5.createElement("div", null, /* @__PURE__ */ React5.createElement(import_ui6.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n7.__)("Cancel", "elementor")), /* @__PURE__ */ React5.createElement(import_ui6.Button, { variant: "contained", color: "secondary", onClick: handleConfirm, sx: { ml: 1 } }, (0, import_i18n7.__)("Got it", "elementor")))));
|
|
868
|
-
};
|
|
869
|
-
|
|
870
832
|
// src/components/variables-manager/hooks/use-auto-edit.ts
|
|
871
|
-
var
|
|
833
|
+
var import_react = require("react");
|
|
872
834
|
var useAutoEdit = () => {
|
|
873
|
-
const [autoEditVariableId, setAutoEditVariableId] = (0,
|
|
874
|
-
const startAutoEdit = (0,
|
|
835
|
+
const [autoEditVariableId, setAutoEditVariableId] = (0, import_react.useState)(void 0);
|
|
836
|
+
const startAutoEdit = (0, import_react.useCallback)((variableId) => {
|
|
875
837
|
setAutoEditVariableId(variableId);
|
|
876
838
|
}, []);
|
|
877
|
-
const handleAutoEditComplete = (0,
|
|
839
|
+
const handleAutoEditComplete = (0, import_react.useCallback)(() => {
|
|
878
840
|
setTimeout(() => {
|
|
879
841
|
setAutoEditVariableId(void 0);
|
|
880
842
|
}, 100);
|
|
@@ -887,10 +849,10 @@ var useAutoEdit = () => {
|
|
|
887
849
|
};
|
|
888
850
|
|
|
889
851
|
// src/components/variables-manager/hooks/use-error-navigation.ts
|
|
890
|
-
var
|
|
852
|
+
var import_react2 = require("react");
|
|
891
853
|
var useErrorNavigation = () => {
|
|
892
|
-
const currentIndexRef = (0,
|
|
893
|
-
const createNavigationCallback = (0,
|
|
854
|
+
const currentIndexRef = (0, import_react2.useRef)(0);
|
|
855
|
+
const createNavigationCallback = (0, import_react2.useCallback)(
|
|
894
856
|
(ids, onNavigate, onComplete) => {
|
|
895
857
|
return () => {
|
|
896
858
|
if (!ids?.length) {
|
|
@@ -912,7 +874,7 @@ var useErrorNavigation = () => {
|
|
|
912
874
|
},
|
|
913
875
|
[]
|
|
914
876
|
);
|
|
915
|
-
const resetNavigation = (0,
|
|
877
|
+
const resetNavigation = (0, import_react2.useCallback)(() => {
|
|
916
878
|
currentIndexRef.current = 0;
|
|
917
879
|
}, []);
|
|
918
880
|
return {
|
|
@@ -922,21 +884,21 @@ var useErrorNavigation = () => {
|
|
|
922
884
|
};
|
|
923
885
|
|
|
924
886
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
925
|
-
var
|
|
887
|
+
var import_react5 = require("react");
|
|
926
888
|
|
|
927
889
|
// src/hooks/use-prop-variables.ts
|
|
928
|
-
var
|
|
890
|
+
var import_react4 = require("react");
|
|
929
891
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
930
892
|
|
|
931
893
|
// src/context/variable-type-context.tsx
|
|
932
|
-
var
|
|
933
|
-
var
|
|
934
|
-
var VariableTypeContext = (0,
|
|
894
|
+
var React5 = __toESM(require("react"));
|
|
895
|
+
var import_react3 = require("react");
|
|
896
|
+
var VariableTypeContext = (0, import_react3.createContext)(null);
|
|
935
897
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
936
|
-
return /* @__PURE__ */
|
|
898
|
+
return /* @__PURE__ */ React5.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
937
899
|
}
|
|
938
900
|
function useVariableType() {
|
|
939
|
-
const context = (0,
|
|
901
|
+
const context = (0, import_react3.useContext)(VariableTypeContext);
|
|
940
902
|
if (context === null) {
|
|
941
903
|
throw new Error("useVariableType must be used within a VariableTypeProvider");
|
|
942
904
|
}
|
|
@@ -1019,7 +981,7 @@ var useVariableSelectionFilter = (variables) => {
|
|
|
1019
981
|
return selectionFilter ? selectionFilter(variables, propType) : variables;
|
|
1020
982
|
};
|
|
1021
983
|
var usePropVariables = (propKey) => {
|
|
1022
|
-
return (0,
|
|
984
|
+
return (0, import_react4.useMemo)(() => normalizeVariables(propKey), [propKey]);
|
|
1023
985
|
};
|
|
1024
986
|
var getMatchingTypes = (propKey) => {
|
|
1025
987
|
const matchingTypes = [];
|
|
@@ -1053,20 +1015,20 @@ var restoreVariable = (restoreId, label, value, type) => {
|
|
|
1053
1015
|
|
|
1054
1016
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
1055
1017
|
var useVariablesManagerState = () => {
|
|
1056
|
-
const [variables, setVariables] = (0,
|
|
1057
|
-
const [deletedVariables, setDeletedVariables] = (0,
|
|
1058
|
-
const [isSaveDisabled, setIsSaveDisabled] = (0,
|
|
1059
|
-
const [isDirty, setIsDirty] = (0,
|
|
1060
|
-
const [isSaving, setIsSaving] = (0,
|
|
1061
|
-
const [searchValue, setSearchValue] = (0,
|
|
1062
|
-
const handleOnChange = (0,
|
|
1018
|
+
const [variables, setVariables] = (0, import_react5.useState)(() => getVariables(false));
|
|
1019
|
+
const [deletedVariables, setDeletedVariables] = (0, import_react5.useState)([]);
|
|
1020
|
+
const [isSaveDisabled, setIsSaveDisabled] = (0, import_react5.useState)(false);
|
|
1021
|
+
const [isDirty, setIsDirty] = (0, import_react5.useState)(false);
|
|
1022
|
+
const [isSaving, setIsSaving] = (0, import_react5.useState)(false);
|
|
1023
|
+
const [searchValue, setSearchValue] = (0, import_react5.useState)("");
|
|
1024
|
+
const handleOnChange = (0, import_react5.useCallback)(
|
|
1063
1025
|
(newVariables) => {
|
|
1064
1026
|
setVariables({ ...variables, ...newVariables });
|
|
1065
1027
|
setIsDirty(true);
|
|
1066
1028
|
},
|
|
1067
1029
|
[variables]
|
|
1068
1030
|
);
|
|
1069
|
-
const createVariable2 = (0,
|
|
1031
|
+
const createVariable2 = (0, import_react5.useCallback)((type, defaultName, defaultValue) => {
|
|
1070
1032
|
const newId = generateTempId();
|
|
1071
1033
|
const newVariable = {
|
|
1072
1034
|
id: newId,
|
|
@@ -1078,19 +1040,19 @@ var useVariablesManagerState = () => {
|
|
|
1078
1040
|
setIsDirty(true);
|
|
1079
1041
|
return newId;
|
|
1080
1042
|
}, []);
|
|
1081
|
-
const handleDeleteVariable = (0,
|
|
1043
|
+
const handleDeleteVariable = (0, import_react5.useCallback)((itemId) => {
|
|
1082
1044
|
setDeletedVariables((prev) => [...prev, itemId]);
|
|
1083
1045
|
setVariables((prev) => ({ ...prev, [itemId]: { ...prev[itemId], deleted: true } }));
|
|
1084
1046
|
setIsDirty(true);
|
|
1085
1047
|
}, []);
|
|
1086
|
-
const handleStartSync = (0,
|
|
1048
|
+
const handleStartSync = (0, import_react5.useCallback)((itemId) => {
|
|
1087
1049
|
setVariables((prev) => ({
|
|
1088
1050
|
...prev,
|
|
1089
1051
|
[itemId]: { ...prev[itemId], sync_to_v3: true }
|
|
1090
1052
|
}));
|
|
1091
1053
|
setIsDirty(true);
|
|
1092
1054
|
}, []);
|
|
1093
|
-
const handleStopSync = (0,
|
|
1055
|
+
const handleStopSync = (0, import_react5.useCallback)((itemId) => {
|
|
1094
1056
|
setVariables((prev) => ({
|
|
1095
1057
|
...prev,
|
|
1096
1058
|
[itemId]: { ...prev[itemId], sync_to_v3: false }
|
|
@@ -1100,7 +1062,7 @@ var useVariablesManagerState = () => {
|
|
|
1100
1062
|
const handleSearch = (searchTerm) => {
|
|
1101
1063
|
setSearchValue(searchTerm);
|
|
1102
1064
|
};
|
|
1103
|
-
const handleSave = (0,
|
|
1065
|
+
const handleSave = (0, import_react5.useCallback)(async () => {
|
|
1104
1066
|
const originalVariables = getVariables(false);
|
|
1105
1067
|
setIsSaving(true);
|
|
1106
1068
|
const result = await service.batchSave(originalVariables, variables, deletedVariables);
|
|
@@ -1113,7 +1075,7 @@ var useVariablesManagerState = () => {
|
|
|
1113
1075
|
}
|
|
1114
1076
|
return { success: result.success };
|
|
1115
1077
|
}, [variables, deletedVariables]);
|
|
1116
|
-
const filteredVariables = (0,
|
|
1078
|
+
const filteredVariables = (0, import_react5.useCallback)(() => {
|
|
1117
1079
|
const list = variablesToList(variables).filter((v) => !v.deleted);
|
|
1118
1080
|
const typeFiltered = applySelectionFilters(list, getVariableTypes());
|
|
1119
1081
|
const searchFiltered = filterBySearch(typeFiltered, searchValue);
|
|
@@ -1139,12 +1101,12 @@ var useVariablesManagerState = () => {
|
|
|
1139
1101
|
};
|
|
1140
1102
|
|
|
1141
1103
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1142
|
-
var
|
|
1143
|
-
var
|
|
1144
|
-
var
|
|
1145
|
-
var
|
|
1104
|
+
var React7 = __toESM(require("react"));
|
|
1105
|
+
var import_react7 = require("react");
|
|
1106
|
+
var import_icons2 = require("@elementor/icons");
|
|
1107
|
+
var import_ui7 = require("@elementor/ui");
|
|
1146
1108
|
var import_utils2 = require("@elementor/utils");
|
|
1147
|
-
var
|
|
1109
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1148
1110
|
|
|
1149
1111
|
// src/hooks/use-quota-permissions.ts
|
|
1150
1112
|
var useQuotaPermissions = (variableType) => {
|
|
@@ -1162,43 +1124,43 @@ var useQuotaPermissions = (variableType) => {
|
|
|
1162
1124
|
};
|
|
1163
1125
|
|
|
1164
1126
|
// src/components/ui/variable-promotion-chip.tsx
|
|
1165
|
-
var
|
|
1166
|
-
var
|
|
1127
|
+
var React6 = __toESM(require("react"));
|
|
1128
|
+
var import_react6 = require("react");
|
|
1167
1129
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1168
|
-
var
|
|
1130
|
+
var import_ui6 = require("@elementor/ui");
|
|
1169
1131
|
var import_utils = require("@elementor/utils");
|
|
1170
|
-
var
|
|
1171
|
-
var VariablePromotionChip = (0,
|
|
1132
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
1133
|
+
var VariablePromotionChip = (0, import_react6.forwardRef)(
|
|
1172
1134
|
({ variableType, upgradeUrl }, ref) => {
|
|
1173
|
-
const [isOpen, setIsOpen] = (0,
|
|
1135
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
1174
1136
|
(0, import_editor_ui2.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
|
|
1175
1137
|
const toggle = () => setIsOpen((prev) => !prev);
|
|
1176
|
-
(0,
|
|
1177
|
-
const title = (0,
|
|
1138
|
+
(0, import_react6.useImperativeHandle)(ref, () => ({ toggle }), []);
|
|
1139
|
+
const title = (0, import_i18n7.sprintf)(
|
|
1178
1140
|
/* translators: %s: Variable Type. */
|
|
1179
|
-
(0,
|
|
1141
|
+
(0, import_i18n7.__)("%s variables", "elementor"),
|
|
1180
1142
|
(0, import_utils.capitalize)(variableType)
|
|
1181
1143
|
);
|
|
1182
|
-
const content = (0,
|
|
1144
|
+
const content = (0, import_i18n7.sprintf)(
|
|
1183
1145
|
/* translators: %s: Variable Type. */
|
|
1184
|
-
(0,
|
|
1146
|
+
(0, import_i18n7.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1185
1147
|
variableType
|
|
1186
1148
|
);
|
|
1187
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ React6.createElement(
|
|
1188
1150
|
import_editor_ui2.PromotionPopover,
|
|
1189
1151
|
{
|
|
1190
1152
|
open: isOpen,
|
|
1191
1153
|
title,
|
|
1192
1154
|
content,
|
|
1193
|
-
ctaText: (0,
|
|
1155
|
+
ctaText: (0, import_i18n7.__)("Upgrade now", "elementor"),
|
|
1194
1156
|
ctaUrl: upgradeUrl,
|
|
1195
1157
|
onClose: (e) => {
|
|
1196
1158
|
e.stopPropagation();
|
|
1197
1159
|
setIsOpen(false);
|
|
1198
1160
|
}
|
|
1199
1161
|
},
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
-
|
|
1162
|
+
/* @__PURE__ */ React6.createElement(
|
|
1163
|
+
import_ui6.Box,
|
|
1202
1164
|
{
|
|
1203
1165
|
onClick: (e) => {
|
|
1204
1166
|
e.stopPropagation();
|
|
@@ -1206,7 +1168,7 @@ var VariablePromotionChip = (0, import_react7.forwardRef)(
|
|
|
1206
1168
|
},
|
|
1207
1169
|
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1208
1170
|
},
|
|
1209
|
-
/* @__PURE__ */
|
|
1171
|
+
/* @__PURE__ */ React6.createElement(import_editor_ui2.PromotionChip, null)
|
|
1210
1172
|
)
|
|
1211
1173
|
);
|
|
1212
1174
|
}
|
|
@@ -1215,9 +1177,9 @@ var VariablePromotionChip = (0, import_react7.forwardRef)(
|
|
|
1215
1177
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1216
1178
|
var SIZE = "tiny";
|
|
1217
1179
|
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1218
|
-
const buttonRef = (0,
|
|
1180
|
+
const buttonRef = (0, import_react7.useRef)(null);
|
|
1219
1181
|
const variableTypes = getVariableTypes();
|
|
1220
|
-
const menuOptionConfigs = (0,
|
|
1182
|
+
const menuOptionConfigs = (0, import_react7.useMemo)(
|
|
1221
1183
|
() => Object.entries(variableTypes).filter(([, variable]) => !!variable.defaultValue).map(([key, variable]) => ({
|
|
1222
1184
|
key,
|
|
1223
1185
|
propTypeKey: variable.propTypeUtil.key,
|
|
@@ -1227,17 +1189,17 @@ var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
|
1227
1189
|
})),
|
|
1228
1190
|
[variableTypes]
|
|
1229
1191
|
);
|
|
1230
|
-
return /* @__PURE__ */
|
|
1231
|
-
|
|
1192
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
1193
|
+
import_ui7.IconButton,
|
|
1232
1194
|
{
|
|
1233
|
-
...(0,
|
|
1195
|
+
...(0, import_ui7.bindTrigger)(menuState),
|
|
1234
1196
|
ref: buttonRef,
|
|
1235
1197
|
size: SIZE,
|
|
1236
|
-
"aria-label": (0,
|
|
1198
|
+
"aria-label": (0, import_i18n8.__)("Add variable", "elementor")
|
|
1237
1199
|
},
|
|
1238
|
-
/* @__PURE__ */
|
|
1239
|
-
), /* @__PURE__ */
|
|
1240
|
-
|
|
1200
|
+
/* @__PURE__ */ React7.createElement(import_icons2.PlusIcon, { fontSize: SIZE })
|
|
1201
|
+
), /* @__PURE__ */ React7.createElement(
|
|
1202
|
+
import_ui7.Menu,
|
|
1241
1203
|
{
|
|
1242
1204
|
disablePortal: true,
|
|
1243
1205
|
MenuListProps: {
|
|
@@ -1246,7 +1208,7 @@ var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
|
1246
1208
|
PaperProps: {
|
|
1247
1209
|
elevation: 6
|
|
1248
1210
|
},
|
|
1249
|
-
...(0,
|
|
1211
|
+
...(0, import_ui7.bindMenu)(menuState),
|
|
1250
1212
|
anchorEl: buttonRef.current,
|
|
1251
1213
|
anchorOrigin: {
|
|
1252
1214
|
vertical: "bottom",
|
|
@@ -1258,7 +1220,7 @@ var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
|
1258
1220
|
},
|
|
1259
1221
|
"data-testid": "variable-manager-create-menu"
|
|
1260
1222
|
},
|
|
1261
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1223
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React7.createElement(
|
|
1262
1224
|
MenuOption,
|
|
1263
1225
|
{
|
|
1264
1226
|
key: config.key,
|
|
@@ -1276,7 +1238,7 @@ var MenuOption = ({
|
|
|
1276
1238
|
onCreate,
|
|
1277
1239
|
onClose
|
|
1278
1240
|
}) => {
|
|
1279
|
-
const promotionRef = (0,
|
|
1241
|
+
const promotionRef = (0, import_react7.useRef)(null);
|
|
1280
1242
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1281
1243
|
const displayName = (0, import_utils2.capitalize)(config.variableType);
|
|
1282
1244
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
@@ -1290,7 +1252,7 @@ var MenuOption = ({
|
|
|
1290
1252
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1291
1253
|
onClose();
|
|
1292
1254
|
};
|
|
1293
|
-
return /* @__PURE__ */
|
|
1255
|
+
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(
|
|
1294
1256
|
VariablePromotionChip,
|
|
1295
1257
|
{
|
|
1296
1258
|
variableType: config.variableType,
|
|
@@ -1311,14 +1273,14 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1311
1273
|
};
|
|
1312
1274
|
|
|
1313
1275
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1314
|
-
var
|
|
1315
|
-
var
|
|
1316
|
-
var
|
|
1317
|
-
var
|
|
1276
|
+
var React13 = __toESM(require("react"));
|
|
1277
|
+
var import_react12 = require("react");
|
|
1278
|
+
var import_ui13 = require("@elementor/ui");
|
|
1279
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1318
1280
|
|
|
1319
1281
|
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1320
|
-
var
|
|
1321
|
-
var
|
|
1282
|
+
var React8 = __toESM(require("react"));
|
|
1283
|
+
var import_ui8 = require("@elementor/ui");
|
|
1322
1284
|
var VariableTableCell = ({
|
|
1323
1285
|
children,
|
|
1324
1286
|
isHeader,
|
|
@@ -1337,26 +1299,26 @@ var VariableTableCell = ({
|
|
|
1337
1299
|
...width && { width },
|
|
1338
1300
|
...sx
|
|
1339
1301
|
};
|
|
1340
|
-
return /* @__PURE__ */
|
|
1302
|
+
return /* @__PURE__ */ React8.createElement(import_ui8.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1341
1303
|
};
|
|
1342
1304
|
|
|
1343
1305
|
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1344
|
-
var
|
|
1345
|
-
var
|
|
1306
|
+
var React12 = __toESM(require("react"));
|
|
1307
|
+
var import_react11 = require("react");
|
|
1346
1308
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1347
|
-
var
|
|
1348
|
-
var
|
|
1309
|
+
var import_icons4 = require("@elementor/icons");
|
|
1310
|
+
var import_ui12 = require("@elementor/ui");
|
|
1349
1311
|
|
|
1350
1312
|
// src/components/fields/label-field.tsx
|
|
1351
|
-
var
|
|
1352
|
-
var
|
|
1313
|
+
var React9 = __toESM(require("react"));
|
|
1314
|
+
var import_react8 = require("react");
|
|
1353
1315
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1354
|
-
var
|
|
1316
|
+
var import_ui9 = require("@elementor/ui");
|
|
1355
1317
|
function isLabelEqual(a, b) {
|
|
1356
1318
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1357
1319
|
}
|
|
1358
1320
|
var useLabelError = (initialError) => {
|
|
1359
|
-
const [error, setError] = (0,
|
|
1321
|
+
const [error, setError] = (0, import_react8.useState)(initialError ?? { value: "", message: "" });
|
|
1360
1322
|
return {
|
|
1361
1323
|
labelFieldError: error,
|
|
1362
1324
|
setLabelFieldError: setError
|
|
@@ -1375,9 +1337,9 @@ var LabelField = ({
|
|
|
1375
1337
|
variables,
|
|
1376
1338
|
onKeyDown
|
|
1377
1339
|
}) => {
|
|
1378
|
-
const [label, setLabel] = (0,
|
|
1379
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
1380
|
-
const fieldRef = (0,
|
|
1340
|
+
const [label, setLabel] = (0, import_react8.useState)(value);
|
|
1341
|
+
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
|
1342
|
+
const fieldRef = (0, import_react8.useRef)(null);
|
|
1381
1343
|
const handleChange = (newValue) => {
|
|
1382
1344
|
setLabel(newValue);
|
|
1383
1345
|
const errorMsg2 = validateLabel(newValue, variables);
|
|
@@ -1390,8 +1352,8 @@ var LabelField = ({
|
|
|
1390
1352
|
errorMsg = error.message;
|
|
1391
1353
|
}
|
|
1392
1354
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1393
|
-
const textField = /* @__PURE__ */
|
|
1394
|
-
|
|
1355
|
+
const textField = /* @__PURE__ */ React9.createElement(
|
|
1356
|
+
import_ui9.TextField,
|
|
1395
1357
|
{
|
|
1396
1358
|
ref: fieldRef,
|
|
1397
1359
|
id: id2,
|
|
@@ -1411,7 +1373,7 @@ var LabelField = ({
|
|
|
1411
1373
|
);
|
|
1412
1374
|
if (showWarningInfotip) {
|
|
1413
1375
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1414
|
-
return /* @__PURE__ */
|
|
1376
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1415
1377
|
import_editor_ui3.WarningInfotip,
|
|
1416
1378
|
{
|
|
1417
1379
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1428,10 +1390,10 @@ var LabelField = ({
|
|
|
1428
1390
|
};
|
|
1429
1391
|
|
|
1430
1392
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1431
|
-
var
|
|
1432
|
-
var
|
|
1433
|
-
var
|
|
1434
|
-
var VariableEditableCell =
|
|
1393
|
+
var React10 = __toESM(require("react"));
|
|
1394
|
+
var import_react9 = require("react");
|
|
1395
|
+
var import_ui10 = require("@elementor/ui");
|
|
1396
|
+
var VariableEditableCell = React10.memo(
|
|
1435
1397
|
({
|
|
1436
1398
|
initialValue,
|
|
1437
1399
|
children,
|
|
@@ -1445,22 +1407,22 @@ var VariableEditableCell = React11.memo(
|
|
|
1445
1407
|
fieldType,
|
|
1446
1408
|
disabled = false
|
|
1447
1409
|
}) => {
|
|
1448
|
-
const [value, setValue] = (0,
|
|
1449
|
-
const [isEditing, setIsEditing] = (0,
|
|
1410
|
+
const [value, setValue] = (0, import_react9.useState)(initialValue);
|
|
1411
|
+
const [isEditing, setIsEditing] = (0, import_react9.useState)(false);
|
|
1450
1412
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1451
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
1452
|
-
const rowRef = (0,
|
|
1453
|
-
const handleSave = (0,
|
|
1413
|
+
const [valueFieldError, setValueFieldError] = (0, import_react9.useState)("");
|
|
1414
|
+
const rowRef = (0, import_react9.useRef)(null);
|
|
1415
|
+
const handleSave = (0, import_react9.useCallback)(() => {
|
|
1454
1416
|
const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
|
|
1455
1417
|
if (!hasError) {
|
|
1456
1418
|
onChange(value);
|
|
1457
1419
|
}
|
|
1458
1420
|
setIsEditing(false);
|
|
1459
1421
|
}, [value, onChange, fieldType, labelFieldError, valueFieldError]);
|
|
1460
|
-
(0,
|
|
1422
|
+
(0, import_react9.useEffect)(() => {
|
|
1461
1423
|
onRowRef?.(rowRef?.current);
|
|
1462
1424
|
}, [onRowRef]);
|
|
1463
|
-
(0,
|
|
1425
|
+
(0, import_react9.useEffect)(() => {
|
|
1464
1426
|
if (autoEdit && !isEditing && !disabled) {
|
|
1465
1427
|
setIsEditing(true);
|
|
1466
1428
|
onAutoEditComplete?.();
|
|
@@ -1486,10 +1448,10 @@ var VariableEditableCell = React11.memo(
|
|
|
1486
1448
|
setIsEditing(true);
|
|
1487
1449
|
}
|
|
1488
1450
|
};
|
|
1489
|
-
const handleChange = (0,
|
|
1451
|
+
const handleChange = (0, import_react9.useCallback)((newValue) => {
|
|
1490
1452
|
setValue(newValue);
|
|
1491
1453
|
}, []);
|
|
1492
|
-
const handleValidationChange = (0,
|
|
1454
|
+
const handleValidationChange = (0, import_react9.useCallback)(
|
|
1493
1455
|
(errorMsg) => {
|
|
1494
1456
|
if (fieldType === "label") {
|
|
1495
1457
|
setLabelFieldError({
|
|
@@ -1515,8 +1477,8 @@ var VariableEditableCell = React11.memo(
|
|
|
1515
1477
|
error: currentError
|
|
1516
1478
|
});
|
|
1517
1479
|
if (isEditing) {
|
|
1518
|
-
return /* @__PURE__ */
|
|
1519
|
-
|
|
1480
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React10.createElement(
|
|
1481
|
+
import_ui10.Stack,
|
|
1520
1482
|
{
|
|
1521
1483
|
ref: rowRef,
|
|
1522
1484
|
direction: "row",
|
|
@@ -1532,8 +1494,8 @@ var VariableEditableCell = React11.memo(
|
|
|
1532
1494
|
editableContent
|
|
1533
1495
|
));
|
|
1534
1496
|
}
|
|
1535
|
-
return /* @__PURE__ */
|
|
1536
|
-
|
|
1497
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1498
|
+
import_ui10.Stack,
|
|
1537
1499
|
{
|
|
1538
1500
|
ref: rowRef,
|
|
1539
1501
|
direction: "row",
|
|
@@ -1552,17 +1514,17 @@ var VariableEditableCell = React11.memo(
|
|
|
1552
1514
|
);
|
|
1553
1515
|
|
|
1554
1516
|
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1555
|
-
var
|
|
1556
|
-
var
|
|
1557
|
-
var
|
|
1558
|
-
var
|
|
1517
|
+
var React11 = __toESM(require("react"));
|
|
1518
|
+
var import_react10 = require("react");
|
|
1519
|
+
var import_icons3 = require("@elementor/icons");
|
|
1520
|
+
var import_ui11 = require("@elementor/ui");
|
|
1559
1521
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1560
|
-
const menuState = (0,
|
|
1522
|
+
const menuState = (0, import_ui11.usePopupState)({
|
|
1561
1523
|
variant: "popover"
|
|
1562
1524
|
});
|
|
1563
|
-
const triggerProps = (0,
|
|
1564
|
-
return /* @__PURE__ */
|
|
1565
|
-
|
|
1525
|
+
const triggerProps = (0, import_ui11.bindTrigger)(menuState);
|
|
1526
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1527
|
+
import_ui11.IconButton,
|
|
1566
1528
|
{
|
|
1567
1529
|
...triggerProps,
|
|
1568
1530
|
disabled,
|
|
@@ -1572,9 +1534,9 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1572
1534
|
triggerProps.onClick?.(e);
|
|
1573
1535
|
}
|
|
1574
1536
|
},
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
), /* @__PURE__ */
|
|
1577
|
-
|
|
1537
|
+
/* @__PURE__ */ React11.createElement(import_icons3.DotsVerticalIcon, { fontSize: "tiny" })
|
|
1538
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1539
|
+
import_ui11.Menu,
|
|
1578
1540
|
{
|
|
1579
1541
|
disablePortal: true,
|
|
1580
1542
|
MenuListProps: {
|
|
@@ -1583,7 +1545,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1583
1545
|
PaperProps: {
|
|
1584
1546
|
elevation: 6
|
|
1585
1547
|
},
|
|
1586
|
-
...(0,
|
|
1548
|
+
...(0, import_ui11.bindMenu)(menuState),
|
|
1587
1549
|
anchorEl: menuState.anchorEl,
|
|
1588
1550
|
anchorOrigin: {
|
|
1589
1551
|
vertical: "bottom",
|
|
@@ -1596,8 +1558,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1596
1558
|
open: menuState.isOpen,
|
|
1597
1559
|
onClose: menuState.close
|
|
1598
1560
|
},
|
|
1599
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
1600
|
-
|
|
1561
|
+
menuActions.map((action) => /* @__PURE__ */ React11.createElement(
|
|
1562
|
+
import_ui11.MenuItem,
|
|
1601
1563
|
{
|
|
1602
1564
|
key: action.name,
|
|
1603
1565
|
onClick: (e) => {
|
|
@@ -1610,7 +1572,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1610
1572
|
gap: 1
|
|
1611
1573
|
}
|
|
1612
1574
|
},
|
|
1613
|
-
action.icon && (0,
|
|
1575
|
+
action.icon && (0, import_react10.createElement)(action.icon, {
|
|
1614
1576
|
fontSize: "inherit"
|
|
1615
1577
|
}),
|
|
1616
1578
|
" ",
|
|
@@ -1640,12 +1602,12 @@ var VariableRow = (props) => {
|
|
|
1640
1602
|
setTriggerRef,
|
|
1641
1603
|
isSorting
|
|
1642
1604
|
} = props;
|
|
1643
|
-
const promotionRef = (0,
|
|
1605
|
+
const promotionRef = (0, import_react11.useRef)(null);
|
|
1644
1606
|
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1645
1607
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1646
1608
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1647
|
-
return /* @__PURE__ */
|
|
1648
|
-
|
|
1609
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1610
|
+
import_ui12.TableRow,
|
|
1649
1611
|
{
|
|
1650
1612
|
...itemProps,
|
|
1651
1613
|
ref: itemProps.ref,
|
|
@@ -1685,8 +1647,8 @@ var VariableRow = (props) => {
|
|
|
1685
1647
|
}
|
|
1686
1648
|
}
|
|
1687
1649
|
},
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1650
|
+
/* @__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" }))),
|
|
1651
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1690
1652
|
VariableEditableCell,
|
|
1691
1653
|
{
|
|
1692
1654
|
initialValue: row.name,
|
|
@@ -1698,11 +1660,11 @@ var VariableRow = (props) => {
|
|
|
1698
1660
|
});
|
|
1699
1661
|
}
|
|
1700
1662
|
},
|
|
1701
|
-
prefixElement: (0,
|
|
1663
|
+
prefixElement: (0, import_react11.createElement)(row.icon, {
|
|
1702
1664
|
fontSize: "inherit",
|
|
1703
1665
|
color: isDisabled ? "disabled" : "inherit"
|
|
1704
1666
|
}),
|
|
1705
|
-
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */
|
|
1667
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React12.createElement(
|
|
1706
1668
|
LabelField,
|
|
1707
1669
|
{
|
|
1708
1670
|
id: "variable-label-" + row.id,
|
|
@@ -1726,9 +1688,9 @@ var VariableRow = (props) => {
|
|
|
1726
1688
|
fieldType: "label",
|
|
1727
1689
|
disabled: isDisabled
|
|
1728
1690
|
},
|
|
1729
|
-
/* @__PURE__ */
|
|
1691
|
+
/* @__PURE__ */ React12.createElement(import_editor_ui4.EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1730
1692
|
)),
|
|
1731
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1732
1694
|
VariableEditableCell,
|
|
1733
1695
|
{
|
|
1734
1696
|
initialValue: row.value,
|
|
@@ -1757,14 +1719,14 @@ var VariableRow = (props) => {
|
|
|
1757
1719
|
onFieldError?.(!!errorMsg);
|
|
1758
1720
|
},
|
|
1759
1721
|
error
|
|
1760
|
-
}) ?? /* @__PURE__ */
|
|
1722
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1761
1723
|
onRowRef: handleRowRef(row.id),
|
|
1762
1724
|
gap: 0.25,
|
|
1763
1725
|
fieldType: "value",
|
|
1764
1726
|
disabled: isDisabled
|
|
1765
1727
|
},
|
|
1766
1728
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1767
|
-
/* @__PURE__ */
|
|
1729
|
+
/* @__PURE__ */ React12.createElement(
|
|
1768
1730
|
import_editor_ui4.EllipsisWithTooltip,
|
|
1769
1731
|
{
|
|
1770
1732
|
title: row.value,
|
|
@@ -1777,14 +1739,14 @@ var VariableRow = (props) => {
|
|
|
1777
1739
|
row.value
|
|
1778
1740
|
)
|
|
1779
1741
|
)),
|
|
1780
|
-
/* @__PURE__ */
|
|
1742
|
+
/* @__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(
|
|
1781
1743
|
VariablePromotionChip,
|
|
1782
1744
|
{
|
|
1783
1745
|
variableType: row.variableType,
|
|
1784
1746
|
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1785
1747
|
ref: promotionRef
|
|
1786
1748
|
}
|
|
1787
|
-
), /* @__PURE__ */
|
|
1749
|
+
), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1788
1750
|
);
|
|
1789
1751
|
};
|
|
1790
1752
|
|
|
@@ -1797,9 +1759,9 @@ var VariablesManagerTable = ({
|
|
|
1797
1759
|
onAutoEditComplete,
|
|
1798
1760
|
onFieldError
|
|
1799
1761
|
}) => {
|
|
1800
|
-
const tableContainerRef = (0,
|
|
1801
|
-
const variableRowRefs = (0,
|
|
1802
|
-
(0,
|
|
1762
|
+
const tableContainerRef = (0, import_react12.useRef)(null);
|
|
1763
|
+
const variableRowRefs = (0, import_react12.useRef)(/* @__PURE__ */ new Map());
|
|
1764
|
+
(0, import_react12.useEffect)(() => {
|
|
1803
1765
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1804
1766
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
1805
1767
|
if (rowElement) {
|
|
@@ -1850,21 +1812,21 @@ var VariablesManagerTable = ({
|
|
|
1850
1812
|
});
|
|
1851
1813
|
handleOnChange(updatedVariables);
|
|
1852
1814
|
};
|
|
1853
|
-
return /* @__PURE__ */
|
|
1854
|
-
|
|
1815
|
+
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(
|
|
1816
|
+
import_ui13.UnstableSortableProvider,
|
|
1855
1817
|
{
|
|
1856
1818
|
value: ids,
|
|
1857
1819
|
onChange: handleReorder,
|
|
1858
1820
|
variant: "static",
|
|
1859
1821
|
restrictAxis: true,
|
|
1860
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1822
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React13.createElement(import_ui13.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React13.createElement(import_ui13.TableBody, null, dragOverlayChildren))
|
|
1861
1823
|
},
|
|
1862
|
-
rows.map((row) => /* @__PURE__ */
|
|
1863
|
-
|
|
1824
|
+
rows.map((row) => /* @__PURE__ */ React13.createElement(
|
|
1825
|
+
import_ui13.UnstableSortableItem,
|
|
1864
1826
|
{
|
|
1865
1827
|
key: row.id,
|
|
1866
1828
|
id: row.id,
|
|
1867
|
-
render: (props) => /* @__PURE__ */
|
|
1829
|
+
render: (props) => /* @__PURE__ */ React13.createElement(
|
|
1868
1830
|
VariableRow,
|
|
1869
1831
|
{
|
|
1870
1832
|
...props,
|
|
@@ -1907,7 +1869,7 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1907
1869
|
function VariablesManagerPanel() {
|
|
1908
1870
|
const { close: closePanel } = usePanelActions();
|
|
1909
1871
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui5.useDialog)();
|
|
1910
|
-
const createMenuState = (0,
|
|
1872
|
+
const createMenuState = (0, import_ui14.usePopupState)({
|
|
1911
1873
|
variant: "popover"
|
|
1912
1874
|
});
|
|
1913
1875
|
const {
|
|
@@ -1928,9 +1890,9 @@ function VariablesManagerPanel() {
|
|
|
1928
1890
|
} = useVariablesManagerState();
|
|
1929
1891
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1930
1892
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1931
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
1932
|
-
const [stopSyncConfirmation, setStopSyncConfirmation] = (0,
|
|
1933
|
-
const [serverError, setServerError] = (0,
|
|
1893
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react13.useState)(null);
|
|
1894
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = (0, import_react13.useState)(null);
|
|
1895
|
+
const [serverError, setServerError] = (0, import_react13.useState)(null);
|
|
1934
1896
|
usePreventUnload(isDirty);
|
|
1935
1897
|
const handleClosePanel = () => {
|
|
1936
1898
|
if (isDirty) {
|
|
@@ -1939,7 +1901,7 @@ function VariablesManagerPanel() {
|
|
|
1939
1901
|
}
|
|
1940
1902
|
closePanel();
|
|
1941
1903
|
};
|
|
1942
|
-
const handleCreateVariable = (0,
|
|
1904
|
+
const handleCreateVariable = (0, import_react13.useCallback)(
|
|
1943
1905
|
(type, defaultName, defaultValue) => {
|
|
1944
1906
|
const newId = createVariable2(type, defaultName, defaultValue);
|
|
1945
1907
|
if (newId) {
|
|
@@ -1973,21 +1935,21 @@ function VariablesManagerPanel() {
|
|
|
1973
1935
|
setIsSaving(false);
|
|
1974
1936
|
}
|
|
1975
1937
|
};
|
|
1976
|
-
const handleDeleteVariableWithConfirmation = (0,
|
|
1938
|
+
const handleDeleteVariableWithConfirmation = (0, import_react13.useCallback)(
|
|
1977
1939
|
(itemId) => {
|
|
1978
1940
|
handleDeleteVariable(itemId);
|
|
1979
1941
|
setDeleteConfirmation(null);
|
|
1980
1942
|
},
|
|
1981
1943
|
[handleDeleteVariable]
|
|
1982
1944
|
);
|
|
1983
|
-
const handleStopSyncWithConfirmation = (0,
|
|
1945
|
+
const handleStopSyncWithConfirmation = (0, import_react13.useCallback)(
|
|
1984
1946
|
(itemId) => {
|
|
1985
1947
|
handleStopSync(itemId);
|
|
1986
1948
|
setStopSyncConfirmation(null);
|
|
1987
1949
|
},
|
|
1988
1950
|
[handleStopSync]
|
|
1989
1951
|
);
|
|
1990
|
-
const buildMenuActions = (0,
|
|
1952
|
+
const buildMenuActions = (0, import_react13.useCallback)(
|
|
1991
1953
|
(variableId) => {
|
|
1992
1954
|
const variable = variables[variableId];
|
|
1993
1955
|
if (!variable) {
|
|
@@ -2002,8 +1964,8 @@ function VariablesManagerPanel() {
|
|
|
2002
1964
|
}
|
|
2003
1965
|
});
|
|
2004
1966
|
const deleteAction = {
|
|
2005
|
-
name: (0,
|
|
2006
|
-
icon:
|
|
1967
|
+
name: (0, import_i18n10.__)("Delete", "elementor"),
|
|
1968
|
+
icon: import_icons5.TrashIcon,
|
|
2007
1969
|
color: "error.main",
|
|
2008
1970
|
onClick: (itemId) => {
|
|
2009
1971
|
const v = variables[itemId];
|
|
@@ -2019,22 +1981,22 @@ function VariablesManagerPanel() {
|
|
|
2019
1981
|
[variables, handleStartSync]
|
|
2020
1982
|
);
|
|
2021
1983
|
const hasVariables = Object.keys(variables).length > 0;
|
|
2022
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ React14.createElement(import_editor_ui5.ThemeProvider, null, /* @__PURE__ */ React14.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React14.createElement(
|
|
2023
1985
|
import_editor_panels.PanelHeader,
|
|
2024
1986
|
{
|
|
2025
1987
|
sx: {
|
|
2026
1988
|
height: "unset"
|
|
2027
1989
|
}
|
|
2028
1990
|
},
|
|
2029
|
-
/* @__PURE__ */
|
|
1991
|
+
/* @__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(
|
|
2030
1992
|
VariableManagerCreateMenu,
|
|
2031
1993
|
{
|
|
2032
1994
|
onCreate: handleCreateVariable,
|
|
2033
1995
|
variables,
|
|
2034
1996
|
menuState: createMenuState
|
|
2035
1997
|
}
|
|
2036
|
-
), /* @__PURE__ */
|
|
2037
|
-
|
|
1998
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1999
|
+
import_ui14.CloseButton,
|
|
2038
2000
|
{
|
|
2039
2001
|
"aria-label": "Close",
|
|
2040
2002
|
slotProps: { icon: { fontSize: SIZE } },
|
|
@@ -2042,19 +2004,19 @@ function VariablesManagerPanel() {
|
|
|
2042
2004
|
handleClosePanel();
|
|
2043
2005
|
}
|
|
2044
2006
|
}
|
|
2045
|
-
))), /* @__PURE__ */
|
|
2007
|
+
))), /* @__PURE__ */ React14.createElement(import_ui14.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(
|
|
2046
2008
|
import_editor_ui5.SearchField,
|
|
2047
2009
|
{
|
|
2048
2010
|
sx: {
|
|
2049
2011
|
display: "flex",
|
|
2050
2012
|
flex: 1
|
|
2051
2013
|
},
|
|
2052
|
-
placeholder: (0,
|
|
2014
|
+
placeholder: (0, import_i18n10.__)("Search", "elementor"),
|
|
2053
2015
|
value: searchValue,
|
|
2054
2016
|
onSearch: handleSearch
|
|
2055
2017
|
}
|
|
2056
|
-
)), /* @__PURE__ */
|
|
2057
|
-
), /* @__PURE__ */
|
|
2018
|
+
)), /* @__PURE__ */ React14.createElement(import_ui14.Divider, { sx: { width: "100%" } }))
|
|
2019
|
+
), /* @__PURE__ */ React14.createElement(
|
|
2058
2020
|
import_editor_panels.PanelBody,
|
|
2059
2021
|
{
|
|
2060
2022
|
sx: {
|
|
@@ -2063,7 +2025,7 @@ function VariablesManagerPanel() {
|
|
|
2063
2025
|
height: "100%"
|
|
2064
2026
|
}
|
|
2065
2027
|
},
|
|
2066
|
-
hasVariables && /* @__PURE__ */
|
|
2028
|
+
hasVariables && /* @__PURE__ */ React14.createElement(
|
|
2067
2029
|
VariablesManagerTable,
|
|
2068
2030
|
{
|
|
2069
2031
|
menuActions: buildMenuActions,
|
|
@@ -2074,43 +2036,43 @@ function VariablesManagerPanel() {
|
|
|
2074
2036
|
onFieldError: setIsSaveDisabled
|
|
2075
2037
|
}
|
|
2076
2038
|
),
|
|
2077
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2039
|
+
!hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
2078
2040
|
NoSearchResults,
|
|
2079
2041
|
{
|
|
2080
2042
|
searchValue,
|
|
2081
2043
|
onClear: () => handleSearch(""),
|
|
2082
|
-
icon: /* @__PURE__ */
|
|
2044
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" })
|
|
2083
2045
|
}
|
|
2084
2046
|
),
|
|
2085
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2047
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
2086
2048
|
EmptyState,
|
|
2087
2049
|
{
|
|
2088
|
-
title: (0,
|
|
2089
|
-
message: (0,
|
|
2050
|
+
title: (0, import_i18n10.__)("Create your first variable", "elementor"),
|
|
2051
|
+
message: (0, import_i18n10.__)(
|
|
2090
2052
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2091
2053
|
"elementor"
|
|
2092
2054
|
),
|
|
2093
|
-
icon: /* @__PURE__ */
|
|
2055
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" }),
|
|
2094
2056
|
onAdd: createMenuState.open
|
|
2095
2057
|
}
|
|
2096
2058
|
)
|
|
2097
|
-
), /* @__PURE__ */
|
|
2098
|
-
|
|
2059
|
+
), /* @__PURE__ */ React14.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
2060
|
+
import_ui14.Infotip,
|
|
2099
2061
|
{
|
|
2100
2062
|
placement: "right",
|
|
2101
2063
|
open: !!serverError,
|
|
2102
|
-
content: serverError ? /* @__PURE__ */
|
|
2103
|
-
|
|
2064
|
+
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
2065
|
+
import_ui14.Alert,
|
|
2104
2066
|
{
|
|
2105
2067
|
severity: serverError.severity ?? "error",
|
|
2106
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2068
|
+
action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(import_ui14.AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
2107
2069
|
onClose: !serverError.action?.label ? () => {
|
|
2108
2070
|
setServerError(null);
|
|
2109
2071
|
setIsSaveDisabled(false);
|
|
2110
2072
|
} : void 0,
|
|
2111
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2073
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(import_icons5.AlertTriangleFilledIcon, null)
|
|
2112
2074
|
},
|
|
2113
|
-
/* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ React14.createElement(import_ui14.AlertTitle, null, serverError.message),
|
|
2114
2076
|
serverError.action?.message
|
|
2115
2077
|
) : null,
|
|
2116
2078
|
arrow: false,
|
|
@@ -2125,8 +2087,8 @@ function VariablesManagerPanel() {
|
|
|
2125
2087
|
}
|
|
2126
2088
|
}
|
|
2127
2089
|
},
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
|
|
2090
|
+
/* @__PURE__ */ React14.createElement(
|
|
2091
|
+
import_ui14.Button,
|
|
2130
2092
|
{
|
|
2131
2093
|
fullWidth: true,
|
|
2132
2094
|
size: "small",
|
|
@@ -2136,9 +2098,9 @@ function VariablesManagerPanel() {
|
|
|
2136
2098
|
onClick: handleSaveClick,
|
|
2137
2099
|
loading: isSaving
|
|
2138
2100
|
},
|
|
2139
|
-
(0,
|
|
2101
|
+
(0, import_i18n10.__)("Save changes", "elementor")
|
|
2140
2102
|
)
|
|
2141
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2103
|
+
))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2142
2104
|
DeleteConfirmationDialog,
|
|
2143
2105
|
{
|
|
2144
2106
|
open: true,
|
|
@@ -2146,26 +2108,26 @@ function VariablesManagerPanel() {
|
|
|
2146
2108
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2147
2109
|
closeDialog: () => setDeleteConfirmation(null)
|
|
2148
2110
|
}
|
|
2149
|
-
), stopSyncConfirmation && /* @__PURE__ */
|
|
2111
|
+
), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2150
2112
|
StopSyncConfirmationDialog,
|
|
2151
2113
|
{
|
|
2152
2114
|
open: true,
|
|
2153
|
-
|
|
2115
|
+
onClose: () => setStopSyncConfirmation(null),
|
|
2154
2116
|
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2155
2117
|
}
|
|
2156
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
2118
|
+
), 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(
|
|
2157
2119
|
import_editor_ui5.SaveChangesDialog.Actions,
|
|
2158
2120
|
{
|
|
2159
2121
|
actions: {
|
|
2160
2122
|
discard: {
|
|
2161
|
-
label: (0,
|
|
2123
|
+
label: (0, import_i18n10.__)("Discard", "elementor"),
|
|
2162
2124
|
action: () => {
|
|
2163
2125
|
closeSaveChangesDialog();
|
|
2164
2126
|
closePanel();
|
|
2165
2127
|
}
|
|
2166
2128
|
},
|
|
2167
2129
|
confirm: {
|
|
2168
|
-
label: (0,
|
|
2130
|
+
label: (0, import_i18n10.__)("Save", "elementor"),
|
|
2169
2131
|
action: async () => {
|
|
2170
2132
|
const result = await handleSaveClick();
|
|
2171
2133
|
closeSaveChangesDialog();
|
|
@@ -2179,7 +2141,7 @@ function VariablesManagerPanel() {
|
|
|
2179
2141
|
)));
|
|
2180
2142
|
}
|
|
2181
2143
|
var usePreventUnload = (isDirty) => {
|
|
2182
|
-
(0,
|
|
2144
|
+
(0, import_react13.useEffect)(() => {
|
|
2183
2145
|
const handleBeforeUnload = (event) => {
|
|
2184
2146
|
if (isDirty) {
|
|
2185
2147
|
event.preventDefault();
|
|
@@ -2191,6 +2153,19 @@ var usePreventUnload = (isDirty) => {
|
|
|
2191
2153
|
};
|
|
2192
2154
|
}, [isDirty]);
|
|
2193
2155
|
};
|
|
2156
|
+
var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Title, { icon: import_icons5.ColorFilterIcon, iconColor: "secondary" }, (0, import_i18n10.__)("Stop syncing variable color", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.ContentText, null, (0, import_i18n10.__)(
|
|
2157
|
+
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
2158
|
+
"elementor"
|
|
2159
|
+
))), /* @__PURE__ */ React14.createElement(
|
|
2160
|
+
import_editor_ui5.ConfirmationDialog.Actions,
|
|
2161
|
+
{
|
|
2162
|
+
onClose,
|
|
2163
|
+
onConfirm,
|
|
2164
|
+
cancelLabel: (0, import_i18n10.__)("Cancel", "elementor"),
|
|
2165
|
+
confirmLabel: (0, import_i18n10.__)("Got it", "elementor"),
|
|
2166
|
+
color: "secondary"
|
|
2167
|
+
}
|
|
2168
|
+
));
|
|
2194
2169
|
|
|
2195
2170
|
// src/components/open-panel-from-url.tsx
|
|
2196
2171
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
@@ -2198,8 +2173,8 @@ var PANEL_ID = "variables-manager";
|
|
|
2198
2173
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2199
2174
|
function OpenPanelFromUrl() {
|
|
2200
2175
|
const { open } = usePanelActions();
|
|
2201
|
-
const hasOpened = (0,
|
|
2202
|
-
(0,
|
|
2176
|
+
const hasOpened = (0, import_react14.useRef)(false);
|
|
2177
|
+
(0, import_react14.useEffect)(() => {
|
|
2203
2178
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2204
2179
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2205
2180
|
if (activePanel !== PANEL_ID) {
|
|
@@ -2220,15 +2195,15 @@ function OpenPanelFromUrl() {
|
|
|
2220
2195
|
}
|
|
2221
2196
|
|
|
2222
2197
|
// src/controls/variable-control.tsx
|
|
2223
|
-
var
|
|
2198
|
+
var React33 = __toESM(require("react"));
|
|
2224
2199
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
2225
2200
|
|
|
2226
2201
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2227
|
-
var
|
|
2228
|
-
var
|
|
2202
|
+
var import_react21 = require("react");
|
|
2203
|
+
var React24 = __toESM(require("react"));
|
|
2229
2204
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2230
|
-
var
|
|
2231
|
-
var
|
|
2205
|
+
var import_icons12 = require("@elementor/icons");
|
|
2206
|
+
var import_ui24 = require("@elementor/ui");
|
|
2232
2207
|
|
|
2233
2208
|
// src/utils/unlink-variable.ts
|
|
2234
2209
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2247,31 +2222,31 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2247
2222
|
}
|
|
2248
2223
|
|
|
2249
2224
|
// src/components/variable-selection-popover.tsx
|
|
2250
|
-
var
|
|
2251
|
-
var
|
|
2225
|
+
var React22 = __toESM(require("react"));
|
|
2226
|
+
var import_react20 = require("react");
|
|
2252
2227
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2253
2228
|
|
|
2254
2229
|
// src/context/variable-selection-popover.context.tsx
|
|
2255
|
-
var
|
|
2256
|
-
var
|
|
2257
|
-
var
|
|
2258
|
-
var PopoverContentRefContext = (0,
|
|
2230
|
+
var React15 = __toESM(require("react"));
|
|
2231
|
+
var import_react15 = require("react");
|
|
2232
|
+
var import_ui15 = require("@elementor/ui");
|
|
2233
|
+
var PopoverContentRefContext = (0, import_react15.createContext)(null);
|
|
2259
2234
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2260
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2261
|
-
return /* @__PURE__ */
|
|
2235
|
+
const [anchorRef, setAnchorRef] = (0, import_react15.useState)(null);
|
|
2236
|
+
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(import_ui15.Box, { ref: setAnchorRef }, children));
|
|
2262
2237
|
};
|
|
2263
2238
|
var usePopoverContentRef = () => {
|
|
2264
|
-
return (0,
|
|
2239
|
+
return (0, import_react15.useContext)(PopoverContentRefContext);
|
|
2265
2240
|
};
|
|
2266
2241
|
|
|
2267
2242
|
// src/components/variable-creation.tsx
|
|
2268
|
-
var
|
|
2269
|
-
var
|
|
2243
|
+
var React17 = __toESM(require("react"));
|
|
2244
|
+
var import_react16 = require("react");
|
|
2270
2245
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2271
2246
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2272
|
-
var
|
|
2273
|
-
var
|
|
2274
|
-
var
|
|
2247
|
+
var import_icons6 = require("@elementor/icons");
|
|
2248
|
+
var import_ui17 = require("@elementor/ui");
|
|
2249
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
2275
2250
|
|
|
2276
2251
|
// src/hooks/use-initial-value.ts
|
|
2277
2252
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -2314,10 +2289,10 @@ var unwrapValue = (input) => {
|
|
|
2314
2289
|
};
|
|
2315
2290
|
|
|
2316
2291
|
// src/components/ui/form-field.tsx
|
|
2317
|
-
var
|
|
2318
|
-
var
|
|
2292
|
+
var React16 = __toESM(require("react"));
|
|
2293
|
+
var import_ui16 = require("@elementor/ui");
|
|
2319
2294
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2320
|
-
return /* @__PURE__ */
|
|
2295
|
+
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)));
|
|
2321
2296
|
};
|
|
2322
2297
|
|
|
2323
2298
|
// src/components/variable-creation.tsx
|
|
@@ -2327,11 +2302,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2327
2302
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2328
2303
|
const { propType } = (0, import_editor_controls4.useBoundProp)();
|
|
2329
2304
|
const initialValue = useInitialValue();
|
|
2330
|
-
const [value, setValue] = (0,
|
|
2331
|
-
const [label, setLabel] = (0,
|
|
2332
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2333
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2334
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2305
|
+
const [value, setValue] = (0, import_react16.useState)(initialValue);
|
|
2306
|
+
const [label, setLabel] = (0, import_react16.useState)("");
|
|
2307
|
+
const [errorMessage, setErrorMessage] = (0, import_react16.useState)("");
|
|
2308
|
+
const [valueFieldError, setValueFieldError] = (0, import_react16.useState)("");
|
|
2309
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react16.useState)(propTypeUtil.key);
|
|
2335
2310
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2336
2311
|
const resetFields = () => {
|
|
2337
2312
|
setValue("");
|
|
@@ -2388,22 +2363,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2388
2363
|
handleCreateAndTrack();
|
|
2389
2364
|
}
|
|
2390
2365
|
};
|
|
2391
|
-
return /* @__PURE__ */
|
|
2366
|
+
return /* @__PURE__ */ React17.createElement(import_editor_ui6.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2392
2367
|
import_editor_ui6.PopoverHeader,
|
|
2393
2368
|
{
|
|
2394
|
-
icon: /* @__PURE__ */
|
|
2395
|
-
title: (0,
|
|
2369
|
+
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 })),
|
|
2370
|
+
title: (0, import_i18n11.__)("Create variable", "elementor"),
|
|
2396
2371
|
onClose: closePopover
|
|
2397
2372
|
}
|
|
2398
|
-
), /* @__PURE__ */
|
|
2373
|
+
), /* @__PURE__ */ React17.createElement(import_ui17.Divider, null), /* @__PURE__ */ React17.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2399
2374
|
FormField,
|
|
2400
2375
|
{
|
|
2401
2376
|
id: "variable-label",
|
|
2402
|
-
label: (0,
|
|
2377
|
+
label: (0, import_i18n11.__)("Name", "elementor"),
|
|
2403
2378
|
errorMsg: labelFieldError?.message,
|
|
2404
2379
|
noticeMsg: labelHint(label)
|
|
2405
2380
|
},
|
|
2406
|
-
/* @__PURE__ */
|
|
2381
|
+
/* @__PURE__ */ React17.createElement(
|
|
2407
2382
|
LabelField,
|
|
2408
2383
|
{
|
|
2409
2384
|
id: "variable-label",
|
|
@@ -2422,7 +2397,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2422
2397
|
onKeyDown: handleKeyDown
|
|
2423
2398
|
}
|
|
2424
2399
|
)
|
|
2425
|
-
), ValueField && /* @__PURE__ */
|
|
2400
|
+
), 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(
|
|
2426
2401
|
ValueField,
|
|
2427
2402
|
{
|
|
2428
2403
|
value,
|
|
@@ -2436,8 +2411,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2436
2411
|
propType,
|
|
2437
2412
|
onKeyDown: handleKeyDown
|
|
2438
2413
|
}
|
|
2439
|
-
))), errorMessage && /* @__PURE__ */
|
|
2440
|
-
|
|
2414
|
+
))), 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(
|
|
2415
|
+
import_ui17.Button,
|
|
2441
2416
|
{
|
|
2442
2417
|
id: "create-variable-button",
|
|
2443
2418
|
size: "small",
|
|
@@ -2445,80 +2420,80 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2445
2420
|
disabled: isSubmitDisabled,
|
|
2446
2421
|
onClick: handleCreateAndTrack
|
|
2447
2422
|
},
|
|
2448
|
-
(0,
|
|
2423
|
+
(0, import_i18n11.__)("Create", "elementor")
|
|
2449
2424
|
)));
|
|
2450
2425
|
};
|
|
2451
2426
|
|
|
2452
2427
|
// src/components/variable-edit.tsx
|
|
2453
|
-
var
|
|
2454
|
-
var
|
|
2428
|
+
var React19 = __toESM(require("react"));
|
|
2429
|
+
var import_react18 = require("react");
|
|
2455
2430
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2456
2431
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2457
2432
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2458
|
-
var import_icons9 = require("@elementor/icons");
|
|
2459
|
-
var import_ui20 = require("@elementor/ui");
|
|
2460
|
-
var import_i18n14 = require("@wordpress/i18n");
|
|
2461
|
-
|
|
2462
|
-
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2463
|
-
var React19 = __toESM(require("react"));
|
|
2464
|
-
var import_react18 = require("react");
|
|
2465
2433
|
var import_icons8 = require("@elementor/icons");
|
|
2466
2434
|
var import_ui19 = require("@elementor/ui");
|
|
2467
2435
|
var import_i18n13 = require("@wordpress/i18n");
|
|
2436
|
+
|
|
2437
|
+
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2438
|
+
var React18 = __toESM(require("react"));
|
|
2439
|
+
var import_react17 = require("react");
|
|
2440
|
+
var import_icons7 = require("@elementor/icons");
|
|
2441
|
+
var import_ui18 = require("@elementor/ui");
|
|
2442
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
2468
2443
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2469
2444
|
var EditConfirmationDialog = ({
|
|
2470
2445
|
closeDialog,
|
|
2471
2446
|
onConfirm,
|
|
2472
2447
|
onSuppressMessage
|
|
2473
2448
|
}) => {
|
|
2474
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2449
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react17.useState)(false);
|
|
2475
2450
|
const handleSave = () => {
|
|
2476
2451
|
if (dontShowAgain) {
|
|
2477
2452
|
onSuppressMessage?.();
|
|
2478
2453
|
}
|
|
2479
2454
|
onConfirm?.();
|
|
2480
2455
|
};
|
|
2481
|
-
return /* @__PURE__ */
|
|
2456
|
+
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.__)(
|
|
2482
2457
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2483
2458
|
"elementor"
|
|
2484
|
-
))), /* @__PURE__ */
|
|
2485
|
-
|
|
2459
|
+
))), /* @__PURE__ */ React18.createElement(import_ui18.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(
|
|
2460
|
+
import_ui18.FormControlLabel,
|
|
2486
2461
|
{
|
|
2487
|
-
control: /* @__PURE__ */
|
|
2488
|
-
|
|
2462
|
+
control: /* @__PURE__ */ React18.createElement(
|
|
2463
|
+
import_ui18.Checkbox,
|
|
2489
2464
|
{
|
|
2490
2465
|
checked: dontShowAgain,
|
|
2491
2466
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2492
2467
|
size: "small"
|
|
2493
2468
|
}
|
|
2494
2469
|
),
|
|
2495
|
-
label: /* @__PURE__ */
|
|
2470
|
+
label: /* @__PURE__ */ React18.createElement(import_ui18.Typography, { variant: "body2" }, (0, import_i18n12.__)("Don't show me again", "elementor"))
|
|
2496
2471
|
}
|
|
2497
|
-
), /* @__PURE__ */
|
|
2472
|
+
), /* @__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")))));
|
|
2498
2473
|
};
|
|
2499
2474
|
|
|
2500
2475
|
// src/components/variable-edit.tsx
|
|
2501
2476
|
var SIZE3 = "tiny";
|
|
2502
|
-
var DELETE_LABEL = (0,
|
|
2477
|
+
var DELETE_LABEL = (0, import_i18n13.__)("Delete variable", "elementor");
|
|
2503
2478
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2504
2479
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2505
2480
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2506
2481
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2507
2482
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2508
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2509
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2510
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2511
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2483
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react18.useState)(false);
|
|
2484
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react18.useState)(false);
|
|
2485
|
+
const [errorMessage, setErrorMessage] = (0, import_react18.useState)("");
|
|
2486
|
+
const [valueFieldError, setValueFieldError] = (0, import_react18.useState)("");
|
|
2512
2487
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2513
2488
|
const variable = useVariable(editId);
|
|
2514
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2489
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react18.useState)(variable?.type ?? propTypeUtil.key);
|
|
2515
2490
|
if (!variable) {
|
|
2516
2491
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2517
2492
|
}
|
|
2518
2493
|
const userPermissions = usePermissions();
|
|
2519
|
-
const [value, setValue] = (0,
|
|
2520
|
-
const [label, setLabel] = (0,
|
|
2521
|
-
(0,
|
|
2494
|
+
const [value, setValue] = (0, import_react18.useState)(() => variable.value);
|
|
2495
|
+
const [label, setLabel] = (0, import_react18.useState)(() => variable.label);
|
|
2496
|
+
(0, import_react18.useEffect)(() => {
|
|
2522
2497
|
styleVariablesRepository.update({
|
|
2523
2498
|
[editId]: {
|
|
2524
2499
|
...variable,
|
|
@@ -2580,7 +2555,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2580
2555
|
const actions = [];
|
|
2581
2556
|
if (userPermissions.canDelete()) {
|
|
2582
2557
|
actions.push(
|
|
2583
|
-
/* @__PURE__ */
|
|
2558
|
+
/* @__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 })))
|
|
2584
2559
|
);
|
|
2585
2560
|
}
|
|
2586
2561
|
const hasEmptyFields = () => {
|
|
@@ -2605,31 +2580,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2605
2580
|
handleUpdate();
|
|
2606
2581
|
}
|
|
2607
2582
|
};
|
|
2608
|
-
return /* @__PURE__ */
|
|
2583
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_editor_ui7.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React19.createElement(
|
|
2609
2584
|
import_editor_ui7.PopoverHeader,
|
|
2610
2585
|
{
|
|
2611
|
-
title: (0,
|
|
2586
|
+
title: (0, import_i18n13.__)("Edit variable", "elementor"),
|
|
2612
2587
|
onClose,
|
|
2613
|
-
icon: /* @__PURE__ */
|
|
2614
|
-
|
|
2588
|
+
icon: /* @__PURE__ */ React19.createElement(React19.Fragment, null, onGoBack && /* @__PURE__ */ React19.createElement(
|
|
2589
|
+
import_ui19.IconButton,
|
|
2615
2590
|
{
|
|
2616
2591
|
size: SIZE3,
|
|
2617
|
-
"aria-label": (0,
|
|
2592
|
+
"aria-label": (0, import_i18n13.__)("Go Back", "elementor"),
|
|
2618
2593
|
onClick: onGoBack
|
|
2619
2594
|
},
|
|
2620
|
-
/* @__PURE__ */
|
|
2621
|
-
), /* @__PURE__ */
|
|
2595
|
+
/* @__PURE__ */ React19.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
2596
|
+
), /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2622
2597
|
actions
|
|
2623
2598
|
}
|
|
2624
|
-
), /* @__PURE__ */
|
|
2599
|
+
), /* @__PURE__ */ React19.createElement(import_ui19.Divider, null), /* @__PURE__ */ React19.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React19.createElement(
|
|
2625
2600
|
FormField,
|
|
2626
2601
|
{
|
|
2627
2602
|
id: "variable-label",
|
|
2628
|
-
label: (0,
|
|
2603
|
+
label: (0, import_i18n13.__)("Name", "elementor"),
|
|
2629
2604
|
errorMsg: labelFieldError?.message,
|
|
2630
2605
|
noticeMsg: labelHint(label)
|
|
2631
2606
|
},
|
|
2632
|
-
/* @__PURE__ */
|
|
2607
|
+
/* @__PURE__ */ React19.createElement(
|
|
2633
2608
|
LabelField,
|
|
2634
2609
|
{
|
|
2635
2610
|
id: "variable-label",
|
|
@@ -2648,7 +2623,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2648
2623
|
onKeyDown: handleKeyDown
|
|
2649
2624
|
}
|
|
2650
2625
|
)
|
|
2651
|
-
), ValueField && /* @__PURE__ */
|
|
2626
|
+
), ValueField && /* @__PURE__ */ React19.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n13.__)("Value", "elementor") }, /* @__PURE__ */ React19.createElement(import_ui19.Typography, { variant: "h5" }, /* @__PURE__ */ React19.createElement(
|
|
2652
2627
|
ValueField,
|
|
2653
2628
|
{
|
|
2654
2629
|
propTypeKey: variable.type,
|
|
@@ -2663,7 +2638,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2663
2638
|
onValidationChange: setValueFieldError,
|
|
2664
2639
|
propType
|
|
2665
2640
|
}
|
|
2666
|
-
))), errorMessage && /* @__PURE__ */
|
|
2641
|
+
))), 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(
|
|
2667
2642
|
DeleteConfirmationDialog,
|
|
2668
2643
|
{
|
|
2669
2644
|
open: true,
|
|
@@ -2671,7 +2646,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2671
2646
|
onConfirm: handleDelete,
|
|
2672
2647
|
closeDialog: closeDeleteDialog()
|
|
2673
2648
|
}
|
|
2674
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2649
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React19.createElement(
|
|
2675
2650
|
EditConfirmationDialog,
|
|
2676
2651
|
{
|
|
2677
2652
|
closeDialog: closeEditDialog(),
|
|
@@ -2682,26 +2657,26 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2682
2657
|
};
|
|
2683
2658
|
|
|
2684
2659
|
// src/components/variables-selection.tsx
|
|
2685
|
-
var
|
|
2686
|
-
var
|
|
2660
|
+
var import_react19 = require("react");
|
|
2661
|
+
var React21 = __toESM(require("react"));
|
|
2687
2662
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2688
2663
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2689
|
-
var
|
|
2690
|
-
var
|
|
2691
|
-
var
|
|
2664
|
+
var import_icons10 = require("@elementor/icons");
|
|
2665
|
+
var import_ui22 = require("@elementor/ui");
|
|
2666
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2692
2667
|
|
|
2693
2668
|
// src/components/ui/menu-item-content.tsx
|
|
2694
|
-
var
|
|
2669
|
+
var React20 = __toESM(require("react"));
|
|
2695
2670
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2696
|
-
var
|
|
2697
|
-
var
|
|
2698
|
-
var
|
|
2671
|
+
var import_icons9 = require("@elementor/icons");
|
|
2672
|
+
var import_ui20 = require("@elementor/ui");
|
|
2673
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2699
2674
|
var SIZE4 = "tiny";
|
|
2700
|
-
var EDIT_LABEL = (0,
|
|
2675
|
+
var EDIT_LABEL = (0, import_i18n14.__)("Edit variable", "elementor");
|
|
2701
2676
|
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2702
2677
|
const onEdit = item.onEdit;
|
|
2703
|
-
return /* @__PURE__ */
|
|
2704
|
-
|
|
2678
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(import_ui20.ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React20.createElement(
|
|
2679
|
+
import_ui20.Box,
|
|
2705
2680
|
{
|
|
2706
2681
|
sx: {
|
|
2707
2682
|
flex: 1,
|
|
@@ -2711,30 +2686,30 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2711
2686
|
gap: 1
|
|
2712
2687
|
}
|
|
2713
2688
|
},
|
|
2714
|
-
/* @__PURE__ */
|
|
2689
|
+
/* @__PURE__ */ React20.createElement(
|
|
2715
2690
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2716
2691
|
{
|
|
2717
2692
|
title: item.label || item.value,
|
|
2718
|
-
as:
|
|
2693
|
+
as: import_ui20.Typography,
|
|
2719
2694
|
variant: "caption",
|
|
2720
2695
|
color: disabled ? "text.disabled" : "text.primary",
|
|
2721
2696
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2722
2697
|
maxWidth: "50%"
|
|
2723
2698
|
}
|
|
2724
2699
|
),
|
|
2725
|
-
item.secondaryText && /* @__PURE__ */
|
|
2700
|
+
item.secondaryText && /* @__PURE__ */ React20.createElement(
|
|
2726
2701
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2727
2702
|
{
|
|
2728
2703
|
title: item.secondaryText,
|
|
2729
|
-
as:
|
|
2704
|
+
as: import_ui20.Typography,
|
|
2730
2705
|
variant: "caption",
|
|
2731
2706
|
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2732
2707
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2733
2708
|
maxWidth: "50%"
|
|
2734
2709
|
}
|
|
2735
2710
|
)
|
|
2736
|
-
), !!onEdit && !disabled && /* @__PURE__ */
|
|
2737
|
-
|
|
2711
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React20.createElement(import_ui20.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2712
|
+
import_ui20.IconButton,
|
|
2738
2713
|
{
|
|
2739
2714
|
sx: { mx: 1, opacity: "0" },
|
|
2740
2715
|
onClick: (e) => {
|
|
@@ -2743,13 +2718,13 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2743
2718
|
},
|
|
2744
2719
|
"aria-label": EDIT_LABEL
|
|
2745
2720
|
},
|
|
2746
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ React20.createElement(import_icons9.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2747
2722
|
)));
|
|
2748
2723
|
};
|
|
2749
2724
|
|
|
2750
2725
|
// src/components/ui/styled-menu-list.tsx
|
|
2751
|
-
var
|
|
2752
|
-
var VariablesStyledMenuList = (0,
|
|
2726
|
+
var import_ui21 = require("@elementor/ui");
|
|
2727
|
+
var VariablesStyledMenuList = (0, import_ui21.styled)(import_ui21.MenuList)(({ theme, disabled }) => ({
|
|
2753
2728
|
"& > li": {
|
|
2754
2729
|
height: 32,
|
|
2755
2730
|
width: "100%",
|
|
@@ -2783,13 +2758,13 @@ var VariablesStyledMenuList = (0, import_ui22.styled)(import_ui22.MenuList)(({ t
|
|
|
2783
2758
|
|
|
2784
2759
|
// src/components/variables-selection.tsx
|
|
2785
2760
|
var SIZE5 = "tiny";
|
|
2786
|
-
var CREATE_LABEL = (0,
|
|
2787
|
-
var MANAGER_LABEL = (0,
|
|
2761
|
+
var CREATE_LABEL = (0, import_i18n15.__)("Create variable", "elementor");
|
|
2762
|
+
var MANAGER_LABEL = (0, import_i18n15.__)("Variables Manager", "elementor");
|
|
2788
2763
|
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license-panel-${variableType}-variable`;
|
|
2789
2764
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2790
2765
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2791
2766
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2792
|
-
const [searchValue, setSearchValue] = (0,
|
|
2767
|
+
const [searchValue, setSearchValue] = (0, import_react19.useState)("");
|
|
2793
2768
|
const {
|
|
2794
2769
|
list: variables,
|
|
2795
2770
|
hasMatches: hasSearchResults,
|
|
@@ -2816,8 +2791,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2816
2791
|
const actions = [];
|
|
2817
2792
|
if (onAdd) {
|
|
2818
2793
|
actions.push(
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
|
|
2794
|
+
/* @__PURE__ */ React21.createElement(import_ui22.Tooltip, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React21.createElement("span", null, /* @__PURE__ */ React21.createElement(
|
|
2795
|
+
import_ui22.IconButton,
|
|
2821
2796
|
{
|
|
2822
2797
|
id: "add-variable-button",
|
|
2823
2798
|
size: SIZE5,
|
|
@@ -2825,7 +2800,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2825
2800
|
"aria-label": CREATE_LABEL,
|
|
2826
2801
|
disabled
|
|
2827
2802
|
},
|
|
2828
|
-
/* @__PURE__ */
|
|
2803
|
+
/* @__PURE__ */ React21.createElement(import_icons10.PlusIcon, { fontSize: SIZE5 })
|
|
2829
2804
|
)))
|
|
2830
2805
|
);
|
|
2831
2806
|
}
|
|
@@ -2839,24 +2814,24 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2839
2814
|
});
|
|
2840
2815
|
};
|
|
2841
2816
|
actions.push(
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
|
|
2817
|
+
/* @__PURE__ */ React21.createElement(import_ui22.Tooltip, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2818
|
+
import_ui22.IconButton,
|
|
2844
2819
|
{
|
|
2845
2820
|
id: "variables-manager-button",
|
|
2846
2821
|
size: SIZE5,
|
|
2847
2822
|
onClick: handleOpenManager,
|
|
2848
2823
|
"aria-label": MANAGER_LABEL
|
|
2849
2824
|
},
|
|
2850
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ React21.createElement(import_icons10.SettingsIcon, { fontSize: SIZE5 })
|
|
2851
2826
|
))
|
|
2852
2827
|
);
|
|
2853
2828
|
}
|
|
2854
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2829
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2855
2830
|
const items = variables.map(({ value, label, key }) => ({
|
|
2856
2831
|
type: "item",
|
|
2857
2832
|
value: key,
|
|
2858
2833
|
label,
|
|
2859
|
-
icon: /* @__PURE__ */
|
|
2834
|
+
icon: /* @__PURE__ */ React21.createElement(StartIcon, { value }),
|
|
2860
2835
|
secondaryText: value,
|
|
2861
2836
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2862
2837
|
}));
|
|
@@ -2866,22 +2841,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2866
2841
|
const handleClearSearch = () => {
|
|
2867
2842
|
setSearchValue("");
|
|
2868
2843
|
};
|
|
2869
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ React21.createElement(import_editor_ui9.SectionPopoverBody, null, /* @__PURE__ */ React21.createElement(
|
|
2870
2845
|
import_editor_ui9.PopoverHeader,
|
|
2871
2846
|
{
|
|
2872
|
-
title: (0,
|
|
2873
|
-
icon: /* @__PURE__ */
|
|
2847
|
+
title: (0, import_i18n15.__)("Variables", "elementor"),
|
|
2848
|
+
icon: /* @__PURE__ */ React21.createElement(import_icons10.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
2874
2849
|
onClose: closePopover,
|
|
2875
2850
|
actions
|
|
2876
2851
|
}
|
|
2877
|
-
), hasVariables && /* @__PURE__ */
|
|
2852
|
+
), hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2878
2853
|
import_editor_ui9.SearchField,
|
|
2879
2854
|
{
|
|
2880
2855
|
value: searchValue,
|
|
2881
2856
|
onSearch: handleSearch,
|
|
2882
|
-
placeholder: (0,
|
|
2857
|
+
placeholder: (0, import_i18n15.__)("Search", "elementor")
|
|
2883
2858
|
}
|
|
2884
|
-
), /* @__PURE__ */
|
|
2859
|
+
), /* @__PURE__ */ React21.createElement(import_ui22.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2885
2860
|
import_editor_ui9.PopoverMenuList,
|
|
2886
2861
|
{
|
|
2887
2862
|
items,
|
|
@@ -2891,66 +2866,66 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2891
2866
|
},
|
|
2892
2867
|
selectedValue: variable,
|
|
2893
2868
|
"data-testid": `${variableType}-variables-list`,
|
|
2894
|
-
menuListTemplate: (props) => /* @__PURE__ */
|
|
2895
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2869
|
+
menuListTemplate: (props) => /* @__PURE__ */ React21.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2870
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React21.createElement(MenuItemContent, { item, disabled })
|
|
2896
2871
|
}
|
|
2897
|
-
), disabled && /* @__PURE__ */
|
|
2872
|
+
), disabled && /* @__PURE__ */ React21.createElement(
|
|
2898
2873
|
import_editor_ui10.PromotionAlert,
|
|
2899
2874
|
{
|
|
2900
|
-
message: (0,
|
|
2875
|
+
message: (0, import_i18n15.sprintf)(
|
|
2901
2876
|
/* translators: %s: Variable Type. */
|
|
2902
|
-
(0,
|
|
2877
|
+
(0, import_i18n15.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2903
2878
|
variableType
|
|
2904
2879
|
),
|
|
2905
2880
|
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2906
2881
|
}
|
|
2907
|
-
)), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2882
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2908
2883
|
NoSearchResults,
|
|
2909
2884
|
{
|
|
2910
2885
|
searchValue,
|
|
2911
2886
|
onClear: handleClearSearch,
|
|
2912
|
-
icon: /* @__PURE__ */
|
|
2887
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2913
2888
|
}
|
|
2914
|
-
), disabled && !hasVariables && /* @__PURE__ */
|
|
2889
|
+
), disabled && !hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2915
2890
|
EmptyState,
|
|
2916
2891
|
{
|
|
2917
|
-
title: (0,
|
|
2892
|
+
title: (0, import_i18n15.sprintf)(
|
|
2918
2893
|
/* translators: %s: Variable Type. */
|
|
2919
|
-
(0,
|
|
2894
|
+
(0, import_i18n15.__)("No %s variables yet", "elementor"),
|
|
2920
2895
|
variableType
|
|
2921
2896
|
),
|
|
2922
|
-
message: (0,
|
|
2897
|
+
message: (0, import_i18n15.sprintf)(
|
|
2923
2898
|
/* translators: %s: Variable Type. */
|
|
2924
|
-
(0,
|
|
2899
|
+
(0, import_i18n15.__)("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2925
2900
|
variableType
|
|
2926
2901
|
),
|
|
2927
|
-
icon: /* @__PURE__ */
|
|
2902
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2928
2903
|
},
|
|
2929
2904
|
emptyState
|
|
2930
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2905
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2931
2906
|
EmptyState,
|
|
2932
2907
|
{
|
|
2933
|
-
title: (0,
|
|
2908
|
+
title: (0, import_i18n15.sprintf)(
|
|
2934
2909
|
/* translators: %s: Variable Type. */
|
|
2935
|
-
(0,
|
|
2910
|
+
(0, import_i18n15.__)("Create your first %s variable", "elementor"),
|
|
2936
2911
|
variableType
|
|
2937
2912
|
),
|
|
2938
|
-
message: (0,
|
|
2913
|
+
message: (0, import_i18n15.__)(
|
|
2939
2914
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2940
2915
|
"elementor"
|
|
2941
2916
|
),
|
|
2942
|
-
icon: /* @__PURE__ */
|
|
2917
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2943
2918
|
onAdd
|
|
2944
2919
|
}
|
|
2945
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2920
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2946
2921
|
EmptyState,
|
|
2947
2922
|
{
|
|
2948
|
-
title: (0,
|
|
2949
|
-
message: (0,
|
|
2923
|
+
title: (0, import_i18n15.__)("No compatible variables", "elementor"),
|
|
2924
|
+
message: (0, import_i18n15.__)(
|
|
2950
2925
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2951
2926
|
"elementor"
|
|
2952
2927
|
),
|
|
2953
|
-
icon: /* @__PURE__ */
|
|
2928
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2954
2929
|
onAdd
|
|
2955
2930
|
}
|
|
2956
2931
|
));
|
|
@@ -2961,13 +2936,13 @@ var VIEW_LIST = "list";
|
|
|
2961
2936
|
var VIEW_ADD = "add";
|
|
2962
2937
|
var VIEW_EDIT = "edit";
|
|
2963
2938
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2964
|
-
const [currentView, setCurrentView] = (0,
|
|
2965
|
-
const [editId, setEditId] = (0,
|
|
2939
|
+
const [currentView, setCurrentView] = (0, import_react20.useState)(VIEW_LIST);
|
|
2940
|
+
const [editId, setEditId] = (0, import_react20.useState)("");
|
|
2966
2941
|
const { open } = usePanelActions();
|
|
2967
2942
|
const onSettingsAvailable = (0, import_editor_v1_adapters4.isExperimentActive)("e_variables_manager") ? () => {
|
|
2968
2943
|
open();
|
|
2969
2944
|
} : void 0;
|
|
2970
|
-
return /* @__PURE__ */
|
|
2945
|
+
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2971
2946
|
propTypeKey,
|
|
2972
2947
|
currentView,
|
|
2973
2948
|
selectedVariable,
|
|
@@ -3014,7 +2989,7 @@ function RenderView(props) {
|
|
|
3014
2989
|
}
|
|
3015
2990
|
};
|
|
3016
2991
|
if (VIEW_LIST === props.currentView) {
|
|
3017
|
-
return /* @__PURE__ */
|
|
2992
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3018
2993
|
VariablesSelection,
|
|
3019
2994
|
{
|
|
3020
2995
|
closePopover: handlers.onClose,
|
|
@@ -3026,10 +3001,10 @@ function RenderView(props) {
|
|
|
3026
3001
|
);
|
|
3027
3002
|
}
|
|
3028
3003
|
if (VIEW_ADD === props.currentView) {
|
|
3029
|
-
return /* @__PURE__ */
|
|
3004
|
+
return /* @__PURE__ */ React22.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
3030
3005
|
}
|
|
3031
3006
|
if (VIEW_EDIT === props.currentView) {
|
|
3032
|
-
return /* @__PURE__ */
|
|
3007
|
+
return /* @__PURE__ */ React22.createElement(
|
|
3033
3008
|
VariableEdit,
|
|
3034
3009
|
{
|
|
3035
3010
|
editId: props.editId,
|
|
@@ -3043,26 +3018,26 @@ function RenderView(props) {
|
|
|
3043
3018
|
}
|
|
3044
3019
|
|
|
3045
3020
|
// src/components/ui/tags/assigned-tag.tsx
|
|
3046
|
-
var
|
|
3047
|
-
var
|
|
3048
|
-
var
|
|
3049
|
-
var
|
|
3021
|
+
var React23 = __toESM(require("react"));
|
|
3022
|
+
var import_icons11 = require("@elementor/icons");
|
|
3023
|
+
var import_ui23 = require("@elementor/ui");
|
|
3024
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
3050
3025
|
var SIZE6 = "tiny";
|
|
3051
|
-
var UNLINK_LABEL = (0,
|
|
3026
|
+
var UNLINK_LABEL = (0, import_i18n16.__)("Unlink variable", "elementor");
|
|
3052
3027
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
3053
3028
|
const actions = [];
|
|
3054
3029
|
if (onUnlink) {
|
|
3055
3030
|
actions.push(
|
|
3056
|
-
/* @__PURE__ */
|
|
3031
|
+
/* @__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 })))
|
|
3057
3032
|
);
|
|
3058
3033
|
}
|
|
3059
|
-
return /* @__PURE__ */
|
|
3060
|
-
|
|
3034
|
+
return /* @__PURE__ */ React23.createElement(import_ui23.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React23.createElement(
|
|
3035
|
+
import_ui23.UnstableTag,
|
|
3061
3036
|
{
|
|
3062
3037
|
fullWidth: true,
|
|
3063
3038
|
showActionsOnHover: true,
|
|
3064
|
-
startIcon: /* @__PURE__ */
|
|
3065
|
-
label: /* @__PURE__ */
|
|
3039
|
+
startIcon: /* @__PURE__ */ React23.createElement(import_ui23.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
3040
|
+
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)),
|
|
3066
3041
|
actions,
|
|
3067
3042
|
...props
|
|
3068
3043
|
}
|
|
@@ -3073,24 +3048,24 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3073
3048
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3074
3049
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3075
3050
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
3076
|
-
const anchorRef = (0,
|
|
3077
|
-
const popupId = (0,
|
|
3078
|
-
const popupState = (0,
|
|
3051
|
+
const anchorRef = (0, import_react21.useRef)(null);
|
|
3052
|
+
const popupId = (0, import_react21.useId)();
|
|
3053
|
+
const popupState = (0, import_ui24.usePopupState)({
|
|
3079
3054
|
variant: "popover",
|
|
3080
3055
|
popupId: `elementor-variables-list-${popupId}`
|
|
3081
3056
|
});
|
|
3082
3057
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
3083
3058
|
const StartIcon = startIcon || (() => null);
|
|
3084
|
-
return /* @__PURE__ */
|
|
3059
|
+
return /* @__PURE__ */ React24.createElement(import_ui24.Box, { ref: anchorRef }, /* @__PURE__ */ React24.createElement(
|
|
3085
3060
|
AssignedTag,
|
|
3086
3061
|
{
|
|
3087
3062
|
label: variable.label,
|
|
3088
|
-
startIcon: /* @__PURE__ */
|
|
3063
|
+
startIcon: /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(import_icons12.ColorFilterIcon, { fontSize: SIZE6 }), /* @__PURE__ */ React24.createElement(StartIcon, { value: variable.value })),
|
|
3089
3064
|
onUnlink: unlinkVariable,
|
|
3090
|
-
...(0,
|
|
3065
|
+
...(0, import_ui24.bindTrigger)(popupState)
|
|
3091
3066
|
}
|
|
3092
|
-
), /* @__PURE__ */
|
|
3093
|
-
|
|
3067
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3068
|
+
import_ui24.Popover,
|
|
3094
3069
|
{
|
|
3095
3070
|
disableScrollLock: true,
|
|
3096
3071
|
anchorEl: anchorRef.current,
|
|
@@ -3099,9 +3074,9 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3099
3074
|
PaperProps: {
|
|
3100
3075
|
sx: { my: 1 }
|
|
3101
3076
|
},
|
|
3102
|
-
...(0,
|
|
3077
|
+
...(0, import_ui24.bindPopover)(popupState)
|
|
3103
3078
|
},
|
|
3104
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ React24.createElement(
|
|
3105
3080
|
VariableSelectionPopover,
|
|
3106
3081
|
{
|
|
3107
3082
|
selectedVariable: variable,
|
|
@@ -3113,19 +3088,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3113
3088
|
};
|
|
3114
3089
|
|
|
3115
3090
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3116
|
-
var
|
|
3117
|
-
var
|
|
3091
|
+
var React28 = __toESM(require("react"));
|
|
3092
|
+
var import_react23 = require("react");
|
|
3118
3093
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
3119
|
-
var
|
|
3120
|
-
var
|
|
3094
|
+
var import_ui28 = require("@elementor/ui");
|
|
3095
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
3121
3096
|
|
|
3122
3097
|
// src/components/variable-restore.tsx
|
|
3123
|
-
var
|
|
3124
|
-
var
|
|
3098
|
+
var React25 = __toESM(require("react"));
|
|
3099
|
+
var import_react22 = require("react");
|
|
3125
3100
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
3126
3101
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3127
|
-
var
|
|
3128
|
-
var
|
|
3102
|
+
var import_ui25 = require("@elementor/ui");
|
|
3103
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
3129
3104
|
var SIZE7 = "tiny";
|
|
3130
3105
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
3131
3106
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -3135,11 +3110,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3135
3110
|
if (!variable) {
|
|
3136
3111
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3137
3112
|
}
|
|
3138
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3139
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
3140
|
-
const [label, setLabel] = (0,
|
|
3141
|
-
const [value, setValue] = (0,
|
|
3142
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
3113
|
+
const [errorMessage, setErrorMessage] = (0, import_react22.useState)("");
|
|
3114
|
+
const [valueFieldError, setValueFieldError] = (0, import_react22.useState)("");
|
|
3115
|
+
const [label, setLabel] = (0, import_react22.useState)(variable.label);
|
|
3116
|
+
const [value, setValue] = (0, import_react22.useState)(variable.value);
|
|
3117
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react22.useState)(variable?.type ?? propTypeUtil.key);
|
|
3143
3118
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3144
3119
|
value: variable.label,
|
|
3145
3120
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3185,22 +3160,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3185
3160
|
handleRestore();
|
|
3186
3161
|
}
|
|
3187
3162
|
};
|
|
3188
|
-
return /* @__PURE__ */
|
|
3163
|
+
return /* @__PURE__ */ React25.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React25.createElement(import_editor_ui11.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React25.createElement(
|
|
3189
3164
|
import_editor_ui11.PopoverHeader,
|
|
3190
3165
|
{
|
|
3191
|
-
icon: /* @__PURE__ */
|
|
3192
|
-
title: (0,
|
|
3166
|
+
icon: /* @__PURE__ */ React25.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3167
|
+
title: (0, import_i18n17.__)("Restore variable", "elementor"),
|
|
3193
3168
|
onClose
|
|
3194
3169
|
}
|
|
3195
|
-
), /* @__PURE__ */
|
|
3170
|
+
), /* @__PURE__ */ React25.createElement(import_ui25.Divider, null), /* @__PURE__ */ React25.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React25.createElement(
|
|
3196
3171
|
FormField,
|
|
3197
3172
|
{
|
|
3198
3173
|
id: "variable-label",
|
|
3199
|
-
label: (0,
|
|
3174
|
+
label: (0, import_i18n17.__)("Name", "elementor"),
|
|
3200
3175
|
errorMsg: labelFieldError?.message,
|
|
3201
3176
|
noticeMsg: labelHint(label)
|
|
3202
3177
|
},
|
|
3203
|
-
/* @__PURE__ */
|
|
3178
|
+
/* @__PURE__ */ React25.createElement(
|
|
3204
3179
|
LabelField,
|
|
3205
3180
|
{
|
|
3206
3181
|
id: "variable-label",
|
|
@@ -3219,7 +3194,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3219
3194
|
onKeyDown: handleKeyDown
|
|
3220
3195
|
}
|
|
3221
3196
|
)
|
|
3222
|
-
), ValueField && /* @__PURE__ */
|
|
3197
|
+
), ValueField && /* @__PURE__ */ React25.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n17.__)("Value", "elementor") }, /* @__PURE__ */ React25.createElement(import_ui25.Typography, { variant: "h5" }, /* @__PURE__ */ React25.createElement(
|
|
3223
3198
|
ValueField,
|
|
3224
3199
|
{
|
|
3225
3200
|
propTypeKey,
|
|
@@ -3234,25 +3209,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3234
3209
|
propType,
|
|
3235
3210
|
onKeyDown: handleKeyDown
|
|
3236
3211
|
}
|
|
3237
|
-
))), errorMessage && /* @__PURE__ */
|
|
3212
|
+
))), 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")))));
|
|
3238
3213
|
};
|
|
3239
3214
|
|
|
3240
3215
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3241
|
-
var
|
|
3242
|
-
var
|
|
3243
|
-
var
|
|
3216
|
+
var React26 = __toESM(require("react"));
|
|
3217
|
+
var import_ui26 = require("@elementor/ui");
|
|
3218
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
3244
3219
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3245
|
-
return /* @__PURE__ */
|
|
3246
|
-
|
|
3220
|
+
return /* @__PURE__ */ React26.createElement(import_ui26.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React26.createElement(
|
|
3221
|
+
import_ui26.Alert,
|
|
3247
3222
|
{
|
|
3248
3223
|
variant: "standard",
|
|
3249
3224
|
severity: "warning",
|
|
3250
3225
|
onClose,
|
|
3251
|
-
action: /* @__PURE__ */
|
|
3226
|
+
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"))),
|
|
3252
3227
|
sx: { maxWidth: 300 }
|
|
3253
3228
|
},
|
|
3254
|
-
/* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3229
|
+
/* @__PURE__ */ React26.createElement(import_ui26.AlertTitle, null, (0, import_i18n18.__)("Deleted variable", "elementor")),
|
|
3230
|
+
/* @__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.__)(
|
|
3256
3231
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3257
3232
|
"elementor"
|
|
3258
3233
|
))
|
|
@@ -3260,14 +3235,14 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3260
3235
|
};
|
|
3261
3236
|
|
|
3262
3237
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3263
|
-
var
|
|
3264
|
-
var
|
|
3265
|
-
var
|
|
3266
|
-
var WarningVariableTag =
|
|
3238
|
+
var React27 = __toESM(require("react"));
|
|
3239
|
+
var import_icons13 = require("@elementor/icons");
|
|
3240
|
+
var import_ui27 = require("@elementor/ui");
|
|
3241
|
+
var WarningVariableTag = React27.forwardRef(
|
|
3267
3242
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3268
3243
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3269
|
-
return /* @__PURE__ */
|
|
3270
|
-
|
|
3244
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3245
|
+
import_ui27.Chip,
|
|
3271
3246
|
{
|
|
3272
3247
|
ref,
|
|
3273
3248
|
size: "tiny",
|
|
@@ -3275,8 +3250,8 @@ var WarningVariableTag = React28.forwardRef(
|
|
|
3275
3250
|
shape: "rounded",
|
|
3276
3251
|
variant: "standard",
|
|
3277
3252
|
onClick,
|
|
3278
|
-
icon: /* @__PURE__ */
|
|
3279
|
-
label: /* @__PURE__ */
|
|
3253
|
+
icon: /* @__PURE__ */ React27.createElement(import_icons13.AlertTriangleFilledIcon, null),
|
|
3254
|
+
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))),
|
|
3280
3255
|
sx: {
|
|
3281
3256
|
height: (theme) => theme.spacing(3.5),
|
|
3282
3257
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3295,12 +3270,12 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3295
3270
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3296
3271
|
const boundProp = (0, import_editor_controls8.useBoundProp)();
|
|
3297
3272
|
const userPermissions = usePermissions();
|
|
3298
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3273
|
+
const [showInfotip, setShowInfotip] = (0, import_react23.useState)(false);
|
|
3299
3274
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3300
3275
|
const closeInfotip = () => setShowInfotip(false);
|
|
3301
|
-
const deletedChipAnchorRef = (0,
|
|
3302
|
-
const popupId = (0,
|
|
3303
|
-
const popupState = (0,
|
|
3276
|
+
const deletedChipAnchorRef = (0, import_react23.useRef)(null);
|
|
3277
|
+
const popupId = (0, import_react23.useId)();
|
|
3278
|
+
const popupState = (0, import_ui28.usePopupState)({
|
|
3304
3279
|
variant: "popover",
|
|
3305
3280
|
popupId: `elementor-variables-restore-${popupId}`
|
|
3306
3281
|
});
|
|
@@ -3326,15 +3301,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3326
3301
|
const handleRestoreWithOverrides = () => {
|
|
3327
3302
|
popupState.close();
|
|
3328
3303
|
};
|
|
3329
|
-
return /* @__PURE__ */
|
|
3330
|
-
|
|
3304
|
+
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(
|
|
3305
|
+
import_ui28.Infotip,
|
|
3331
3306
|
{
|
|
3332
3307
|
color: "warning",
|
|
3333
3308
|
placement: "right-start",
|
|
3334
3309
|
open: showInfotip,
|
|
3335
3310
|
disableHoverListener: true,
|
|
3336
3311
|
onClose: closeInfotip,
|
|
3337
|
-
content: /* @__PURE__ */
|
|
3312
|
+
content: /* @__PURE__ */ React28.createElement(
|
|
3338
3313
|
DeletedVariableAlert,
|
|
3339
3314
|
{
|
|
3340
3315
|
onClose: closeInfotip,
|
|
@@ -3354,16 +3329,16 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3354
3329
|
}
|
|
3355
3330
|
}
|
|
3356
3331
|
},
|
|
3357
|
-
/* @__PURE__ */
|
|
3332
|
+
/* @__PURE__ */ React28.createElement(
|
|
3358
3333
|
WarningVariableTag,
|
|
3359
3334
|
{
|
|
3360
3335
|
label: variable.label,
|
|
3361
3336
|
onClick: toggleInfotip,
|
|
3362
|
-
suffix: (0,
|
|
3337
|
+
suffix: (0, import_i18n19.__)("deleted", "elementor")
|
|
3363
3338
|
}
|
|
3364
3339
|
)
|
|
3365
|
-
), /* @__PURE__ */
|
|
3366
|
-
|
|
3340
|
+
), /* @__PURE__ */ React28.createElement(
|
|
3341
|
+
import_ui28.Popover,
|
|
3367
3342
|
{
|
|
3368
3343
|
disableScrollLock: true,
|
|
3369
3344
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -3371,9 +3346,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3371
3346
|
PaperProps: {
|
|
3372
3347
|
sx: { my: 1 }
|
|
3373
3348
|
},
|
|
3374
|
-
...(0,
|
|
3349
|
+
...(0, import_ui28.bindPopover)(popupState)
|
|
3375
3350
|
},
|
|
3376
|
-
/* @__PURE__ */
|
|
3351
|
+
/* @__PURE__ */ React28.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React28.createElement(
|
|
3377
3352
|
VariableRestore,
|
|
3378
3353
|
{
|
|
3379
3354
|
variableId: variable.key ?? "",
|
|
@@ -3385,52 +3360,52 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3385
3360
|
};
|
|
3386
3361
|
|
|
3387
3362
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3388
|
-
var React31 = __toESM(require("react"));
|
|
3389
|
-
var import_react25 = require("react");
|
|
3390
|
-
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3391
|
-
var import_ui31 = require("@elementor/ui");
|
|
3392
|
-
var import_i18n22 = require("@wordpress/i18n");
|
|
3393
|
-
|
|
3394
|
-
// src/components/ui/mismatch-variable-alert.tsx
|
|
3395
3363
|
var React30 = __toESM(require("react"));
|
|
3364
|
+
var import_react24 = require("react");
|
|
3365
|
+
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3396
3366
|
var import_ui30 = require("@elementor/ui");
|
|
3397
3367
|
var import_i18n21 = require("@wordpress/i18n");
|
|
3368
|
+
|
|
3369
|
+
// src/components/ui/mismatch-variable-alert.tsx
|
|
3370
|
+
var React29 = __toESM(require("react"));
|
|
3371
|
+
var import_ui29 = require("@elementor/ui");
|
|
3372
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
3398
3373
|
var i18n = {
|
|
3399
|
-
title: (0,
|
|
3400
|
-
message: (0,
|
|
3374
|
+
title: (0, import_i18n20.__)("Variable has changed", "elementor"),
|
|
3375
|
+
message: (0, import_i18n20.__)(
|
|
3401
3376
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3402
3377
|
"elementor"
|
|
3403
3378
|
),
|
|
3404
3379
|
buttons: {
|
|
3405
|
-
clear: (0,
|
|
3406
|
-
select: (0,
|
|
3380
|
+
clear: (0, import_i18n20.__)("Clear", "elementor"),
|
|
3381
|
+
select: (0, import_i18n20.__)("Select variable", "elementor")
|
|
3407
3382
|
}
|
|
3408
3383
|
};
|
|
3409
3384
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3410
|
-
return /* @__PURE__ */
|
|
3411
|
-
|
|
3385
|
+
return /* @__PURE__ */ React29.createElement(import_ui29.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
3386
|
+
import_ui29.Alert,
|
|
3412
3387
|
{
|
|
3413
3388
|
variant: "standard",
|
|
3414
3389
|
severity: "warning",
|
|
3415
3390
|
onClose,
|
|
3416
|
-
action: /* @__PURE__ */
|
|
3391
|
+
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)),
|
|
3417
3392
|
sx: { maxWidth: 300 }
|
|
3418
3393
|
},
|
|
3419
|
-
/* @__PURE__ */
|
|
3420
|
-
/* @__PURE__ */
|
|
3394
|
+
/* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, i18n.title),
|
|
3395
|
+
/* @__PURE__ */ React29.createElement(import_ui29.Typography, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3421
3396
|
));
|
|
3422
3397
|
};
|
|
3423
3398
|
|
|
3424
3399
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3425
3400
|
var MismatchVariable = ({ variable }) => {
|
|
3426
3401
|
const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
|
|
3427
|
-
const anchorRef = (0,
|
|
3428
|
-
const popupId = (0,
|
|
3429
|
-
const popupState = (0,
|
|
3402
|
+
const anchorRef = (0, import_react24.useRef)(null);
|
|
3403
|
+
const popupId = (0, import_react24.useId)();
|
|
3404
|
+
const popupState = (0, import_ui30.usePopupState)({
|
|
3430
3405
|
variant: "popover",
|
|
3431
3406
|
popupId: `elementor-variables-list-${popupId}`
|
|
3432
3407
|
});
|
|
3433
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3408
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react24.useState)(false);
|
|
3434
3409
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3435
3410
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3436
3411
|
const triggerSelect = () => {
|
|
@@ -3443,15 +3418,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3443
3418
|
setValue(null);
|
|
3444
3419
|
};
|
|
3445
3420
|
const showClearButton = !!value;
|
|
3446
|
-
return /* @__PURE__ */
|
|
3447
|
-
|
|
3421
|
+
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(
|
|
3422
|
+
import_ui30.Infotip,
|
|
3448
3423
|
{
|
|
3449
3424
|
color: "warning",
|
|
3450
3425
|
placement: "right-start",
|
|
3451
3426
|
open: infotipVisible,
|
|
3452
3427
|
disableHoverListener: true,
|
|
3453
3428
|
onClose: closeInfotip,
|
|
3454
|
-
content: /* @__PURE__ */
|
|
3429
|
+
content: /* @__PURE__ */ React30.createElement(
|
|
3455
3430
|
MismatchVariableAlert,
|
|
3456
3431
|
{
|
|
3457
3432
|
onClose: closeInfotip,
|
|
@@ -3470,16 +3445,16 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3470
3445
|
}
|
|
3471
3446
|
}
|
|
3472
3447
|
},
|
|
3473
|
-
/* @__PURE__ */
|
|
3448
|
+
/* @__PURE__ */ React30.createElement(
|
|
3474
3449
|
WarningVariableTag,
|
|
3475
3450
|
{
|
|
3476
3451
|
label: variable.label,
|
|
3477
3452
|
onClick: toggleInfotip,
|
|
3478
|
-
suffix: (0,
|
|
3453
|
+
suffix: (0, import_i18n21.__)("changed", "elementor")
|
|
3479
3454
|
}
|
|
3480
3455
|
)
|
|
3481
|
-
), /* @__PURE__ */
|
|
3482
|
-
|
|
3456
|
+
), /* @__PURE__ */ React30.createElement(
|
|
3457
|
+
import_ui30.Popover,
|
|
3483
3458
|
{
|
|
3484
3459
|
disableScrollLock: true,
|
|
3485
3460
|
anchorEl: anchorRef.current,
|
|
@@ -3488,9 +3463,9 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3488
3463
|
PaperProps: {
|
|
3489
3464
|
sx: { my: 1 }
|
|
3490
3465
|
},
|
|
3491
|
-
...(0,
|
|
3466
|
+
...(0, import_ui30.bindPopover)(popupState)
|
|
3492
3467
|
},
|
|
3493
|
-
/* @__PURE__ */
|
|
3468
|
+
/* @__PURE__ */ React30.createElement(
|
|
3494
3469
|
VariableSelectionPopover,
|
|
3495
3470
|
{
|
|
3496
3471
|
selectedVariable: variable,
|
|
@@ -3502,28 +3477,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3502
3477
|
};
|
|
3503
3478
|
|
|
3504
3479
|
// src/components/ui/variable/missing-variable.tsx
|
|
3505
|
-
var React33 = __toESM(require("react"));
|
|
3506
|
-
var import_react26 = require("react");
|
|
3507
|
-
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3508
|
-
var import_ui33 = require("@elementor/ui");
|
|
3509
|
-
var import_i18n24 = require("@wordpress/i18n");
|
|
3510
|
-
|
|
3511
|
-
// src/components/ui/missing-variable-alert.tsx
|
|
3512
3480
|
var React32 = __toESM(require("react"));
|
|
3481
|
+
var import_react25 = require("react");
|
|
3482
|
+
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3513
3483
|
var import_ui32 = require("@elementor/ui");
|
|
3514
3484
|
var import_i18n23 = require("@wordpress/i18n");
|
|
3485
|
+
|
|
3486
|
+
// src/components/ui/missing-variable-alert.tsx
|
|
3487
|
+
var React31 = __toESM(require("react"));
|
|
3488
|
+
var import_ui31 = require("@elementor/ui");
|
|
3489
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
3515
3490
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3516
|
-
return /* @__PURE__ */
|
|
3517
|
-
|
|
3491
|
+
return /* @__PURE__ */ React31.createElement(import_ui31.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React31.createElement(
|
|
3492
|
+
import_ui31.Alert,
|
|
3518
3493
|
{
|
|
3519
3494
|
variant: "standard",
|
|
3520
3495
|
severity: "warning",
|
|
3521
3496
|
onClose,
|
|
3522
|
-
action: /* @__PURE__ */
|
|
3497
|
+
action: /* @__PURE__ */ React31.createElement(React31.Fragment, null, onClear && /* @__PURE__ */ React31.createElement(import_ui31.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n22.__)("Clear", "elementor"))),
|
|
3523
3498
|
sx: { maxWidth: 300 }
|
|
3524
3499
|
},
|
|
3525
|
-
/* @__PURE__ */
|
|
3526
|
-
/* @__PURE__ */
|
|
3500
|
+
/* @__PURE__ */ React31.createElement(import_ui31.AlertTitle, null, (0, import_i18n22.__)("This variable is missing", "elementor")),
|
|
3501
|
+
/* @__PURE__ */ React31.createElement(import_ui31.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n22.__)(
|
|
3527
3502
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3528
3503
|
"elementor"
|
|
3529
3504
|
))
|
|
@@ -3533,19 +3508,19 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3533
3508
|
// src/components/ui/variable/missing-variable.tsx
|
|
3534
3509
|
var MissingVariable = () => {
|
|
3535
3510
|
const { setValue } = (0, import_editor_controls10.useBoundProp)();
|
|
3536
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3511
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react25.useState)(false);
|
|
3537
3512
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3538
3513
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3539
3514
|
const clearValue = () => setValue(null);
|
|
3540
|
-
return /* @__PURE__ */
|
|
3541
|
-
|
|
3515
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, infotipVisible && /* @__PURE__ */ React32.createElement(import_ui32.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React32.createElement(
|
|
3516
|
+
import_ui32.Infotip,
|
|
3542
3517
|
{
|
|
3543
3518
|
color: "warning",
|
|
3544
3519
|
placement: "right-start",
|
|
3545
3520
|
open: infotipVisible,
|
|
3546
3521
|
disableHoverListener: true,
|
|
3547
3522
|
onClose: closeInfotip,
|
|
3548
|
-
content: /* @__PURE__ */
|
|
3523
|
+
content: /* @__PURE__ */ React32.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3549
3524
|
slotProps: {
|
|
3550
3525
|
popper: {
|
|
3551
3526
|
modifiers: [
|
|
@@ -3557,7 +3532,7 @@ var MissingVariable = () => {
|
|
|
3557
3532
|
}
|
|
3558
3533
|
}
|
|
3559
3534
|
},
|
|
3560
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ React32.createElement(WarningVariableTag, { label: (0, import_i18n23.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3561
3536
|
));
|
|
3562
3537
|
};
|
|
3563
3538
|
|
|
@@ -3567,37 +3542,37 @@ var VariableControl = () => {
|
|
|
3567
3542
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3568
3543
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3569
3544
|
if (!assignedVariable) {
|
|
3570
|
-
return /* @__PURE__ */
|
|
3545
|
+
return /* @__PURE__ */ React33.createElement(MissingVariable, null);
|
|
3571
3546
|
}
|
|
3572
3547
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3573
3548
|
if (assignedVariable?.deleted) {
|
|
3574
|
-
return /* @__PURE__ */
|
|
3549
|
+
return /* @__PURE__ */ React33.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3575
3550
|
}
|
|
3576
3551
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3577
3552
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3578
|
-
return /* @__PURE__ */
|
|
3553
|
+
return /* @__PURE__ */ React33.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3579
3554
|
}
|
|
3580
|
-
return /* @__PURE__ */
|
|
3555
|
+
return /* @__PURE__ */ React33.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3581
3556
|
};
|
|
3582
3557
|
|
|
3583
3558
|
// src/hooks/use-prop-variable-action.tsx
|
|
3584
|
-
var
|
|
3559
|
+
var React34 = __toESM(require("react"));
|
|
3585
3560
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
3586
|
-
var
|
|
3587
|
-
var
|
|
3561
|
+
var import_icons14 = require("@elementor/icons");
|
|
3562
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3588
3563
|
var usePropVariableAction = () => {
|
|
3589
3564
|
const { propType, path } = (0, import_editor_controls12.useBoundProp)();
|
|
3590
3565
|
const variable = resolveVariableFromPropType(propType);
|
|
3591
3566
|
return {
|
|
3592
3567
|
visible: Boolean(variable),
|
|
3593
|
-
icon:
|
|
3594
|
-
title: (0,
|
|
3568
|
+
icon: import_icons14.ColorFilterIcon,
|
|
3569
|
+
title: (0, import_i18n24.__)("Variables", "elementor"),
|
|
3595
3570
|
content: ({ close: closePopover }) => {
|
|
3596
3571
|
if (!variable) {
|
|
3597
3572
|
return null;
|
|
3598
3573
|
}
|
|
3599
3574
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3600
|
-
return /* @__PURE__ */
|
|
3575
|
+
return /* @__PURE__ */ React34.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3601
3576
|
}
|
|
3602
3577
|
};
|
|
3603
3578
|
};
|
|
@@ -3744,21 +3719,21 @@ function initMcp() {
|
|
|
3744
3719
|
}
|
|
3745
3720
|
|
|
3746
3721
|
// src/register-variable-types.tsx
|
|
3747
|
-
var
|
|
3722
|
+
var React37 = __toESM(require("react"));
|
|
3748
3723
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3749
3724
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
3750
3725
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3751
|
-
var
|
|
3752
|
-
var
|
|
3726
|
+
var import_icons16 = require("@elementor/icons");
|
|
3727
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
3753
3728
|
|
|
3754
3729
|
// src/components/fields/color-field.tsx
|
|
3755
|
-
var
|
|
3756
|
-
var
|
|
3757
|
-
var
|
|
3730
|
+
var React35 = __toESM(require("react"));
|
|
3731
|
+
var import_react26 = require("react");
|
|
3732
|
+
var import_ui33 = require("@elementor/ui");
|
|
3758
3733
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3759
|
-
const [color, setColor] = (0,
|
|
3760
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3761
|
-
const defaultRef = (0,
|
|
3734
|
+
const [color, setColor] = (0, import_react26.useState)(value);
|
|
3735
|
+
const [errorMessage, setErrorMessage] = (0, import_react26.useState)("");
|
|
3736
|
+
const defaultRef = (0, import_react26.useRef)(null);
|
|
3762
3737
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3763
3738
|
const handleChange = (newValue) => {
|
|
3764
3739
|
setColor(newValue);
|
|
@@ -3767,8 +3742,8 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3767
3742
|
onValidationChange?.(errorMsg);
|
|
3768
3743
|
onChange(errorMsg ? "" : newValue);
|
|
3769
3744
|
};
|
|
3770
|
-
return /* @__PURE__ */
|
|
3771
|
-
|
|
3745
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3746
|
+
import_ui33.UnstableColorField,
|
|
3772
3747
|
{
|
|
3773
3748
|
id: "color-variable-field",
|
|
3774
3749
|
size: "tiny",
|
|
@@ -3796,21 +3771,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3796
3771
|
};
|
|
3797
3772
|
|
|
3798
3773
|
// src/components/fields/font-field.tsx
|
|
3799
|
-
var
|
|
3800
|
-
var
|
|
3774
|
+
var React36 = __toESM(require("react"));
|
|
3775
|
+
var import_react27 = require("react");
|
|
3801
3776
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
3802
3777
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3803
|
-
var
|
|
3804
|
-
var
|
|
3805
|
-
var
|
|
3778
|
+
var import_icons15 = require("@elementor/icons");
|
|
3779
|
+
var import_ui34 = require("@elementor/ui");
|
|
3780
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3806
3781
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3807
|
-
const [fontFamily, setFontFamily] = (0,
|
|
3808
|
-
const defaultRef = (0,
|
|
3782
|
+
const [fontFamily, setFontFamily] = (0, import_react27.useState)(value);
|
|
3783
|
+
const defaultRef = (0, import_react27.useRef)(null);
|
|
3809
3784
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3810
|
-
const fontPopoverState = (0,
|
|
3785
|
+
const fontPopoverState = (0, import_ui34.usePopupState)({ variant: "popover" });
|
|
3811
3786
|
const fontFamilies = (0, import_editor_controls13.useFontFamilies)();
|
|
3812
3787
|
const sectionWidth = (0, import_editor_ui12.useSectionWidth)();
|
|
3813
|
-
const mapFontSubs =
|
|
3788
|
+
const mapFontSubs = React36.useMemo(() => {
|
|
3814
3789
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3815
3790
|
label,
|
|
3816
3791
|
items: fonts
|
|
@@ -3826,28 +3801,28 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3826
3801
|
handleChange(newFontFamily);
|
|
3827
3802
|
fontPopoverState.close();
|
|
3828
3803
|
};
|
|
3829
|
-
const id2 = (0,
|
|
3830
|
-
return /* @__PURE__ */
|
|
3831
|
-
|
|
3804
|
+
const id2 = (0, import_react27.useId)();
|
|
3805
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3806
|
+
import_ui34.UnstableTag,
|
|
3832
3807
|
{
|
|
3833
3808
|
id: id2,
|
|
3834
3809
|
variant: "outlined",
|
|
3835
3810
|
label: fontFamily,
|
|
3836
|
-
endIcon: /* @__PURE__ */
|
|
3837
|
-
...(0,
|
|
3811
|
+
endIcon: /* @__PURE__ */ React36.createElement(import_icons15.ChevronDownIcon, { fontSize: "tiny" }),
|
|
3812
|
+
...(0, import_ui34.bindTrigger)(fontPopoverState),
|
|
3838
3813
|
fullWidth: true
|
|
3839
3814
|
}
|
|
3840
|
-
), /* @__PURE__ */
|
|
3841
|
-
|
|
3815
|
+
), /* @__PURE__ */ React36.createElement(
|
|
3816
|
+
import_ui34.Popover,
|
|
3842
3817
|
{
|
|
3843
3818
|
disablePortal: true,
|
|
3844
3819
|
disableScrollLock: true,
|
|
3845
3820
|
anchorEl: anchorRef,
|
|
3846
3821
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3847
3822
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3848
|
-
...(0,
|
|
3823
|
+
...(0, import_ui34.bindPopover)(fontPopoverState)
|
|
3849
3824
|
},
|
|
3850
|
-
/* @__PURE__ */
|
|
3825
|
+
/* @__PURE__ */ React36.createElement(
|
|
3851
3826
|
import_editor_controls13.ItemSelector,
|
|
3852
3827
|
{
|
|
3853
3828
|
id: "font-family-variables-selector",
|
|
@@ -3856,10 +3831,10 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3856
3831
|
onItemChange: handleFontFamilyChange,
|
|
3857
3832
|
onClose: fontPopoverState.close,
|
|
3858
3833
|
sectionWidth,
|
|
3859
|
-
title: (0,
|
|
3834
|
+
title: (0, import_i18n25.__)("Font family", "elementor"),
|
|
3860
3835
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3861
3836
|
onDebounce: import_editor_controls13.enqueueFont,
|
|
3862
|
-
icon:
|
|
3837
|
+
icon: import_icons15.TextIcon
|
|
3863
3838
|
}
|
|
3864
3839
|
)
|
|
3865
3840
|
));
|
|
@@ -3881,11 +3856,11 @@ function registerVariableTypes() {
|
|
|
3881
3856
|
registerVariableType({
|
|
3882
3857
|
key: colorVariablePropTypeUtil.key,
|
|
3883
3858
|
valueField: ColorField,
|
|
3884
|
-
icon:
|
|
3859
|
+
icon: import_icons16.BrushIcon,
|
|
3885
3860
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3886
3861
|
fallbackPropTypeUtil: import_editor_props5.colorPropTypeUtil,
|
|
3887
3862
|
variableType: "color",
|
|
3888
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3863
|
+
startIcon: ({ value }) => /* @__PURE__ */ React37.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3889
3864
|
defaultValue: "#ffffff",
|
|
3890
3865
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3891
3866
|
const actions = [];
|
|
@@ -3894,15 +3869,15 @@ function registerVariableTypes() {
|
|
|
3894
3869
|
}
|
|
3895
3870
|
if (variable.sync_to_v3) {
|
|
3896
3871
|
actions.push({
|
|
3897
|
-
name: (0,
|
|
3898
|
-
icon:
|
|
3872
|
+
name: (0, import_i18n26.__)("Stop syncing to Version 3", "elementor"),
|
|
3873
|
+
icon: import_icons16.ResetIcon,
|
|
3899
3874
|
color: "text.primary",
|
|
3900
3875
|
onClick: () => handlers.onStopSync(variableId)
|
|
3901
3876
|
});
|
|
3902
3877
|
} else {
|
|
3903
3878
|
actions.push({
|
|
3904
|
-
name: (0,
|
|
3905
|
-
icon:
|
|
3879
|
+
name: (0, import_i18n26.__)("Sync to Version 3", "elementor"),
|
|
3880
|
+
icon: import_icons16.ResetIcon,
|
|
3906
3881
|
color: "text.primary",
|
|
3907
3882
|
onClick: () => handlers.onStartSync(variableId)
|
|
3908
3883
|
});
|
|
@@ -3913,7 +3888,7 @@ function registerVariableTypes() {
|
|
|
3913
3888
|
registerVariableType({
|
|
3914
3889
|
key: fontVariablePropTypeUtil.key,
|
|
3915
3890
|
valueField: FontField,
|
|
3916
|
-
icon:
|
|
3891
|
+
icon: import_icons16.TextIcon,
|
|
3917
3892
|
propTypeUtil: fontVariablePropTypeUtil,
|
|
3918
3893
|
fallbackPropTypeUtil: import_editor_props5.stringPropTypeUtil,
|
|
3919
3894
|
variableType: "font",
|
|
@@ -3921,13 +3896,13 @@ function registerVariableTypes() {
|
|
|
3921
3896
|
});
|
|
3922
3897
|
const sizePromotions = {
|
|
3923
3898
|
isActive: false,
|
|
3924
|
-
icon:
|
|
3899
|
+
icon: import_icons16.ExpandDiagonalIcon,
|
|
3925
3900
|
propTypeUtil: sizeVariablePropTypeUtil,
|
|
3926
3901
|
fallbackPropTypeUtil: import_editor_props5.sizePropTypeUtil,
|
|
3927
3902
|
styleTransformer: EmptyTransformer,
|
|
3928
3903
|
variableType: "size",
|
|
3929
3904
|
selectionFilter: () => [],
|
|
3930
|
-
emptyState: /* @__PURE__ */
|
|
3905
|
+
emptyState: /* @__PURE__ */ React37.createElement(import_editor_ui13.CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3931
3906
|
};
|
|
3932
3907
|
registerVariableType({
|
|
3933
3908
|
...sizePromotions,
|
|
@@ -3941,10 +3916,10 @@ function registerVariableTypes() {
|
|
|
3941
3916
|
}
|
|
3942
3917
|
|
|
3943
3918
|
// src/renderers/style-variables-renderer.tsx
|
|
3944
|
-
var
|
|
3945
|
-
var
|
|
3919
|
+
var React38 = __toESM(require("react"));
|
|
3920
|
+
var import_react28 = require("react");
|
|
3946
3921
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3947
|
-
var
|
|
3922
|
+
var import_ui35 = require("@elementor/ui");
|
|
3948
3923
|
var VARIABLES_WRAPPER = "body";
|
|
3949
3924
|
function StyleVariablesRenderer() {
|
|
3950
3925
|
const container = usePortalContainer();
|
|
@@ -3955,14 +3930,14 @@ function StyleVariablesRenderer() {
|
|
|
3955
3930
|
}
|
|
3956
3931
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3957
3932
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3958
|
-
return /* @__PURE__ */
|
|
3933
|
+
return /* @__PURE__ */ React38.createElement(import_ui35.Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3959
3934
|
}
|
|
3960
3935
|
function usePortalContainer() {
|
|
3961
3936
|
return (0, import_editor_v1_adapters6.__privateUseListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters6.getCanvasIframeDocument)()?.head);
|
|
3962
3937
|
}
|
|
3963
3938
|
function useStyleVariables() {
|
|
3964
|
-
const [variables, setVariables] = (0,
|
|
3965
|
-
(0,
|
|
3939
|
+
const [variables, setVariables] = (0, import_react28.useState)({});
|
|
3940
|
+
(0, import_react28.useEffect)(() => {
|
|
3966
3941
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3967
3942
|
return () => {
|
|
3968
3943
|
unsubscribe();
|
|
@@ -3985,22 +3960,22 @@ var import_editor_controls14 = require("@elementor/editor-controls");
|
|
|
3985
3960
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
3986
3961
|
|
|
3987
3962
|
// src/components/variables-repeater-item-slot.tsx
|
|
3988
|
-
var
|
|
3963
|
+
var React39 = __toESM(require("react"));
|
|
3989
3964
|
var useColorVariable = (value) => {
|
|
3990
3965
|
const variableId = value?.value?.color?.value;
|
|
3991
3966
|
return useVariable(variableId || "");
|
|
3992
3967
|
};
|
|
3993
3968
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3994
3969
|
const colorVariable = useColorVariable(value);
|
|
3995
|
-
return /* @__PURE__ */
|
|
3970
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3996
3971
|
};
|
|
3997
3972
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3998
3973
|
const colorVariable = useColorVariable(value);
|
|
3999
|
-
return /* @__PURE__ */
|
|
3974
|
+
return /* @__PURE__ */ React39.createElement("span", null, colorVariable?.label);
|
|
4000
3975
|
};
|
|
4001
3976
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
4002
3977
|
const colorVariable = useColorVariable(value);
|
|
4003
|
-
return /* @__PURE__ */
|
|
3978
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
4004
3979
|
};
|
|
4005
3980
|
|
|
4006
3981
|
// src/repeater-injections.ts
|