@elementor/editor-variables 4.0.0-527 → 4.0.0-528
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.d.mts +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +628 -497
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +508 -368
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/api.ts +2 -0
- package/src/batch-operations.ts +4 -1
- package/src/components/ui/stop-sync-confirmation-dialog.tsx +77 -0
- package/src/components/variables-manager/hooks/use-variables-manager-state.ts +18 -0
- package/src/components/variables-manager/variables-manager-panel.tsx +56 -17
- package/src/components/variables-manager/variables-manager-table.tsx +2 -2
- package/src/index.ts +7 -1
- package/src/register-variable-types.tsx +28 -1
- package/src/storage.ts +1 -0
- package/src/types.ts +2 -0
- package/src/utils/variables-to-list.ts +8 -1
- package/src/variables-registry/create-variable-type-registry.ts +15 -0
- package/src/variables-registry/variable-type-registry.ts +19 -1
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
GLOBAL_VARIABLES_URI: () => GLOBAL_VARIABLES_URI,
|
|
34
34
|
Utils: () => Utils,
|
|
35
|
+
getMenuActionsForVariable: () => getMenuActionsForVariable,
|
|
35
36
|
hasVariable: () => hasVariable,
|
|
36
37
|
init: () => init,
|
|
37
38
|
registerVariableType: () => registerVariableType,
|
|
@@ -49,18 +50,18 @@ var import_editor_props7 = require("@elementor/editor-props");
|
|
|
49
50
|
var import_menus = require("@elementor/menus");
|
|
50
51
|
|
|
51
52
|
// src/components/open-panel-from-url.tsx
|
|
52
|
-
var
|
|
53
|
+
var import_react13 = require("react");
|
|
53
54
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
54
55
|
|
|
55
56
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
56
|
-
var
|
|
57
|
-
var
|
|
57
|
+
var React13 = __toESM(require("react"));
|
|
58
|
+
var import_react12 = require("react");
|
|
58
59
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
59
60
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
60
61
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
var
|
|
62
|
+
var import_icons6 = require("@elementor/icons");
|
|
63
|
+
var import_ui13 = require("@elementor/ui");
|
|
64
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
64
65
|
|
|
65
66
|
// src/utils/tracking.ts
|
|
66
67
|
var import_mixpanel = require("@elementor/mixpanel");
|
|
@@ -284,6 +285,7 @@ var buildOperationsArray = (originalVariables, currentVariables) => {
|
|
|
284
285
|
});
|
|
285
286
|
} else if (originalVariables[id2]) {
|
|
286
287
|
const original = originalVariables[id2];
|
|
288
|
+
const syncChanged = original.sync_to_v3 !== variable.sync_to_v3;
|
|
287
289
|
if (original.deleted && !variable.deleted) {
|
|
288
290
|
operations.push({
|
|
289
291
|
type: "restore",
|
|
@@ -291,14 +293,15 @@ var buildOperationsArray = (originalVariables, currentVariables) => {
|
|
|
291
293
|
...original.label !== variable.label && { label: variable.label },
|
|
292
294
|
...original.value !== variable.value && { value: variable.value }
|
|
293
295
|
});
|
|
294
|
-
} else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value || original.order !== variable.order)) {
|
|
296
|
+
} else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value || original.order !== variable.order || syncChanged)) {
|
|
295
297
|
operations.push({
|
|
296
298
|
type: "update",
|
|
297
299
|
id: id2,
|
|
298
300
|
variable: {
|
|
299
301
|
...original.label !== variable.label && { label: variable.label },
|
|
300
302
|
...original.value !== variable.value && { value: variable.value },
|
|
301
|
-
...original.order !== variable.order && { order: variable.order }
|
|
303
|
+
...original.order !== variable.order && { order: variable.order },
|
|
304
|
+
...syncChanged && { sync_to_v3: variable.sync_to_v3 }
|
|
302
305
|
}
|
|
303
306
|
});
|
|
304
307
|
}
|
|
@@ -691,7 +694,8 @@ function createVariableTypeRegistry() {
|
|
|
691
694
|
fallbackPropTypeUtil,
|
|
692
695
|
isCompatible,
|
|
693
696
|
emptyState,
|
|
694
|
-
isActive = true
|
|
697
|
+
isActive = true,
|
|
698
|
+
menuActionsFactory
|
|
695
699
|
}) => {
|
|
696
700
|
const variableTypeKey = key ?? propTypeUtil.key;
|
|
697
701
|
if (!isCompatible) {
|
|
@@ -716,7 +720,8 @@ function createVariableTypeRegistry() {
|
|
|
716
720
|
fallbackPropTypeUtil,
|
|
717
721
|
isCompatible,
|
|
718
722
|
emptyState,
|
|
719
|
-
isActive
|
|
723
|
+
isActive,
|
|
724
|
+
menuActionsFactory
|
|
720
725
|
};
|
|
721
726
|
registerTransformer(propTypeUtil.key, styleTransformer);
|
|
722
727
|
registerInheritanceTransformer(propTypeUtil.key);
|
|
@@ -746,6 +751,13 @@ function createVariableTypeRegistry() {
|
|
|
746
751
|
|
|
747
752
|
// src/variables-registry/variable-type-registry.ts
|
|
748
753
|
var { registerVariableType, getVariableType, getVariableTypes, hasVariableType } = createVariableTypeRegistry();
|
|
754
|
+
function getMenuActionsForVariable(variableType, context) {
|
|
755
|
+
const typeOptions = getVariableType(variableType);
|
|
756
|
+
if (typeOptions?.menuActionsFactory) {
|
|
757
|
+
return typeOptions.menuActionsFactory(context);
|
|
758
|
+
}
|
|
759
|
+
return [];
|
|
760
|
+
}
|
|
749
761
|
|
|
750
762
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
751
763
|
var React2 = __toESM(require("react"));
|
|
@@ -822,14 +834,52 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
822
834
|
);
|
|
823
835
|
};
|
|
824
836
|
|
|
825
|
-
// src/components/
|
|
837
|
+
// src/components/ui/stop-sync-confirmation-dialog.tsx
|
|
838
|
+
var React5 = __toESM(require("react"));
|
|
826
839
|
var import_react = require("react");
|
|
840
|
+
var import_icons2 = require("@elementor/icons");
|
|
841
|
+
var import_ui6 = require("@elementor/ui");
|
|
842
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
843
|
+
var StopSyncConfirmationDialog = ({
|
|
844
|
+
open,
|
|
845
|
+
closeDialog,
|
|
846
|
+
onConfirm,
|
|
847
|
+
onSuppressMessage
|
|
848
|
+
}) => {
|
|
849
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react.useState)(false);
|
|
850
|
+
const handleConfirm = () => {
|
|
851
|
+
if (dontShowAgain) {
|
|
852
|
+
onSuppressMessage?.();
|
|
853
|
+
}
|
|
854
|
+
onConfirm();
|
|
855
|
+
};
|
|
856
|
+
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.__)(
|
|
857
|
+
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
858
|
+
"elementor"
|
|
859
|
+
))), /* @__PURE__ */ React5.createElement(import_ui6.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React5.createElement(
|
|
860
|
+
import_ui6.FormControlLabel,
|
|
861
|
+
{
|
|
862
|
+
control: /* @__PURE__ */ React5.createElement(
|
|
863
|
+
import_ui6.Checkbox,
|
|
864
|
+
{
|
|
865
|
+
checked: dontShowAgain,
|
|
866
|
+
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
867
|
+
size: "small"
|
|
868
|
+
}
|
|
869
|
+
),
|
|
870
|
+
label: /* @__PURE__ */ React5.createElement(import_ui6.Typography, { variant: "body2" }, (0, import_i18n7.__)("Don't show this again", "elementor"))
|
|
871
|
+
}
|
|
872
|
+
), /* @__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")))));
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
// src/components/variables-manager/hooks/use-auto-edit.ts
|
|
876
|
+
var import_react2 = require("react");
|
|
827
877
|
var useAutoEdit = () => {
|
|
828
|
-
const [autoEditVariableId, setAutoEditVariableId] = (0,
|
|
829
|
-
const startAutoEdit = (0,
|
|
878
|
+
const [autoEditVariableId, setAutoEditVariableId] = (0, import_react2.useState)(void 0);
|
|
879
|
+
const startAutoEdit = (0, import_react2.useCallback)((variableId) => {
|
|
830
880
|
setAutoEditVariableId(variableId);
|
|
831
881
|
}, []);
|
|
832
|
-
const handleAutoEditComplete = (0,
|
|
882
|
+
const handleAutoEditComplete = (0, import_react2.useCallback)(() => {
|
|
833
883
|
setTimeout(() => {
|
|
834
884
|
setAutoEditVariableId(void 0);
|
|
835
885
|
}, 100);
|
|
@@ -842,10 +892,10 @@ var useAutoEdit = () => {
|
|
|
842
892
|
};
|
|
843
893
|
|
|
844
894
|
// src/components/variables-manager/hooks/use-error-navigation.ts
|
|
845
|
-
var
|
|
895
|
+
var import_react3 = require("react");
|
|
846
896
|
var useErrorNavigation = () => {
|
|
847
|
-
const currentIndexRef = (0,
|
|
848
|
-
const createNavigationCallback = (0,
|
|
897
|
+
const currentIndexRef = (0, import_react3.useRef)(0);
|
|
898
|
+
const createNavigationCallback = (0, import_react3.useCallback)(
|
|
849
899
|
(ids, onNavigate, onComplete) => {
|
|
850
900
|
return () => {
|
|
851
901
|
if (!ids?.length) {
|
|
@@ -867,7 +917,7 @@ var useErrorNavigation = () => {
|
|
|
867
917
|
},
|
|
868
918
|
[]
|
|
869
919
|
);
|
|
870
|
-
const resetNavigation = (0,
|
|
920
|
+
const resetNavigation = (0, import_react3.useCallback)(() => {
|
|
871
921
|
currentIndexRef.current = 0;
|
|
872
922
|
}, []);
|
|
873
923
|
return {
|
|
@@ -877,21 +927,21 @@ var useErrorNavigation = () => {
|
|
|
877
927
|
};
|
|
878
928
|
|
|
879
929
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
880
|
-
var
|
|
930
|
+
var import_react6 = require("react");
|
|
881
931
|
|
|
882
932
|
// src/hooks/use-prop-variables.ts
|
|
883
|
-
var
|
|
933
|
+
var import_react5 = require("react");
|
|
884
934
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
885
935
|
|
|
886
936
|
// src/context/variable-type-context.tsx
|
|
887
|
-
var
|
|
888
|
-
var
|
|
889
|
-
var VariableTypeContext = (0,
|
|
937
|
+
var React6 = __toESM(require("react"));
|
|
938
|
+
var import_react4 = require("react");
|
|
939
|
+
var VariableTypeContext = (0, import_react4.createContext)(null);
|
|
890
940
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
891
|
-
return /* @__PURE__ */
|
|
941
|
+
return /* @__PURE__ */ React6.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
892
942
|
}
|
|
893
943
|
function useVariableType() {
|
|
894
|
-
const context = (0,
|
|
944
|
+
const context = (0, import_react4.useContext)(VariableTypeContext);
|
|
895
945
|
if (context === null) {
|
|
896
946
|
throw new Error("useVariableType must be used within a VariableTypeProvider");
|
|
897
947
|
}
|
|
@@ -908,11 +958,18 @@ function filterBySearch(variables, searchValue) {
|
|
|
908
958
|
var variablesToList = (variables) => {
|
|
909
959
|
return Object.entries(variables).map(([key, variable]) => ({ key, ...variable }));
|
|
910
960
|
};
|
|
911
|
-
var toNormalizedVariable = ({
|
|
961
|
+
var toNormalizedVariable = ({
|
|
962
|
+
key,
|
|
963
|
+
label,
|
|
964
|
+
value,
|
|
965
|
+
order,
|
|
966
|
+
sync_to_v3: syncToV3
|
|
967
|
+
}) => ({
|
|
912
968
|
key,
|
|
913
969
|
label,
|
|
914
970
|
value,
|
|
915
|
-
order
|
|
971
|
+
order,
|
|
972
|
+
sync_to_v3: syncToV3
|
|
916
973
|
});
|
|
917
974
|
var applySelectionFilters = (variables, variableTypes) => {
|
|
918
975
|
const grouped = {};
|
|
@@ -967,7 +1024,7 @@ var useVariableSelectionFilter = (variables) => {
|
|
|
967
1024
|
return selectionFilter ? selectionFilter(variables, propType) : variables;
|
|
968
1025
|
};
|
|
969
1026
|
var usePropVariables = (propKey) => {
|
|
970
|
-
return (0,
|
|
1027
|
+
return (0, import_react5.useMemo)(() => normalizeVariables(propKey), [propKey]);
|
|
971
1028
|
};
|
|
972
1029
|
var getMatchingTypes = (propKey) => {
|
|
973
1030
|
const matchingTypes = [];
|
|
@@ -1001,20 +1058,20 @@ var restoreVariable = (restoreId, label, value, type) => {
|
|
|
1001
1058
|
|
|
1002
1059
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
1003
1060
|
var useVariablesManagerState = () => {
|
|
1004
|
-
const [variables, setVariables] = (0,
|
|
1005
|
-
const [deletedVariables, setDeletedVariables] = (0,
|
|
1006
|
-
const [isSaveDisabled, setIsSaveDisabled] = (0,
|
|
1007
|
-
const [isDirty, setIsDirty] = (0,
|
|
1008
|
-
const [isSaving, setIsSaving] = (0,
|
|
1009
|
-
const [searchValue, setSearchValue] = (0,
|
|
1010
|
-
const handleOnChange = (0,
|
|
1061
|
+
const [variables, setVariables] = (0, import_react6.useState)(() => getVariables(false));
|
|
1062
|
+
const [deletedVariables, setDeletedVariables] = (0, import_react6.useState)([]);
|
|
1063
|
+
const [isSaveDisabled, setIsSaveDisabled] = (0, import_react6.useState)(false);
|
|
1064
|
+
const [isDirty, setIsDirty] = (0, import_react6.useState)(false);
|
|
1065
|
+
const [isSaving, setIsSaving] = (0, import_react6.useState)(false);
|
|
1066
|
+
const [searchValue, setSearchValue] = (0, import_react6.useState)("");
|
|
1067
|
+
const handleOnChange = (0, import_react6.useCallback)(
|
|
1011
1068
|
(newVariables) => {
|
|
1012
1069
|
setVariables({ ...variables, ...newVariables });
|
|
1013
1070
|
setIsDirty(true);
|
|
1014
1071
|
},
|
|
1015
1072
|
[variables]
|
|
1016
1073
|
);
|
|
1017
|
-
const createVariable2 = (0,
|
|
1074
|
+
const createVariable2 = (0, import_react6.useCallback)((type, defaultName, defaultValue) => {
|
|
1018
1075
|
const newId = generateTempId();
|
|
1019
1076
|
const newVariable = {
|
|
1020
1077
|
id: newId,
|
|
@@ -1026,15 +1083,29 @@ var useVariablesManagerState = () => {
|
|
|
1026
1083
|
setIsDirty(true);
|
|
1027
1084
|
return newId;
|
|
1028
1085
|
}, []);
|
|
1029
|
-
const handleDeleteVariable = (0,
|
|
1086
|
+
const handleDeleteVariable = (0, import_react6.useCallback)((itemId) => {
|
|
1030
1087
|
setDeletedVariables((prev) => [...prev, itemId]);
|
|
1031
1088
|
setVariables((prev) => ({ ...prev, [itemId]: { ...prev[itemId], deleted: true } }));
|
|
1032
1089
|
setIsDirty(true);
|
|
1033
1090
|
}, []);
|
|
1091
|
+
const handleStartSync = (0, import_react6.useCallback)((itemId) => {
|
|
1092
|
+
setVariables((prev) => ({
|
|
1093
|
+
...prev,
|
|
1094
|
+
[itemId]: { ...prev[itemId], sync_to_v3: true }
|
|
1095
|
+
}));
|
|
1096
|
+
setIsDirty(true);
|
|
1097
|
+
}, []);
|
|
1098
|
+
const handleStopSync = (0, import_react6.useCallback)((itemId) => {
|
|
1099
|
+
setVariables((prev) => ({
|
|
1100
|
+
...prev,
|
|
1101
|
+
[itemId]: { ...prev[itemId], sync_to_v3: false }
|
|
1102
|
+
}));
|
|
1103
|
+
setIsDirty(true);
|
|
1104
|
+
}, []);
|
|
1034
1105
|
const handleSearch = (searchTerm) => {
|
|
1035
1106
|
setSearchValue(searchTerm);
|
|
1036
1107
|
};
|
|
1037
|
-
const handleSave = (0,
|
|
1108
|
+
const handleSave = (0, import_react6.useCallback)(async () => {
|
|
1038
1109
|
const originalVariables = getVariables(false);
|
|
1039
1110
|
setIsSaving(true);
|
|
1040
1111
|
const result = await service.batchSave(originalVariables, variables);
|
|
@@ -1047,7 +1118,7 @@ var useVariablesManagerState = () => {
|
|
|
1047
1118
|
}
|
|
1048
1119
|
return { success: result.success };
|
|
1049
1120
|
}, [variables]);
|
|
1050
|
-
const filteredVariables = (0,
|
|
1121
|
+
const filteredVariables = (0, import_react6.useCallback)(() => {
|
|
1051
1122
|
const list = variablesToList(variables).filter((v) => !v.deleted);
|
|
1052
1123
|
const typeFiltered = applySelectionFilters(list, getVariableTypes());
|
|
1053
1124
|
const searchFiltered = filterBySearch(typeFiltered, searchValue);
|
|
@@ -1061,6 +1132,8 @@ var useVariablesManagerState = () => {
|
|
|
1061
1132
|
handleOnChange,
|
|
1062
1133
|
createVariable: createVariable2,
|
|
1063
1134
|
handleDeleteVariable,
|
|
1135
|
+
handleStartSync,
|
|
1136
|
+
handleStopSync,
|
|
1064
1137
|
handleSave,
|
|
1065
1138
|
isSaving,
|
|
1066
1139
|
handleSearch,
|
|
@@ -1071,13 +1144,13 @@ var useVariablesManagerState = () => {
|
|
|
1071
1144
|
};
|
|
1072
1145
|
|
|
1073
1146
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1074
|
-
var
|
|
1075
|
-
var
|
|
1147
|
+
var React7 = __toESM(require("react"));
|
|
1148
|
+
var import_react7 = require("react");
|
|
1076
1149
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
1077
|
-
var
|
|
1078
|
-
var
|
|
1150
|
+
var import_icons3 = require("@elementor/icons");
|
|
1151
|
+
var import_ui7 = require("@elementor/ui");
|
|
1079
1152
|
var import_utils = require("@elementor/utils");
|
|
1080
|
-
var
|
|
1153
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1081
1154
|
|
|
1082
1155
|
// src/sync/license-info.ts
|
|
1083
1156
|
function getLicenseInfo() {
|
|
@@ -1105,9 +1178,9 @@ var VariableManagerCreateMenu = ({
|
|
|
1105
1178
|
disabled,
|
|
1106
1179
|
menuState
|
|
1107
1180
|
}) => {
|
|
1108
|
-
const buttonRef = (0,
|
|
1181
|
+
const buttonRef = (0, import_react7.useRef)(null);
|
|
1109
1182
|
const variableTypes = getVariableTypes();
|
|
1110
|
-
const menuOptionConfigs = (0,
|
|
1183
|
+
const menuOptionConfigs = (0, import_react7.useMemo)(
|
|
1111
1184
|
() => Object.entries(variableTypes).filter(([, variable]) => !!variable.defaultValue).map(([key, variable]) => ({
|
|
1112
1185
|
key,
|
|
1113
1186
|
propTypeKey: variable.propTypeUtil.key,
|
|
@@ -1117,18 +1190,18 @@ var VariableManagerCreateMenu = ({
|
|
|
1117
1190
|
})),
|
|
1118
1191
|
[variableTypes]
|
|
1119
1192
|
);
|
|
1120
|
-
return /* @__PURE__ */
|
|
1121
|
-
|
|
1193
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
1194
|
+
import_ui7.IconButton,
|
|
1122
1195
|
{
|
|
1123
|
-
...(0,
|
|
1196
|
+
...(0, import_ui7.bindTrigger)(menuState),
|
|
1124
1197
|
ref: buttonRef,
|
|
1125
1198
|
disabled,
|
|
1126
1199
|
size: SIZE,
|
|
1127
|
-
"aria-label": (0,
|
|
1200
|
+
"aria-label": (0, import_i18n8.__)("Add variable", "elementor")
|
|
1128
1201
|
},
|
|
1129
|
-
/* @__PURE__ */
|
|
1130
|
-
), /* @__PURE__ */
|
|
1131
|
-
|
|
1202
|
+
/* @__PURE__ */ React7.createElement(import_icons3.PlusIcon, { fontSize: SIZE })
|
|
1203
|
+
), /* @__PURE__ */ React7.createElement(
|
|
1204
|
+
import_ui7.Menu,
|
|
1132
1205
|
{
|
|
1133
1206
|
disablePortal: true,
|
|
1134
1207
|
MenuListProps: {
|
|
@@ -1137,7 +1210,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1137
1210
|
PaperProps: {
|
|
1138
1211
|
elevation: 6
|
|
1139
1212
|
},
|
|
1140
|
-
...(0,
|
|
1213
|
+
...(0, import_ui7.bindMenu)(menuState),
|
|
1141
1214
|
anchorEl: buttonRef.current,
|
|
1142
1215
|
anchorOrigin: {
|
|
1143
1216
|
vertical: "bottom",
|
|
@@ -1149,7 +1222,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1149
1222
|
},
|
|
1150
1223
|
"data-testid": "variable-manager-create-menu"
|
|
1151
1224
|
},
|
|
1152
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1225
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React7.createElement(
|
|
1153
1226
|
MenuOption,
|
|
1154
1227
|
{
|
|
1155
1228
|
key: config.key,
|
|
@@ -1167,7 +1240,7 @@ var MenuOption = ({
|
|
|
1167
1240
|
onCreate,
|
|
1168
1241
|
onClose
|
|
1169
1242
|
}) => {
|
|
1170
|
-
const [isPopoverOpen, setIsPopoverOpen] = (0,
|
|
1243
|
+
const [isPopoverOpen, setIsPopoverOpen] = (0, import_react7.useState)(false);
|
|
1171
1244
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1172
1245
|
const displayName = (0, import_utils.capitalize)(config.variableType);
|
|
1173
1246
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
@@ -1183,29 +1256,29 @@ var MenuOption = ({
|
|
|
1183
1256
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1184
1257
|
onClose();
|
|
1185
1258
|
};
|
|
1186
|
-
const title = (0,
|
|
1259
|
+
const title = (0, import_i18n8.sprintf)(
|
|
1187
1260
|
/* translators: %s: Variable Type. */
|
|
1188
|
-
(0,
|
|
1261
|
+
(0, import_i18n8.__)("%s variables", "elementor"),
|
|
1189
1262
|
(0, import_utils.capitalize)(config.variableType)
|
|
1190
1263
|
);
|
|
1191
|
-
const content = (0,
|
|
1264
|
+
const content = (0, import_i18n8.sprintf)(
|
|
1192
1265
|
/* translators: %s: Variable Type. */
|
|
1193
|
-
(0,
|
|
1266
|
+
(0, import_i18n8.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1194
1267
|
config.variableType
|
|
1195
1268
|
);
|
|
1196
|
-
return /* @__PURE__ */
|
|
1269
|
+
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(
|
|
1197
1270
|
import_editor_ui2.PromotionPopover,
|
|
1198
1271
|
{
|
|
1199
1272
|
open: isPopoverOpen,
|
|
1200
1273
|
title,
|
|
1201
1274
|
content,
|
|
1202
|
-
ctaText: (0,
|
|
1275
|
+
ctaText: (0, import_i18n8.__)("Upgrade now", "elementor"),
|
|
1203
1276
|
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1204
1277
|
onClose: () => {
|
|
1205
1278
|
setIsPopoverOpen(false);
|
|
1206
1279
|
}
|
|
1207
1280
|
},
|
|
1208
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ React7.createElement(import_editor_ui2.PromotionChip, null)
|
|
1209
1282
|
));
|
|
1210
1283
|
};
|
|
1211
1284
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1220,23 +1293,23 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1220
1293
|
};
|
|
1221
1294
|
|
|
1222
1295
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1223
|
-
var
|
|
1224
|
-
var
|
|
1296
|
+
var React12 = __toESM(require("react"));
|
|
1297
|
+
var import_react11 = require("react");
|
|
1225
1298
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1226
|
-
var
|
|
1227
|
-
var
|
|
1228
|
-
var
|
|
1299
|
+
var import_icons5 = require("@elementor/icons");
|
|
1300
|
+
var import_ui12 = require("@elementor/ui");
|
|
1301
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1229
1302
|
|
|
1230
1303
|
// src/components/fields/label-field.tsx
|
|
1231
|
-
var
|
|
1232
|
-
var
|
|
1304
|
+
var React8 = __toESM(require("react"));
|
|
1305
|
+
var import_react8 = require("react");
|
|
1233
1306
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1234
|
-
var
|
|
1307
|
+
var import_ui8 = require("@elementor/ui");
|
|
1235
1308
|
function isLabelEqual(a, b) {
|
|
1236
1309
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1237
1310
|
}
|
|
1238
1311
|
var useLabelError = (initialError) => {
|
|
1239
|
-
const [error, setError] = (0,
|
|
1312
|
+
const [error, setError] = (0, import_react8.useState)(initialError ?? { value: "", message: "" });
|
|
1240
1313
|
return {
|
|
1241
1314
|
labelFieldError: error,
|
|
1242
1315
|
setLabelFieldError: setError
|
|
@@ -1255,9 +1328,9 @@ var LabelField = ({
|
|
|
1255
1328
|
variables,
|
|
1256
1329
|
onKeyDown
|
|
1257
1330
|
}) => {
|
|
1258
|
-
const [label, setLabel] = (0,
|
|
1259
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
1260
|
-
const fieldRef = (0,
|
|
1331
|
+
const [label, setLabel] = (0, import_react8.useState)(value);
|
|
1332
|
+
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
|
1333
|
+
const fieldRef = (0, import_react8.useRef)(null);
|
|
1261
1334
|
const handleChange = (newValue) => {
|
|
1262
1335
|
setLabel(newValue);
|
|
1263
1336
|
const errorMsg2 = validateLabel(newValue, variables);
|
|
@@ -1270,8 +1343,8 @@ var LabelField = ({
|
|
|
1270
1343
|
errorMsg = error.message;
|
|
1271
1344
|
}
|
|
1272
1345
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1273
|
-
const textField = /* @__PURE__ */
|
|
1274
|
-
|
|
1346
|
+
const textField = /* @__PURE__ */ React8.createElement(
|
|
1347
|
+
import_ui8.TextField,
|
|
1275
1348
|
{
|
|
1276
1349
|
ref: fieldRef,
|
|
1277
1350
|
id: id2,
|
|
@@ -1291,7 +1364,7 @@ var LabelField = ({
|
|
|
1291
1364
|
);
|
|
1292
1365
|
if (showWarningInfotip) {
|
|
1293
1366
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1294
|
-
return /* @__PURE__ */
|
|
1367
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1295
1368
|
import_editor_ui3.WarningInfotip,
|
|
1296
1369
|
{
|
|
1297
1370
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1308,16 +1381,16 @@ var LabelField = ({
|
|
|
1308
1381
|
};
|
|
1309
1382
|
|
|
1310
1383
|
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1311
|
-
var
|
|
1312
|
-
var
|
|
1313
|
-
var
|
|
1314
|
-
var
|
|
1384
|
+
var React9 = __toESM(require("react"));
|
|
1385
|
+
var import_react9 = require("react");
|
|
1386
|
+
var import_icons4 = require("@elementor/icons");
|
|
1387
|
+
var import_ui9 = require("@elementor/ui");
|
|
1315
1388
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1316
|
-
const menuState = (0,
|
|
1389
|
+
const menuState = (0, import_ui9.usePopupState)({
|
|
1317
1390
|
variant: "popover"
|
|
1318
1391
|
});
|
|
1319
|
-
return /* @__PURE__ */
|
|
1320
|
-
|
|
1392
|
+
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(
|
|
1393
|
+
import_ui9.Menu,
|
|
1321
1394
|
{
|
|
1322
1395
|
disablePortal: true,
|
|
1323
1396
|
MenuListProps: {
|
|
@@ -1326,7 +1399,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1326
1399
|
PaperProps: {
|
|
1327
1400
|
elevation: 6
|
|
1328
1401
|
},
|
|
1329
|
-
...(0,
|
|
1402
|
+
...(0, import_ui9.bindMenu)(menuState),
|
|
1330
1403
|
anchorEl: menuState.anchorEl,
|
|
1331
1404
|
anchorOrigin: {
|
|
1332
1405
|
vertical: "bottom",
|
|
@@ -1339,8 +1412,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1339
1412
|
open: menuState.isOpen,
|
|
1340
1413
|
onClose: menuState.close
|
|
1341
1414
|
},
|
|
1342
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
1343
|
-
|
|
1415
|
+
menuActions.map((action) => /* @__PURE__ */ React9.createElement(
|
|
1416
|
+
import_ui9.MenuItem,
|
|
1344
1417
|
{
|
|
1345
1418
|
key: action.name,
|
|
1346
1419
|
onClick: () => {
|
|
@@ -1352,7 +1425,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1352
1425
|
gap: 1
|
|
1353
1426
|
}
|
|
1354
1427
|
},
|
|
1355
|
-
action.icon && (0,
|
|
1428
|
+
action.icon && (0, import_react9.createElement)(action.icon, {
|
|
1356
1429
|
fontSize: "inherit"
|
|
1357
1430
|
}),
|
|
1358
1431
|
" ",
|
|
@@ -1362,8 +1435,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1362
1435
|
};
|
|
1363
1436
|
|
|
1364
1437
|
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1365
|
-
var
|
|
1366
|
-
var
|
|
1438
|
+
var React10 = __toESM(require("react"));
|
|
1439
|
+
var import_ui10 = require("@elementor/ui");
|
|
1367
1440
|
var VariableTableCell = ({
|
|
1368
1441
|
children,
|
|
1369
1442
|
isHeader,
|
|
@@ -1382,14 +1455,14 @@ var VariableTableCell = ({
|
|
|
1382
1455
|
...width && { width },
|
|
1383
1456
|
...sx
|
|
1384
1457
|
};
|
|
1385
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1386
1459
|
};
|
|
1387
1460
|
|
|
1388
1461
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1389
|
-
var
|
|
1390
|
-
var
|
|
1391
|
-
var
|
|
1392
|
-
var VariableEditableCell =
|
|
1462
|
+
var React11 = __toESM(require("react"));
|
|
1463
|
+
var import_react10 = require("react");
|
|
1464
|
+
var import_ui11 = require("@elementor/ui");
|
|
1465
|
+
var VariableEditableCell = React11.memo(
|
|
1393
1466
|
({
|
|
1394
1467
|
initialValue,
|
|
1395
1468
|
children,
|
|
@@ -1402,22 +1475,22 @@ var VariableEditableCell = React10.memo(
|
|
|
1402
1475
|
gap = 1,
|
|
1403
1476
|
fieldType
|
|
1404
1477
|
}) => {
|
|
1405
|
-
const [value, setValue] = (0,
|
|
1406
|
-
const [isEditing, setIsEditing] = (0,
|
|
1478
|
+
const [value, setValue] = (0, import_react10.useState)(initialValue);
|
|
1479
|
+
const [isEditing, setIsEditing] = (0, import_react10.useState)(false);
|
|
1407
1480
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1408
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
1409
|
-
const rowRef = (0,
|
|
1410
|
-
const handleSave = (0,
|
|
1481
|
+
const [valueFieldError, setValueFieldError] = (0, import_react10.useState)("");
|
|
1482
|
+
const rowRef = (0, import_react10.useRef)(null);
|
|
1483
|
+
const handleSave = (0, import_react10.useCallback)(() => {
|
|
1411
1484
|
const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
|
|
1412
1485
|
if (!hasError) {
|
|
1413
1486
|
onChange(value);
|
|
1414
1487
|
}
|
|
1415
1488
|
setIsEditing(false);
|
|
1416
1489
|
}, [value, onChange, fieldType, labelFieldError, valueFieldError]);
|
|
1417
|
-
(0,
|
|
1490
|
+
(0, import_react10.useEffect)(() => {
|
|
1418
1491
|
onRowRef?.(rowRef?.current);
|
|
1419
1492
|
}, [onRowRef]);
|
|
1420
|
-
(0,
|
|
1493
|
+
(0, import_react10.useEffect)(() => {
|
|
1421
1494
|
if (autoEdit && !isEditing) {
|
|
1422
1495
|
setIsEditing(true);
|
|
1423
1496
|
onAutoEditComplete?.();
|
|
@@ -1437,10 +1510,10 @@ var VariableEditableCell = React10.memo(
|
|
|
1437
1510
|
setIsEditing(true);
|
|
1438
1511
|
}
|
|
1439
1512
|
};
|
|
1440
|
-
const handleChange = (0,
|
|
1513
|
+
const handleChange = (0, import_react10.useCallback)((newValue) => {
|
|
1441
1514
|
setValue(newValue);
|
|
1442
1515
|
}, []);
|
|
1443
|
-
const handleValidationChange = (0,
|
|
1516
|
+
const handleValidationChange = (0, import_react10.useCallback)(
|
|
1444
1517
|
(errorMsg) => {
|
|
1445
1518
|
if (fieldType === "label") {
|
|
1446
1519
|
setLabelFieldError({
|
|
@@ -1466,8 +1539,8 @@ var VariableEditableCell = React10.memo(
|
|
|
1466
1539
|
error: currentError
|
|
1467
1540
|
});
|
|
1468
1541
|
if (isEditing) {
|
|
1469
|
-
return /* @__PURE__ */
|
|
1470
|
-
|
|
1542
|
+
return /* @__PURE__ */ React11.createElement(import_ui11.ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React11.createElement(
|
|
1543
|
+
import_ui11.Stack,
|
|
1471
1544
|
{
|
|
1472
1545
|
ref: rowRef,
|
|
1473
1546
|
direction: "row",
|
|
@@ -1483,8 +1556,8 @@ var VariableEditableCell = React10.memo(
|
|
|
1483
1556
|
editableContent
|
|
1484
1557
|
));
|
|
1485
1558
|
}
|
|
1486
|
-
return /* @__PURE__ */
|
|
1487
|
-
|
|
1559
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1560
|
+
import_ui11.Stack,
|
|
1488
1561
|
{
|
|
1489
1562
|
ref: rowRef,
|
|
1490
1563
|
direction: "row",
|
|
@@ -1511,9 +1584,9 @@ var VariablesManagerTable = ({
|
|
|
1511
1584
|
onAutoEditComplete,
|
|
1512
1585
|
onFieldError
|
|
1513
1586
|
}) => {
|
|
1514
|
-
const tableContainerRef = (0,
|
|
1515
|
-
const variableRowRefs = (0,
|
|
1516
|
-
(0,
|
|
1587
|
+
const tableContainerRef = (0, import_react11.useRef)(null);
|
|
1588
|
+
const variableRowRefs = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
|
|
1589
|
+
(0, import_react11.useEffect)(() => {
|
|
1517
1590
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1518
1591
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
1519
1592
|
if (rowElement) {
|
|
@@ -1564,17 +1637,17 @@ var VariablesManagerTable = ({
|
|
|
1564
1637
|
});
|
|
1565
1638
|
handleOnChange(updatedVariables);
|
|
1566
1639
|
};
|
|
1567
|
-
return /* @__PURE__ */
|
|
1568
|
-
|
|
1640
|
+
return /* @__PURE__ */ React12.createElement(import_ui12.TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React12.createElement(import_ui12.Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React12.createElement(import_ui12.TableHead, null, /* @__PURE__ */ React12.createElement(import_ui12.TableRow, null, /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n9.__)("Name", "elementor")), /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n9.__)("Value", "elementor")), /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React12.createElement(import_ui12.TableBody, null, /* @__PURE__ */ React12.createElement(
|
|
1641
|
+
import_ui12.UnstableSortableProvider,
|
|
1569
1642
|
{
|
|
1570
1643
|
value: ids,
|
|
1571
1644
|
onChange: handleReorder,
|
|
1572
1645
|
variant: "static",
|
|
1573
1646
|
restrictAxis: true,
|
|
1574
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1647
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React12.createElement(import_ui12.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React12.createElement(import_ui12.TableBody, null, dragOverlayChildren))
|
|
1575
1648
|
},
|
|
1576
|
-
rows.map((row) => /* @__PURE__ */
|
|
1577
|
-
|
|
1649
|
+
rows.map((row) => /* @__PURE__ */ React12.createElement(
|
|
1650
|
+
import_ui12.UnstableSortableItem,
|
|
1578
1651
|
{
|
|
1579
1652
|
key: row.id,
|
|
1580
1653
|
id: row.id,
|
|
@@ -1591,8 +1664,8 @@ var VariablesManagerTable = ({
|
|
|
1591
1664
|
}) => {
|
|
1592
1665
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1593
1666
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1594
|
-
return /* @__PURE__ */
|
|
1595
|
-
|
|
1667
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1668
|
+
import_ui12.TableRow,
|
|
1596
1669
|
{
|
|
1597
1670
|
...itemProps,
|
|
1598
1671
|
ref: itemProps.ref,
|
|
@@ -1622,8 +1695,8 @@ var VariablesManagerTable = ({
|
|
|
1622
1695
|
},
|
|
1623
1696
|
style: { ...itemStyle, ...triggerStyle }
|
|
1624
1697
|
},
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
|
|
1698
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(
|
|
1699
|
+
import_ui12.IconButton,
|
|
1627
1700
|
{
|
|
1628
1701
|
size: "small",
|
|
1629
1702
|
ref: setTriggerRef,
|
|
@@ -1631,9 +1704,9 @@ var VariablesManagerTable = ({
|
|
|
1631
1704
|
disabled: isSorting,
|
|
1632
1705
|
draggable: true
|
|
1633
1706
|
},
|
|
1634
|
-
/* @__PURE__ */
|
|
1707
|
+
/* @__PURE__ */ React12.createElement(import_icons5.GripVerticalIcon, { fontSize: "inherit" })
|
|
1635
1708
|
)),
|
|
1636
|
-
/* @__PURE__ */
|
|
1709
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1637
1710
|
VariableEditableCell,
|
|
1638
1711
|
{
|
|
1639
1712
|
initialValue: row.name,
|
|
@@ -1645,13 +1718,13 @@ var VariablesManagerTable = ({
|
|
|
1645
1718
|
});
|
|
1646
1719
|
}
|
|
1647
1720
|
},
|
|
1648
|
-
prefixElement: (0,
|
|
1721
|
+
prefixElement: (0, import_react11.createElement)(row.icon, { fontSize: "inherit" }),
|
|
1649
1722
|
editableElement: ({
|
|
1650
1723
|
value,
|
|
1651
1724
|
onChange,
|
|
1652
1725
|
onValidationChange,
|
|
1653
1726
|
error
|
|
1654
|
-
}) => /* @__PURE__ */
|
|
1727
|
+
}) => /* @__PURE__ */ React12.createElement(
|
|
1655
1728
|
LabelField,
|
|
1656
1729
|
{
|
|
1657
1730
|
id: "variable-label-" + row.id,
|
|
@@ -1674,7 +1747,7 @@ var VariablesManagerTable = ({
|
|
|
1674
1747
|
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1675
1748
|
fieldType: "label"
|
|
1676
1749
|
},
|
|
1677
|
-
/* @__PURE__ */
|
|
1750
|
+
/* @__PURE__ */ React12.createElement(
|
|
1678
1751
|
import_editor_ui4.EllipsisWithTooltip,
|
|
1679
1752
|
{
|
|
1680
1753
|
title: row.name,
|
|
@@ -1683,7 +1756,7 @@ var VariablesManagerTable = ({
|
|
|
1683
1756
|
row.name
|
|
1684
1757
|
)
|
|
1685
1758
|
)),
|
|
1686
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1687
1760
|
VariableEditableCell,
|
|
1688
1761
|
{
|
|
1689
1762
|
initialValue: row.value,
|
|
@@ -1715,13 +1788,13 @@ var VariablesManagerTable = ({
|
|
|
1715
1788
|
onFieldError?.(!!errorMsg);
|
|
1716
1789
|
},
|
|
1717
1790
|
error
|
|
1718
|
-
}) ?? /* @__PURE__ */
|
|
1791
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1719
1792
|
onRowRef: handleRowRef(row.id),
|
|
1720
1793
|
gap: 0.25,
|
|
1721
1794
|
fieldType: "value"
|
|
1722
1795
|
},
|
|
1723
1796
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1724
|
-
/* @__PURE__ */
|
|
1797
|
+
/* @__PURE__ */ React12.createElement(
|
|
1725
1798
|
import_editor_ui4.EllipsisWithTooltip,
|
|
1726
1799
|
{
|
|
1727
1800
|
title: row.value,
|
|
@@ -1734,7 +1807,7 @@ var VariablesManagerTable = ({
|
|
|
1734
1807
|
row.value
|
|
1735
1808
|
)
|
|
1736
1809
|
)),
|
|
1737
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ React12.createElement(
|
|
1738
1811
|
VariableTableCell,
|
|
1739
1812
|
{
|
|
1740
1813
|
align: "right",
|
|
@@ -1743,10 +1816,10 @@ var VariablesManagerTable = ({
|
|
|
1743
1816
|
maxWidth: 16,
|
|
1744
1817
|
sx: { paddingInlineEnd: 1 }
|
|
1745
1818
|
},
|
|
1746
|
-
/* @__PURE__ */
|
|
1819
|
+
/* @__PURE__ */ React12.createElement(import_ui12.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React12.createElement(
|
|
1747
1820
|
VariableEditMenu,
|
|
1748
1821
|
{
|
|
1749
|
-
menuActions,
|
|
1822
|
+
menuActions: menuActions(row.id),
|
|
1750
1823
|
disabled: isSorting,
|
|
1751
1824
|
itemId: row.id
|
|
1752
1825
|
}
|
|
@@ -1783,7 +1856,7 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1783
1856
|
function VariablesManagerPanel() {
|
|
1784
1857
|
const { close: closePanel } = usePanelActions();
|
|
1785
1858
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui5.useDialog)();
|
|
1786
|
-
const createMenuState = (0,
|
|
1859
|
+
const createMenuState = (0, import_ui13.usePopupState)({
|
|
1787
1860
|
variant: "popover"
|
|
1788
1861
|
});
|
|
1789
1862
|
const {
|
|
@@ -1794,6 +1867,8 @@ function VariablesManagerPanel() {
|
|
|
1794
1867
|
handleOnChange,
|
|
1795
1868
|
createVariable: createVariable2,
|
|
1796
1869
|
handleDeleteVariable,
|
|
1870
|
+
handleStartSync,
|
|
1871
|
+
handleStopSync,
|
|
1797
1872
|
handleSave,
|
|
1798
1873
|
isSaving,
|
|
1799
1874
|
handleSearch,
|
|
@@ -1802,8 +1877,9 @@ function VariablesManagerPanel() {
|
|
|
1802
1877
|
} = useVariablesManagerState();
|
|
1803
1878
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1804
1879
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1805
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
1806
|
-
const [
|
|
1880
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react12.useState)(null);
|
|
1881
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = (0, import_react12.useState)(null);
|
|
1882
|
+
const [serverError, setServerError] = (0, import_react12.useState)(null);
|
|
1807
1883
|
usePreventUnload(isDirty);
|
|
1808
1884
|
const handleClosePanel = () => {
|
|
1809
1885
|
if (isDirty) {
|
|
@@ -1812,7 +1888,7 @@ function VariablesManagerPanel() {
|
|
|
1812
1888
|
}
|
|
1813
1889
|
closePanel();
|
|
1814
1890
|
};
|
|
1815
|
-
const handleCreateVariable = (0,
|
|
1891
|
+
const handleCreateVariable = (0, import_react12.useCallback)(
|
|
1816
1892
|
(type, defaultName, defaultValue) => {
|
|
1817
1893
|
const newId = createVariable2(type, defaultName, defaultValue);
|
|
1818
1894
|
if (newId) {
|
|
@@ -1846,45 +1922,68 @@ function VariablesManagerPanel() {
|
|
|
1846
1922
|
setIsSaving(false);
|
|
1847
1923
|
}
|
|
1848
1924
|
};
|
|
1849
|
-
const handleDeleteVariableWithConfirmation = (0,
|
|
1925
|
+
const handleDeleteVariableWithConfirmation = (0, import_react12.useCallback)(
|
|
1850
1926
|
(itemId) => {
|
|
1851
1927
|
handleDeleteVariable(itemId);
|
|
1852
1928
|
setDeleteConfirmation(null);
|
|
1853
1929
|
},
|
|
1854
1930
|
[handleDeleteVariable]
|
|
1855
1931
|
);
|
|
1856
|
-
const
|
|
1857
|
-
{
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1932
|
+
const handleStopSyncWithConfirmation = (0, import_react12.useCallback)(
|
|
1933
|
+
(itemId) => {
|
|
1934
|
+
handleStopSync(itemId);
|
|
1935
|
+
setStopSyncConfirmation(null);
|
|
1936
|
+
},
|
|
1937
|
+
[handleStopSync]
|
|
1938
|
+
);
|
|
1939
|
+
const buildMenuActions = (0, import_react12.useCallback)(
|
|
1940
|
+
(variableId) => {
|
|
1941
|
+
const variable = variables[variableId];
|
|
1942
|
+
if (!variable) {
|
|
1943
|
+
return [];
|
|
1944
|
+
}
|
|
1945
|
+
const typeActions = getMenuActionsForVariable(variable.type, {
|
|
1946
|
+
variable,
|
|
1947
|
+
variableId,
|
|
1948
|
+
handlers: {
|
|
1949
|
+
onStartSync: handleStartSync,
|
|
1950
|
+
onStopSync: (itemId) => setStopSyncConfirmation(itemId)
|
|
1867
1951
|
}
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1952
|
+
});
|
|
1953
|
+
const deleteAction = {
|
|
1954
|
+
name: (0, import_i18n10.__)("Delete", "elementor"),
|
|
1955
|
+
icon: import_icons6.TrashIcon,
|
|
1956
|
+
color: "error.main",
|
|
1957
|
+
onClick: (itemId) => {
|
|
1958
|
+
const v = variables[itemId];
|
|
1959
|
+
if (v) {
|
|
1960
|
+
setDeleteConfirmation({ id: itemId, label: v.label });
|
|
1961
|
+
const variableTypeOptions = getVariableType(v.type);
|
|
1962
|
+
trackVariablesManagerEvent({ action: "delete", varType: variableTypeOptions?.variableType });
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
};
|
|
1966
|
+
return [...typeActions, deleteAction];
|
|
1967
|
+
},
|
|
1968
|
+
[variables, handleStartSync]
|
|
1969
|
+
);
|
|
1871
1970
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1872
|
-
return /* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ React13.createElement(import_editor_ui5.ThemeProvider, null, /* @__PURE__ */ React13.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React13.createElement(
|
|
1873
1972
|
import_editor_panels.PanelHeader,
|
|
1874
1973
|
{
|
|
1875
1974
|
sx: {
|
|
1876
1975
|
height: "unset"
|
|
1877
1976
|
}
|
|
1878
1977
|
},
|
|
1879
|
-
/* @__PURE__ */
|
|
1978
|
+
/* @__PURE__ */ React13.createElement(import_ui13.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React13.createElement(import_ui13.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React13.createElement(import_ui13.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React13.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React13.createElement(import_icons6.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n10.__)("Variables Manager", "elementor"))), /* @__PURE__ */ React13.createElement(import_ui13.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React13.createElement(
|
|
1880
1979
|
VariableManagerCreateMenu,
|
|
1881
1980
|
{
|
|
1882
1981
|
onCreate: handleCreateVariable,
|
|
1883
1982
|
variables,
|
|
1884
1983
|
menuState: createMenuState
|
|
1885
1984
|
}
|
|
1886
|
-
), /* @__PURE__ */
|
|
1887
|
-
|
|
1985
|
+
), /* @__PURE__ */ React13.createElement(
|
|
1986
|
+
import_ui13.CloseButton,
|
|
1888
1987
|
{
|
|
1889
1988
|
"aria-label": "Close",
|
|
1890
1989
|
slotProps: { icon: { fontSize: SIZE } },
|
|
@@ -1892,19 +1991,19 @@ function VariablesManagerPanel() {
|
|
|
1892
1991
|
handleClosePanel();
|
|
1893
1992
|
}
|
|
1894
1993
|
}
|
|
1895
|
-
))), /* @__PURE__ */
|
|
1994
|
+
))), /* @__PURE__ */ React13.createElement(import_ui13.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React13.createElement(
|
|
1896
1995
|
import_editor_ui5.SearchField,
|
|
1897
1996
|
{
|
|
1898
1997
|
sx: {
|
|
1899
1998
|
display: "flex",
|
|
1900
1999
|
flex: 1
|
|
1901
2000
|
},
|
|
1902
|
-
placeholder: (0,
|
|
2001
|
+
placeholder: (0, import_i18n10.__)("Search", "elementor"),
|
|
1903
2002
|
value: searchValue,
|
|
1904
2003
|
onSearch: handleSearch
|
|
1905
2004
|
}
|
|
1906
|
-
)), /* @__PURE__ */
|
|
1907
|
-
), /* @__PURE__ */
|
|
2005
|
+
)), /* @__PURE__ */ React13.createElement(import_ui13.Divider, { sx: { width: "100%" } }))
|
|
2006
|
+
), /* @__PURE__ */ React13.createElement(
|
|
1908
2007
|
import_editor_panels.PanelBody,
|
|
1909
2008
|
{
|
|
1910
2009
|
sx: {
|
|
@@ -1913,10 +2012,10 @@ function VariablesManagerPanel() {
|
|
|
1913
2012
|
height: "100%"
|
|
1914
2013
|
}
|
|
1915
2014
|
},
|
|
1916
|
-
hasVariables && /* @__PURE__ */
|
|
2015
|
+
hasVariables && /* @__PURE__ */ React13.createElement(
|
|
1917
2016
|
VariablesManagerTable,
|
|
1918
2017
|
{
|
|
1919
|
-
menuActions,
|
|
2018
|
+
menuActions: buildMenuActions,
|
|
1920
2019
|
variables,
|
|
1921
2020
|
onChange: handleOnChange,
|
|
1922
2021
|
autoEditVariableId,
|
|
@@ -1924,43 +2023,43 @@ function VariablesManagerPanel() {
|
|
|
1924
2023
|
onFieldError: setIsSaveDisabled
|
|
1925
2024
|
}
|
|
1926
2025
|
),
|
|
1927
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2026
|
+
!hasVariables && searchValue && /* @__PURE__ */ React13.createElement(
|
|
1928
2027
|
NoSearchResults,
|
|
1929
2028
|
{
|
|
1930
2029
|
searchValue,
|
|
1931
2030
|
onClear: () => handleSearch(""),
|
|
1932
|
-
icon: /* @__PURE__ */
|
|
2031
|
+
icon: /* @__PURE__ */ React13.createElement(import_icons6.ColorFilterIcon, { fontSize: "large" })
|
|
1933
2032
|
}
|
|
1934
2033
|
),
|
|
1935
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2034
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React13.createElement(
|
|
1936
2035
|
EmptyState,
|
|
1937
2036
|
{
|
|
1938
|
-
title: (0,
|
|
1939
|
-
message: (0,
|
|
2037
|
+
title: (0, import_i18n10.__)("Create your first variable", "elementor"),
|
|
2038
|
+
message: (0, import_i18n10.__)(
|
|
1940
2039
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1941
2040
|
"elementor"
|
|
1942
2041
|
),
|
|
1943
|
-
icon: /* @__PURE__ */
|
|
2042
|
+
icon: /* @__PURE__ */ React13.createElement(import_icons6.ColorFilterIcon, { fontSize: "large" }),
|
|
1944
2043
|
onAdd: createMenuState.open
|
|
1945
2044
|
}
|
|
1946
2045
|
)
|
|
1947
|
-
), /* @__PURE__ */
|
|
1948
|
-
|
|
2046
|
+
), /* @__PURE__ */ React13.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React13.createElement(
|
|
2047
|
+
import_ui13.Infotip,
|
|
1949
2048
|
{
|
|
1950
2049
|
placement: "right",
|
|
1951
2050
|
open: !!serverError,
|
|
1952
|
-
content: serverError ? /* @__PURE__ */
|
|
1953
|
-
|
|
2051
|
+
content: serverError ? /* @__PURE__ */ React13.createElement(
|
|
2052
|
+
import_ui13.Alert,
|
|
1954
2053
|
{
|
|
1955
2054
|
severity: serverError.severity ?? "error",
|
|
1956
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2055
|
+
action: serverError.action?.label ? /* @__PURE__ */ React13.createElement(import_ui13.AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
1957
2056
|
onClose: !serverError.action?.label ? () => {
|
|
1958
2057
|
setServerError(null);
|
|
1959
2058
|
setIsSaveDisabled(false);
|
|
1960
2059
|
} : void 0,
|
|
1961
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2060
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React13.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React13.createElement(import_icons6.AlertTriangleFilledIcon, null)
|
|
1962
2061
|
},
|
|
1963
|
-
/* @__PURE__ */
|
|
2062
|
+
/* @__PURE__ */ React13.createElement(import_ui13.AlertTitle, null, serverError.message),
|
|
1964
2063
|
serverError.action?.message
|
|
1965
2064
|
) : null,
|
|
1966
2065
|
arrow: false,
|
|
@@ -1975,8 +2074,8 @@ function VariablesManagerPanel() {
|
|
|
1975
2074
|
}
|
|
1976
2075
|
}
|
|
1977
2076
|
},
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
|
|
2077
|
+
/* @__PURE__ */ React13.createElement(
|
|
2078
|
+
import_ui13.Button,
|
|
1980
2079
|
{
|
|
1981
2080
|
fullWidth: true,
|
|
1982
2081
|
size: "small",
|
|
@@ -1986,9 +2085,9 @@ function VariablesManagerPanel() {
|
|
|
1986
2085
|
onClick: handleSaveClick,
|
|
1987
2086
|
loading: isSaving
|
|
1988
2087
|
},
|
|
1989
|
-
(0,
|
|
2088
|
+
(0, import_i18n10.__)("Save changes", "elementor")
|
|
1990
2089
|
)
|
|
1991
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2090
|
+
))), deleteConfirmation && /* @__PURE__ */ React13.createElement(
|
|
1992
2091
|
DeleteConfirmationDialog,
|
|
1993
2092
|
{
|
|
1994
2093
|
open: true,
|
|
@@ -1996,19 +2095,26 @@ function VariablesManagerPanel() {
|
|
|
1996
2095
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1997
2096
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1998
2097
|
}
|
|
1999
|
-
),
|
|
2098
|
+
), stopSyncConfirmation && /* @__PURE__ */ React13.createElement(
|
|
2099
|
+
StopSyncConfirmationDialog,
|
|
2100
|
+
{
|
|
2101
|
+
open: true,
|
|
2102
|
+
closeDialog: () => setStopSyncConfirmation(null),
|
|
2103
|
+
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2104
|
+
}
|
|
2105
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React13.createElement(import_editor_ui5.SaveChangesDialog, null, /* @__PURE__ */ React13.createElement(import_editor_ui5.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n10.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React13.createElement(import_editor_ui5.SaveChangesDialog.Content, null, /* @__PURE__ */ React13.createElement(import_editor_ui5.SaveChangesDialog.ContentText, null, (0, import_i18n10.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React13.createElement(
|
|
2000
2106
|
import_editor_ui5.SaveChangesDialog.Actions,
|
|
2001
2107
|
{
|
|
2002
2108
|
actions: {
|
|
2003
2109
|
discard: {
|
|
2004
|
-
label: (0,
|
|
2110
|
+
label: (0, import_i18n10.__)("Discard", "elementor"),
|
|
2005
2111
|
action: () => {
|
|
2006
2112
|
closeSaveChangesDialog();
|
|
2007
2113
|
closePanel();
|
|
2008
2114
|
}
|
|
2009
2115
|
},
|
|
2010
2116
|
confirm: {
|
|
2011
|
-
label: (0,
|
|
2117
|
+
label: (0, import_i18n10.__)("Save", "elementor"),
|
|
2012
2118
|
action: async () => {
|
|
2013
2119
|
const result = await handleSaveClick();
|
|
2014
2120
|
closeSaveChangesDialog();
|
|
@@ -2022,7 +2128,7 @@ function VariablesManagerPanel() {
|
|
|
2022
2128
|
)));
|
|
2023
2129
|
}
|
|
2024
2130
|
var usePreventUnload = (isDirty) => {
|
|
2025
|
-
(0,
|
|
2131
|
+
(0, import_react12.useEffect)(() => {
|
|
2026
2132
|
const handleBeforeUnload = (event) => {
|
|
2027
2133
|
if (isDirty) {
|
|
2028
2134
|
event.preventDefault();
|
|
@@ -2041,8 +2147,8 @@ var PANEL_ID = "variables-manager";
|
|
|
2041
2147
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2042
2148
|
function OpenPanelFromUrl() {
|
|
2043
2149
|
const { open } = usePanelActions();
|
|
2044
|
-
const hasOpened = (0,
|
|
2045
|
-
(0,
|
|
2150
|
+
const hasOpened = (0, import_react13.useRef)(false);
|
|
2151
|
+
(0, import_react13.useEffect)(() => {
|
|
2046
2152
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2047
2153
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
2048
2154
|
if (activePanel !== PANEL_ID) {
|
|
@@ -2063,15 +2169,15 @@ function OpenPanelFromUrl() {
|
|
|
2063
2169
|
}
|
|
2064
2170
|
|
|
2065
2171
|
// src/controls/variable-control.tsx
|
|
2066
|
-
var
|
|
2172
|
+
var React32 = __toESM(require("react"));
|
|
2067
2173
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
2068
2174
|
|
|
2069
2175
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2070
|
-
var
|
|
2071
|
-
var
|
|
2176
|
+
var import_react20 = require("react");
|
|
2177
|
+
var React23 = __toESM(require("react"));
|
|
2072
2178
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
2073
|
-
var
|
|
2074
|
-
var
|
|
2179
|
+
var import_icons13 = require("@elementor/icons");
|
|
2180
|
+
var import_ui23 = require("@elementor/ui");
|
|
2075
2181
|
|
|
2076
2182
|
// src/utils/unlink-variable.ts
|
|
2077
2183
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2090,31 +2196,31 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2090
2196
|
}
|
|
2091
2197
|
|
|
2092
2198
|
// src/components/variable-selection-popover.tsx
|
|
2093
|
-
var
|
|
2094
|
-
var
|
|
2199
|
+
var React21 = __toESM(require("react"));
|
|
2200
|
+
var import_react19 = require("react");
|
|
2095
2201
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2096
2202
|
|
|
2097
2203
|
// src/context/variable-selection-popover.context.tsx
|
|
2098
|
-
var
|
|
2099
|
-
var
|
|
2100
|
-
var
|
|
2101
|
-
var PopoverContentRefContext = (0,
|
|
2204
|
+
var React14 = __toESM(require("react"));
|
|
2205
|
+
var import_react14 = require("react");
|
|
2206
|
+
var import_ui14 = require("@elementor/ui");
|
|
2207
|
+
var PopoverContentRefContext = (0, import_react14.createContext)(null);
|
|
2102
2208
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2103
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
2104
|
-
return /* @__PURE__ */
|
|
2209
|
+
const [anchorRef, setAnchorRef] = (0, import_react14.useState)(null);
|
|
2210
|
+
return /* @__PURE__ */ React14.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React14.createElement(import_ui14.Box, { ref: setAnchorRef }, children));
|
|
2105
2211
|
};
|
|
2106
2212
|
var usePopoverContentRef = () => {
|
|
2107
|
-
return (0,
|
|
2213
|
+
return (0, import_react14.useContext)(PopoverContentRefContext);
|
|
2108
2214
|
};
|
|
2109
2215
|
|
|
2110
2216
|
// src/components/variable-creation.tsx
|
|
2111
|
-
var
|
|
2112
|
-
var
|
|
2217
|
+
var React16 = __toESM(require("react"));
|
|
2218
|
+
var import_react15 = require("react");
|
|
2113
2219
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
2114
2220
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2117
|
-
var
|
|
2221
|
+
var import_icons7 = require("@elementor/icons");
|
|
2222
|
+
var import_ui16 = require("@elementor/ui");
|
|
2223
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
2118
2224
|
|
|
2119
2225
|
// src/hooks/use-initial-value.ts
|
|
2120
2226
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -2157,10 +2263,10 @@ var unwrapValue = (input) => {
|
|
|
2157
2263
|
};
|
|
2158
2264
|
|
|
2159
2265
|
// src/components/ui/form-field.tsx
|
|
2160
|
-
var
|
|
2161
|
-
var
|
|
2266
|
+
var React15 = __toESM(require("react"));
|
|
2267
|
+
var import_ui15 = require("@elementor/ui");
|
|
2162
2268
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2163
|
-
return /* @__PURE__ */
|
|
2269
|
+
return /* @__PURE__ */ React15.createElement(import_ui15.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React15.createElement(import_ui15.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React15.createElement(import_ui15.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React15.createElement(import_ui15.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React15.createElement(import_ui15.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React15.createElement(import_ui15.FormHelperText, null, noticeMsg)));
|
|
2164
2270
|
};
|
|
2165
2271
|
|
|
2166
2272
|
// src/components/variable-creation.tsx
|
|
@@ -2170,11 +2276,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2170
2276
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2171
2277
|
const { propType } = (0, import_editor_controls4.useBoundProp)();
|
|
2172
2278
|
const initialValue = useInitialValue();
|
|
2173
|
-
const [value, setValue] = (0,
|
|
2174
|
-
const [label, setLabel] = (0,
|
|
2175
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2176
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2177
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2279
|
+
const [value, setValue] = (0, import_react15.useState)(initialValue);
|
|
2280
|
+
const [label, setLabel] = (0, import_react15.useState)("");
|
|
2281
|
+
const [errorMessage, setErrorMessage] = (0, import_react15.useState)("");
|
|
2282
|
+
const [valueFieldError, setValueFieldError] = (0, import_react15.useState)("");
|
|
2283
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react15.useState)(propTypeUtil.key);
|
|
2178
2284
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2179
2285
|
const resetFields = () => {
|
|
2180
2286
|
setValue("");
|
|
@@ -2231,22 +2337,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2231
2337
|
handleCreateAndTrack();
|
|
2232
2338
|
}
|
|
2233
2339
|
};
|
|
2234
|
-
return /* @__PURE__ */
|
|
2340
|
+
return /* @__PURE__ */ React16.createElement(import_editor_ui6.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React16.createElement(
|
|
2235
2341
|
import_editor_ui6.PopoverHeader,
|
|
2236
2342
|
{
|
|
2237
|
-
icon: /* @__PURE__ */
|
|
2238
|
-
title: (0,
|
|
2343
|
+
icon: /* @__PURE__ */ React16.createElement(React16.Fragment, null, onGoBack && /* @__PURE__ */ React16.createElement(import_ui16.IconButton, { size: SIZE2, "aria-label": (0, import_i18n11.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React16.createElement(import_icons7.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React16.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2344
|
+
title: (0, import_i18n11.__)("Create variable", "elementor"),
|
|
2239
2345
|
onClose: closePopover
|
|
2240
2346
|
}
|
|
2241
|
-
), /* @__PURE__ */
|
|
2347
|
+
), /* @__PURE__ */ React16.createElement(import_ui16.Divider, null), /* @__PURE__ */ React16.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React16.createElement(
|
|
2242
2348
|
FormField,
|
|
2243
2349
|
{
|
|
2244
2350
|
id: "variable-label",
|
|
2245
|
-
label: (0,
|
|
2351
|
+
label: (0, import_i18n11.__)("Name", "elementor"),
|
|
2246
2352
|
errorMsg: labelFieldError?.message,
|
|
2247
2353
|
noticeMsg: labelHint(label)
|
|
2248
2354
|
},
|
|
2249
|
-
/* @__PURE__ */
|
|
2355
|
+
/* @__PURE__ */ React16.createElement(
|
|
2250
2356
|
LabelField,
|
|
2251
2357
|
{
|
|
2252
2358
|
id: "variable-label",
|
|
@@ -2265,7 +2371,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2265
2371
|
onKeyDown: handleKeyDown
|
|
2266
2372
|
}
|
|
2267
2373
|
)
|
|
2268
|
-
), ValueField && /* @__PURE__ */
|
|
2374
|
+
), ValueField && /* @__PURE__ */ React16.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n11.__)("Value", "elementor") }, /* @__PURE__ */ React16.createElement(import_ui16.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React16.createElement(
|
|
2269
2375
|
ValueField,
|
|
2270
2376
|
{
|
|
2271
2377
|
value,
|
|
@@ -2279,8 +2385,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2279
2385
|
propType,
|
|
2280
2386
|
onKeyDown: handleKeyDown
|
|
2281
2387
|
}
|
|
2282
|
-
))), errorMessage && /* @__PURE__ */
|
|
2283
|
-
|
|
2388
|
+
))), errorMessage && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React16.createElement(import_ui16.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React16.createElement(
|
|
2389
|
+
import_ui16.Button,
|
|
2284
2390
|
{
|
|
2285
2391
|
id: "create-variable-button",
|
|
2286
2392
|
size: "small",
|
|
@@ -2288,80 +2394,80 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2288
2394
|
disabled: isSubmitDisabled,
|
|
2289
2395
|
onClick: handleCreateAndTrack
|
|
2290
2396
|
},
|
|
2291
|
-
(0,
|
|
2397
|
+
(0, import_i18n11.__)("Create", "elementor")
|
|
2292
2398
|
)));
|
|
2293
2399
|
};
|
|
2294
2400
|
|
|
2295
2401
|
// src/components/variable-edit.tsx
|
|
2296
|
-
var
|
|
2297
|
-
var
|
|
2402
|
+
var React18 = __toESM(require("react"));
|
|
2403
|
+
var import_react17 = require("react");
|
|
2298
2404
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
2299
2405
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
2300
2406
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2407
|
+
var import_icons9 = require("@elementor/icons");
|
|
2408
|
+
var import_ui18 = require("@elementor/ui");
|
|
2409
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2410
|
+
|
|
2411
|
+
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2412
|
+
var React17 = __toESM(require("react"));
|
|
2413
|
+
var import_react16 = require("react");
|
|
2301
2414
|
var import_icons8 = require("@elementor/icons");
|
|
2302
2415
|
var import_ui17 = require("@elementor/ui");
|
|
2303
2416
|
var import_i18n12 = require("@wordpress/i18n");
|
|
2304
|
-
|
|
2305
|
-
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2306
|
-
var React16 = __toESM(require("react"));
|
|
2307
|
-
var import_react15 = require("react");
|
|
2308
|
-
var import_icons7 = require("@elementor/icons");
|
|
2309
|
-
var import_ui16 = require("@elementor/ui");
|
|
2310
|
-
var import_i18n11 = require("@wordpress/i18n");
|
|
2311
2417
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2312
2418
|
var EditConfirmationDialog = ({
|
|
2313
2419
|
closeDialog,
|
|
2314
2420
|
onConfirm,
|
|
2315
2421
|
onSuppressMessage
|
|
2316
2422
|
}) => {
|
|
2317
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
2423
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react16.useState)(false);
|
|
2318
2424
|
const handleSave = () => {
|
|
2319
2425
|
if (dontShowAgain) {
|
|
2320
2426
|
onSuppressMessage?.();
|
|
2321
2427
|
}
|
|
2322
2428
|
onConfirm?.();
|
|
2323
2429
|
};
|
|
2324
|
-
return /* @__PURE__ */
|
|
2430
|
+
return /* @__PURE__ */ React17.createElement(import_ui17.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React17.createElement(import_ui17.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React17.createElement(import_icons8.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n12.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React17.createElement(import_ui17.DialogContent, null, /* @__PURE__ */ React17.createElement(import_ui17.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n12.__)(
|
|
2325
2431
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2326
2432
|
"elementor"
|
|
2327
|
-
))), /* @__PURE__ */
|
|
2328
|
-
|
|
2433
|
+
))), /* @__PURE__ */ React17.createElement(import_ui17.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React17.createElement(
|
|
2434
|
+
import_ui17.FormControlLabel,
|
|
2329
2435
|
{
|
|
2330
|
-
control: /* @__PURE__ */
|
|
2331
|
-
|
|
2436
|
+
control: /* @__PURE__ */ React17.createElement(
|
|
2437
|
+
import_ui17.Checkbox,
|
|
2332
2438
|
{
|
|
2333
2439
|
checked: dontShowAgain,
|
|
2334
2440
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2335
2441
|
size: "small"
|
|
2336
2442
|
}
|
|
2337
2443
|
),
|
|
2338
|
-
label: /* @__PURE__ */
|
|
2444
|
+
label: /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "body2" }, (0, import_i18n12.__)("Don't show me again", "elementor"))
|
|
2339
2445
|
}
|
|
2340
|
-
), /* @__PURE__ */
|
|
2446
|
+
), /* @__PURE__ */ React17.createElement("div", null, /* @__PURE__ */ React17.createElement(import_ui17.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n12.__)("Keep editing", "elementor")), /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n12.__)("Save", "elementor")))));
|
|
2341
2447
|
};
|
|
2342
2448
|
|
|
2343
2449
|
// src/components/variable-edit.tsx
|
|
2344
2450
|
var SIZE3 = "tiny";
|
|
2345
|
-
var DELETE_LABEL = (0,
|
|
2451
|
+
var DELETE_LABEL = (0, import_i18n13.__)("Delete variable", "elementor");
|
|
2346
2452
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2347
2453
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2348
2454
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2349
2455
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
2350
2456
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2351
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
2352
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
2353
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2354
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2457
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react17.useState)(false);
|
|
2458
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react17.useState)(false);
|
|
2459
|
+
const [errorMessage, setErrorMessage] = (0, import_react17.useState)("");
|
|
2460
|
+
const [valueFieldError, setValueFieldError] = (0, import_react17.useState)("");
|
|
2355
2461
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2356
2462
|
const variable = useVariable(editId);
|
|
2357
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
2463
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react17.useState)(variable?.type ?? propTypeUtil.key);
|
|
2358
2464
|
if (!variable) {
|
|
2359
2465
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2360
2466
|
}
|
|
2361
2467
|
const userPermissions = usePermissions();
|
|
2362
|
-
const [value, setValue] = (0,
|
|
2363
|
-
const [label, setLabel] = (0,
|
|
2364
|
-
(0,
|
|
2468
|
+
const [value, setValue] = (0, import_react17.useState)(() => variable.value);
|
|
2469
|
+
const [label, setLabel] = (0, import_react17.useState)(() => variable.label);
|
|
2470
|
+
(0, import_react17.useEffect)(() => {
|
|
2365
2471
|
styleVariablesRepository.update({
|
|
2366
2472
|
[editId]: {
|
|
2367
2473
|
...variable,
|
|
@@ -2423,7 +2529,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2423
2529
|
const actions = [];
|
|
2424
2530
|
if (userPermissions.canDelete()) {
|
|
2425
2531
|
actions.push(
|
|
2426
|
-
/* @__PURE__ */
|
|
2532
|
+
/* @__PURE__ */ React18.createElement(import_ui18.Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React18.createElement(import_ui18.IconButton, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React18.createElement(import_icons9.TrashIcon, { fontSize: SIZE3 })))
|
|
2427
2533
|
);
|
|
2428
2534
|
}
|
|
2429
2535
|
const hasEmptyFields = () => {
|
|
@@ -2448,31 +2554,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2448
2554
|
handleUpdate();
|
|
2449
2555
|
}
|
|
2450
2556
|
};
|
|
2451
|
-
return /* @__PURE__ */
|
|
2557
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_editor_ui7.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React18.createElement(
|
|
2452
2558
|
import_editor_ui7.PopoverHeader,
|
|
2453
2559
|
{
|
|
2454
|
-
title: (0,
|
|
2560
|
+
title: (0, import_i18n13.__)("Edit variable", "elementor"),
|
|
2455
2561
|
onClose,
|
|
2456
|
-
icon: /* @__PURE__ */
|
|
2457
|
-
|
|
2562
|
+
icon: /* @__PURE__ */ React18.createElement(React18.Fragment, null, onGoBack && /* @__PURE__ */ React18.createElement(
|
|
2563
|
+
import_ui18.IconButton,
|
|
2458
2564
|
{
|
|
2459
2565
|
size: SIZE3,
|
|
2460
|
-
"aria-label": (0,
|
|
2566
|
+
"aria-label": (0, import_i18n13.__)("Go Back", "elementor"),
|
|
2461
2567
|
onClick: onGoBack
|
|
2462
2568
|
},
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
), /* @__PURE__ */
|
|
2569
|
+
/* @__PURE__ */ React18.createElement(import_icons9.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
2570
|
+
), /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2465
2571
|
actions
|
|
2466
2572
|
}
|
|
2467
|
-
), /* @__PURE__ */
|
|
2573
|
+
), /* @__PURE__ */ React18.createElement(import_ui18.Divider, null), /* @__PURE__ */ React18.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React18.createElement(
|
|
2468
2574
|
FormField,
|
|
2469
2575
|
{
|
|
2470
2576
|
id: "variable-label",
|
|
2471
|
-
label: (0,
|
|
2577
|
+
label: (0, import_i18n13.__)("Name", "elementor"),
|
|
2472
2578
|
errorMsg: labelFieldError?.message,
|
|
2473
2579
|
noticeMsg: labelHint(label)
|
|
2474
2580
|
},
|
|
2475
|
-
/* @__PURE__ */
|
|
2581
|
+
/* @__PURE__ */ React18.createElement(
|
|
2476
2582
|
LabelField,
|
|
2477
2583
|
{
|
|
2478
2584
|
id: "variable-label",
|
|
@@ -2491,7 +2597,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2491
2597
|
onKeyDown: handleKeyDown
|
|
2492
2598
|
}
|
|
2493
2599
|
)
|
|
2494
|
-
), ValueField && /* @__PURE__ */
|
|
2600
|
+
), ValueField && /* @__PURE__ */ React18.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n13.__)("Value", "elementor") }, /* @__PURE__ */ React18.createElement(import_ui18.Typography, { variant: "h5" }, /* @__PURE__ */ React18.createElement(
|
|
2495
2601
|
ValueField,
|
|
2496
2602
|
{
|
|
2497
2603
|
propTypeKey: variable.type,
|
|
@@ -2506,7 +2612,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2506
2612
|
onValidationChange: setValueFieldError,
|
|
2507
2613
|
propType
|
|
2508
2614
|
}
|
|
2509
|
-
))), errorMessage && /* @__PURE__ */
|
|
2615
|
+
))), errorMessage && /* @__PURE__ */ React18.createElement(import_ui18.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React18.createElement(import_ui18.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React18.createElement(import_ui18.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n13.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React18.createElement(
|
|
2510
2616
|
DeleteConfirmationDialog,
|
|
2511
2617
|
{
|
|
2512
2618
|
open: true,
|
|
@@ -2514,7 +2620,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2514
2620
|
onConfirm: handleDelete,
|
|
2515
2621
|
closeDialog: closeDeleteDialog()
|
|
2516
2622
|
}
|
|
2517
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2623
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React18.createElement(
|
|
2518
2624
|
EditConfirmationDialog,
|
|
2519
2625
|
{
|
|
2520
2626
|
closeDialog: closeEditDialog(),
|
|
@@ -2525,26 +2631,26 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2525
2631
|
};
|
|
2526
2632
|
|
|
2527
2633
|
// src/components/variables-selection.tsx
|
|
2528
|
-
var
|
|
2529
|
-
var
|
|
2634
|
+
var React20 = __toESM(require("react"));
|
|
2635
|
+
var import_react18 = require("react");
|
|
2530
2636
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2531
2637
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2532
|
-
var
|
|
2533
|
-
var
|
|
2534
|
-
var
|
|
2638
|
+
var import_icons11 = require("@elementor/icons");
|
|
2639
|
+
var import_ui21 = require("@elementor/ui");
|
|
2640
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2535
2641
|
|
|
2536
2642
|
// src/components/ui/menu-item-content.tsx
|
|
2537
|
-
var
|
|
2643
|
+
var React19 = __toESM(require("react"));
|
|
2538
2644
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
2539
|
-
var
|
|
2540
|
-
var
|
|
2541
|
-
var
|
|
2645
|
+
var import_icons10 = require("@elementor/icons");
|
|
2646
|
+
var import_ui19 = require("@elementor/ui");
|
|
2647
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2542
2648
|
var SIZE4 = "tiny";
|
|
2543
|
-
var EDIT_LABEL = (0,
|
|
2649
|
+
var EDIT_LABEL = (0, import_i18n14.__)("Edit variable", "elementor");
|
|
2544
2650
|
var MenuItemContent = ({ item }) => {
|
|
2545
2651
|
const onEdit = item.onEdit;
|
|
2546
|
-
return /* @__PURE__ */
|
|
2547
|
-
|
|
2652
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui19.ListItemIcon, null, item.icon), /* @__PURE__ */ React19.createElement(
|
|
2653
|
+
import_ui19.Box,
|
|
2548
2654
|
{
|
|
2549
2655
|
sx: {
|
|
2550
2656
|
flex: 1,
|
|
@@ -2554,30 +2660,30 @@ var MenuItemContent = ({ item }) => {
|
|
|
2554
2660
|
gap: 1
|
|
2555
2661
|
}
|
|
2556
2662
|
},
|
|
2557
|
-
/* @__PURE__ */
|
|
2663
|
+
/* @__PURE__ */ React19.createElement(
|
|
2558
2664
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2559
2665
|
{
|
|
2560
2666
|
title: item.label || item.value,
|
|
2561
|
-
as:
|
|
2667
|
+
as: import_ui19.Typography,
|
|
2562
2668
|
variant: "caption",
|
|
2563
2669
|
color: "text.primary",
|
|
2564
2670
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2565
2671
|
maxWidth: "50%"
|
|
2566
2672
|
}
|
|
2567
2673
|
),
|
|
2568
|
-
item.secondaryText && /* @__PURE__ */
|
|
2674
|
+
item.secondaryText && /* @__PURE__ */ React19.createElement(
|
|
2569
2675
|
import_editor_ui8.EllipsisWithTooltip,
|
|
2570
2676
|
{
|
|
2571
2677
|
title: item.secondaryText,
|
|
2572
|
-
as:
|
|
2678
|
+
as: import_ui19.Typography,
|
|
2573
2679
|
variant: "caption",
|
|
2574
2680
|
color: "text.tertiary",
|
|
2575
2681
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2576
2682
|
maxWidth: "50%"
|
|
2577
2683
|
}
|
|
2578
2684
|
)
|
|
2579
|
-
), !!onEdit && /* @__PURE__ */
|
|
2580
|
-
|
|
2685
|
+
), !!onEdit && /* @__PURE__ */ React19.createElement(import_ui19.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2686
|
+
import_ui19.IconButton,
|
|
2581
2687
|
{
|
|
2582
2688
|
sx: { mx: 1, opacity: "0" },
|
|
2583
2689
|
onClick: (e) => {
|
|
@@ -2586,13 +2692,13 @@ var MenuItemContent = ({ item }) => {
|
|
|
2586
2692
|
},
|
|
2587
2693
|
"aria-label": EDIT_LABEL
|
|
2588
2694
|
},
|
|
2589
|
-
/* @__PURE__ */
|
|
2695
|
+
/* @__PURE__ */ React19.createElement(import_icons10.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2590
2696
|
)));
|
|
2591
2697
|
};
|
|
2592
2698
|
|
|
2593
2699
|
// src/components/ui/styled-menu-list.tsx
|
|
2594
|
-
var
|
|
2595
|
-
var VariablesStyledMenuList = (0,
|
|
2700
|
+
var import_ui20 = require("@elementor/ui");
|
|
2701
|
+
var VariablesStyledMenuList = (0, import_ui20.styled)(import_ui20.MenuList)(({ theme }) => ({
|
|
2596
2702
|
"& > li": {
|
|
2597
2703
|
height: 32,
|
|
2598
2704
|
width: "100%",
|
|
@@ -2624,12 +2730,12 @@ var VariablesStyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ t
|
|
|
2624
2730
|
|
|
2625
2731
|
// src/components/variables-selection.tsx
|
|
2626
2732
|
var SIZE5 = "tiny";
|
|
2627
|
-
var CREATE_LABEL = (0,
|
|
2628
|
-
var MANAGER_LABEL = (0,
|
|
2733
|
+
var CREATE_LABEL = (0, import_i18n15.__)("Create variable", "elementor");
|
|
2734
|
+
var MANAGER_LABEL = (0, import_i18n15.__)("Variables Manager", "elementor");
|
|
2629
2735
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2630
2736
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2631
2737
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2632
|
-
const [searchValue, setSearchValue] = (0,
|
|
2738
|
+
const [searchValue, setSearchValue] = (0, import_react18.useState)("");
|
|
2633
2739
|
const {
|
|
2634
2740
|
list: variables,
|
|
2635
2741
|
hasMatches: hasSearchResults,
|
|
@@ -2656,8 +2762,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2656
2762
|
const actions = [];
|
|
2657
2763
|
if (onAdd) {
|
|
2658
2764
|
actions.push(
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
|
|
2765
|
+
/* @__PURE__ */ React20.createElement(import_ui21.Tooltip, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React20.createElement("span", null, /* @__PURE__ */ React20.createElement(
|
|
2766
|
+
import_ui21.IconButton,
|
|
2661
2767
|
{
|
|
2662
2768
|
id: "add-variable-button",
|
|
2663
2769
|
size: SIZE5,
|
|
@@ -2665,7 +2771,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2665
2771
|
"aria-label": CREATE_LABEL,
|
|
2666
2772
|
disabled
|
|
2667
2773
|
},
|
|
2668
|
-
/* @__PURE__ */
|
|
2774
|
+
/* @__PURE__ */ React20.createElement(import_icons11.PlusIcon, { fontSize: SIZE5 })
|
|
2669
2775
|
)))
|
|
2670
2776
|
);
|
|
2671
2777
|
}
|
|
@@ -2679,24 +2785,24 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2679
2785
|
});
|
|
2680
2786
|
};
|
|
2681
2787
|
actions.push(
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
|
|
2788
|
+
/* @__PURE__ */ React20.createElement(import_ui21.Tooltip, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2789
|
+
import_ui21.IconButton,
|
|
2684
2790
|
{
|
|
2685
2791
|
id: "variables-manager-button",
|
|
2686
2792
|
size: SIZE5,
|
|
2687
2793
|
onClick: handleOpenManager,
|
|
2688
2794
|
"aria-label": MANAGER_LABEL
|
|
2689
2795
|
},
|
|
2690
|
-
/* @__PURE__ */
|
|
2796
|
+
/* @__PURE__ */ React20.createElement(import_icons11.SettingsIcon, { fontSize: SIZE5 })
|
|
2691
2797
|
))
|
|
2692
2798
|
);
|
|
2693
2799
|
}
|
|
2694
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2800
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2695
2801
|
const items = variables.map(({ value, label, key }) => ({
|
|
2696
2802
|
type: "item",
|
|
2697
2803
|
value: key,
|
|
2698
2804
|
label,
|
|
2699
|
-
icon: /* @__PURE__ */
|
|
2805
|
+
icon: /* @__PURE__ */ React20.createElement(StartIcon, { value }),
|
|
2700
2806
|
secondaryText: value,
|
|
2701
2807
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2702
2808
|
}));
|
|
@@ -2706,22 +2812,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2706
2812
|
const handleClearSearch = () => {
|
|
2707
2813
|
setSearchValue("");
|
|
2708
2814
|
};
|
|
2709
|
-
return /* @__PURE__ */
|
|
2815
|
+
return /* @__PURE__ */ React20.createElement(import_editor_ui9.SectionPopoverBody, null, /* @__PURE__ */ React20.createElement(
|
|
2710
2816
|
import_editor_ui10.PopoverHeader,
|
|
2711
2817
|
{
|
|
2712
|
-
title: (0,
|
|
2713
|
-
icon: /* @__PURE__ */
|
|
2818
|
+
title: (0, import_i18n15.__)("Variables", "elementor"),
|
|
2819
|
+
icon: /* @__PURE__ */ React20.createElement(import_icons11.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
2714
2820
|
onClose: closePopover,
|
|
2715
2821
|
actions
|
|
2716
2822
|
}
|
|
2717
|
-
), hasVariables && /* @__PURE__ */
|
|
2823
|
+
), hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2718
2824
|
import_editor_ui10.SearchField,
|
|
2719
2825
|
{
|
|
2720
2826
|
value: searchValue,
|
|
2721
2827
|
onSearch: handleSearch,
|
|
2722
|
-
placeholder: (0,
|
|
2828
|
+
placeholder: (0, import_i18n15.__)("Search", "elementor")
|
|
2723
2829
|
}
|
|
2724
|
-
), /* @__PURE__ */
|
|
2830
|
+
), /* @__PURE__ */ React20.createElement(import_ui21.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React20.createElement(
|
|
2725
2831
|
import_editor_ui10.PopoverMenuList,
|
|
2726
2832
|
{
|
|
2727
2833
|
items,
|
|
@@ -2731,55 +2837,55 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2731
2837
|
selectedValue: variable,
|
|
2732
2838
|
"data-testid": `${variableType}-variables-list`,
|
|
2733
2839
|
menuListTemplate: VariablesStyledMenuList,
|
|
2734
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2840
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React20.createElement(MenuItemContent, { item })
|
|
2735
2841
|
}
|
|
2736
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2842
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2737
2843
|
NoSearchResults,
|
|
2738
2844
|
{
|
|
2739
2845
|
searchValue,
|
|
2740
2846
|
onClear: handleClearSearch,
|
|
2741
|
-
icon: /* @__PURE__ */
|
|
2847
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" })
|
|
2742
2848
|
}
|
|
2743
|
-
), disabled && /* @__PURE__ */
|
|
2849
|
+
), disabled && /* @__PURE__ */ React20.createElement(
|
|
2744
2850
|
EmptyState,
|
|
2745
2851
|
{
|
|
2746
|
-
title: (0,
|
|
2852
|
+
title: (0, import_i18n15.sprintf)(
|
|
2747
2853
|
/* translators: %s: Variable Type. */
|
|
2748
|
-
(0,
|
|
2854
|
+
(0, import_i18n15.__)("No %s variables yet", "elementor"),
|
|
2749
2855
|
variableType
|
|
2750
2856
|
),
|
|
2751
|
-
message: (0,
|
|
2857
|
+
message: (0, import_i18n15.sprintf)(
|
|
2752
2858
|
/* translators: %s: Variable Type. */
|
|
2753
|
-
(0,
|
|
2859
|
+
(0, import_i18n15.__)("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2754
2860
|
variableType
|
|
2755
2861
|
),
|
|
2756
|
-
icon: /* @__PURE__ */
|
|
2862
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" })
|
|
2757
2863
|
},
|
|
2758
2864
|
emptyState
|
|
2759
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2865
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React20.createElement(
|
|
2760
2866
|
EmptyState,
|
|
2761
2867
|
{
|
|
2762
|
-
title: (0,
|
|
2868
|
+
title: (0, import_i18n15.sprintf)(
|
|
2763
2869
|
/* translators: %s: Variable Type. */
|
|
2764
|
-
(0,
|
|
2870
|
+
(0, import_i18n15.__)("Create your first %s variable", "elementor"),
|
|
2765
2871
|
variableType
|
|
2766
2872
|
),
|
|
2767
|
-
message: (0,
|
|
2873
|
+
message: (0, import_i18n15.__)(
|
|
2768
2874
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2769
2875
|
"elementor"
|
|
2770
2876
|
),
|
|
2771
|
-
icon: /* @__PURE__ */
|
|
2877
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" }),
|
|
2772
2878
|
onAdd
|
|
2773
2879
|
}
|
|
2774
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2880
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React20.createElement(
|
|
2775
2881
|
EmptyState,
|
|
2776
2882
|
{
|
|
2777
|
-
title: (0,
|
|
2778
|
-
message: (0,
|
|
2883
|
+
title: (0, import_i18n15.__)("No compatible variables", "elementor"),
|
|
2884
|
+
message: (0, import_i18n15.__)(
|
|
2779
2885
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2780
2886
|
"elementor"
|
|
2781
2887
|
),
|
|
2782
|
-
icon: /* @__PURE__ */
|
|
2888
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" }),
|
|
2783
2889
|
onAdd
|
|
2784
2890
|
}
|
|
2785
2891
|
));
|
|
@@ -2790,13 +2896,13 @@ var VIEW_LIST = "list";
|
|
|
2790
2896
|
var VIEW_ADD = "add";
|
|
2791
2897
|
var VIEW_EDIT = "edit";
|
|
2792
2898
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2793
|
-
const [currentView, setCurrentView] = (0,
|
|
2794
|
-
const [editId, setEditId] = (0,
|
|
2899
|
+
const [currentView, setCurrentView] = (0, import_react19.useState)(VIEW_LIST);
|
|
2900
|
+
const [editId, setEditId] = (0, import_react19.useState)("");
|
|
2795
2901
|
const { open } = usePanelActions();
|
|
2796
2902
|
const onSettingsAvailable = (0, import_editor_v1_adapters4.isExperimentActive)("e_variables_manager") ? () => {
|
|
2797
2903
|
open();
|
|
2798
2904
|
} : void 0;
|
|
2799
|
-
return /* @__PURE__ */
|
|
2905
|
+
return /* @__PURE__ */ React21.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React21.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2800
2906
|
propTypeKey,
|
|
2801
2907
|
currentView,
|
|
2802
2908
|
selectedVariable,
|
|
@@ -2843,7 +2949,7 @@ function RenderView(props) {
|
|
|
2843
2949
|
}
|
|
2844
2950
|
};
|
|
2845
2951
|
if (VIEW_LIST === props.currentView) {
|
|
2846
|
-
return /* @__PURE__ */
|
|
2952
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2847
2953
|
VariablesSelection,
|
|
2848
2954
|
{
|
|
2849
2955
|
closePopover: handlers.onClose,
|
|
@@ -2855,10 +2961,10 @@ function RenderView(props) {
|
|
|
2855
2961
|
);
|
|
2856
2962
|
}
|
|
2857
2963
|
if (VIEW_ADD === props.currentView) {
|
|
2858
|
-
return /* @__PURE__ */
|
|
2964
|
+
return /* @__PURE__ */ React21.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2859
2965
|
}
|
|
2860
2966
|
if (VIEW_EDIT === props.currentView) {
|
|
2861
|
-
return /* @__PURE__ */
|
|
2967
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2862
2968
|
VariableEdit,
|
|
2863
2969
|
{
|
|
2864
2970
|
editId: props.editId,
|
|
@@ -2872,26 +2978,26 @@ function RenderView(props) {
|
|
|
2872
2978
|
}
|
|
2873
2979
|
|
|
2874
2980
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2875
|
-
var
|
|
2876
|
-
var
|
|
2877
|
-
var
|
|
2878
|
-
var
|
|
2981
|
+
var React22 = __toESM(require("react"));
|
|
2982
|
+
var import_icons12 = require("@elementor/icons");
|
|
2983
|
+
var import_ui22 = require("@elementor/ui");
|
|
2984
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2879
2985
|
var SIZE6 = "tiny";
|
|
2880
|
-
var UNLINK_LABEL = (0,
|
|
2986
|
+
var UNLINK_LABEL = (0, import_i18n16.__)("Unlink variable", "elementor");
|
|
2881
2987
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2882
2988
|
const actions = [];
|
|
2883
2989
|
if (onUnlink) {
|
|
2884
2990
|
actions.push(
|
|
2885
|
-
/* @__PURE__ */
|
|
2991
|
+
/* @__PURE__ */ React22.createElement(import_ui22.Tooltip, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React22.createElement(import_ui22.IconButton, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React22.createElement(import_icons12.DetachIcon, { fontSize: SIZE6 })))
|
|
2886
2992
|
);
|
|
2887
2993
|
}
|
|
2888
|
-
return /* @__PURE__ */
|
|
2889
|
-
|
|
2994
|
+
return /* @__PURE__ */ React22.createElement(import_ui22.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React22.createElement(
|
|
2995
|
+
import_ui22.UnstableTag,
|
|
2890
2996
|
{
|
|
2891
2997
|
fullWidth: true,
|
|
2892
2998
|
showActionsOnHover: true,
|
|
2893
|
-
startIcon: /* @__PURE__ */
|
|
2894
|
-
label: /* @__PURE__ */
|
|
2999
|
+
startIcon: /* @__PURE__ */ React22.createElement(import_ui22.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
3000
|
+
label: /* @__PURE__ */ React22.createElement(import_ui22.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React22.createElement(import_ui22.Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
2895
3001
|
actions,
|
|
2896
3002
|
...props
|
|
2897
3003
|
}
|
|
@@ -2902,24 +3008,24 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2902
3008
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
2903
3009
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
2904
3010
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
2905
|
-
const anchorRef = (0,
|
|
2906
|
-
const popupId = (0,
|
|
2907
|
-
const popupState = (0,
|
|
3011
|
+
const anchorRef = (0, import_react20.useRef)(null);
|
|
3012
|
+
const popupId = (0, import_react20.useId)();
|
|
3013
|
+
const popupState = (0, import_ui23.usePopupState)({
|
|
2908
3014
|
variant: "popover",
|
|
2909
3015
|
popupId: `elementor-variables-list-${popupId}`
|
|
2910
3016
|
});
|
|
2911
3017
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
2912
3018
|
const StartIcon = startIcon || (() => null);
|
|
2913
|
-
return /* @__PURE__ */
|
|
3019
|
+
return /* @__PURE__ */ React23.createElement(import_ui23.Box, { ref: anchorRef }, /* @__PURE__ */ React23.createElement(
|
|
2914
3020
|
AssignedTag,
|
|
2915
3021
|
{
|
|
2916
3022
|
label: variable.label,
|
|
2917
|
-
startIcon: /* @__PURE__ */
|
|
3023
|
+
startIcon: /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(import_icons13.ColorFilterIcon, { fontSize: SIZE6 }), /* @__PURE__ */ React23.createElement(StartIcon, { value: variable.value })),
|
|
2918
3024
|
onUnlink: unlinkVariable,
|
|
2919
|
-
...(0,
|
|
3025
|
+
...(0, import_ui23.bindTrigger)(popupState)
|
|
2920
3026
|
}
|
|
2921
|
-
), /* @__PURE__ */
|
|
2922
|
-
|
|
3027
|
+
), /* @__PURE__ */ React23.createElement(
|
|
3028
|
+
import_ui23.Popover,
|
|
2923
3029
|
{
|
|
2924
3030
|
disableScrollLock: true,
|
|
2925
3031
|
anchorEl: anchorRef.current,
|
|
@@ -2928,9 +3034,9 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2928
3034
|
PaperProps: {
|
|
2929
3035
|
sx: { my: 1 }
|
|
2930
3036
|
},
|
|
2931
|
-
...(0,
|
|
3037
|
+
...(0, import_ui23.bindPopover)(popupState)
|
|
2932
3038
|
},
|
|
2933
|
-
/* @__PURE__ */
|
|
3039
|
+
/* @__PURE__ */ React23.createElement(
|
|
2934
3040
|
VariableSelectionPopover,
|
|
2935
3041
|
{
|
|
2936
3042
|
selectedVariable: variable,
|
|
@@ -2942,19 +3048,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2942
3048
|
};
|
|
2943
3049
|
|
|
2944
3050
|
// src/components/ui/variable/deleted-variable.tsx
|
|
2945
|
-
var
|
|
2946
|
-
var
|
|
3051
|
+
var React27 = __toESM(require("react"));
|
|
3052
|
+
var import_react22 = require("react");
|
|
2947
3053
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
2948
|
-
var
|
|
2949
|
-
var
|
|
3054
|
+
var import_ui27 = require("@elementor/ui");
|
|
3055
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2950
3056
|
|
|
2951
3057
|
// src/components/variable-restore.tsx
|
|
2952
|
-
var
|
|
2953
|
-
var
|
|
3058
|
+
var React24 = __toESM(require("react"));
|
|
3059
|
+
var import_react21 = require("react");
|
|
2954
3060
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
2955
3061
|
var import_editor_ui11 = require("@elementor/editor-ui");
|
|
2956
|
-
var
|
|
2957
|
-
var
|
|
3062
|
+
var import_ui24 = require("@elementor/ui");
|
|
3063
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2958
3064
|
var SIZE7 = "tiny";
|
|
2959
3065
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
2960
3066
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -2964,11 +3070,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2964
3070
|
if (!variable) {
|
|
2965
3071
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2966
3072
|
}
|
|
2967
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2968
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2969
|
-
const [label, setLabel] = (0,
|
|
2970
|
-
const [value, setValue] = (0,
|
|
2971
|
-
const [propTypeKey, setPropTypeKey] = (0,
|
|
3073
|
+
const [errorMessage, setErrorMessage] = (0, import_react21.useState)("");
|
|
3074
|
+
const [valueFieldError, setValueFieldError] = (0, import_react21.useState)("");
|
|
3075
|
+
const [label, setLabel] = (0, import_react21.useState)(variable.label);
|
|
3076
|
+
const [value, setValue] = (0, import_react21.useState)(variable.value);
|
|
3077
|
+
const [propTypeKey, setPropTypeKey] = (0, import_react21.useState)(variable?.type ?? propTypeUtil.key);
|
|
2972
3078
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
2973
3079
|
value: variable.label,
|
|
2974
3080
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3014,22 +3120,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3014
3120
|
handleRestore();
|
|
3015
3121
|
}
|
|
3016
3122
|
};
|
|
3017
|
-
return /* @__PURE__ */
|
|
3123
|
+
return /* @__PURE__ */ React24.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React24.createElement(import_editor_ui11.SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React24.createElement(
|
|
3018
3124
|
import_editor_ui11.PopoverHeader,
|
|
3019
3125
|
{
|
|
3020
|
-
icon: /* @__PURE__ */
|
|
3021
|
-
title: (0,
|
|
3126
|
+
icon: /* @__PURE__ */ React24.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3127
|
+
title: (0, import_i18n17.__)("Restore variable", "elementor"),
|
|
3022
3128
|
onClose
|
|
3023
3129
|
}
|
|
3024
|
-
), /* @__PURE__ */
|
|
3130
|
+
), /* @__PURE__ */ React24.createElement(import_ui24.Divider, null), /* @__PURE__ */ React24.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React24.createElement(
|
|
3025
3131
|
FormField,
|
|
3026
3132
|
{
|
|
3027
3133
|
id: "variable-label",
|
|
3028
|
-
label: (0,
|
|
3134
|
+
label: (0, import_i18n17.__)("Name", "elementor"),
|
|
3029
3135
|
errorMsg: labelFieldError?.message,
|
|
3030
3136
|
noticeMsg: labelHint(label)
|
|
3031
3137
|
},
|
|
3032
|
-
/* @__PURE__ */
|
|
3138
|
+
/* @__PURE__ */ React24.createElement(
|
|
3033
3139
|
LabelField,
|
|
3034
3140
|
{
|
|
3035
3141
|
id: "variable-label",
|
|
@@ -3048,7 +3154,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3048
3154
|
onKeyDown: handleKeyDown
|
|
3049
3155
|
}
|
|
3050
3156
|
)
|
|
3051
|
-
), ValueField && /* @__PURE__ */
|
|
3157
|
+
), ValueField && /* @__PURE__ */ React24.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n17.__)("Value", "elementor") }, /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "h5" }, /* @__PURE__ */ React24.createElement(
|
|
3052
3158
|
ValueField,
|
|
3053
3159
|
{
|
|
3054
3160
|
propTypeKey,
|
|
@@ -3063,25 +3169,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3063
3169
|
propType,
|
|
3064
3170
|
onKeyDown: handleKeyDown
|
|
3065
3171
|
}
|
|
3066
|
-
))), errorMessage && /* @__PURE__ */
|
|
3172
|
+
))), errorMessage && /* @__PURE__ */ React24.createElement(import_ui24.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React24.createElement(import_ui24.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React24.createElement(import_ui24.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n17.__)("Restore", "elementor")))));
|
|
3067
3173
|
};
|
|
3068
3174
|
|
|
3069
3175
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3070
|
-
var
|
|
3071
|
-
var
|
|
3072
|
-
var
|
|
3176
|
+
var React25 = __toESM(require("react"));
|
|
3177
|
+
var import_ui25 = require("@elementor/ui");
|
|
3178
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
3073
3179
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3074
|
-
return /* @__PURE__ */
|
|
3075
|
-
|
|
3180
|
+
return /* @__PURE__ */ React25.createElement(import_ui25.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React25.createElement(
|
|
3181
|
+
import_ui25.Alert,
|
|
3076
3182
|
{
|
|
3077
3183
|
variant: "standard",
|
|
3078
3184
|
severity: "warning",
|
|
3079
3185
|
onClose,
|
|
3080
|
-
action: /* @__PURE__ */
|
|
3186
|
+
action: /* @__PURE__ */ React25.createElement(React25.Fragment, null, onUnlink && /* @__PURE__ */ React25.createElement(import_ui25.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n18.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React25.createElement(import_ui25.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n18.__)("Restore", "elementor"))),
|
|
3081
3187
|
sx: { maxWidth: 300 }
|
|
3082
3188
|
},
|
|
3083
|
-
/* @__PURE__ */
|
|
3084
|
-
/* @__PURE__ */
|
|
3189
|
+
/* @__PURE__ */ React25.createElement(import_ui25.AlertTitle, null, (0, import_i18n18.__)("Deleted variable", "elementor")),
|
|
3190
|
+
/* @__PURE__ */ React25.createElement(import_ui25.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n18.__)("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React25.createElement(import_ui25.Typography, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", (0, import_i18n18.__)(
|
|
3085
3191
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3086
3192
|
"elementor"
|
|
3087
3193
|
))
|
|
@@ -3089,14 +3195,14 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3089
3195
|
};
|
|
3090
3196
|
|
|
3091
3197
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3092
|
-
var
|
|
3093
|
-
var
|
|
3094
|
-
var
|
|
3095
|
-
var WarningVariableTag =
|
|
3198
|
+
var React26 = __toESM(require("react"));
|
|
3199
|
+
var import_icons14 = require("@elementor/icons");
|
|
3200
|
+
var import_ui26 = require("@elementor/ui");
|
|
3201
|
+
var WarningVariableTag = React26.forwardRef(
|
|
3096
3202
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3097
3203
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3098
|
-
return /* @__PURE__ */
|
|
3099
|
-
|
|
3204
|
+
return /* @__PURE__ */ React26.createElement(
|
|
3205
|
+
import_ui26.Chip,
|
|
3100
3206
|
{
|
|
3101
3207
|
ref,
|
|
3102
3208
|
size: "tiny",
|
|
@@ -3104,8 +3210,8 @@ var WarningVariableTag = React25.forwardRef(
|
|
|
3104
3210
|
shape: "rounded",
|
|
3105
3211
|
variant: "standard",
|
|
3106
3212
|
onClick,
|
|
3107
|
-
icon: /* @__PURE__ */
|
|
3108
|
-
label: /* @__PURE__ */
|
|
3213
|
+
icon: /* @__PURE__ */ React26.createElement(import_icons14.AlertTriangleFilledIcon, null),
|
|
3214
|
+
label: /* @__PURE__ */ React26.createElement(import_ui26.Tooltip, { title: displayText, placement: "top" }, /* @__PURE__ */ React26.createElement(import_ui26.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React26.createElement(import_ui26.Typography, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3109
3215
|
sx: {
|
|
3110
3216
|
height: (theme) => theme.spacing(3.5),
|
|
3111
3217
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3124,12 +3230,12 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3124
3230
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3125
3231
|
const boundProp = (0, import_editor_controls8.useBoundProp)();
|
|
3126
3232
|
const userPermissions = usePermissions();
|
|
3127
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
3233
|
+
const [showInfotip, setShowInfotip] = (0, import_react22.useState)(false);
|
|
3128
3234
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3129
3235
|
const closeInfotip = () => setShowInfotip(false);
|
|
3130
|
-
const deletedChipAnchorRef = (0,
|
|
3131
|
-
const popupId = (0,
|
|
3132
|
-
const popupState = (0,
|
|
3236
|
+
const deletedChipAnchorRef = (0, import_react22.useRef)(null);
|
|
3237
|
+
const popupId = (0, import_react22.useId)();
|
|
3238
|
+
const popupState = (0, import_ui27.usePopupState)({
|
|
3133
3239
|
variant: "popover",
|
|
3134
3240
|
popupId: `elementor-variables-restore-${popupId}`
|
|
3135
3241
|
});
|
|
@@ -3155,15 +3261,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3155
3261
|
const handleRestoreWithOverrides = () => {
|
|
3156
3262
|
popupState.close();
|
|
3157
3263
|
};
|
|
3158
|
-
return /* @__PURE__ */
|
|
3159
|
-
|
|
3264
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(import_ui27.Box, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React27.createElement(import_ui27.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React27.createElement(
|
|
3265
|
+
import_ui27.Infotip,
|
|
3160
3266
|
{
|
|
3161
3267
|
color: "warning",
|
|
3162
3268
|
placement: "right-start",
|
|
3163
3269
|
open: showInfotip,
|
|
3164
3270
|
disableHoverListener: true,
|
|
3165
3271
|
onClose: closeInfotip,
|
|
3166
|
-
content: /* @__PURE__ */
|
|
3272
|
+
content: /* @__PURE__ */ React27.createElement(
|
|
3167
3273
|
DeletedVariableAlert,
|
|
3168
3274
|
{
|
|
3169
3275
|
onClose: closeInfotip,
|
|
@@ -3183,16 +3289,16 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3183
3289
|
}
|
|
3184
3290
|
}
|
|
3185
3291
|
},
|
|
3186
|
-
/* @__PURE__ */
|
|
3292
|
+
/* @__PURE__ */ React27.createElement(
|
|
3187
3293
|
WarningVariableTag,
|
|
3188
3294
|
{
|
|
3189
3295
|
label: variable.label,
|
|
3190
3296
|
onClick: toggleInfotip,
|
|
3191
|
-
suffix: (0,
|
|
3297
|
+
suffix: (0, import_i18n19.__)("deleted", "elementor")
|
|
3192
3298
|
}
|
|
3193
3299
|
)
|
|
3194
|
-
), /* @__PURE__ */
|
|
3195
|
-
|
|
3300
|
+
), /* @__PURE__ */ React27.createElement(
|
|
3301
|
+
import_ui27.Popover,
|
|
3196
3302
|
{
|
|
3197
3303
|
disableScrollLock: true,
|
|
3198
3304
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -3200,9 +3306,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3200
3306
|
PaperProps: {
|
|
3201
3307
|
sx: { my: 1 }
|
|
3202
3308
|
},
|
|
3203
|
-
...(0,
|
|
3309
|
+
...(0, import_ui27.bindPopover)(popupState)
|
|
3204
3310
|
},
|
|
3205
|
-
/* @__PURE__ */
|
|
3311
|
+
/* @__PURE__ */ React27.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React27.createElement(
|
|
3206
3312
|
VariableRestore,
|
|
3207
3313
|
{
|
|
3208
3314
|
variableId: variable.key ?? "",
|
|
@@ -3214,52 +3320,52 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3214
3320
|
};
|
|
3215
3321
|
|
|
3216
3322
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3217
|
-
var
|
|
3218
|
-
var
|
|
3323
|
+
var React29 = __toESM(require("react"));
|
|
3324
|
+
var import_react23 = require("react");
|
|
3219
3325
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
3220
|
-
var
|
|
3221
|
-
var
|
|
3326
|
+
var import_ui29 = require("@elementor/ui");
|
|
3327
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
3222
3328
|
|
|
3223
3329
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3224
|
-
var
|
|
3225
|
-
var
|
|
3226
|
-
var
|
|
3330
|
+
var React28 = __toESM(require("react"));
|
|
3331
|
+
var import_ui28 = require("@elementor/ui");
|
|
3332
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
3227
3333
|
var i18n = {
|
|
3228
|
-
title: (0,
|
|
3229
|
-
message: (0,
|
|
3334
|
+
title: (0, import_i18n20.__)("Variable has changed", "elementor"),
|
|
3335
|
+
message: (0, import_i18n20.__)(
|
|
3230
3336
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3231
3337
|
"elementor"
|
|
3232
3338
|
),
|
|
3233
3339
|
buttons: {
|
|
3234
|
-
clear: (0,
|
|
3235
|
-
select: (0,
|
|
3340
|
+
clear: (0, import_i18n20.__)("Clear", "elementor"),
|
|
3341
|
+
select: (0, import_i18n20.__)("Select variable", "elementor")
|
|
3236
3342
|
}
|
|
3237
3343
|
};
|
|
3238
3344
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3239
|
-
return /* @__PURE__ */
|
|
3240
|
-
|
|
3345
|
+
return /* @__PURE__ */ React28.createElement(import_ui28.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React28.createElement(
|
|
3346
|
+
import_ui28.Alert,
|
|
3241
3347
|
{
|
|
3242
3348
|
variant: "standard",
|
|
3243
3349
|
severity: "warning",
|
|
3244
3350
|
onClose,
|
|
3245
|
-
action: /* @__PURE__ */
|
|
3351
|
+
action: /* @__PURE__ */ React28.createElement(React28.Fragment, null, onClear && /* @__PURE__ */ React28.createElement(import_ui28.AlertAction, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React28.createElement(import_ui28.AlertAction, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3246
3352
|
sx: { maxWidth: 300 }
|
|
3247
3353
|
},
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
/* @__PURE__ */
|
|
3354
|
+
/* @__PURE__ */ React28.createElement(import_ui28.AlertTitle, null, i18n.title),
|
|
3355
|
+
/* @__PURE__ */ React28.createElement(import_ui28.Typography, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3250
3356
|
));
|
|
3251
3357
|
};
|
|
3252
3358
|
|
|
3253
3359
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3254
3360
|
var MismatchVariable = ({ variable }) => {
|
|
3255
3361
|
const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
|
|
3256
|
-
const anchorRef = (0,
|
|
3257
|
-
const popupId = (0,
|
|
3258
|
-
const popupState = (0,
|
|
3362
|
+
const anchorRef = (0, import_react23.useRef)(null);
|
|
3363
|
+
const popupId = (0, import_react23.useId)();
|
|
3364
|
+
const popupState = (0, import_ui29.usePopupState)({
|
|
3259
3365
|
variant: "popover",
|
|
3260
3366
|
popupId: `elementor-variables-list-${popupId}`
|
|
3261
3367
|
});
|
|
3262
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3368
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react23.useState)(false);
|
|
3263
3369
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3264
3370
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3265
3371
|
const triggerSelect = () => {
|
|
@@ -3272,15 +3378,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3272
3378
|
setValue(null);
|
|
3273
3379
|
};
|
|
3274
3380
|
const showClearButton = !!value;
|
|
3275
|
-
return /* @__PURE__ */
|
|
3276
|
-
|
|
3381
|
+
return /* @__PURE__ */ React29.createElement(import_ui29.Box, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React29.createElement(import_ui29.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React29.createElement(
|
|
3382
|
+
import_ui29.Infotip,
|
|
3277
3383
|
{
|
|
3278
3384
|
color: "warning",
|
|
3279
3385
|
placement: "right-start",
|
|
3280
3386
|
open: infotipVisible,
|
|
3281
3387
|
disableHoverListener: true,
|
|
3282
3388
|
onClose: closeInfotip,
|
|
3283
|
-
content: /* @__PURE__ */
|
|
3389
|
+
content: /* @__PURE__ */ React29.createElement(
|
|
3284
3390
|
MismatchVariableAlert,
|
|
3285
3391
|
{
|
|
3286
3392
|
onClose: closeInfotip,
|
|
@@ -3299,16 +3405,16 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3299
3405
|
}
|
|
3300
3406
|
}
|
|
3301
3407
|
},
|
|
3302
|
-
/* @__PURE__ */
|
|
3408
|
+
/* @__PURE__ */ React29.createElement(
|
|
3303
3409
|
WarningVariableTag,
|
|
3304
3410
|
{
|
|
3305
3411
|
label: variable.label,
|
|
3306
3412
|
onClick: toggleInfotip,
|
|
3307
|
-
suffix: (0,
|
|
3413
|
+
suffix: (0, import_i18n21.__)("changed", "elementor")
|
|
3308
3414
|
}
|
|
3309
3415
|
)
|
|
3310
|
-
), /* @__PURE__ */
|
|
3311
|
-
|
|
3416
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3417
|
+
import_ui29.Popover,
|
|
3312
3418
|
{
|
|
3313
3419
|
disableScrollLock: true,
|
|
3314
3420
|
anchorEl: anchorRef.current,
|
|
@@ -3317,9 +3423,9 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3317
3423
|
PaperProps: {
|
|
3318
3424
|
sx: { my: 1 }
|
|
3319
3425
|
},
|
|
3320
|
-
...(0,
|
|
3426
|
+
...(0, import_ui29.bindPopover)(popupState)
|
|
3321
3427
|
},
|
|
3322
|
-
/* @__PURE__ */
|
|
3428
|
+
/* @__PURE__ */ React29.createElement(
|
|
3323
3429
|
VariableSelectionPopover,
|
|
3324
3430
|
{
|
|
3325
3431
|
selectedVariable: variable,
|
|
@@ -3331,28 +3437,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3331
3437
|
};
|
|
3332
3438
|
|
|
3333
3439
|
// src/components/ui/variable/missing-variable.tsx
|
|
3334
|
-
var
|
|
3335
|
-
var
|
|
3440
|
+
var React31 = __toESM(require("react"));
|
|
3441
|
+
var import_react24 = require("react");
|
|
3336
3442
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
3337
|
-
var
|
|
3338
|
-
var
|
|
3443
|
+
var import_ui31 = require("@elementor/ui");
|
|
3444
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
3339
3445
|
|
|
3340
3446
|
// src/components/ui/missing-variable-alert.tsx
|
|
3341
|
-
var
|
|
3342
|
-
var
|
|
3343
|
-
var
|
|
3447
|
+
var React30 = __toESM(require("react"));
|
|
3448
|
+
var import_ui30 = require("@elementor/ui");
|
|
3449
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
3344
3450
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3345
|
-
return /* @__PURE__ */
|
|
3346
|
-
|
|
3451
|
+
return /* @__PURE__ */ React30.createElement(import_ui30.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React30.createElement(
|
|
3452
|
+
import_ui30.Alert,
|
|
3347
3453
|
{
|
|
3348
3454
|
variant: "standard",
|
|
3349
3455
|
severity: "warning",
|
|
3350
3456
|
onClose,
|
|
3351
|
-
action: /* @__PURE__ */
|
|
3457
|
+
action: /* @__PURE__ */ React30.createElement(React30.Fragment, null, onClear && /* @__PURE__ */ React30.createElement(import_ui30.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n22.__)("Clear", "elementor"))),
|
|
3352
3458
|
sx: { maxWidth: 300 }
|
|
3353
3459
|
},
|
|
3354
|
-
/* @__PURE__ */
|
|
3355
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ React30.createElement(import_ui30.AlertTitle, null, (0, import_i18n22.__)("This variable is missing", "elementor")),
|
|
3461
|
+
/* @__PURE__ */ React30.createElement(import_ui30.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n22.__)(
|
|
3356
3462
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3357
3463
|
"elementor"
|
|
3358
3464
|
))
|
|
@@ -3362,19 +3468,19 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3362
3468
|
// src/components/ui/variable/missing-variable.tsx
|
|
3363
3469
|
var MissingVariable = () => {
|
|
3364
3470
|
const { setValue } = (0, import_editor_controls10.useBoundProp)();
|
|
3365
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
3471
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react24.useState)(false);
|
|
3366
3472
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3367
3473
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3368
3474
|
const clearValue = () => setValue(null);
|
|
3369
|
-
return /* @__PURE__ */
|
|
3370
|
-
|
|
3475
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, infotipVisible && /* @__PURE__ */ React31.createElement(import_ui31.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React31.createElement(
|
|
3476
|
+
import_ui31.Infotip,
|
|
3371
3477
|
{
|
|
3372
3478
|
color: "warning",
|
|
3373
3479
|
placement: "right-start",
|
|
3374
3480
|
open: infotipVisible,
|
|
3375
3481
|
disableHoverListener: true,
|
|
3376
3482
|
onClose: closeInfotip,
|
|
3377
|
-
content: /* @__PURE__ */
|
|
3483
|
+
content: /* @__PURE__ */ React31.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3378
3484
|
slotProps: {
|
|
3379
3485
|
popper: {
|
|
3380
3486
|
modifiers: [
|
|
@@ -3386,7 +3492,7 @@ var MissingVariable = () => {
|
|
|
3386
3492
|
}
|
|
3387
3493
|
}
|
|
3388
3494
|
},
|
|
3389
|
-
/* @__PURE__ */
|
|
3495
|
+
/* @__PURE__ */ React31.createElement(WarningVariableTag, { label: (0, import_i18n23.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3390
3496
|
));
|
|
3391
3497
|
};
|
|
3392
3498
|
|
|
@@ -3396,37 +3502,37 @@ var VariableControl = () => {
|
|
|
3396
3502
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3397
3503
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3398
3504
|
if (!assignedVariable) {
|
|
3399
|
-
return /* @__PURE__ */
|
|
3505
|
+
return /* @__PURE__ */ React32.createElement(MissingVariable, null);
|
|
3400
3506
|
}
|
|
3401
3507
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3402
3508
|
if (assignedVariable?.deleted) {
|
|
3403
|
-
return /* @__PURE__ */
|
|
3509
|
+
return /* @__PURE__ */ React32.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3404
3510
|
}
|
|
3405
3511
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3406
3512
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3407
|
-
return /* @__PURE__ */
|
|
3513
|
+
return /* @__PURE__ */ React32.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3408
3514
|
}
|
|
3409
|
-
return /* @__PURE__ */
|
|
3515
|
+
return /* @__PURE__ */ React32.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3410
3516
|
};
|
|
3411
3517
|
|
|
3412
3518
|
// src/hooks/use-prop-variable-action.tsx
|
|
3413
|
-
var
|
|
3519
|
+
var React33 = __toESM(require("react"));
|
|
3414
3520
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
3415
|
-
var
|
|
3416
|
-
var
|
|
3521
|
+
var import_icons15 = require("@elementor/icons");
|
|
3522
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
3417
3523
|
var usePropVariableAction = () => {
|
|
3418
3524
|
const { propType, path } = (0, import_editor_controls12.useBoundProp)();
|
|
3419
3525
|
const variable = resolveVariableFromPropType(propType);
|
|
3420
3526
|
return {
|
|
3421
3527
|
visible: Boolean(variable),
|
|
3422
|
-
icon:
|
|
3423
|
-
title: (0,
|
|
3528
|
+
icon: import_icons15.ColorFilterIcon,
|
|
3529
|
+
title: (0, import_i18n24.__)("Variables", "elementor"),
|
|
3424
3530
|
content: ({ close: closePopover }) => {
|
|
3425
3531
|
if (!variable) {
|
|
3426
3532
|
return null;
|
|
3427
3533
|
}
|
|
3428
3534
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3429
|
-
return /* @__PURE__ */
|
|
3535
|
+
return /* @__PURE__ */ React33.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3430
3536
|
}
|
|
3431
3537
|
};
|
|
3432
3538
|
};
|
|
@@ -3567,19 +3673,21 @@ function initMcp() {
|
|
|
3567
3673
|
}
|
|
3568
3674
|
|
|
3569
3675
|
// src/register-variable-types.tsx
|
|
3570
|
-
var
|
|
3676
|
+
var React36 = __toESM(require("react"));
|
|
3571
3677
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
3572
3678
|
var import_editor_ui13 = require("@elementor/editor-ui");
|
|
3573
|
-
var
|
|
3679
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3680
|
+
var import_icons17 = require("@elementor/icons");
|
|
3681
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
3574
3682
|
|
|
3575
3683
|
// src/components/fields/color-field.tsx
|
|
3576
|
-
var
|
|
3577
|
-
var
|
|
3578
|
-
var
|
|
3684
|
+
var React34 = __toESM(require("react"));
|
|
3685
|
+
var import_react25 = require("react");
|
|
3686
|
+
var import_ui32 = require("@elementor/ui");
|
|
3579
3687
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3580
|
-
const [color, setColor] = (0,
|
|
3581
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3582
|
-
const defaultRef = (0,
|
|
3688
|
+
const [color, setColor] = (0, import_react25.useState)(value);
|
|
3689
|
+
const [errorMessage, setErrorMessage] = (0, import_react25.useState)("");
|
|
3690
|
+
const defaultRef = (0, import_react25.useRef)(null);
|
|
3583
3691
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3584
3692
|
const handleChange = (newValue) => {
|
|
3585
3693
|
setColor(newValue);
|
|
@@ -3588,8 +3696,8 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3588
3696
|
onValidationChange?.(errorMsg);
|
|
3589
3697
|
onChange(errorMsg ? "" : newValue);
|
|
3590
3698
|
};
|
|
3591
|
-
return /* @__PURE__ */
|
|
3592
|
-
|
|
3699
|
+
return /* @__PURE__ */ React34.createElement(
|
|
3700
|
+
import_ui32.UnstableColorField,
|
|
3593
3701
|
{
|
|
3594
3702
|
id: "color-variable-field",
|
|
3595
3703
|
size: "tiny",
|
|
@@ -3617,21 +3725,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3617
3725
|
};
|
|
3618
3726
|
|
|
3619
3727
|
// src/components/fields/font-field.tsx
|
|
3620
|
-
var
|
|
3621
|
-
var
|
|
3728
|
+
var React35 = __toESM(require("react"));
|
|
3729
|
+
var import_react26 = require("react");
|
|
3622
3730
|
var import_editor_controls13 = require("@elementor/editor-controls");
|
|
3623
3731
|
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
3624
|
-
var
|
|
3625
|
-
var
|
|
3626
|
-
var
|
|
3732
|
+
var import_icons16 = require("@elementor/icons");
|
|
3733
|
+
var import_ui33 = require("@elementor/ui");
|
|
3734
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
3627
3735
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3628
|
-
const [fontFamily, setFontFamily] = (0,
|
|
3629
|
-
const defaultRef = (0,
|
|
3736
|
+
const [fontFamily, setFontFamily] = (0, import_react26.useState)(value);
|
|
3737
|
+
const defaultRef = (0, import_react26.useRef)(null);
|
|
3630
3738
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3631
|
-
const fontPopoverState = (0,
|
|
3739
|
+
const fontPopoverState = (0, import_ui33.usePopupState)({ variant: "popover" });
|
|
3632
3740
|
const fontFamilies = (0, import_editor_controls13.useFontFamilies)();
|
|
3633
3741
|
const sectionWidth = (0, import_editor_ui12.useSectionWidth)();
|
|
3634
|
-
const mapFontSubs =
|
|
3742
|
+
const mapFontSubs = React35.useMemo(() => {
|
|
3635
3743
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3636
3744
|
label,
|
|
3637
3745
|
items: fonts
|
|
@@ -3647,28 +3755,28 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3647
3755
|
handleChange(newFontFamily);
|
|
3648
3756
|
fontPopoverState.close();
|
|
3649
3757
|
};
|
|
3650
|
-
const id2 = (0,
|
|
3651
|
-
return /* @__PURE__ */
|
|
3652
|
-
|
|
3758
|
+
const id2 = (0, import_react26.useId)();
|
|
3759
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, /* @__PURE__ */ React35.createElement(
|
|
3760
|
+
import_ui33.UnstableTag,
|
|
3653
3761
|
{
|
|
3654
3762
|
id: id2,
|
|
3655
3763
|
variant: "outlined",
|
|
3656
3764
|
label: fontFamily,
|
|
3657
|
-
endIcon: /* @__PURE__ */
|
|
3658
|
-
...(0,
|
|
3765
|
+
endIcon: /* @__PURE__ */ React35.createElement(import_icons16.ChevronDownIcon, { fontSize: "tiny" }),
|
|
3766
|
+
...(0, import_ui33.bindTrigger)(fontPopoverState),
|
|
3659
3767
|
fullWidth: true
|
|
3660
3768
|
}
|
|
3661
|
-
), /* @__PURE__ */
|
|
3662
|
-
|
|
3769
|
+
), /* @__PURE__ */ React35.createElement(
|
|
3770
|
+
import_ui33.Popover,
|
|
3663
3771
|
{
|
|
3664
3772
|
disablePortal: true,
|
|
3665
3773
|
disableScrollLock: true,
|
|
3666
3774
|
anchorEl: anchorRef,
|
|
3667
3775
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
3668
3776
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3669
|
-
...(0,
|
|
3777
|
+
...(0, import_ui33.bindPopover)(fontPopoverState)
|
|
3670
3778
|
},
|
|
3671
|
-
/* @__PURE__ */
|
|
3779
|
+
/* @__PURE__ */ React35.createElement(
|
|
3672
3780
|
import_editor_controls13.ItemSelector,
|
|
3673
3781
|
{
|
|
3674
3782
|
id: "font-family-variables-selector",
|
|
@@ -3677,10 +3785,10 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3677
3785
|
onItemChange: handleFontFamilyChange,
|
|
3678
3786
|
onClose: fontPopoverState.close,
|
|
3679
3787
|
sectionWidth,
|
|
3680
|
-
title: (0,
|
|
3788
|
+
title: (0, import_i18n25.__)("Font family", "elementor"),
|
|
3681
3789
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3682
3790
|
onDebounce: import_editor_controls13.enqueueFont,
|
|
3683
|
-
icon:
|
|
3791
|
+
icon: import_icons16.TextIcon
|
|
3684
3792
|
}
|
|
3685
3793
|
)
|
|
3686
3794
|
));
|
|
@@ -3702,17 +3810,39 @@ function registerVariableTypes() {
|
|
|
3702
3810
|
registerVariableType({
|
|
3703
3811
|
key: colorVariablePropTypeUtil.key,
|
|
3704
3812
|
valueField: ColorField,
|
|
3705
|
-
icon:
|
|
3813
|
+
icon: import_icons17.BrushIcon,
|
|
3706
3814
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3707
3815
|
fallbackPropTypeUtil: import_editor_props5.colorPropTypeUtil,
|
|
3708
3816
|
variableType: "color",
|
|
3709
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3710
|
-
defaultValue: "#ffffff"
|
|
3817
|
+
startIcon: ({ value }) => /* @__PURE__ */ React36.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3818
|
+
defaultValue: "#ffffff",
|
|
3819
|
+
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3820
|
+
const actions = [];
|
|
3821
|
+
if (!(0, import_editor_v1_adapters5.isExperimentActive)("e_design_system_sync")) {
|
|
3822
|
+
return [];
|
|
3823
|
+
}
|
|
3824
|
+
if (variable.sync_to_v3) {
|
|
3825
|
+
actions.push({
|
|
3826
|
+
name: (0, import_i18n26.__)("Stop syncing to Version 3", "elementor"),
|
|
3827
|
+
icon: import_icons17.ResetIcon,
|
|
3828
|
+
color: "text.primary",
|
|
3829
|
+
onClick: () => handlers.onStopSync(variableId)
|
|
3830
|
+
});
|
|
3831
|
+
} else {
|
|
3832
|
+
actions.push({
|
|
3833
|
+
name: (0, import_i18n26.__)("Sync to Version 3", "elementor"),
|
|
3834
|
+
icon: import_icons17.ResetIcon,
|
|
3835
|
+
color: "text.primary",
|
|
3836
|
+
onClick: () => handlers.onStartSync(variableId)
|
|
3837
|
+
});
|
|
3838
|
+
}
|
|
3839
|
+
return actions;
|
|
3840
|
+
}
|
|
3711
3841
|
});
|
|
3712
3842
|
registerVariableType({
|
|
3713
3843
|
key: fontVariablePropTypeUtil.key,
|
|
3714
3844
|
valueField: FontField,
|
|
3715
|
-
icon:
|
|
3845
|
+
icon: import_icons17.TextIcon,
|
|
3716
3846
|
propTypeUtil: fontVariablePropTypeUtil,
|
|
3717
3847
|
fallbackPropTypeUtil: import_editor_props5.stringPropTypeUtil,
|
|
3718
3848
|
variableType: "font",
|
|
@@ -3720,13 +3850,13 @@ function registerVariableTypes() {
|
|
|
3720
3850
|
});
|
|
3721
3851
|
const sizePromotions = {
|
|
3722
3852
|
isActive: false,
|
|
3723
|
-
icon:
|
|
3853
|
+
icon: import_icons17.ExpandDiagonalIcon,
|
|
3724
3854
|
propTypeUtil: sizeVariablePropTypeUtil,
|
|
3725
3855
|
fallbackPropTypeUtil: import_editor_props5.sizePropTypeUtil,
|
|
3726
3856
|
styleTransformer: EmptyTransformer,
|
|
3727
3857
|
variableType: "size",
|
|
3728
3858
|
selectionFilter: () => [],
|
|
3729
|
-
emptyState: /* @__PURE__ */
|
|
3859
|
+
emptyState: /* @__PURE__ */ React36.createElement(import_editor_ui13.CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3730
3860
|
};
|
|
3731
3861
|
registerVariableType({
|
|
3732
3862
|
...sizePromotions,
|
|
@@ -3740,10 +3870,10 @@ function registerVariableTypes() {
|
|
|
3740
3870
|
}
|
|
3741
3871
|
|
|
3742
3872
|
// src/renderers/style-variables-renderer.tsx
|
|
3743
|
-
var
|
|
3744
|
-
var
|
|
3745
|
-
var
|
|
3746
|
-
var
|
|
3873
|
+
var React37 = __toESM(require("react"));
|
|
3874
|
+
var import_react27 = require("react");
|
|
3875
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3876
|
+
var import_ui34 = require("@elementor/ui");
|
|
3747
3877
|
var VARIABLES_WRAPPER = "body";
|
|
3748
3878
|
function StyleVariablesRenderer() {
|
|
3749
3879
|
const container = usePortalContainer();
|
|
@@ -3754,14 +3884,14 @@ function StyleVariablesRenderer() {
|
|
|
3754
3884
|
}
|
|
3755
3885
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3756
3886
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3757
|
-
return /* @__PURE__ */
|
|
3887
|
+
return /* @__PURE__ */ React37.createElement(import_ui34.Portal, { container }, /* @__PURE__ */ React37.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3758
3888
|
}
|
|
3759
3889
|
function usePortalContainer() {
|
|
3760
|
-
return (0,
|
|
3890
|
+
return (0, import_editor_v1_adapters6.__privateUseListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters6.getCanvasIframeDocument)()?.head);
|
|
3761
3891
|
}
|
|
3762
3892
|
function useStyleVariables() {
|
|
3763
|
-
const [variables, setVariables] = (0,
|
|
3764
|
-
(0,
|
|
3893
|
+
const [variables, setVariables] = (0, import_react27.useState)({});
|
|
3894
|
+
(0, import_react27.useEffect)(() => {
|
|
3765
3895
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3766
3896
|
return () => {
|
|
3767
3897
|
unsubscribe();
|
|
@@ -3784,22 +3914,22 @@ var import_editor_controls14 = require("@elementor/editor-controls");
|
|
|
3784
3914
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
3785
3915
|
|
|
3786
3916
|
// src/components/variables-repeater-item-slot.tsx
|
|
3787
|
-
var
|
|
3917
|
+
var React38 = __toESM(require("react"));
|
|
3788
3918
|
var useColorVariable = (value) => {
|
|
3789
3919
|
const variableId = value?.value?.color?.value;
|
|
3790
3920
|
return useVariable(variableId || "");
|
|
3791
3921
|
};
|
|
3792
3922
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3793
3923
|
const colorVariable = useColorVariable(value);
|
|
3794
|
-
return /* @__PURE__ */
|
|
3924
|
+
return /* @__PURE__ */ React38.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3795
3925
|
};
|
|
3796
3926
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3797
3927
|
const colorVariable = useColorVariable(value);
|
|
3798
|
-
return /* @__PURE__ */
|
|
3928
|
+
return /* @__PURE__ */ React38.createElement("span", null, colorVariable?.label);
|
|
3799
3929
|
};
|
|
3800
3930
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3801
3931
|
const colorVariable = useColorVariable(value);
|
|
3802
|
-
return /* @__PURE__ */
|
|
3932
|
+
return /* @__PURE__ */ React38.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3803
3933
|
};
|
|
3804
3934
|
|
|
3805
3935
|
// src/repeater-injections.ts
|
|
@@ -3893,6 +4023,7 @@ var Utils = {
|
|
|
3893
4023
|
0 && (module.exports = {
|
|
3894
4024
|
GLOBAL_VARIABLES_URI,
|
|
3895
4025
|
Utils,
|
|
4026
|
+
getMenuActionsForVariable,
|
|
3896
4027
|
hasVariable,
|
|
3897
4028
|
init,
|
|
3898
4029
|
registerVariableType,
|