@elementor/editor-variables 4.0.0-552 → 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 +740 -706
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +655 -633
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/ui/variable-promotion-chip.tsx +63 -0
- package/src/components/variables-manager/ui/variable-edit-menu.tsx +14 -3
- package/src/components/variables-manager/ui/variable-table-row.tsx +210 -0
- package/src/components/variables-manager/variable-editable-cell.tsx +12 -4
- package/src/components/variables-manager/variables-manager-create-menu.tsx +11 -38
- package/src/components/variables-manager/variables-manager-panel.tsx +31 -3
- package/src/components/variables-manager/variables-manager-table.tsx +17 -188
- package/src/hooks/use-quota-permissions.ts +2 -2
- package/src/components/ui/stop-sync-confirmation-dialog.tsx +0 -77
package/dist/index.js
CHANGED
|
@@ -50,17 +50,17 @@ 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
|
|
62
|
+
var import_icons5 = require("@elementor/icons");
|
|
63
|
+
var import_ui14 = require("@elementor/ui");
|
|
64
64
|
var import_i18n10 = require("@wordpress/i18n");
|
|
65
65
|
|
|
66
66
|
// src/utils/tracking.ts
|
|
@@ -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);
|
|
@@ -1141,17 +1103,16 @@ var useVariablesManagerState = () => {
|
|
|
1141
1103
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1142
1104
|
var React7 = __toESM(require("react"));
|
|
1143
1105
|
var import_react7 = require("react");
|
|
1144
|
-
var
|
|
1145
|
-
var import_icons3 = require("@elementor/icons");
|
|
1106
|
+
var import_icons2 = require("@elementor/icons");
|
|
1146
1107
|
var import_ui7 = require("@elementor/ui");
|
|
1147
|
-
var
|
|
1108
|
+
var import_utils2 = require("@elementor/utils");
|
|
1148
1109
|
var import_i18n8 = require("@wordpress/i18n");
|
|
1149
1110
|
|
|
1150
1111
|
// src/hooks/use-quota-permissions.ts
|
|
1151
1112
|
var useQuotaPermissions = (variableType) => {
|
|
1152
1113
|
const quotaConfig = {
|
|
1153
|
-
...window.ElementorVariablesQuotaConfig
|
|
1154
|
-
...window.ElementorVariablesQuotaConfigExtended
|
|
1114
|
+
...window.ElementorVariablesQuotaConfig ?? {},
|
|
1115
|
+
...window.ElementorVariablesQuotaConfigExtended ?? {}
|
|
1155
1116
|
};
|
|
1156
1117
|
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1157
1118
|
const limit = quotaConfig[variableType] || 0;
|
|
@@ -1162,14 +1123,60 @@ var useQuotaPermissions = (variableType) => {
|
|
|
1162
1123
|
};
|
|
1163
1124
|
};
|
|
1164
1125
|
|
|
1126
|
+
// src/components/ui/variable-promotion-chip.tsx
|
|
1127
|
+
var React6 = __toESM(require("react"));
|
|
1128
|
+
var import_react6 = require("react");
|
|
1129
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1130
|
+
var import_ui6 = require("@elementor/ui");
|
|
1131
|
+
var import_utils = require("@elementor/utils");
|
|
1132
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
1133
|
+
var VariablePromotionChip = (0, import_react6.forwardRef)(
|
|
1134
|
+
({ variableType, upgradeUrl }, ref) => {
|
|
1135
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
1136
|
+
(0, import_editor_ui2.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
|
|
1137
|
+
const toggle = () => setIsOpen((prev) => !prev);
|
|
1138
|
+
(0, import_react6.useImperativeHandle)(ref, () => ({ toggle }), []);
|
|
1139
|
+
const title = (0, import_i18n7.sprintf)(
|
|
1140
|
+
/* translators: %s: Variable Type. */
|
|
1141
|
+
(0, import_i18n7.__)("%s variables", "elementor"),
|
|
1142
|
+
(0, import_utils.capitalize)(variableType)
|
|
1143
|
+
);
|
|
1144
|
+
const content = (0, import_i18n7.sprintf)(
|
|
1145
|
+
/* translators: %s: Variable Type. */
|
|
1146
|
+
(0, import_i18n7.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1147
|
+
variableType
|
|
1148
|
+
);
|
|
1149
|
+
return /* @__PURE__ */ React6.createElement(
|
|
1150
|
+
import_editor_ui2.PromotionPopover,
|
|
1151
|
+
{
|
|
1152
|
+
open: isOpen,
|
|
1153
|
+
title,
|
|
1154
|
+
content,
|
|
1155
|
+
ctaText: (0, import_i18n7.__)("Upgrade now", "elementor"),
|
|
1156
|
+
ctaUrl: upgradeUrl,
|
|
1157
|
+
onClose: (e) => {
|
|
1158
|
+
e.stopPropagation();
|
|
1159
|
+
setIsOpen(false);
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
/* @__PURE__ */ React6.createElement(
|
|
1163
|
+
import_ui6.Box,
|
|
1164
|
+
{
|
|
1165
|
+
onClick: (e) => {
|
|
1166
|
+
e.stopPropagation();
|
|
1167
|
+
toggle();
|
|
1168
|
+
},
|
|
1169
|
+
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1170
|
+
},
|
|
1171
|
+
/* @__PURE__ */ React6.createElement(import_editor_ui2.PromotionChip, null)
|
|
1172
|
+
)
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
);
|
|
1176
|
+
|
|
1165
1177
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1166
1178
|
var SIZE = "tiny";
|
|
1167
|
-
var VariableManagerCreateMenu = ({
|
|
1168
|
-
variables,
|
|
1169
|
-
onCreate,
|
|
1170
|
-
disabled,
|
|
1171
|
-
menuState
|
|
1172
|
-
}) => {
|
|
1179
|
+
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1173
1180
|
const buttonRef = (0, import_react7.useRef)(null);
|
|
1174
1181
|
const variableTypes = getVariableTypes();
|
|
1175
1182
|
const menuOptionConfigs = (0, import_react7.useMemo)(
|
|
@@ -1187,11 +1194,10 @@ var VariableManagerCreateMenu = ({
|
|
|
1187
1194
|
{
|
|
1188
1195
|
...(0, import_ui7.bindTrigger)(menuState),
|
|
1189
1196
|
ref: buttonRef,
|
|
1190
|
-
disabled,
|
|
1191
1197
|
size: SIZE,
|
|
1192
1198
|
"aria-label": (0, import_i18n8.__)("Add variable", "elementor")
|
|
1193
1199
|
},
|
|
1194
|
-
/* @__PURE__ */ React7.createElement(
|
|
1200
|
+
/* @__PURE__ */ React7.createElement(import_icons2.PlusIcon, { fontSize: SIZE })
|
|
1195
1201
|
), /* @__PURE__ */ React7.createElement(
|
|
1196
1202
|
import_ui7.Menu,
|
|
1197
1203
|
{
|
|
@@ -1232,15 +1238,13 @@ var MenuOption = ({
|
|
|
1232
1238
|
onCreate,
|
|
1233
1239
|
onClose
|
|
1234
1240
|
}) => {
|
|
1235
|
-
const
|
|
1241
|
+
const promotionRef = (0, import_react7.useRef)(null);
|
|
1236
1242
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1237
|
-
const displayName = (0,
|
|
1243
|
+
const displayName = (0, import_utils2.capitalize)(config.variableType);
|
|
1238
1244
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
1239
1245
|
const handleClick = () => {
|
|
1240
1246
|
if (isDisabled) {
|
|
1241
|
-
|
|
1242
|
-
setIsPopoverOpen(true);
|
|
1243
|
-
}
|
|
1247
|
+
promotionRef.current?.toggle();
|
|
1244
1248
|
return;
|
|
1245
1249
|
}
|
|
1246
1250
|
const defaultName = getDefaultName(variables, config.key, config.variableType);
|
|
@@ -1248,29 +1252,13 @@ var MenuOption = ({
|
|
|
1248
1252
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1249
1253
|
onClose();
|
|
1250
1254
|
};
|
|
1251
|
-
const title = (0, import_i18n8.sprintf)(
|
|
1252
|
-
/* translators: %s: Variable Type. */
|
|
1253
|
-
(0, import_i18n8.__)("%s variables", "elementor"),
|
|
1254
|
-
(0, import_utils.capitalize)(config.variableType)
|
|
1255
|
-
);
|
|
1256
|
-
const content = (0, import_i18n8.sprintf)(
|
|
1257
|
-
/* translators: %s: Variable Type. */
|
|
1258
|
-
(0, import_i18n8.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1259
|
-
config.variableType
|
|
1260
|
-
);
|
|
1261
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(
|
|
1262
|
-
|
|
1256
|
+
VariablePromotionChip,
|
|
1263
1257
|
{
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1269
|
-
onClose: () => {
|
|
1270
|
-
setIsPopoverOpen(false);
|
|
1271
|
-
}
|
|
1272
|
-
},
|
|
1273
|
-
/* @__PURE__ */ React7.createElement(import_editor_ui2.PromotionChip, null)
|
|
1258
|
+
variableType: config.variableType,
|
|
1259
|
+
upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1260
|
+
ref: promotionRef
|
|
1261
|
+
}
|
|
1274
1262
|
));
|
|
1275
1263
|
};
|
|
1276
1264
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1285,18 +1273,47 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1285
1273
|
};
|
|
1286
1274
|
|
|
1287
1275
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
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");
|
|
1280
|
+
|
|
1281
|
+
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1282
|
+
var React8 = __toESM(require("react"));
|
|
1283
|
+
var import_ui8 = require("@elementor/ui");
|
|
1284
|
+
var VariableTableCell = ({
|
|
1285
|
+
children,
|
|
1286
|
+
isHeader,
|
|
1287
|
+
width,
|
|
1288
|
+
maxWidth,
|
|
1289
|
+
align,
|
|
1290
|
+
noPadding,
|
|
1291
|
+
sx
|
|
1292
|
+
}) => {
|
|
1293
|
+
const baseSx = {
|
|
1294
|
+
maxWidth: maxWidth ?? 150,
|
|
1295
|
+
cursor: "initial",
|
|
1296
|
+
typography: "caption",
|
|
1297
|
+
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1298
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1299
|
+
...width && { width },
|
|
1300
|
+
...sx
|
|
1301
|
+
};
|
|
1302
|
+
return /* @__PURE__ */ React8.createElement(import_ui8.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1288
1306
|
var React12 = __toESM(require("react"));
|
|
1289
1307
|
var import_react11 = require("react");
|
|
1290
1308
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1291
|
-
var
|
|
1309
|
+
var import_icons4 = require("@elementor/icons");
|
|
1292
1310
|
var import_ui12 = require("@elementor/ui");
|
|
1293
|
-
var import_i18n9 = require("@wordpress/i18n");
|
|
1294
1311
|
|
|
1295
1312
|
// src/components/fields/label-field.tsx
|
|
1296
|
-
var
|
|
1313
|
+
var React9 = __toESM(require("react"));
|
|
1297
1314
|
var import_react8 = require("react");
|
|
1298
1315
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1299
|
-
var
|
|
1316
|
+
var import_ui9 = require("@elementor/ui");
|
|
1300
1317
|
function isLabelEqual(a, b) {
|
|
1301
1318
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1302
1319
|
}
|
|
@@ -1335,8 +1352,8 @@ var LabelField = ({
|
|
|
1335
1352
|
errorMsg = error.message;
|
|
1336
1353
|
}
|
|
1337
1354
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1338
|
-
const textField = /* @__PURE__ */
|
|
1339
|
-
|
|
1355
|
+
const textField = /* @__PURE__ */ React9.createElement(
|
|
1356
|
+
import_ui9.TextField,
|
|
1340
1357
|
{
|
|
1341
1358
|
ref: fieldRef,
|
|
1342
1359
|
id: id2,
|
|
@@ -1356,7 +1373,7 @@ var LabelField = ({
|
|
|
1356
1373
|
);
|
|
1357
1374
|
if (showWarningInfotip) {
|
|
1358
1375
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1359
|
-
return /* @__PURE__ */
|
|
1376
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1360
1377
|
import_editor_ui3.WarningInfotip,
|
|
1361
1378
|
{
|
|
1362
1379
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1372,89 +1389,11 @@ var LabelField = ({
|
|
|
1372
1389
|
return textField;
|
|
1373
1390
|
};
|
|
1374
1391
|
|
|
1375
|
-
// src/components/variables-manager/
|
|
1376
|
-
var React9 = __toESM(require("react"));
|
|
1377
|
-
var import_react9 = require("react");
|
|
1378
|
-
var import_icons4 = require("@elementor/icons");
|
|
1379
|
-
var import_ui9 = require("@elementor/ui");
|
|
1380
|
-
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1381
|
-
const menuState = (0, import_ui9.usePopupState)({
|
|
1382
|
-
variant: "popover"
|
|
1383
|
-
});
|
|
1384
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(import_ui9.IconButton, { ...(0, import_ui9.bindTrigger)(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React9.createElement(import_icons4.DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React9.createElement(
|
|
1385
|
-
import_ui9.Menu,
|
|
1386
|
-
{
|
|
1387
|
-
disablePortal: true,
|
|
1388
|
-
MenuListProps: {
|
|
1389
|
-
dense: true
|
|
1390
|
-
},
|
|
1391
|
-
PaperProps: {
|
|
1392
|
-
elevation: 6
|
|
1393
|
-
},
|
|
1394
|
-
...(0, import_ui9.bindMenu)(menuState),
|
|
1395
|
-
anchorEl: menuState.anchorEl,
|
|
1396
|
-
anchorOrigin: {
|
|
1397
|
-
vertical: "bottom",
|
|
1398
|
-
horizontal: "right"
|
|
1399
|
-
},
|
|
1400
|
-
transformOrigin: {
|
|
1401
|
-
vertical: "top",
|
|
1402
|
-
horizontal: "right"
|
|
1403
|
-
},
|
|
1404
|
-
open: menuState.isOpen,
|
|
1405
|
-
onClose: menuState.close
|
|
1406
|
-
},
|
|
1407
|
-
menuActions.map((action) => /* @__PURE__ */ React9.createElement(
|
|
1408
|
-
import_ui9.MenuItem,
|
|
1409
|
-
{
|
|
1410
|
-
key: action.name,
|
|
1411
|
-
onClick: () => {
|
|
1412
|
-
action.onClick?.(itemId);
|
|
1413
|
-
menuState.close();
|
|
1414
|
-
},
|
|
1415
|
-
sx: {
|
|
1416
|
-
color: action.color,
|
|
1417
|
-
gap: 1
|
|
1418
|
-
}
|
|
1419
|
-
},
|
|
1420
|
-
action.icon && (0, import_react9.createElement)(action.icon, {
|
|
1421
|
-
fontSize: "inherit"
|
|
1422
|
-
}),
|
|
1423
|
-
" ",
|
|
1424
|
-
action.name
|
|
1425
|
-
))
|
|
1426
|
-
));
|
|
1427
|
-
};
|
|
1428
|
-
|
|
1429
|
-
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1392
|
+
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1430
1393
|
var React10 = __toESM(require("react"));
|
|
1394
|
+
var import_react9 = require("react");
|
|
1431
1395
|
var import_ui10 = require("@elementor/ui");
|
|
1432
|
-
var
|
|
1433
|
-
children,
|
|
1434
|
-
isHeader,
|
|
1435
|
-
width,
|
|
1436
|
-
maxWidth,
|
|
1437
|
-
align,
|
|
1438
|
-
noPadding,
|
|
1439
|
-
sx
|
|
1440
|
-
}) => {
|
|
1441
|
-
const baseSx = {
|
|
1442
|
-
maxWidth: maxWidth ?? 150,
|
|
1443
|
-
cursor: "initial",
|
|
1444
|
-
typography: "caption",
|
|
1445
|
-
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1446
|
-
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1447
|
-
...width && { width },
|
|
1448
|
-
...sx
|
|
1449
|
-
};
|
|
1450
|
-
return /* @__PURE__ */ React10.createElement(import_ui10.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1451
|
-
};
|
|
1452
|
-
|
|
1453
|
-
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1454
|
-
var React11 = __toESM(require("react"));
|
|
1455
|
-
var import_react10 = require("react");
|
|
1456
|
-
var import_ui11 = require("@elementor/ui");
|
|
1457
|
-
var VariableEditableCell = React11.memo(
|
|
1396
|
+
var VariableEditableCell = React10.memo(
|
|
1458
1397
|
({
|
|
1459
1398
|
initialValue,
|
|
1460
1399
|
children,
|
|
@@ -1465,33 +1404,40 @@ var VariableEditableCell = React11.memo(
|
|
|
1465
1404
|
onRowRef,
|
|
1466
1405
|
onAutoEditComplete,
|
|
1467
1406
|
gap = 1,
|
|
1468
|
-
fieldType
|
|
1407
|
+
fieldType,
|
|
1408
|
+
disabled = false
|
|
1469
1409
|
}) => {
|
|
1470
|
-
const [value, setValue] = (0,
|
|
1471
|
-
const [isEditing, setIsEditing] = (0,
|
|
1410
|
+
const [value, setValue] = (0, import_react9.useState)(initialValue);
|
|
1411
|
+
const [isEditing, setIsEditing] = (0, import_react9.useState)(false);
|
|
1472
1412
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1473
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
1474
|
-
const rowRef = (0,
|
|
1475
|
-
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)(() => {
|
|
1476
1416
|
const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
|
|
1477
1417
|
if (!hasError) {
|
|
1478
1418
|
onChange(value);
|
|
1479
1419
|
}
|
|
1480
1420
|
setIsEditing(false);
|
|
1481
1421
|
}, [value, onChange, fieldType, labelFieldError, valueFieldError]);
|
|
1482
|
-
(0,
|
|
1422
|
+
(0, import_react9.useEffect)(() => {
|
|
1483
1423
|
onRowRef?.(rowRef?.current);
|
|
1484
1424
|
}, [onRowRef]);
|
|
1485
|
-
(0,
|
|
1486
|
-
if (autoEdit && !isEditing) {
|
|
1425
|
+
(0, import_react9.useEffect)(() => {
|
|
1426
|
+
if (autoEdit && !isEditing && !disabled) {
|
|
1487
1427
|
setIsEditing(true);
|
|
1488
1428
|
onAutoEditComplete?.();
|
|
1489
1429
|
}
|
|
1490
|
-
}, [autoEdit, isEditing, onAutoEditComplete]);
|
|
1430
|
+
}, [autoEdit, isEditing, onAutoEditComplete, disabled]);
|
|
1491
1431
|
const handleDoubleClick = () => {
|
|
1432
|
+
if (disabled) {
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1492
1435
|
setIsEditing(true);
|
|
1493
1436
|
};
|
|
1494
1437
|
const handleKeyDown = (event) => {
|
|
1438
|
+
if (disabled) {
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1495
1441
|
if (event.key === "Enter") {
|
|
1496
1442
|
handleSave();
|
|
1497
1443
|
} else if (event.key === "Escape") {
|
|
@@ -1502,10 +1448,10 @@ var VariableEditableCell = React11.memo(
|
|
|
1502
1448
|
setIsEditing(true);
|
|
1503
1449
|
}
|
|
1504
1450
|
};
|
|
1505
|
-
const handleChange = (0,
|
|
1451
|
+
const handleChange = (0, import_react9.useCallback)((newValue) => {
|
|
1506
1452
|
setValue(newValue);
|
|
1507
1453
|
}, []);
|
|
1508
|
-
const handleValidationChange = (0,
|
|
1454
|
+
const handleValidationChange = (0, import_react9.useCallback)(
|
|
1509
1455
|
(errorMsg) => {
|
|
1510
1456
|
if (fieldType === "label") {
|
|
1511
1457
|
setLabelFieldError({
|
|
@@ -1531,8 +1477,8 @@ var VariableEditableCell = React11.memo(
|
|
|
1531
1477
|
error: currentError
|
|
1532
1478
|
});
|
|
1533
1479
|
if (isEditing) {
|
|
1534
|
-
return /* @__PURE__ */
|
|
1535
|
-
|
|
1480
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React10.createElement(
|
|
1481
|
+
import_ui10.Stack,
|
|
1536
1482
|
{
|
|
1537
1483
|
ref: rowRef,
|
|
1538
1484
|
direction: "row",
|
|
@@ -1548,8 +1494,8 @@ var VariableEditableCell = React11.memo(
|
|
|
1548
1494
|
editableContent
|
|
1549
1495
|
));
|
|
1550
1496
|
}
|
|
1551
|
-
return /* @__PURE__ */
|
|
1552
|
-
|
|
1497
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1498
|
+
import_ui10.Stack,
|
|
1553
1499
|
{
|
|
1554
1500
|
ref: rowRef,
|
|
1555
1501
|
direction: "row",
|
|
@@ -1557,9 +1503,9 @@ var VariableEditableCell = React11.memo(
|
|
|
1557
1503
|
gap,
|
|
1558
1504
|
onDoubleClick: handleDoubleClick,
|
|
1559
1505
|
onKeyDown: handleKeyDown,
|
|
1560
|
-
tabIndex: 0,
|
|
1506
|
+
tabIndex: disabled ? -1 : 0,
|
|
1561
1507
|
role: "button",
|
|
1562
|
-
"aria-label": "Double click or press Space to edit"
|
|
1508
|
+
"aria-label": disabled ? "" : "Double click or press Space to edit"
|
|
1563
1509
|
},
|
|
1564
1510
|
prefixElement,
|
|
1565
1511
|
children
|
|
@@ -1567,6 +1513,243 @@ var VariableEditableCell = React11.memo(
|
|
|
1567
1513
|
}
|
|
1568
1514
|
);
|
|
1569
1515
|
|
|
1516
|
+
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
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");
|
|
1521
|
+
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1522
|
+
const menuState = (0, import_ui11.usePopupState)({
|
|
1523
|
+
variant: "popover"
|
|
1524
|
+
});
|
|
1525
|
+
const triggerProps = (0, import_ui11.bindTrigger)(menuState);
|
|
1526
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1527
|
+
import_ui11.IconButton,
|
|
1528
|
+
{
|
|
1529
|
+
...triggerProps,
|
|
1530
|
+
disabled,
|
|
1531
|
+
size: "tiny",
|
|
1532
|
+
onClick: (e) => {
|
|
1533
|
+
e.stopPropagation();
|
|
1534
|
+
triggerProps.onClick?.(e);
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1537
|
+
/* @__PURE__ */ React11.createElement(import_icons3.DotsVerticalIcon, { fontSize: "tiny" })
|
|
1538
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1539
|
+
import_ui11.Menu,
|
|
1540
|
+
{
|
|
1541
|
+
disablePortal: true,
|
|
1542
|
+
MenuListProps: {
|
|
1543
|
+
dense: true
|
|
1544
|
+
},
|
|
1545
|
+
PaperProps: {
|
|
1546
|
+
elevation: 6
|
|
1547
|
+
},
|
|
1548
|
+
...(0, import_ui11.bindMenu)(menuState),
|
|
1549
|
+
anchorEl: menuState.anchorEl,
|
|
1550
|
+
anchorOrigin: {
|
|
1551
|
+
vertical: "bottom",
|
|
1552
|
+
horizontal: "right"
|
|
1553
|
+
},
|
|
1554
|
+
transformOrigin: {
|
|
1555
|
+
vertical: "top",
|
|
1556
|
+
horizontal: "right"
|
|
1557
|
+
},
|
|
1558
|
+
open: menuState.isOpen,
|
|
1559
|
+
onClose: menuState.close
|
|
1560
|
+
},
|
|
1561
|
+
menuActions.map((action) => /* @__PURE__ */ React11.createElement(
|
|
1562
|
+
import_ui11.MenuItem,
|
|
1563
|
+
{
|
|
1564
|
+
key: action.name,
|
|
1565
|
+
onClick: (e) => {
|
|
1566
|
+
e.stopPropagation();
|
|
1567
|
+
action.onClick?.(itemId);
|
|
1568
|
+
menuState.close();
|
|
1569
|
+
},
|
|
1570
|
+
sx: {
|
|
1571
|
+
color: action.color,
|
|
1572
|
+
gap: 1
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
action.icon && (0, import_react10.createElement)(action.icon, {
|
|
1576
|
+
fontSize: "inherit"
|
|
1577
|
+
}),
|
|
1578
|
+
" ",
|
|
1579
|
+
action.name
|
|
1580
|
+
))
|
|
1581
|
+
));
|
|
1582
|
+
};
|
|
1583
|
+
|
|
1584
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1585
|
+
var VariableRow = (props) => {
|
|
1586
|
+
const {
|
|
1587
|
+
row,
|
|
1588
|
+
variables,
|
|
1589
|
+
handleOnChange,
|
|
1590
|
+
autoEditVariableId,
|
|
1591
|
+
onAutoEditComplete,
|
|
1592
|
+
onFieldError,
|
|
1593
|
+
menuActions,
|
|
1594
|
+
handleRowRef,
|
|
1595
|
+
itemProps,
|
|
1596
|
+
showDropIndication,
|
|
1597
|
+
triggerProps,
|
|
1598
|
+
itemStyle,
|
|
1599
|
+
triggerStyle,
|
|
1600
|
+
isDragged,
|
|
1601
|
+
dropPosition,
|
|
1602
|
+
setTriggerRef,
|
|
1603
|
+
isSorting
|
|
1604
|
+
} = props;
|
|
1605
|
+
const promotionRef = (0, import_react11.useRef)(null);
|
|
1606
|
+
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1607
|
+
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1608
|
+
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1609
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1610
|
+
import_ui12.TableRow,
|
|
1611
|
+
{
|
|
1612
|
+
...itemProps,
|
|
1613
|
+
ref: itemProps.ref,
|
|
1614
|
+
selected: isDragged,
|
|
1615
|
+
sx: {
|
|
1616
|
+
...isDisabled && {
|
|
1617
|
+
"& td, & th": {
|
|
1618
|
+
color: "text.disabled"
|
|
1619
|
+
}
|
|
1620
|
+
},
|
|
1621
|
+
...showIndicationBefore && {
|
|
1622
|
+
"& td, & th": {
|
|
1623
|
+
borderTop: "2px solid",
|
|
1624
|
+
borderTopColor: "primary.main"
|
|
1625
|
+
}
|
|
1626
|
+
},
|
|
1627
|
+
...showIndicationAfter && {
|
|
1628
|
+
"& td, & th": {
|
|
1629
|
+
borderBottom: "2px solid",
|
|
1630
|
+
borderBottomColor: "primary.main"
|
|
1631
|
+
}
|
|
1632
|
+
},
|
|
1633
|
+
"&:hover, &:focus-within": {
|
|
1634
|
+
backgroundColor: "action.hover",
|
|
1635
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1636
|
+
opacity: 1
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1639
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1640
|
+
opacity: 0
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
style: { ...itemStyle, ...triggerStyle },
|
|
1644
|
+
onClick: () => {
|
|
1645
|
+
if (isDisabled) {
|
|
1646
|
+
promotionRef.current?.toggle();
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
},
|
|
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(
|
|
1652
|
+
VariableEditableCell,
|
|
1653
|
+
{
|
|
1654
|
+
initialValue: row.name,
|
|
1655
|
+
onChange: (value) => {
|
|
1656
|
+
if (value !== row.name && !isDisabled) {
|
|
1657
|
+
handleOnChange({
|
|
1658
|
+
...variables,
|
|
1659
|
+
[row.id]: { ...variables[row.id], label: value }
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
},
|
|
1663
|
+
prefixElement: (0, import_react11.createElement)(row.icon, {
|
|
1664
|
+
fontSize: "inherit",
|
|
1665
|
+
color: isDisabled ? "disabled" : "inherit"
|
|
1666
|
+
}),
|
|
1667
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React12.createElement(
|
|
1668
|
+
LabelField,
|
|
1669
|
+
{
|
|
1670
|
+
id: "variable-label-" + row.id,
|
|
1671
|
+
size: "tiny",
|
|
1672
|
+
value,
|
|
1673
|
+
onChange,
|
|
1674
|
+
onErrorChange: (errorMsg) => {
|
|
1675
|
+
onValidationChange?.(errorMsg);
|
|
1676
|
+
onFieldError?.(!!errorMsg);
|
|
1677
|
+
},
|
|
1678
|
+
error,
|
|
1679
|
+
focusOnShow: true,
|
|
1680
|
+
selectOnShow: autoEditVariableId === row.id,
|
|
1681
|
+
showWarningInfotip: true,
|
|
1682
|
+
variables
|
|
1683
|
+
}
|
|
1684
|
+
),
|
|
1685
|
+
autoEdit: autoEditVariableId === row.id && !isDisabled,
|
|
1686
|
+
onRowRef: handleRowRef(row.id),
|
|
1687
|
+
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1688
|
+
fieldType: "label",
|
|
1689
|
+
disabled: isDisabled
|
|
1690
|
+
},
|
|
1691
|
+
/* @__PURE__ */ React12.createElement(import_editor_ui4.EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1692
|
+
)),
|
|
1693
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1694
|
+
VariableEditableCell,
|
|
1695
|
+
{
|
|
1696
|
+
initialValue: row.value,
|
|
1697
|
+
onChange: (value) => {
|
|
1698
|
+
if (value !== row.value && !isDisabled) {
|
|
1699
|
+
handleOnChange({
|
|
1700
|
+
...variables,
|
|
1701
|
+
[row.id]: { ...variables[row.id], value }
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
},
|
|
1705
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => row.valueField?.({
|
|
1706
|
+
value,
|
|
1707
|
+
onChange,
|
|
1708
|
+
onPropTypeKeyChange: (type) => {
|
|
1709
|
+
if (!isDisabled) {
|
|
1710
|
+
handleOnChange({
|
|
1711
|
+
...variables,
|
|
1712
|
+
[row.id]: { ...variables[row.id], type }
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
},
|
|
1716
|
+
propTypeKey: row.type,
|
|
1717
|
+
onValidationChange: (errorMsg) => {
|
|
1718
|
+
onValidationChange?.(errorMsg);
|
|
1719
|
+
onFieldError?.(!!errorMsg);
|
|
1720
|
+
},
|
|
1721
|
+
error
|
|
1722
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1723
|
+
onRowRef: handleRowRef(row.id),
|
|
1724
|
+
gap: 0.25,
|
|
1725
|
+
fieldType: "value",
|
|
1726
|
+
disabled: isDisabled
|
|
1727
|
+
},
|
|
1728
|
+
row.startIcon && row.startIcon({ value: row.value }),
|
|
1729
|
+
/* @__PURE__ */ React12.createElement(
|
|
1730
|
+
import_editor_ui4.EllipsisWithTooltip,
|
|
1731
|
+
{
|
|
1732
|
+
title: row.value,
|
|
1733
|
+
sx: {
|
|
1734
|
+
border: "4px solid transparent",
|
|
1735
|
+
lineHeight: "1",
|
|
1736
|
+
pt: 0.25
|
|
1737
|
+
}
|
|
1738
|
+
},
|
|
1739
|
+
row.value
|
|
1740
|
+
)
|
|
1741
|
+
)),
|
|
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(
|
|
1743
|
+
VariablePromotionChip,
|
|
1744
|
+
{
|
|
1745
|
+
variableType: row.variableType,
|
|
1746
|
+
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1747
|
+
ref: promotionRef
|
|
1748
|
+
}
|
|
1749
|
+
), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1750
|
+
);
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1570
1753
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1571
1754
|
var VariablesManagerTable = ({
|
|
1572
1755
|
menuActions,
|
|
@@ -1576,9 +1759,9 @@ var VariablesManagerTable = ({
|
|
|
1576
1759
|
onAutoEditComplete,
|
|
1577
1760
|
onFieldError
|
|
1578
1761
|
}) => {
|
|
1579
|
-
const tableContainerRef = (0,
|
|
1580
|
-
const variableRowRefs = (0,
|
|
1581
|
-
(0,
|
|
1762
|
+
const tableContainerRef = (0, import_react12.useRef)(null);
|
|
1763
|
+
const variableRowRefs = (0, import_react12.useRef)(/* @__PURE__ */ new Map());
|
|
1764
|
+
(0, import_react12.useEffect)(() => {
|
|
1582
1765
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1583
1766
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
1584
1767
|
if (rowElement) {
|
|
@@ -1629,196 +1812,34 @@ var VariablesManagerTable = ({
|
|
|
1629
1812
|
});
|
|
1630
1813
|
handleOnChange(updatedVariables);
|
|
1631
1814
|
};
|
|
1632
|
-
return /* @__PURE__ */
|
|
1633
|
-
|
|
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,
|
|
1634
1817
|
{
|
|
1635
1818
|
value: ids,
|
|
1636
1819
|
onChange: handleReorder,
|
|
1637
1820
|
variant: "static",
|
|
1638
1821
|
restrictAxis: true,
|
|
1639
|
-
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))
|
|
1640
1823
|
},
|
|
1641
|
-
rows.map((row) => /* @__PURE__ */
|
|
1642
|
-
|
|
1824
|
+
rows.map((row) => /* @__PURE__ */ React13.createElement(
|
|
1825
|
+
import_ui13.UnstableSortableItem,
|
|
1643
1826
|
{
|
|
1644
1827
|
key: row.id,
|
|
1645
1828
|
id: row.id,
|
|
1646
|
-
render: (
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
import_ui12.TableRow,
|
|
1661
|
-
{
|
|
1662
|
-
...itemProps,
|
|
1663
|
-
ref: itemProps.ref,
|
|
1664
|
-
selected: isDragged,
|
|
1665
|
-
sx: {
|
|
1666
|
-
...showIndicationBefore && {
|
|
1667
|
-
"& td, & th": {
|
|
1668
|
-
borderTop: "2px solid",
|
|
1669
|
-
borderTopColor: "primary.main"
|
|
1670
|
-
}
|
|
1671
|
-
},
|
|
1672
|
-
...showIndicationAfter && {
|
|
1673
|
-
"& td, & th": {
|
|
1674
|
-
borderBottom: "2px solid",
|
|
1675
|
-
borderBottomColor: "primary.main"
|
|
1676
|
-
}
|
|
1677
|
-
},
|
|
1678
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1679
|
-
opacity: 0
|
|
1680
|
-
},
|
|
1681
|
-
"&:hover, &:focus-within": {
|
|
1682
|
-
backgroundColor: "action.hover",
|
|
1683
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1684
|
-
opacity: 1
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
},
|
|
1688
|
-
style: { ...itemStyle, ...triggerStyle }
|
|
1689
|
-
},
|
|
1690
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(
|
|
1691
|
-
import_ui12.IconButton,
|
|
1692
|
-
{
|
|
1693
|
-
size: "small",
|
|
1694
|
-
ref: setTriggerRef,
|
|
1695
|
-
...triggerProps,
|
|
1696
|
-
disabled: isSorting,
|
|
1697
|
-
draggable: true
|
|
1698
|
-
},
|
|
1699
|
-
/* @__PURE__ */ React12.createElement(import_icons5.GripVerticalIcon, { fontSize: "inherit" })
|
|
1700
|
-
)),
|
|
1701
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1702
|
-
VariableEditableCell,
|
|
1703
|
-
{
|
|
1704
|
-
initialValue: row.name,
|
|
1705
|
-
onChange: (value) => {
|
|
1706
|
-
if (value !== row.name) {
|
|
1707
|
-
handleOnChange({
|
|
1708
|
-
...variables,
|
|
1709
|
-
[row.id]: { ...variables[row.id], label: value }
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
},
|
|
1713
|
-
prefixElement: (0, import_react11.createElement)(row.icon, { fontSize: "inherit" }),
|
|
1714
|
-
editableElement: ({
|
|
1715
|
-
value,
|
|
1716
|
-
onChange,
|
|
1717
|
-
onValidationChange,
|
|
1718
|
-
error
|
|
1719
|
-
}) => /* @__PURE__ */ React12.createElement(
|
|
1720
|
-
LabelField,
|
|
1721
|
-
{
|
|
1722
|
-
id: "variable-label-" + row.id,
|
|
1723
|
-
size: "tiny",
|
|
1724
|
-
value,
|
|
1725
|
-
onChange,
|
|
1726
|
-
onErrorChange: (errorMsg) => {
|
|
1727
|
-
onValidationChange?.(errorMsg);
|
|
1728
|
-
onFieldError?.(!!errorMsg);
|
|
1729
|
-
},
|
|
1730
|
-
error,
|
|
1731
|
-
focusOnShow: true,
|
|
1732
|
-
selectOnShow: autoEditVariableId === row.id,
|
|
1733
|
-
showWarningInfotip: true,
|
|
1734
|
-
variables
|
|
1735
|
-
}
|
|
1736
|
-
),
|
|
1737
|
-
autoEdit: autoEditVariableId === row.id,
|
|
1738
|
-
onRowRef: handleRowRef(row.id),
|
|
1739
|
-
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1740
|
-
fieldType: "label"
|
|
1741
|
-
},
|
|
1742
|
-
/* @__PURE__ */ React12.createElement(
|
|
1743
|
-
import_editor_ui4.EllipsisWithTooltip,
|
|
1744
|
-
{
|
|
1745
|
-
title: row.name,
|
|
1746
|
-
sx: { border: "4px solid transparent" }
|
|
1747
|
-
},
|
|
1748
|
-
row.name
|
|
1749
|
-
)
|
|
1750
|
-
)),
|
|
1751
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1752
|
-
VariableEditableCell,
|
|
1753
|
-
{
|
|
1754
|
-
initialValue: row.value,
|
|
1755
|
-
onChange: (value) => {
|
|
1756
|
-
if (value !== row.value) {
|
|
1757
|
-
handleOnChange({
|
|
1758
|
-
...variables,
|
|
1759
|
-
[row.id]: { ...variables[row.id], value }
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
},
|
|
1763
|
-
editableElement: ({
|
|
1764
|
-
value,
|
|
1765
|
-
onChange,
|
|
1766
|
-
onValidationChange,
|
|
1767
|
-
error
|
|
1768
|
-
}) => row.valueField?.({
|
|
1769
|
-
value,
|
|
1770
|
-
onChange,
|
|
1771
|
-
onPropTypeKeyChange: (type) => {
|
|
1772
|
-
handleOnChange({
|
|
1773
|
-
...variables,
|
|
1774
|
-
[row.id]: { ...variables[row.id], type }
|
|
1775
|
-
});
|
|
1776
|
-
},
|
|
1777
|
-
propTypeKey: row.type,
|
|
1778
|
-
onValidationChange: (errorMsg) => {
|
|
1779
|
-
onValidationChange?.(errorMsg);
|
|
1780
|
-
onFieldError?.(!!errorMsg);
|
|
1781
|
-
},
|
|
1782
|
-
error
|
|
1783
|
-
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1784
|
-
onRowRef: handleRowRef(row.id),
|
|
1785
|
-
gap: 0.25,
|
|
1786
|
-
fieldType: "value"
|
|
1787
|
-
},
|
|
1788
|
-
row.startIcon && row.startIcon({ value: row.value }),
|
|
1789
|
-
/* @__PURE__ */ React12.createElement(
|
|
1790
|
-
import_editor_ui4.EllipsisWithTooltip,
|
|
1791
|
-
{
|
|
1792
|
-
title: row.value,
|
|
1793
|
-
sx: {
|
|
1794
|
-
border: "4px solid transparent",
|
|
1795
|
-
lineHeight: "1",
|
|
1796
|
-
pt: 0.25
|
|
1797
|
-
}
|
|
1798
|
-
},
|
|
1799
|
-
row.value
|
|
1800
|
-
)
|
|
1801
|
-
)),
|
|
1802
|
-
/* @__PURE__ */ React12.createElement(
|
|
1803
|
-
VariableTableCell,
|
|
1804
|
-
{
|
|
1805
|
-
align: "right",
|
|
1806
|
-
noPadding: true,
|
|
1807
|
-
width: 16,
|
|
1808
|
-
maxWidth: 16,
|
|
1809
|
-
sx: { paddingInlineEnd: 1 }
|
|
1810
|
-
},
|
|
1811
|
-
/* @__PURE__ */ React12.createElement(import_ui12.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React12.createElement(
|
|
1812
|
-
VariableEditMenu,
|
|
1813
|
-
{
|
|
1814
|
-
menuActions: menuActions(row.id),
|
|
1815
|
-
disabled: isSorting,
|
|
1816
|
-
itemId: row.id
|
|
1817
|
-
}
|
|
1818
|
-
))
|
|
1819
|
-
)
|
|
1820
|
-
);
|
|
1821
|
-
}
|
|
1829
|
+
render: (props) => /* @__PURE__ */ React13.createElement(
|
|
1830
|
+
VariableRow,
|
|
1831
|
+
{
|
|
1832
|
+
...props,
|
|
1833
|
+
row,
|
|
1834
|
+
variables,
|
|
1835
|
+
handleOnChange,
|
|
1836
|
+
autoEditVariableId,
|
|
1837
|
+
onAutoEditComplete,
|
|
1838
|
+
onFieldError,
|
|
1839
|
+
menuActions,
|
|
1840
|
+
handleRowRef
|
|
1841
|
+
}
|
|
1842
|
+
)
|
|
1822
1843
|
}
|
|
1823
1844
|
))
|
|
1824
1845
|
))));
|
|
@@ -1848,7 +1869,7 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1848
1869
|
function VariablesManagerPanel() {
|
|
1849
1870
|
const { close: closePanel } = usePanelActions();
|
|
1850
1871
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui5.useDialog)();
|
|
1851
|
-
const createMenuState = (0,
|
|
1872
|
+
const createMenuState = (0, import_ui14.usePopupState)({
|
|
1852
1873
|
variant: "popover"
|
|
1853
1874
|
});
|
|
1854
1875
|
const {
|
|
@@ -1869,9 +1890,9 @@ function VariablesManagerPanel() {
|
|
|
1869
1890
|
} = useVariablesManagerState();
|
|
1870
1891
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1871
1892
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1872
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
1873
|
-
const [stopSyncConfirmation, setStopSyncConfirmation] = (0,
|
|
1874
|
-
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);
|
|
1875
1896
|
usePreventUnload(isDirty);
|
|
1876
1897
|
const handleClosePanel = () => {
|
|
1877
1898
|
if (isDirty) {
|
|
@@ -1880,7 +1901,7 @@ function VariablesManagerPanel() {
|
|
|
1880
1901
|
}
|
|
1881
1902
|
closePanel();
|
|
1882
1903
|
};
|
|
1883
|
-
const handleCreateVariable = (0,
|
|
1904
|
+
const handleCreateVariable = (0, import_react13.useCallback)(
|
|
1884
1905
|
(type, defaultName, defaultValue) => {
|
|
1885
1906
|
const newId = createVariable2(type, defaultName, defaultValue);
|
|
1886
1907
|
if (newId) {
|
|
@@ -1914,21 +1935,21 @@ function VariablesManagerPanel() {
|
|
|
1914
1935
|
setIsSaving(false);
|
|
1915
1936
|
}
|
|
1916
1937
|
};
|
|
1917
|
-
const handleDeleteVariableWithConfirmation = (0,
|
|
1938
|
+
const handleDeleteVariableWithConfirmation = (0, import_react13.useCallback)(
|
|
1918
1939
|
(itemId) => {
|
|
1919
1940
|
handleDeleteVariable(itemId);
|
|
1920
1941
|
setDeleteConfirmation(null);
|
|
1921
1942
|
},
|
|
1922
1943
|
[handleDeleteVariable]
|
|
1923
1944
|
);
|
|
1924
|
-
const handleStopSyncWithConfirmation = (0,
|
|
1945
|
+
const handleStopSyncWithConfirmation = (0, import_react13.useCallback)(
|
|
1925
1946
|
(itemId) => {
|
|
1926
1947
|
handleStopSync(itemId);
|
|
1927
1948
|
setStopSyncConfirmation(null);
|
|
1928
1949
|
},
|
|
1929
1950
|
[handleStopSync]
|
|
1930
1951
|
);
|
|
1931
|
-
const buildMenuActions = (0,
|
|
1952
|
+
const buildMenuActions = (0, import_react13.useCallback)(
|
|
1932
1953
|
(variableId) => {
|
|
1933
1954
|
const variable = variables[variableId];
|
|
1934
1955
|
if (!variable) {
|
|
@@ -1944,7 +1965,7 @@ function VariablesManagerPanel() {
|
|
|
1944
1965
|
});
|
|
1945
1966
|
const deleteAction = {
|
|
1946
1967
|
name: (0, import_i18n10.__)("Delete", "elementor"),
|
|
1947
|
-
icon:
|
|
1968
|
+
icon: import_icons5.TrashIcon,
|
|
1948
1969
|
color: "error.main",
|
|
1949
1970
|
onClick: (itemId) => {
|
|
1950
1971
|
const v = variables[itemId];
|
|
@@ -1960,22 +1981,22 @@ function VariablesManagerPanel() {
|
|
|
1960
1981
|
[variables, handleStartSync]
|
|
1961
1982
|
);
|
|
1962
1983
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1963
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ React14.createElement(import_editor_ui5.ThemeProvider, null, /* @__PURE__ */ React14.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React14.createElement(
|
|
1964
1985
|
import_editor_panels.PanelHeader,
|
|
1965
1986
|
{
|
|
1966
1987
|
sx: {
|
|
1967
1988
|
height: "unset"
|
|
1968
1989
|
}
|
|
1969
1990
|
},
|
|
1970
|
-
/* @__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(
|
|
1971
1992
|
VariableManagerCreateMenu,
|
|
1972
1993
|
{
|
|
1973
1994
|
onCreate: handleCreateVariable,
|
|
1974
1995
|
variables,
|
|
1975
1996
|
menuState: createMenuState
|
|
1976
1997
|
}
|
|
1977
|
-
), /* @__PURE__ */
|
|
1978
|
-
|
|
1998
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1999
|
+
import_ui14.CloseButton,
|
|
1979
2000
|
{
|
|
1980
2001
|
"aria-label": "Close",
|
|
1981
2002
|
slotProps: { icon: { fontSize: SIZE } },
|
|
@@ -1983,7 +2004,7 @@ function VariablesManagerPanel() {
|
|
|
1983
2004
|
handleClosePanel();
|
|
1984
2005
|
}
|
|
1985
2006
|
}
|
|
1986
|
-
))), /* @__PURE__ */
|
|
2007
|
+
))), /* @__PURE__ */ React14.createElement(import_ui14.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(
|
|
1987
2008
|
import_editor_ui5.SearchField,
|
|
1988
2009
|
{
|
|
1989
2010
|
sx: {
|
|
@@ -1994,8 +2015,8 @@ function VariablesManagerPanel() {
|
|
|
1994
2015
|
value: searchValue,
|
|
1995
2016
|
onSearch: handleSearch
|
|
1996
2017
|
}
|
|
1997
|
-
)), /* @__PURE__ */
|
|
1998
|
-
), /* @__PURE__ */
|
|
2018
|
+
)), /* @__PURE__ */ React14.createElement(import_ui14.Divider, { sx: { width: "100%" } }))
|
|
2019
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1999
2020
|
import_editor_panels.PanelBody,
|
|
2000
2021
|
{
|
|
2001
2022
|
sx: {
|
|
@@ -2004,7 +2025,7 @@ function VariablesManagerPanel() {
|
|
|
2004
2025
|
height: "100%"
|
|
2005
2026
|
}
|
|
2006
2027
|
},
|
|
2007
|
-
hasVariables && /* @__PURE__ */
|
|
2028
|
+
hasVariables && /* @__PURE__ */ React14.createElement(
|
|
2008
2029
|
VariablesManagerTable,
|
|
2009
2030
|
{
|
|
2010
2031
|
menuActions: buildMenuActions,
|
|
@@ -2015,15 +2036,15 @@ function VariablesManagerPanel() {
|
|
|
2015
2036
|
onFieldError: setIsSaveDisabled
|
|
2016
2037
|
}
|
|
2017
2038
|
),
|
|
2018
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2039
|
+
!hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
2019
2040
|
NoSearchResults,
|
|
2020
2041
|
{
|
|
2021
2042
|
searchValue,
|
|
2022
2043
|
onClear: () => handleSearch(""),
|
|
2023
|
-
icon: /* @__PURE__ */
|
|
2044
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" })
|
|
2024
2045
|
}
|
|
2025
2046
|
),
|
|
2026
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2047
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
2027
2048
|
EmptyState,
|
|
2028
2049
|
{
|
|
2029
2050
|
title: (0, import_i18n10.__)("Create your first variable", "elementor"),
|
|
@@ -2031,27 +2052,27 @@ function VariablesManagerPanel() {
|
|
|
2031
2052
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2032
2053
|
"elementor"
|
|
2033
2054
|
),
|
|
2034
|
-
icon: /* @__PURE__ */
|
|
2055
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" }),
|
|
2035
2056
|
onAdd: createMenuState.open
|
|
2036
2057
|
}
|
|
2037
2058
|
)
|
|
2038
|
-
), /* @__PURE__ */
|
|
2039
|
-
|
|
2059
|
+
), /* @__PURE__ */ React14.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
2060
|
+
import_ui14.Infotip,
|
|
2040
2061
|
{
|
|
2041
2062
|
placement: "right",
|
|
2042
2063
|
open: !!serverError,
|
|
2043
|
-
content: serverError ? /* @__PURE__ */
|
|
2044
|
-
|
|
2064
|
+
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
2065
|
+
import_ui14.Alert,
|
|
2045
2066
|
{
|
|
2046
2067
|
severity: serverError.severity ?? "error",
|
|
2047
|
-
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,
|
|
2048
2069
|
onClose: !serverError.action?.label ? () => {
|
|
2049
2070
|
setServerError(null);
|
|
2050
2071
|
setIsSaveDisabled(false);
|
|
2051
2072
|
} : void 0,
|
|
2052
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2073
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(import_icons5.AlertTriangleFilledIcon, null)
|
|
2053
2074
|
},
|
|
2054
|
-
/* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ React14.createElement(import_ui14.AlertTitle, null, serverError.message),
|
|
2055
2076
|
serverError.action?.message
|
|
2056
2077
|
) : null,
|
|
2057
2078
|
arrow: false,
|
|
@@ -2066,8 +2087,8 @@ function VariablesManagerPanel() {
|
|
|
2066
2087
|
}
|
|
2067
2088
|
}
|
|
2068
2089
|
},
|
|
2069
|
-
/* @__PURE__ */
|
|
2070
|
-
|
|
2090
|
+
/* @__PURE__ */ React14.createElement(
|
|
2091
|
+
import_ui14.Button,
|
|
2071
2092
|
{
|
|
2072
2093
|
fullWidth: true,
|
|
2073
2094
|
size: "small",
|
|
@@ -2079,7 +2100,7 @@ function VariablesManagerPanel() {
|
|
|
2079
2100
|
},
|
|
2080
2101
|
(0, import_i18n10.__)("Save changes", "elementor")
|
|
2081
2102
|
)
|
|
2082
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2103
|
+
))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2083
2104
|
DeleteConfirmationDialog,
|
|
2084
2105
|
{
|
|
2085
2106
|
open: true,
|
|
@@ -2087,14 +2108,14 @@ function VariablesManagerPanel() {
|
|
|
2087
2108
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2088
2109
|
closeDialog: () => setDeleteConfirmation(null)
|
|
2089
2110
|
}
|
|
2090
|
-
), stopSyncConfirmation && /* @__PURE__ */
|
|
2111
|
+
), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2091
2112
|
StopSyncConfirmationDialog,
|
|
2092
2113
|
{
|
|
2093
2114
|
open: true,
|
|
2094
|
-
|
|
2115
|
+
onClose: () => setStopSyncConfirmation(null),
|
|
2095
2116
|
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2096
2117
|
}
|
|
2097
|
-
), 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(
|
|
2098
2119
|
import_editor_ui5.SaveChangesDialog.Actions,
|
|
2099
2120
|
{
|
|
2100
2121
|
actions: {
|
|
@@ -2120,7 +2141,7 @@ function VariablesManagerPanel() {
|
|
|
2120
2141
|
)));
|
|
2121
2142
|
}
|
|
2122
2143
|
var usePreventUnload = (isDirty) => {
|
|
2123
|
-
(0,
|
|
2144
|
+
(0, import_react13.useEffect)(() => {
|
|
2124
2145
|
const handleBeforeUnload = (event) => {
|
|
2125
2146
|
if (isDirty) {
|
|
2126
2147
|
event.preventDefault();
|
|
@@ -2132,6 +2153,19 @@ var usePreventUnload = (isDirty) => {
|
|
|
2132
2153
|
};
|
|
2133
2154
|
}, [isDirty]);
|
|
2134
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
|
+
));
|
|
2135
2169
|
|
|
2136
2170
|
// src/components/open-panel-from-url.tsx
|
|
2137
2171
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
@@ -2139,8 +2173,8 @@ var PANEL_ID = "variables-manager";
|
|
|
2139
2173
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2140
2174
|
function OpenPanelFromUrl() {
|
|
2141
2175
|
const { open } = usePanelActions();
|
|
2142
|
-
const hasOpened = (0,
|
|
2143
|
-
(0,
|
|
2176
|
+
const hasOpened = (0, import_react14.useRef)(false);
|
|
2177
|
+
(0, import_react14.useEffect)(() => {
|
|
2144
2178
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2145
2179
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2146
2180
|
if (activePanel !== PANEL_ID) {
|
|
@@ -2161,15 +2195,15 @@ function OpenPanelFromUrl() {
|
|
|
2161
2195
|
}
|
|
2162
2196
|
|
|
2163
2197
|
// src/controls/variable-control.tsx
|
|
2164
|
-
var
|
|
2198
|
+
var React33 = __toESM(require("react"));
|
|
2165
2199
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
2166
2200
|
|
|
2167
2201
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2168
|
-
var
|
|
2169
|
-
var
|
|
2202
|
+
var import_react21 = require("react");
|
|
2203
|
+
var React24 = __toESM(require("react"));
|
|
2170
2204
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2171
|
-
var
|
|
2172
|
-
var
|
|
2205
|
+
var import_icons12 = require("@elementor/icons");
|
|
2206
|
+
var import_ui24 = require("@elementor/ui");
|
|
2173
2207
|
|
|
2174
2208
|
// src/utils/unlink-variable.ts
|
|
2175
2209
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2188,30 +2222,30 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2188
2222
|
}
|
|
2189
2223
|
|
|
2190
2224
|
// src/components/variable-selection-popover.tsx
|
|
2191
|
-
var
|
|
2192
|
-
var
|
|
2225
|
+
var React22 = __toESM(require("react"));
|
|
2226
|
+
var import_react20 = require("react");
|
|
2193
2227
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2194
2228
|
|
|
2195
2229
|
// src/context/variable-selection-popover.context.tsx
|
|
2196
|
-
var
|
|
2197
|
-
var
|
|
2198
|
-
var
|
|
2199
|
-
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);
|
|
2200
2234
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2201
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2202
|
-
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));
|
|
2203
2237
|
};
|
|
2204
2238
|
var usePopoverContentRef = () => {
|
|
2205
|
-
return (0,
|
|
2239
|
+
return (0, import_react15.useContext)(PopoverContentRefContext);
|
|
2206
2240
|
};
|
|
2207
2241
|
|
|
2208
2242
|
// src/components/variable-creation.tsx
|
|
2209
|
-
var
|
|
2210
|
-
var
|
|
2243
|
+
var React17 = __toESM(require("react"));
|
|
2244
|
+
var import_react16 = require("react");
|
|
2211
2245
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2212
2246
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2213
|
-
var
|
|
2214
|
-
var
|
|
2247
|
+
var import_icons6 = require("@elementor/icons");
|
|
2248
|
+
var import_ui17 = require("@elementor/ui");
|
|
2215
2249
|
var import_i18n11 = require("@wordpress/i18n");
|
|
2216
2250
|
|
|
2217
2251
|
// src/hooks/use-initial-value.ts
|
|
@@ -2255,10 +2289,10 @@ var unwrapValue = (input) => {
|
|
|
2255
2289
|
};
|
|
2256
2290
|
|
|
2257
2291
|
// src/components/ui/form-field.tsx
|
|
2258
|
-
var
|
|
2259
|
-
var
|
|
2292
|
+
var React16 = __toESM(require("react"));
|
|
2293
|
+
var import_ui16 = require("@elementor/ui");
|
|
2260
2294
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2261
|
-
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)));
|
|
2262
2296
|
};
|
|
2263
2297
|
|
|
2264
2298
|
// src/components/variable-creation.tsx
|
|
@@ -2268,11 +2302,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2268
2302
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2269
2303
|
const { propType } = (0, import_editor_controls4.useBoundProp)();
|
|
2270
2304
|
const initialValue = useInitialValue();
|
|
2271
|
-
const [value, setValue] = (0,
|
|
2272
|
-
const [label, setLabel] = (0,
|
|
2273
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2274
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2275
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
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);
|
|
2276
2310
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2277
2311
|
const resetFields = () => {
|
|
2278
2312
|
setValue("");
|
|
@@ -2329,14 +2363,14 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2329
2363
|
handleCreateAndTrack();
|
|
2330
2364
|
}
|
|
2331
2365
|
};
|
|
2332
|
-
return /* @__PURE__ */
|
|
2366
|
+
return /* @__PURE__ */ React17.createElement(import_editor_ui6.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2333
2367
|
import_editor_ui6.PopoverHeader,
|
|
2334
2368
|
{
|
|
2335
|
-
icon: /* @__PURE__ */
|
|
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 })),
|
|
2336
2370
|
title: (0, import_i18n11.__)("Create variable", "elementor"),
|
|
2337
2371
|
onClose: closePopover
|
|
2338
2372
|
}
|
|
2339
|
-
), /* @__PURE__ */
|
|
2373
|
+
), /* @__PURE__ */ React17.createElement(import_ui17.Divider, null), /* @__PURE__ */ React17.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2340
2374
|
FormField,
|
|
2341
2375
|
{
|
|
2342
2376
|
id: "variable-label",
|
|
@@ -2344,7 +2378,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2344
2378
|
errorMsg: labelFieldError?.message,
|
|
2345
2379
|
noticeMsg: labelHint(label)
|
|
2346
2380
|
},
|
|
2347
|
-
/* @__PURE__ */
|
|
2381
|
+
/* @__PURE__ */ React17.createElement(
|
|
2348
2382
|
LabelField,
|
|
2349
2383
|
{
|
|
2350
2384
|
id: "variable-label",
|
|
@@ -2363,7 +2397,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2363
2397
|
onKeyDown: handleKeyDown
|
|
2364
2398
|
}
|
|
2365
2399
|
)
|
|
2366
|
-
), 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(
|
|
2367
2401
|
ValueField,
|
|
2368
2402
|
{
|
|
2369
2403
|
value,
|
|
@@ -2377,8 +2411,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2377
2411
|
propType,
|
|
2378
2412
|
onKeyDown: handleKeyDown
|
|
2379
2413
|
}
|
|
2380
|
-
))), errorMessage && /* @__PURE__ */
|
|
2381
|
-
|
|
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,
|
|
2382
2416
|
{
|
|
2383
2417
|
id: "create-variable-button",
|
|
2384
2418
|
size: "small",
|
|
@@ -2391,20 +2425,20 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2391
2425
|
};
|
|
2392
2426
|
|
|
2393
2427
|
// src/components/variable-edit.tsx
|
|
2394
|
-
var
|
|
2395
|
-
var
|
|
2428
|
+
var React19 = __toESM(require("react"));
|
|
2429
|
+
var import_react18 = require("react");
|
|
2396
2430
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2397
2431
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2398
2432
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2399
|
-
var
|
|
2400
|
-
var
|
|
2433
|
+
var import_icons8 = require("@elementor/icons");
|
|
2434
|
+
var import_ui19 = require("@elementor/ui");
|
|
2401
2435
|
var import_i18n13 = require("@wordpress/i18n");
|
|
2402
2436
|
|
|
2403
2437
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2404
|
-
var
|
|
2405
|
-
var
|
|
2406
|
-
var
|
|
2407
|
-
var
|
|
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");
|
|
2408
2442
|
var import_i18n12 = require("@wordpress/i18n");
|
|
2409
2443
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2410
2444
|
var EditConfirmationDialog = ({
|
|
@@ -2412,30 +2446,30 @@ var EditConfirmationDialog = ({
|
|
|
2412
2446
|
onConfirm,
|
|
2413
2447
|
onSuppressMessage
|
|
2414
2448
|
}) => {
|
|
2415
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2449
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react17.useState)(false);
|
|
2416
2450
|
const handleSave = () => {
|
|
2417
2451
|
if (dontShowAgain) {
|
|
2418
2452
|
onSuppressMessage?.();
|
|
2419
2453
|
}
|
|
2420
2454
|
onConfirm?.();
|
|
2421
2455
|
};
|
|
2422
|
-
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.__)(
|
|
2423
2457
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2424
2458
|
"elementor"
|
|
2425
|
-
))), /* @__PURE__ */
|
|
2426
|
-
|
|
2459
|
+
))), /* @__PURE__ */ React18.createElement(import_ui18.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(
|
|
2460
|
+
import_ui18.FormControlLabel,
|
|
2427
2461
|
{
|
|
2428
|
-
control: /* @__PURE__ */
|
|
2429
|
-
|
|
2462
|
+
control: /* @__PURE__ */ React18.createElement(
|
|
2463
|
+
import_ui18.Checkbox,
|
|
2430
2464
|
{
|
|
2431
2465
|
checked: dontShowAgain,
|
|
2432
2466
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2433
2467
|
size: "small"
|
|
2434
2468
|
}
|
|
2435
2469
|
),
|
|
2436
|
-
label: /* @__PURE__ */
|
|
2470
|
+
label: /* @__PURE__ */ React18.createElement(import_ui18.Typography, { variant: "body2" }, (0, import_i18n12.__)("Don't show me again", "elementor"))
|
|
2437
2471
|
}
|
|
2438
|
-
), /* @__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")))));
|
|
2439
2473
|
};
|
|
2440
2474
|
|
|
2441
2475
|
// src/components/variable-edit.tsx
|
|
@@ -2446,20 +2480,20 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2446
2480
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2447
2481
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2448
2482
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2449
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2450
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2451
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2452
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
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)("");
|
|
2453
2487
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2454
2488
|
const variable = useVariable(editId);
|
|
2455
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2489
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react18.useState)(variable?.type ?? propTypeUtil.key);
|
|
2456
2490
|
if (!variable) {
|
|
2457
2491
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2458
2492
|
}
|
|
2459
2493
|
const userPermissions = usePermissions();
|
|
2460
|
-
const [value, setValue] = (0,
|
|
2461
|
-
const [label, setLabel] = (0,
|
|
2462
|
-
(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)(() => {
|
|
2463
2497
|
styleVariablesRepository.update({
|
|
2464
2498
|
[editId]: {
|
|
2465
2499
|
...variable,
|
|
@@ -2521,7 +2555,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2521
2555
|
const actions = [];
|
|
2522
2556
|
if (userPermissions.canDelete()) {
|
|
2523
2557
|
actions.push(
|
|
2524
|
-
/* @__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 })))
|
|
2525
2559
|
);
|
|
2526
2560
|
}
|
|
2527
2561
|
const hasEmptyFields = () => {
|
|
@@ -2546,23 +2580,23 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2546
2580
|
handleUpdate();
|
|
2547
2581
|
}
|
|
2548
2582
|
};
|
|
2549
|
-
return /* @__PURE__ */
|
|
2583
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_editor_ui7.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React19.createElement(
|
|
2550
2584
|
import_editor_ui7.PopoverHeader,
|
|
2551
2585
|
{
|
|
2552
2586
|
title: (0, import_i18n13.__)("Edit variable", "elementor"),
|
|
2553
2587
|
onClose,
|
|
2554
|
-
icon: /* @__PURE__ */
|
|
2555
|
-
|
|
2588
|
+
icon: /* @__PURE__ */ React19.createElement(React19.Fragment, null, onGoBack && /* @__PURE__ */ React19.createElement(
|
|
2589
|
+
import_ui19.IconButton,
|
|
2556
2590
|
{
|
|
2557
2591
|
size: SIZE3,
|
|
2558
2592
|
"aria-label": (0, import_i18n13.__)("Go Back", "elementor"),
|
|
2559
2593
|
onClick: onGoBack
|
|
2560
2594
|
},
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
), /* @__PURE__ */
|
|
2595
|
+
/* @__PURE__ */ React19.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
2596
|
+
), /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2563
2597
|
actions
|
|
2564
2598
|
}
|
|
2565
|
-
), /* @__PURE__ */
|
|
2599
|
+
), /* @__PURE__ */ React19.createElement(import_ui19.Divider, null), /* @__PURE__ */ React19.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React19.createElement(
|
|
2566
2600
|
FormField,
|
|
2567
2601
|
{
|
|
2568
2602
|
id: "variable-label",
|
|
@@ -2570,7 +2604,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2570
2604
|
errorMsg: labelFieldError?.message,
|
|
2571
2605
|
noticeMsg: labelHint(label)
|
|
2572
2606
|
},
|
|
2573
|
-
/* @__PURE__ */
|
|
2607
|
+
/* @__PURE__ */ React19.createElement(
|
|
2574
2608
|
LabelField,
|
|
2575
2609
|
{
|
|
2576
2610
|
id: "variable-label",
|
|
@@ -2589,7 +2623,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2589
2623
|
onKeyDown: handleKeyDown
|
|
2590
2624
|
}
|
|
2591
2625
|
)
|
|
2592
|
-
), 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(
|
|
2593
2627
|
ValueField,
|
|
2594
2628
|
{
|
|
2595
2629
|
propTypeKey: variable.type,
|
|
@@ -2604,7 +2638,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2604
2638
|
onValidationChange: setValueFieldError,
|
|
2605
2639
|
propType
|
|
2606
2640
|
}
|
|
2607
|
-
))), 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(
|
|
2608
2642
|
DeleteConfirmationDialog,
|
|
2609
2643
|
{
|
|
2610
2644
|
open: true,
|
|
@@ -2612,7 +2646,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2612
2646
|
onConfirm: handleDelete,
|
|
2613
2647
|
closeDialog: closeDeleteDialog()
|
|
2614
2648
|
}
|
|
2615
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2649
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React19.createElement(
|
|
2616
2650
|
EditConfirmationDialog,
|
|
2617
2651
|
{
|
|
2618
2652
|
closeDialog: closeEditDialog(),
|
|
@@ -2623,26 +2657,26 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2623
2657
|
};
|
|
2624
2658
|
|
|
2625
2659
|
// src/components/variables-selection.tsx
|
|
2626
|
-
var
|
|
2627
|
-
var
|
|
2660
|
+
var import_react19 = require("react");
|
|
2661
|
+
var React21 = __toESM(require("react"));
|
|
2628
2662
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2629
2663
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2630
|
-
var
|
|
2631
|
-
var
|
|
2664
|
+
var import_icons10 = require("@elementor/icons");
|
|
2665
|
+
var import_ui22 = require("@elementor/ui");
|
|
2632
2666
|
var import_i18n15 = require("@wordpress/i18n");
|
|
2633
2667
|
|
|
2634
2668
|
// src/components/ui/menu-item-content.tsx
|
|
2635
|
-
var
|
|
2669
|
+
var React20 = __toESM(require("react"));
|
|
2636
2670
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2637
|
-
var
|
|
2638
|
-
var
|
|
2671
|
+
var import_icons9 = require("@elementor/icons");
|
|
2672
|
+
var import_ui20 = require("@elementor/ui");
|
|
2639
2673
|
var import_i18n14 = require("@wordpress/i18n");
|
|
2640
2674
|
var SIZE4 = "tiny";
|
|
2641
2675
|
var EDIT_LABEL = (0, import_i18n14.__)("Edit variable", "elementor");
|
|
2642
2676
|
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2643
2677
|
const onEdit = item.onEdit;
|
|
2644
|
-
return /* @__PURE__ */
|
|
2645
|
-
|
|
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,
|
|
2646
2680
|
{
|
|
2647
2681
|
sx: {
|
|
2648
2682
|
flex: 1,
|
|
@@ -2652,30 +2686,30 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2652
2686
|
gap: 1
|
|
2653
2687
|
}
|
|
2654
2688
|
},
|
|
2655
|
-
/* @__PURE__ */
|
|
2689
|
+
/* @__PURE__ */ React20.createElement(
|
|
2656
2690
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2657
2691
|
{
|
|
2658
2692
|
title: item.label || item.value,
|
|
2659
|
-
as:
|
|
2693
|
+
as: import_ui20.Typography,
|
|
2660
2694
|
variant: "caption",
|
|
2661
2695
|
color: disabled ? "text.disabled" : "text.primary",
|
|
2662
2696
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2663
2697
|
maxWidth: "50%"
|
|
2664
2698
|
}
|
|
2665
2699
|
),
|
|
2666
|
-
item.secondaryText && /* @__PURE__ */
|
|
2700
|
+
item.secondaryText && /* @__PURE__ */ React20.createElement(
|
|
2667
2701
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2668
2702
|
{
|
|
2669
2703
|
title: item.secondaryText,
|
|
2670
|
-
as:
|
|
2704
|
+
as: import_ui20.Typography,
|
|
2671
2705
|
variant: "caption",
|
|
2672
2706
|
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2673
2707
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2674
2708
|
maxWidth: "50%"
|
|
2675
2709
|
}
|
|
2676
2710
|
)
|
|
2677
|
-
), !!onEdit && !disabled && /* @__PURE__ */
|
|
2678
|
-
|
|
2711
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React20.createElement(import_ui20.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2712
|
+
import_ui20.IconButton,
|
|
2679
2713
|
{
|
|
2680
2714
|
sx: { mx: 1, opacity: "0" },
|
|
2681
2715
|
onClick: (e) => {
|
|
@@ -2684,13 +2718,13 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2684
2718
|
},
|
|
2685
2719
|
"aria-label": EDIT_LABEL
|
|
2686
2720
|
},
|
|
2687
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ React20.createElement(import_icons9.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2688
2722
|
)));
|
|
2689
2723
|
};
|
|
2690
2724
|
|
|
2691
2725
|
// src/components/ui/styled-menu-list.tsx
|
|
2692
|
-
var
|
|
2693
|
-
var VariablesStyledMenuList = (0,
|
|
2726
|
+
var import_ui21 = require("@elementor/ui");
|
|
2727
|
+
var VariablesStyledMenuList = (0, import_ui21.styled)(import_ui21.MenuList)(({ theme, disabled }) => ({
|
|
2694
2728
|
"& > li": {
|
|
2695
2729
|
height: 32,
|
|
2696
2730
|
width: "100%",
|
|
@@ -2730,7 +2764,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
|
|
|
2730
2764
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2731
2765
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2732
2766
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2733
|
-
const [searchValue, setSearchValue] = (0,
|
|
2767
|
+
const [searchValue, setSearchValue] = (0, import_react19.useState)("");
|
|
2734
2768
|
const {
|
|
2735
2769
|
list: variables,
|
|
2736
2770
|
hasMatches: hasSearchResults,
|
|
@@ -2757,8 +2791,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2757
2791
|
const actions = [];
|
|
2758
2792
|
if (onAdd) {
|
|
2759
2793
|
actions.push(
|
|
2760
|
-
/* @__PURE__ */
|
|
2761
|
-
|
|
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,
|
|
2762
2796
|
{
|
|
2763
2797
|
id: "add-variable-button",
|
|
2764
2798
|
size: SIZE5,
|
|
@@ -2766,7 +2800,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2766
2800
|
"aria-label": CREATE_LABEL,
|
|
2767
2801
|
disabled
|
|
2768
2802
|
},
|
|
2769
|
-
/* @__PURE__ */
|
|
2803
|
+
/* @__PURE__ */ React21.createElement(import_icons10.PlusIcon, { fontSize: SIZE5 })
|
|
2770
2804
|
)))
|
|
2771
2805
|
);
|
|
2772
2806
|
}
|
|
@@ -2780,24 +2814,24 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2780
2814
|
});
|
|
2781
2815
|
};
|
|
2782
2816
|
actions.push(
|
|
2783
|
-
/* @__PURE__ */
|
|
2784
|
-
|
|
2817
|
+
/* @__PURE__ */ React21.createElement(import_ui22.Tooltip, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2818
|
+
import_ui22.IconButton,
|
|
2785
2819
|
{
|
|
2786
2820
|
id: "variables-manager-button",
|
|
2787
2821
|
size: SIZE5,
|
|
2788
2822
|
onClick: handleOpenManager,
|
|
2789
2823
|
"aria-label": MANAGER_LABEL
|
|
2790
2824
|
},
|
|
2791
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ React21.createElement(import_icons10.SettingsIcon, { fontSize: SIZE5 })
|
|
2792
2826
|
))
|
|
2793
2827
|
);
|
|
2794
2828
|
}
|
|
2795
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2829
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2796
2830
|
const items = variables.map(({ value, label, key }) => ({
|
|
2797
2831
|
type: "item",
|
|
2798
2832
|
value: key,
|
|
2799
2833
|
label,
|
|
2800
|
-
icon: /* @__PURE__ */
|
|
2834
|
+
icon: /* @__PURE__ */ React21.createElement(StartIcon, { value }),
|
|
2801
2835
|
secondaryText: value,
|
|
2802
2836
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2803
2837
|
}));
|
|
@@ -2807,22 +2841,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2807
2841
|
const handleClearSearch = () => {
|
|
2808
2842
|
setSearchValue("");
|
|
2809
2843
|
};
|
|
2810
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ React21.createElement(import_editor_ui9.SectionPopoverBody, null, /* @__PURE__ */ React21.createElement(
|
|
2811
2845
|
import_editor_ui9.PopoverHeader,
|
|
2812
2846
|
{
|
|
2813
2847
|
title: (0, import_i18n15.__)("Variables", "elementor"),
|
|
2814
|
-
icon: /* @__PURE__ */
|
|
2848
|
+
icon: /* @__PURE__ */ React21.createElement(import_icons10.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
2815
2849
|
onClose: closePopover,
|
|
2816
2850
|
actions
|
|
2817
2851
|
}
|
|
2818
|
-
), hasVariables && /* @__PURE__ */
|
|
2852
|
+
), hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2819
2853
|
import_editor_ui9.SearchField,
|
|
2820
2854
|
{
|
|
2821
2855
|
value: searchValue,
|
|
2822
2856
|
onSearch: handleSearch,
|
|
2823
2857
|
placeholder: (0, import_i18n15.__)("Search", "elementor")
|
|
2824
2858
|
}
|
|
2825
|
-
), /* @__PURE__ */
|
|
2859
|
+
), /* @__PURE__ */ React21.createElement(import_ui22.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2826
2860
|
import_editor_ui9.PopoverMenuList,
|
|
2827
2861
|
{
|
|
2828
2862
|
items,
|
|
@@ -2832,10 +2866,10 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2832
2866
|
},
|
|
2833
2867
|
selectedValue: variable,
|
|
2834
2868
|
"data-testid": `${variableType}-variables-list`,
|
|
2835
|
-
menuListTemplate: (props) => /* @__PURE__ */
|
|
2836
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2869
|
+
menuListTemplate: (props) => /* @__PURE__ */ React21.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2870
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React21.createElement(MenuItemContent, { item, disabled })
|
|
2837
2871
|
}
|
|
2838
|
-
), disabled && /* @__PURE__ */
|
|
2872
|
+
), disabled && /* @__PURE__ */ React21.createElement(
|
|
2839
2873
|
import_editor_ui10.PromotionAlert,
|
|
2840
2874
|
{
|
|
2841
2875
|
message: (0, import_i18n15.sprintf)(
|
|
@@ -2845,14 +2879,14 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2845
2879
|
),
|
|
2846
2880
|
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2847
2881
|
}
|
|
2848
|
-
)), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2882
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2849
2883
|
NoSearchResults,
|
|
2850
2884
|
{
|
|
2851
2885
|
searchValue,
|
|
2852
2886
|
onClear: handleClearSearch,
|
|
2853
|
-
icon: /* @__PURE__ */
|
|
2887
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2854
2888
|
}
|
|
2855
|
-
), disabled && !hasVariables && /* @__PURE__ */
|
|
2889
|
+
), disabled && !hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2856
2890
|
EmptyState,
|
|
2857
2891
|
{
|
|
2858
2892
|
title: (0, import_i18n15.sprintf)(
|
|
@@ -2865,10 +2899,10 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2865
2899
|
(0, import_i18n15.__)("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2866
2900
|
variableType
|
|
2867
2901
|
),
|
|
2868
|
-
icon: /* @__PURE__ */
|
|
2902
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2869
2903
|
},
|
|
2870
2904
|
emptyState
|
|
2871
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2905
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2872
2906
|
EmptyState,
|
|
2873
2907
|
{
|
|
2874
2908
|
title: (0, import_i18n15.sprintf)(
|
|
@@ -2880,10 +2914,10 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2880
2914
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2881
2915
|
"elementor"
|
|
2882
2916
|
),
|
|
2883
|
-
icon: /* @__PURE__ */
|
|
2917
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2884
2918
|
onAdd
|
|
2885
2919
|
}
|
|
2886
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2920
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2887
2921
|
EmptyState,
|
|
2888
2922
|
{
|
|
2889
2923
|
title: (0, import_i18n15.__)("No compatible variables", "elementor"),
|
|
@@ -2891,7 +2925,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2891
2925
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2892
2926
|
"elementor"
|
|
2893
2927
|
),
|
|
2894
|
-
icon: /* @__PURE__ */
|
|
2928
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2895
2929
|
onAdd
|
|
2896
2930
|
}
|
|
2897
2931
|
));
|
|
@@ -2902,13 +2936,13 @@ var VIEW_LIST = "list";
|
|
|
2902
2936
|
var VIEW_ADD = "add";
|
|
2903
2937
|
var VIEW_EDIT = "edit";
|
|
2904
2938
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2905
|
-
const [currentView, setCurrentView] = (0,
|
|
2906
|
-
const [editId, setEditId] = (0,
|
|
2939
|
+
const [currentView, setCurrentView] = (0, import_react20.useState)(VIEW_LIST);
|
|
2940
|
+
const [editId, setEditId] = (0, import_react20.useState)("");
|
|
2907
2941
|
const { open } = usePanelActions();
|
|
2908
2942
|
const onSettingsAvailable = (0, import_editor_v1_adapters4.isExperimentActive)("e_variables_manager") ? () => {
|
|
2909
2943
|
open();
|
|
2910
2944
|
} : void 0;
|
|
2911
|
-
return /* @__PURE__ */
|
|
2945
|
+
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2912
2946
|
propTypeKey,
|
|
2913
2947
|
currentView,
|
|
2914
2948
|
selectedVariable,
|
|
@@ -2955,7 +2989,7 @@ function RenderView(props) {
|
|
|
2955
2989
|
}
|
|
2956
2990
|
};
|
|
2957
2991
|
if (VIEW_LIST === props.currentView) {
|
|
2958
|
-
return /* @__PURE__ */
|
|
2992
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2959
2993
|
VariablesSelection,
|
|
2960
2994
|
{
|
|
2961
2995
|
closePopover: handlers.onClose,
|
|
@@ -2967,10 +3001,10 @@ function RenderView(props) {
|
|
|
2967
3001
|
);
|
|
2968
3002
|
}
|
|
2969
3003
|
if (VIEW_ADD === props.currentView) {
|
|
2970
|
-
return /* @__PURE__ */
|
|
3004
|
+
return /* @__PURE__ */ React22.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2971
3005
|
}
|
|
2972
3006
|
if (VIEW_EDIT === props.currentView) {
|
|
2973
|
-
return /* @__PURE__ */
|
|
3007
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2974
3008
|
VariableEdit,
|
|
2975
3009
|
{
|
|
2976
3010
|
editId: props.editId,
|
|
@@ -2984,9 +3018,9 @@ function RenderView(props) {
|
|
|
2984
3018
|
}
|
|
2985
3019
|
|
|
2986
3020
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2987
|
-
var
|
|
2988
|
-
var
|
|
2989
|
-
var
|
|
3021
|
+
var React23 = __toESM(require("react"));
|
|
3022
|
+
var import_icons11 = require("@elementor/icons");
|
|
3023
|
+
var import_ui23 = require("@elementor/ui");
|
|
2990
3024
|
var import_i18n16 = require("@wordpress/i18n");
|
|
2991
3025
|
var SIZE6 = "tiny";
|
|
2992
3026
|
var UNLINK_LABEL = (0, import_i18n16.__)("Unlink variable", "elementor");
|
|
@@ -2994,16 +3028,16 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2994
3028
|
const actions = [];
|
|
2995
3029
|
if (onUnlink) {
|
|
2996
3030
|
actions.push(
|
|
2997
|
-
/* @__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 })))
|
|
2998
3032
|
);
|
|
2999
3033
|
}
|
|
3000
|
-
return /* @__PURE__ */
|
|
3001
|
-
|
|
3034
|
+
return /* @__PURE__ */ React23.createElement(import_ui23.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React23.createElement(
|
|
3035
|
+
import_ui23.UnstableTag,
|
|
3002
3036
|
{
|
|
3003
3037
|
fullWidth: true,
|
|
3004
3038
|
showActionsOnHover: true,
|
|
3005
|
-
startIcon: /* @__PURE__ */
|
|
3006
|
-
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)),
|
|
3007
3041
|
actions,
|
|
3008
3042
|
...props
|
|
3009
3043
|
}
|
|
@@ -3014,24 +3048,24 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3014
3048
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3015
3049
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3016
3050
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
3017
|
-
const anchorRef = (0,
|
|
3018
|
-
const popupId = (0,
|
|
3019
|
-
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)({
|
|
3020
3054
|
variant: "popover",
|
|
3021
3055
|
popupId: `elementor-variables-list-${popupId}`
|
|
3022
3056
|
});
|
|
3023
3057
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
3024
3058
|
const StartIcon = startIcon || (() => null);
|
|
3025
|
-
return /* @__PURE__ */
|
|
3059
|
+
return /* @__PURE__ */ React24.createElement(import_ui24.Box, { ref: anchorRef }, /* @__PURE__ */ React24.createElement(
|
|
3026
3060
|
AssignedTag,
|
|
3027
3061
|
{
|
|
3028
3062
|
label: variable.label,
|
|
3029
|
-
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 })),
|
|
3030
3064
|
onUnlink: unlinkVariable,
|
|
3031
|
-
...(0,
|
|
3065
|
+
...(0, import_ui24.bindTrigger)(popupState)
|
|
3032
3066
|
}
|
|
3033
|
-
), /* @__PURE__ */
|
|
3034
|
-
|
|
3067
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3068
|
+
import_ui24.Popover,
|
|
3035
3069
|
{
|
|
3036
3070
|
disableScrollLock: true,
|
|
3037
3071
|
anchorEl: anchorRef.current,
|
|
@@ -3040,9 +3074,9 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3040
3074
|
PaperProps: {
|
|
3041
3075
|
sx: { my: 1 }
|
|
3042
3076
|
},
|
|
3043
|
-
...(0,
|
|
3077
|
+
...(0, import_ui24.bindPopover)(popupState)
|
|
3044
3078
|
},
|
|
3045
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ React24.createElement(
|
|
3046
3080
|
VariableSelectionPopover,
|
|
3047
3081
|
{
|
|
3048
3082
|
selectedVariable: variable,
|
|
@@ -3054,18 +3088,18 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3054
3088
|
};
|
|
3055
3089
|
|
|
3056
3090
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3057
|
-
var
|
|
3058
|
-
var
|
|
3091
|
+
var React28 = __toESM(require("react"));
|
|
3092
|
+
var import_react23 = require("react");
|
|
3059
3093
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
3060
|
-
var
|
|
3094
|
+
var import_ui28 = require("@elementor/ui");
|
|
3061
3095
|
var import_i18n19 = require("@wordpress/i18n");
|
|
3062
3096
|
|
|
3063
3097
|
// src/components/variable-restore.tsx
|
|
3064
|
-
var
|
|
3065
|
-
var
|
|
3098
|
+
var React25 = __toESM(require("react"));
|
|
3099
|
+
var import_react22 = require("react");
|
|
3066
3100
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
3067
3101
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
3068
|
-
var
|
|
3102
|
+
var import_ui25 = require("@elementor/ui");
|
|
3069
3103
|
var import_i18n17 = require("@wordpress/i18n");
|
|
3070
3104
|
var SIZE7 = "tiny";
|
|
3071
3105
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
@@ -3076,11 +3110,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3076
3110
|
if (!variable) {
|
|
3077
3111
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3078
3112
|
}
|
|
3079
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3080
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
3081
|
-
const [label, setLabel] = (0,
|
|
3082
|
-
const [value, setValue] = (0,
|
|
3083
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
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);
|
|
3084
3118
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3085
3119
|
value: variable.label,
|
|
3086
3120
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3126,14 +3160,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3126
3160
|
handleRestore();
|
|
3127
3161
|
}
|
|
3128
3162
|
};
|
|
3129
|
-
return /* @__PURE__ */
|
|
3163
|
+
return /* @__PURE__ */ React25.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React25.createElement(import_editor_ui11.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React25.createElement(
|
|
3130
3164
|
import_editor_ui11.PopoverHeader,
|
|
3131
3165
|
{
|
|
3132
|
-
icon: /* @__PURE__ */
|
|
3166
|
+
icon: /* @__PURE__ */ React25.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3133
3167
|
title: (0, import_i18n17.__)("Restore variable", "elementor"),
|
|
3134
3168
|
onClose
|
|
3135
3169
|
}
|
|
3136
|
-
), /* @__PURE__ */
|
|
3170
|
+
), /* @__PURE__ */ React25.createElement(import_ui25.Divider, null), /* @__PURE__ */ React25.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React25.createElement(
|
|
3137
3171
|
FormField,
|
|
3138
3172
|
{
|
|
3139
3173
|
id: "variable-label",
|
|
@@ -3141,7 +3175,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3141
3175
|
errorMsg: labelFieldError?.message,
|
|
3142
3176
|
noticeMsg: labelHint(label)
|
|
3143
3177
|
},
|
|
3144
|
-
/* @__PURE__ */
|
|
3178
|
+
/* @__PURE__ */ React25.createElement(
|
|
3145
3179
|
LabelField,
|
|
3146
3180
|
{
|
|
3147
3181
|
id: "variable-label",
|
|
@@ -3160,7 +3194,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3160
3194
|
onKeyDown: handleKeyDown
|
|
3161
3195
|
}
|
|
3162
3196
|
)
|
|
3163
|
-
), 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(
|
|
3164
3198
|
ValueField,
|
|
3165
3199
|
{
|
|
3166
3200
|
propTypeKey,
|
|
@@ -3175,25 +3209,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3175
3209
|
propType,
|
|
3176
3210
|
onKeyDown: handleKeyDown
|
|
3177
3211
|
}
|
|
3178
|
-
))), 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")))));
|
|
3179
3213
|
};
|
|
3180
3214
|
|
|
3181
3215
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3182
|
-
var
|
|
3183
|
-
var
|
|
3216
|
+
var React26 = __toESM(require("react"));
|
|
3217
|
+
var import_ui26 = require("@elementor/ui");
|
|
3184
3218
|
var import_i18n18 = require("@wordpress/i18n");
|
|
3185
3219
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3186
|
-
return /* @__PURE__ */
|
|
3187
|
-
|
|
3220
|
+
return /* @__PURE__ */ React26.createElement(import_ui26.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React26.createElement(
|
|
3221
|
+
import_ui26.Alert,
|
|
3188
3222
|
{
|
|
3189
3223
|
variant: "standard",
|
|
3190
3224
|
severity: "warning",
|
|
3191
3225
|
onClose,
|
|
3192
|
-
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"))),
|
|
3193
3227
|
sx: { maxWidth: 300 }
|
|
3194
3228
|
},
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
/* @__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.__)(
|
|
3197
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.",
|
|
3198
3232
|
"elementor"
|
|
3199
3233
|
))
|
|
@@ -3201,14 +3235,14 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3201
3235
|
};
|
|
3202
3236
|
|
|
3203
3237
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3204
|
-
var
|
|
3205
|
-
var
|
|
3206
|
-
var
|
|
3207
|
-
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(
|
|
3208
3242
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3209
3243
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3210
|
-
return /* @__PURE__ */
|
|
3211
|
-
|
|
3244
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3245
|
+
import_ui27.Chip,
|
|
3212
3246
|
{
|
|
3213
3247
|
ref,
|
|
3214
3248
|
size: "tiny",
|
|
@@ -3216,8 +3250,8 @@ var WarningVariableTag = React26.forwardRef(
|
|
|
3216
3250
|
shape: "rounded",
|
|
3217
3251
|
variant: "standard",
|
|
3218
3252
|
onClick,
|
|
3219
|
-
icon: /* @__PURE__ */
|
|
3220
|
-
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))),
|
|
3221
3255
|
sx: {
|
|
3222
3256
|
height: (theme) => theme.spacing(3.5),
|
|
3223
3257
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3236,12 +3270,12 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3236
3270
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3237
3271
|
const boundProp = (0, import_editor_controls8.useBoundProp)();
|
|
3238
3272
|
const userPermissions = usePermissions();
|
|
3239
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3273
|
+
const [showInfotip, setShowInfotip] = (0, import_react23.useState)(false);
|
|
3240
3274
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3241
3275
|
const closeInfotip = () => setShowInfotip(false);
|
|
3242
|
-
const deletedChipAnchorRef = (0,
|
|
3243
|
-
const popupId = (0,
|
|
3244
|
-
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)({
|
|
3245
3279
|
variant: "popover",
|
|
3246
3280
|
popupId: `elementor-variables-restore-${popupId}`
|
|
3247
3281
|
});
|
|
@@ -3267,15 +3301,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3267
3301
|
const handleRestoreWithOverrides = () => {
|
|
3268
3302
|
popupState.close();
|
|
3269
3303
|
};
|
|
3270
|
-
return /* @__PURE__ */
|
|
3271
|
-
|
|
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,
|
|
3272
3306
|
{
|
|
3273
3307
|
color: "warning",
|
|
3274
3308
|
placement: "right-start",
|
|
3275
3309
|
open: showInfotip,
|
|
3276
3310
|
disableHoverListener: true,
|
|
3277
3311
|
onClose: closeInfotip,
|
|
3278
|
-
content: /* @__PURE__ */
|
|
3312
|
+
content: /* @__PURE__ */ React28.createElement(
|
|
3279
3313
|
DeletedVariableAlert,
|
|
3280
3314
|
{
|
|
3281
3315
|
onClose: closeInfotip,
|
|
@@ -3295,7 +3329,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3295
3329
|
}
|
|
3296
3330
|
}
|
|
3297
3331
|
},
|
|
3298
|
-
/* @__PURE__ */
|
|
3332
|
+
/* @__PURE__ */ React28.createElement(
|
|
3299
3333
|
WarningVariableTag,
|
|
3300
3334
|
{
|
|
3301
3335
|
label: variable.label,
|
|
@@ -3303,8 +3337,8 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3303
3337
|
suffix: (0, import_i18n19.__)("deleted", "elementor")
|
|
3304
3338
|
}
|
|
3305
3339
|
)
|
|
3306
|
-
), /* @__PURE__ */
|
|
3307
|
-
|
|
3340
|
+
), /* @__PURE__ */ React28.createElement(
|
|
3341
|
+
import_ui28.Popover,
|
|
3308
3342
|
{
|
|
3309
3343
|
disableScrollLock: true,
|
|
3310
3344
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -3312,9 +3346,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3312
3346
|
PaperProps: {
|
|
3313
3347
|
sx: { my: 1 }
|
|
3314
3348
|
},
|
|
3315
|
-
...(0,
|
|
3349
|
+
...(0, import_ui28.bindPopover)(popupState)
|
|
3316
3350
|
},
|
|
3317
|
-
/* @__PURE__ */
|
|
3351
|
+
/* @__PURE__ */ React28.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React28.createElement(
|
|
3318
3352
|
VariableRestore,
|
|
3319
3353
|
{
|
|
3320
3354
|
variableId: variable.key ?? "",
|
|
@@ -3326,15 +3360,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3326
3360
|
};
|
|
3327
3361
|
|
|
3328
3362
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3329
|
-
var
|
|
3330
|
-
var
|
|
3363
|
+
var React30 = __toESM(require("react"));
|
|
3364
|
+
var import_react24 = require("react");
|
|
3331
3365
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3332
|
-
var
|
|
3366
|
+
var import_ui30 = require("@elementor/ui");
|
|
3333
3367
|
var import_i18n21 = require("@wordpress/i18n");
|
|
3334
3368
|
|
|
3335
3369
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3336
|
-
var
|
|
3337
|
-
var
|
|
3370
|
+
var React29 = __toESM(require("react"));
|
|
3371
|
+
var import_ui29 = require("@elementor/ui");
|
|
3338
3372
|
var import_i18n20 = require("@wordpress/i18n");
|
|
3339
3373
|
var i18n = {
|
|
3340
3374
|
title: (0, import_i18n20.__)("Variable has changed", "elementor"),
|
|
@@ -3348,30 +3382,30 @@ var i18n = {
|
|
|
3348
3382
|
}
|
|
3349
3383
|
};
|
|
3350
3384
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3351
|
-
return /* @__PURE__ */
|
|
3352
|
-
|
|
3385
|
+
return /* @__PURE__ */ React29.createElement(import_ui29.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
3386
|
+
import_ui29.Alert,
|
|
3353
3387
|
{
|
|
3354
3388
|
variant: "standard",
|
|
3355
3389
|
severity: "warning",
|
|
3356
3390
|
onClose,
|
|
3357
|
-
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)),
|
|
3358
3392
|
sx: { maxWidth: 300 }
|
|
3359
3393
|
},
|
|
3360
|
-
/* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3394
|
+
/* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, i18n.title),
|
|
3395
|
+
/* @__PURE__ */ React29.createElement(import_ui29.Typography, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3362
3396
|
));
|
|
3363
3397
|
};
|
|
3364
3398
|
|
|
3365
3399
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3366
3400
|
var MismatchVariable = ({ variable }) => {
|
|
3367
3401
|
const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
|
|
3368
|
-
const anchorRef = (0,
|
|
3369
|
-
const popupId = (0,
|
|
3370
|
-
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)({
|
|
3371
3405
|
variant: "popover",
|
|
3372
3406
|
popupId: `elementor-variables-list-${popupId}`
|
|
3373
3407
|
});
|
|
3374
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3408
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react24.useState)(false);
|
|
3375
3409
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3376
3410
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3377
3411
|
const triggerSelect = () => {
|
|
@@ -3384,15 +3418,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3384
3418
|
setValue(null);
|
|
3385
3419
|
};
|
|
3386
3420
|
const showClearButton = !!value;
|
|
3387
|
-
return /* @__PURE__ */
|
|
3388
|
-
|
|
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,
|
|
3389
3423
|
{
|
|
3390
3424
|
color: "warning",
|
|
3391
3425
|
placement: "right-start",
|
|
3392
3426
|
open: infotipVisible,
|
|
3393
3427
|
disableHoverListener: true,
|
|
3394
3428
|
onClose: closeInfotip,
|
|
3395
|
-
content: /* @__PURE__ */
|
|
3429
|
+
content: /* @__PURE__ */ React30.createElement(
|
|
3396
3430
|
MismatchVariableAlert,
|
|
3397
3431
|
{
|
|
3398
3432
|
onClose: closeInfotip,
|
|
@@ -3411,7 +3445,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3411
3445
|
}
|
|
3412
3446
|
}
|
|
3413
3447
|
},
|
|
3414
|
-
/* @__PURE__ */
|
|
3448
|
+
/* @__PURE__ */ React30.createElement(
|
|
3415
3449
|
WarningVariableTag,
|
|
3416
3450
|
{
|
|
3417
3451
|
label: variable.label,
|
|
@@ -3419,8 +3453,8 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3419
3453
|
suffix: (0, import_i18n21.__)("changed", "elementor")
|
|
3420
3454
|
}
|
|
3421
3455
|
)
|
|
3422
|
-
), /* @__PURE__ */
|
|
3423
|
-
|
|
3456
|
+
), /* @__PURE__ */ React30.createElement(
|
|
3457
|
+
import_ui30.Popover,
|
|
3424
3458
|
{
|
|
3425
3459
|
disableScrollLock: true,
|
|
3426
3460
|
anchorEl: anchorRef.current,
|
|
@@ -3429,9 +3463,9 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3429
3463
|
PaperProps: {
|
|
3430
3464
|
sx: { my: 1 }
|
|
3431
3465
|
},
|
|
3432
|
-
...(0,
|
|
3466
|
+
...(0, import_ui30.bindPopover)(popupState)
|
|
3433
3467
|
},
|
|
3434
|
-
/* @__PURE__ */
|
|
3468
|
+
/* @__PURE__ */ React30.createElement(
|
|
3435
3469
|
VariableSelectionPopover,
|
|
3436
3470
|
{
|
|
3437
3471
|
selectedVariable: variable,
|
|
@@ -3443,28 +3477,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3443
3477
|
};
|
|
3444
3478
|
|
|
3445
3479
|
// src/components/ui/variable/missing-variable.tsx
|
|
3446
|
-
var
|
|
3447
|
-
var
|
|
3480
|
+
var React32 = __toESM(require("react"));
|
|
3481
|
+
var import_react25 = require("react");
|
|
3448
3482
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3449
|
-
var
|
|
3483
|
+
var import_ui32 = require("@elementor/ui");
|
|
3450
3484
|
var import_i18n23 = require("@wordpress/i18n");
|
|
3451
3485
|
|
|
3452
3486
|
// src/components/ui/missing-variable-alert.tsx
|
|
3453
|
-
var
|
|
3454
|
-
var
|
|
3487
|
+
var React31 = __toESM(require("react"));
|
|
3488
|
+
var import_ui31 = require("@elementor/ui");
|
|
3455
3489
|
var import_i18n22 = require("@wordpress/i18n");
|
|
3456
3490
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3457
|
-
return /* @__PURE__ */
|
|
3458
|
-
|
|
3491
|
+
return /* @__PURE__ */ React31.createElement(import_ui31.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React31.createElement(
|
|
3492
|
+
import_ui31.Alert,
|
|
3459
3493
|
{
|
|
3460
3494
|
variant: "standard",
|
|
3461
3495
|
severity: "warning",
|
|
3462
3496
|
onClose,
|
|
3463
|
-
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"))),
|
|
3464
3498
|
sx: { maxWidth: 300 }
|
|
3465
3499
|
},
|
|
3466
|
-
/* @__PURE__ */
|
|
3467
|
-
/* @__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.__)(
|
|
3468
3502
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3469
3503
|
"elementor"
|
|
3470
3504
|
))
|
|
@@ -3474,19 +3508,19 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3474
3508
|
// src/components/ui/variable/missing-variable.tsx
|
|
3475
3509
|
var MissingVariable = () => {
|
|
3476
3510
|
const { setValue } = (0, import_editor_controls10.useBoundProp)();
|
|
3477
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3511
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react25.useState)(false);
|
|
3478
3512
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3479
3513
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3480
3514
|
const clearValue = () => setValue(null);
|
|
3481
|
-
return /* @__PURE__ */
|
|
3482
|
-
|
|
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,
|
|
3483
3517
|
{
|
|
3484
3518
|
color: "warning",
|
|
3485
3519
|
placement: "right-start",
|
|
3486
3520
|
open: infotipVisible,
|
|
3487
3521
|
disableHoverListener: true,
|
|
3488
3522
|
onClose: closeInfotip,
|
|
3489
|
-
content: /* @__PURE__ */
|
|
3523
|
+
content: /* @__PURE__ */ React32.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3490
3524
|
slotProps: {
|
|
3491
3525
|
popper: {
|
|
3492
3526
|
modifiers: [
|
|
@@ -3498,7 +3532,7 @@ var MissingVariable = () => {
|
|
|
3498
3532
|
}
|
|
3499
3533
|
}
|
|
3500
3534
|
},
|
|
3501
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ React32.createElement(WarningVariableTag, { label: (0, import_i18n23.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3502
3536
|
));
|
|
3503
3537
|
};
|
|
3504
3538
|
|
|
@@ -3508,37 +3542,37 @@ var VariableControl = () => {
|
|
|
3508
3542
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3509
3543
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3510
3544
|
if (!assignedVariable) {
|
|
3511
|
-
return /* @__PURE__ */
|
|
3545
|
+
return /* @__PURE__ */ React33.createElement(MissingVariable, null);
|
|
3512
3546
|
}
|
|
3513
3547
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3514
3548
|
if (assignedVariable?.deleted) {
|
|
3515
|
-
return /* @__PURE__ */
|
|
3549
|
+
return /* @__PURE__ */ React33.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3516
3550
|
}
|
|
3517
3551
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3518
3552
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3519
|
-
return /* @__PURE__ */
|
|
3553
|
+
return /* @__PURE__ */ React33.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3520
3554
|
}
|
|
3521
|
-
return /* @__PURE__ */
|
|
3555
|
+
return /* @__PURE__ */ React33.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3522
3556
|
};
|
|
3523
3557
|
|
|
3524
3558
|
// src/hooks/use-prop-variable-action.tsx
|
|
3525
|
-
var
|
|
3559
|
+
var React34 = __toESM(require("react"));
|
|
3526
3560
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
3527
|
-
var
|
|
3561
|
+
var import_icons14 = require("@elementor/icons");
|
|
3528
3562
|
var import_i18n24 = require("@wordpress/i18n");
|
|
3529
3563
|
var usePropVariableAction = () => {
|
|
3530
3564
|
const { propType, path } = (0, import_editor_controls12.useBoundProp)();
|
|
3531
3565
|
const variable = resolveVariableFromPropType(propType);
|
|
3532
3566
|
return {
|
|
3533
3567
|
visible: Boolean(variable),
|
|
3534
|
-
icon:
|
|
3568
|
+
icon: import_icons14.ColorFilterIcon,
|
|
3535
3569
|
title: (0, import_i18n24.__)("Variables", "elementor"),
|
|
3536
3570
|
content: ({ close: closePopover }) => {
|
|
3537
3571
|
if (!variable) {
|
|
3538
3572
|
return null;
|
|
3539
3573
|
}
|
|
3540
3574
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3541
|
-
return /* @__PURE__ */
|
|
3575
|
+
return /* @__PURE__ */ React34.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3542
3576
|
}
|
|
3543
3577
|
};
|
|
3544
3578
|
};
|
|
@@ -3685,21 +3719,21 @@ function initMcp() {
|
|
|
3685
3719
|
}
|
|
3686
3720
|
|
|
3687
3721
|
// src/register-variable-types.tsx
|
|
3688
|
-
var
|
|
3722
|
+
var React37 = __toESM(require("react"));
|
|
3689
3723
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3690
3724
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
3691
3725
|
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3692
|
-
var
|
|
3726
|
+
var import_icons16 = require("@elementor/icons");
|
|
3693
3727
|
var import_i18n26 = require("@wordpress/i18n");
|
|
3694
3728
|
|
|
3695
3729
|
// src/components/fields/color-field.tsx
|
|
3696
|
-
var
|
|
3697
|
-
var
|
|
3698
|
-
var
|
|
3730
|
+
var React35 = __toESM(require("react"));
|
|
3731
|
+
var import_react26 = require("react");
|
|
3732
|
+
var import_ui33 = require("@elementor/ui");
|
|
3699
3733
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3700
|
-
const [color, setColor] = (0,
|
|
3701
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3702
|
-
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);
|
|
3703
3737
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3704
3738
|
const handleChange = (newValue) => {
|
|
3705
3739
|
setColor(newValue);
|
|
@@ -3708,8 +3742,8 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3708
3742
|
onValidationChange?.(errorMsg);
|
|
3709
3743
|
onChange(errorMsg ? "" : newValue);
|
|
3710
3744
|
};
|
|
3711
|
-
return /* @__PURE__ */
|
|
3712
|
-
|
|
3745
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3746
|
+
import_ui33.UnstableColorField,
|
|
3713
3747
|
{
|
|
3714
3748
|
id: "color-variable-field",
|
|
3715
3749
|
size: "tiny",
|
|
@@ -3737,21 +3771,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3737
3771
|
};
|
|
3738
3772
|
|
|
3739
3773
|
// src/components/fields/font-field.tsx
|
|
3740
|
-
var
|
|
3741
|
-
var
|
|
3774
|
+
var React36 = __toESM(require("react"));
|
|
3775
|
+
var import_react27 = require("react");
|
|
3742
3776
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
3743
3777
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3744
|
-
var
|
|
3745
|
-
var
|
|
3778
|
+
var import_icons15 = require("@elementor/icons");
|
|
3779
|
+
var import_ui34 = require("@elementor/ui");
|
|
3746
3780
|
var import_i18n25 = require("@wordpress/i18n");
|
|
3747
3781
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3748
|
-
const [fontFamily, setFontFamily] = (0,
|
|
3749
|
-
const defaultRef = (0,
|
|
3782
|
+
const [fontFamily, setFontFamily] = (0, import_react27.useState)(value);
|
|
3783
|
+
const defaultRef = (0, import_react27.useRef)(null);
|
|
3750
3784
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3751
|
-
const fontPopoverState = (0,
|
|
3785
|
+
const fontPopoverState = (0, import_ui34.usePopupState)({ variant: "popover" });
|
|
3752
3786
|
const fontFamilies = (0, import_editor_controls13.useFontFamilies)();
|
|
3753
3787
|
const sectionWidth = (0, import_editor_ui12.useSectionWidth)();
|
|
3754
|
-
const mapFontSubs =
|
|
3788
|
+
const mapFontSubs = React36.useMemo(() => {
|
|
3755
3789
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3756
3790
|
label,
|
|
3757
3791
|
items: fonts
|
|
@@ -3767,28 +3801,28 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3767
3801
|
handleChange(newFontFamily);
|
|
3768
3802
|
fontPopoverState.close();
|
|
3769
3803
|
};
|
|
3770
|
-
const id2 = (0,
|
|
3771
|
-
return /* @__PURE__ */
|
|
3772
|
-
|
|
3804
|
+
const id2 = (0, import_react27.useId)();
|
|
3805
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3806
|
+
import_ui34.UnstableTag,
|
|
3773
3807
|
{
|
|
3774
3808
|
id: id2,
|
|
3775
3809
|
variant: "outlined",
|
|
3776
3810
|
label: fontFamily,
|
|
3777
|
-
endIcon: /* @__PURE__ */
|
|
3778
|
-
...(0,
|
|
3811
|
+
endIcon: /* @__PURE__ */ React36.createElement(import_icons15.ChevronDownIcon, { fontSize: "tiny" }),
|
|
3812
|
+
...(0, import_ui34.bindTrigger)(fontPopoverState),
|
|
3779
3813
|
fullWidth: true
|
|
3780
3814
|
}
|
|
3781
|
-
), /* @__PURE__ */
|
|
3782
|
-
|
|
3815
|
+
), /* @__PURE__ */ React36.createElement(
|
|
3816
|
+
import_ui34.Popover,
|
|
3783
3817
|
{
|
|
3784
3818
|
disablePortal: true,
|
|
3785
3819
|
disableScrollLock: true,
|
|
3786
3820
|
anchorEl: anchorRef,
|
|
3787
3821
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3788
3822
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3789
|
-
...(0,
|
|
3823
|
+
...(0, import_ui34.bindPopover)(fontPopoverState)
|
|
3790
3824
|
},
|
|
3791
|
-
/* @__PURE__ */
|
|
3825
|
+
/* @__PURE__ */ React36.createElement(
|
|
3792
3826
|
import_editor_controls13.ItemSelector,
|
|
3793
3827
|
{
|
|
3794
3828
|
id: "font-family-variables-selector",
|
|
@@ -3800,7 +3834,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3800
3834
|
title: (0, import_i18n25.__)("Font family", "elementor"),
|
|
3801
3835
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3802
3836
|
onDebounce: import_editor_controls13.enqueueFont,
|
|
3803
|
-
icon:
|
|
3837
|
+
icon: import_icons15.TextIcon
|
|
3804
3838
|
}
|
|
3805
3839
|
)
|
|
3806
3840
|
));
|
|
@@ -3822,11 +3856,11 @@ function registerVariableTypes() {
|
|
|
3822
3856
|
registerVariableType({
|
|
3823
3857
|
key: colorVariablePropTypeUtil.key,
|
|
3824
3858
|
valueField: ColorField,
|
|
3825
|
-
icon:
|
|
3859
|
+
icon: import_icons16.BrushIcon,
|
|
3826
3860
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3827
3861
|
fallbackPropTypeUtil: import_editor_props5.colorPropTypeUtil,
|
|
3828
3862
|
variableType: "color",
|
|
3829
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3863
|
+
startIcon: ({ value }) => /* @__PURE__ */ React37.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3830
3864
|
defaultValue: "#ffffff",
|
|
3831
3865
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3832
3866
|
const actions = [];
|
|
@@ -3836,14 +3870,14 @@ function registerVariableTypes() {
|
|
|
3836
3870
|
if (variable.sync_to_v3) {
|
|
3837
3871
|
actions.push({
|
|
3838
3872
|
name: (0, import_i18n26.__)("Stop syncing to Version 3", "elementor"),
|
|
3839
|
-
icon:
|
|
3873
|
+
icon: import_icons16.ResetIcon,
|
|
3840
3874
|
color: "text.primary",
|
|
3841
3875
|
onClick: () => handlers.onStopSync(variableId)
|
|
3842
3876
|
});
|
|
3843
3877
|
} else {
|
|
3844
3878
|
actions.push({
|
|
3845
3879
|
name: (0, import_i18n26.__)("Sync to Version 3", "elementor"),
|
|
3846
|
-
icon:
|
|
3880
|
+
icon: import_icons16.ResetIcon,
|
|
3847
3881
|
color: "text.primary",
|
|
3848
3882
|
onClick: () => handlers.onStartSync(variableId)
|
|
3849
3883
|
});
|
|
@@ -3854,7 +3888,7 @@ function registerVariableTypes() {
|
|
|
3854
3888
|
registerVariableType({
|
|
3855
3889
|
key: fontVariablePropTypeUtil.key,
|
|
3856
3890
|
valueField: FontField,
|
|
3857
|
-
icon:
|
|
3891
|
+
icon: import_icons16.TextIcon,
|
|
3858
3892
|
propTypeUtil: fontVariablePropTypeUtil,
|
|
3859
3893
|
fallbackPropTypeUtil: import_editor_props5.stringPropTypeUtil,
|
|
3860
3894
|
variableType: "font",
|
|
@@ -3862,13 +3896,13 @@ function registerVariableTypes() {
|
|
|
3862
3896
|
});
|
|
3863
3897
|
const sizePromotions = {
|
|
3864
3898
|
isActive: false,
|
|
3865
|
-
icon:
|
|
3899
|
+
icon: import_icons16.ExpandDiagonalIcon,
|
|
3866
3900
|
propTypeUtil: sizeVariablePropTypeUtil,
|
|
3867
3901
|
fallbackPropTypeUtil: import_editor_props5.sizePropTypeUtil,
|
|
3868
3902
|
styleTransformer: EmptyTransformer,
|
|
3869
3903
|
variableType: "size",
|
|
3870
3904
|
selectionFilter: () => [],
|
|
3871
|
-
emptyState: /* @__PURE__ */
|
|
3905
|
+
emptyState: /* @__PURE__ */ React37.createElement(import_editor_ui13.CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3872
3906
|
};
|
|
3873
3907
|
registerVariableType({
|
|
3874
3908
|
...sizePromotions,
|
|
@@ -3882,10 +3916,10 @@ function registerVariableTypes() {
|
|
|
3882
3916
|
}
|
|
3883
3917
|
|
|
3884
3918
|
// src/renderers/style-variables-renderer.tsx
|
|
3885
|
-
var
|
|
3886
|
-
var
|
|
3919
|
+
var React38 = __toESM(require("react"));
|
|
3920
|
+
var import_react28 = require("react");
|
|
3887
3921
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3888
|
-
var
|
|
3922
|
+
var import_ui35 = require("@elementor/ui");
|
|
3889
3923
|
var VARIABLES_WRAPPER = "body";
|
|
3890
3924
|
function StyleVariablesRenderer() {
|
|
3891
3925
|
const container = usePortalContainer();
|
|
@@ -3896,14 +3930,14 @@ function StyleVariablesRenderer() {
|
|
|
3896
3930
|
}
|
|
3897
3931
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3898
3932
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3899
|
-
return /* @__PURE__ */
|
|
3933
|
+
return /* @__PURE__ */ React38.createElement(import_ui35.Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3900
3934
|
}
|
|
3901
3935
|
function usePortalContainer() {
|
|
3902
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);
|
|
3903
3937
|
}
|
|
3904
3938
|
function useStyleVariables() {
|
|
3905
|
-
const [variables, setVariables] = (0,
|
|
3906
|
-
(0,
|
|
3939
|
+
const [variables, setVariables] = (0, import_react28.useState)({});
|
|
3940
|
+
(0, import_react28.useEffect)(() => {
|
|
3907
3941
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3908
3942
|
return () => {
|
|
3909
3943
|
unsubscribe();
|
|
@@ -3926,22 +3960,22 @@ var import_editor_controls14 = require("@elementor/editor-controls");
|
|
|
3926
3960
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
3927
3961
|
|
|
3928
3962
|
// src/components/variables-repeater-item-slot.tsx
|
|
3929
|
-
var
|
|
3963
|
+
var React39 = __toESM(require("react"));
|
|
3930
3964
|
var useColorVariable = (value) => {
|
|
3931
3965
|
const variableId = value?.value?.color?.value;
|
|
3932
3966
|
return useVariable(variableId || "");
|
|
3933
3967
|
};
|
|
3934
3968
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3935
3969
|
const colorVariable = useColorVariable(value);
|
|
3936
|
-
return /* @__PURE__ */
|
|
3970
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3937
3971
|
};
|
|
3938
3972
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3939
3973
|
const colorVariable = useColorVariable(value);
|
|
3940
|
-
return /* @__PURE__ */
|
|
3974
|
+
return /* @__PURE__ */ React39.createElement("span", null, colorVariable?.label);
|
|
3941
3975
|
};
|
|
3942
3976
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3943
3977
|
const colorVariable = useColorVariable(value);
|
|
3944
|
-
return /* @__PURE__ */
|
|
3978
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3945
3979
|
};
|
|
3946
3980
|
|
|
3947
3981
|
// src/repeater-injections.ts
|