@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.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import { useEffect as useEffect4, useRef as useRef6 } from "react";
|
|
|
10
10
|
import { __privateListenTo as listenTo, routeOpenEvent } from "@elementor/editor-v1-adapters";
|
|
11
11
|
|
|
12
12
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
13
|
-
import * as
|
|
14
|
-
import { useCallback as useCallback5, useEffect as useEffect3, useState as
|
|
13
|
+
import * as React13 from "react";
|
|
14
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState7 } from "react";
|
|
15
15
|
import {
|
|
16
16
|
__createPanel as createPanel,
|
|
17
17
|
Panel,
|
|
@@ -27,14 +27,14 @@ import {
|
|
|
27
27
|
Alert,
|
|
28
28
|
AlertAction,
|
|
29
29
|
AlertTitle,
|
|
30
|
-
Button as
|
|
30
|
+
Button as Button3,
|
|
31
31
|
CloseButton,
|
|
32
32
|
Divider,
|
|
33
33
|
Infotip,
|
|
34
34
|
Stack as Stack6,
|
|
35
35
|
usePopupState as usePopupState2
|
|
36
36
|
} from "@elementor/ui";
|
|
37
|
-
import { __ as
|
|
37
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
38
38
|
|
|
39
39
|
// src/utils/tracking.ts
|
|
40
40
|
import { getMixpanel } from "@elementor/mixpanel";
|
|
@@ -261,6 +261,7 @@ var buildOperationsArray = (originalVariables, currentVariables) => {
|
|
|
261
261
|
});
|
|
262
262
|
} else if (originalVariables[id2]) {
|
|
263
263
|
const original = originalVariables[id2];
|
|
264
|
+
const syncChanged = original.sync_to_v3 !== variable.sync_to_v3;
|
|
264
265
|
if (original.deleted && !variable.deleted) {
|
|
265
266
|
operations.push({
|
|
266
267
|
type: "restore",
|
|
@@ -268,14 +269,15 @@ var buildOperationsArray = (originalVariables, currentVariables) => {
|
|
|
268
269
|
...original.label !== variable.label && { label: variable.label },
|
|
269
270
|
...original.value !== variable.value && { value: variable.value }
|
|
270
271
|
});
|
|
271
|
-
} else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value || original.order !== variable.order)) {
|
|
272
|
+
} else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value || original.order !== variable.order || syncChanged)) {
|
|
272
273
|
operations.push({
|
|
273
274
|
type: "update",
|
|
274
275
|
id: id2,
|
|
275
276
|
variable: {
|
|
276
277
|
...original.label !== variable.label && { label: variable.label },
|
|
277
278
|
...original.value !== variable.value && { value: variable.value },
|
|
278
|
-
...original.order !== variable.order && { order: variable.order }
|
|
279
|
+
...original.order !== variable.order && { order: variable.order },
|
|
280
|
+
...syncChanged && { sync_to_v3: variable.sync_to_v3 }
|
|
279
281
|
}
|
|
280
282
|
});
|
|
281
283
|
}
|
|
@@ -668,7 +670,8 @@ function createVariableTypeRegistry() {
|
|
|
668
670
|
fallbackPropTypeUtil,
|
|
669
671
|
isCompatible,
|
|
670
672
|
emptyState,
|
|
671
|
-
isActive = true
|
|
673
|
+
isActive = true,
|
|
674
|
+
menuActionsFactory
|
|
672
675
|
}) => {
|
|
673
676
|
const variableTypeKey = key ?? propTypeUtil.key;
|
|
674
677
|
if (!isCompatible) {
|
|
@@ -693,7 +696,8 @@ function createVariableTypeRegistry() {
|
|
|
693
696
|
fallbackPropTypeUtil,
|
|
694
697
|
isCompatible,
|
|
695
698
|
emptyState,
|
|
696
|
-
isActive
|
|
699
|
+
isActive,
|
|
700
|
+
menuActionsFactory
|
|
697
701
|
};
|
|
698
702
|
registerTransformer(propTypeUtil.key, styleTransformer);
|
|
699
703
|
registerInheritanceTransformer(propTypeUtil.key);
|
|
@@ -723,6 +727,13 @@ function createVariableTypeRegistry() {
|
|
|
723
727
|
|
|
724
728
|
// src/variables-registry/variable-type-registry.ts
|
|
725
729
|
var { registerVariableType, getVariableType, getVariableTypes, hasVariableType } = createVariableTypeRegistry();
|
|
730
|
+
function getMenuActionsForVariable(variableType, context) {
|
|
731
|
+
const typeOptions = getVariableType(variableType);
|
|
732
|
+
if (typeOptions?.menuActionsFactory) {
|
|
733
|
+
return typeOptions.menuActionsFactory(context);
|
|
734
|
+
}
|
|
735
|
+
return [];
|
|
736
|
+
}
|
|
726
737
|
|
|
727
738
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
728
739
|
import * as React2 from "react";
|
|
@@ -799,10 +810,58 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
799
810
|
);
|
|
800
811
|
};
|
|
801
812
|
|
|
813
|
+
// src/components/ui/stop-sync-confirmation-dialog.tsx
|
|
814
|
+
import * as React5 from "react";
|
|
815
|
+
import { useState } from "react";
|
|
816
|
+
import { BrushIcon } from "@elementor/icons";
|
|
817
|
+
import {
|
|
818
|
+
Button as Button2,
|
|
819
|
+
Checkbox,
|
|
820
|
+
Dialog,
|
|
821
|
+
DialogActions,
|
|
822
|
+
DialogContent,
|
|
823
|
+
DialogContentText,
|
|
824
|
+
DialogTitle,
|
|
825
|
+
FormControlLabel,
|
|
826
|
+
Typography as Typography5
|
|
827
|
+
} from "@elementor/ui";
|
|
828
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
829
|
+
var StopSyncConfirmationDialog = ({
|
|
830
|
+
open,
|
|
831
|
+
closeDialog,
|
|
832
|
+
onConfirm,
|
|
833
|
+
onSuppressMessage
|
|
834
|
+
}) => {
|
|
835
|
+
const [dontShowAgain, setDontShowAgain] = useState(false);
|
|
836
|
+
const handleConfirm = () => {
|
|
837
|
+
if (dontShowAgain) {
|
|
838
|
+
onSuppressMessage?.();
|
|
839
|
+
}
|
|
840
|
+
onConfirm();
|
|
841
|
+
};
|
|
842
|
+
return /* @__PURE__ */ React5.createElement(Dialog, { open, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React5.createElement(DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React5.createElement(BrushIcon, { color: "secondary" }), __7("Stop syncing variable color", "elementor")), /* @__PURE__ */ React5.createElement(DialogContent, null, /* @__PURE__ */ React5.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __7(
|
|
843
|
+
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
844
|
+
"elementor"
|
|
845
|
+
))), /* @__PURE__ */ React5.createElement(DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React5.createElement(
|
|
846
|
+
FormControlLabel,
|
|
847
|
+
{
|
|
848
|
+
control: /* @__PURE__ */ React5.createElement(
|
|
849
|
+
Checkbox,
|
|
850
|
+
{
|
|
851
|
+
checked: dontShowAgain,
|
|
852
|
+
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
853
|
+
size: "small"
|
|
854
|
+
}
|
|
855
|
+
),
|
|
856
|
+
label: /* @__PURE__ */ React5.createElement(Typography5, { variant: "body2" }, __7("Don't show this again", "elementor"))
|
|
857
|
+
}
|
|
858
|
+
), /* @__PURE__ */ React5.createElement("div", null, /* @__PURE__ */ React5.createElement(Button2, { color: "secondary", onClick: closeDialog }, __7("Cancel", "elementor")), /* @__PURE__ */ React5.createElement(Button2, { variant: "contained", color: "secondary", onClick: handleConfirm, sx: { ml: 1 } }, __7("Got it", "elementor")))));
|
|
859
|
+
};
|
|
860
|
+
|
|
802
861
|
// src/components/variables-manager/hooks/use-auto-edit.ts
|
|
803
|
-
import { useCallback, useState } from "react";
|
|
862
|
+
import { useCallback, useState as useState2 } from "react";
|
|
804
863
|
var useAutoEdit = () => {
|
|
805
|
-
const [autoEditVariableId, setAutoEditVariableId] =
|
|
864
|
+
const [autoEditVariableId, setAutoEditVariableId] = useState2(void 0);
|
|
806
865
|
const startAutoEdit = useCallback((variableId) => {
|
|
807
866
|
setAutoEditVariableId(variableId);
|
|
808
867
|
}, []);
|
|
@@ -854,18 +913,18 @@ var useErrorNavigation = () => {
|
|
|
854
913
|
};
|
|
855
914
|
|
|
856
915
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
857
|
-
import { useCallback as useCallback3, useState as
|
|
916
|
+
import { useCallback as useCallback3, useState as useState3 } from "react";
|
|
858
917
|
|
|
859
918
|
// src/hooks/use-prop-variables.ts
|
|
860
919
|
import { useMemo } from "react";
|
|
861
920
|
import { useBoundProp } from "@elementor/editor-controls";
|
|
862
921
|
|
|
863
922
|
// src/context/variable-type-context.tsx
|
|
864
|
-
import * as
|
|
923
|
+
import * as React6 from "react";
|
|
865
924
|
import { createContext, useContext } from "react";
|
|
866
925
|
var VariableTypeContext = createContext(null);
|
|
867
926
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
868
|
-
return /* @__PURE__ */
|
|
927
|
+
return /* @__PURE__ */ React6.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
869
928
|
}
|
|
870
929
|
function useVariableType() {
|
|
871
930
|
const context = useContext(VariableTypeContext);
|
|
@@ -885,11 +944,18 @@ function filterBySearch(variables, searchValue) {
|
|
|
885
944
|
var variablesToList = (variables) => {
|
|
886
945
|
return Object.entries(variables).map(([key, variable]) => ({ key, ...variable }));
|
|
887
946
|
};
|
|
888
|
-
var toNormalizedVariable = ({
|
|
947
|
+
var toNormalizedVariable = ({
|
|
889
948
|
key,
|
|
890
949
|
label,
|
|
891
950
|
value,
|
|
892
|
-
order
|
|
951
|
+
order,
|
|
952
|
+
sync_to_v3: syncToV3
|
|
953
|
+
}) => ({
|
|
954
|
+
key,
|
|
955
|
+
label,
|
|
956
|
+
value,
|
|
957
|
+
order,
|
|
958
|
+
sync_to_v3: syncToV3
|
|
893
959
|
});
|
|
894
960
|
var applySelectionFilters = (variables, variableTypes) => {
|
|
895
961
|
const grouped = {};
|
|
@@ -978,12 +1044,12 @@ var restoreVariable = (restoreId, label, value, type) => {
|
|
|
978
1044
|
|
|
979
1045
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
980
1046
|
var useVariablesManagerState = () => {
|
|
981
|
-
const [variables, setVariables] =
|
|
982
|
-
const [deletedVariables, setDeletedVariables] =
|
|
983
|
-
const [isSaveDisabled, setIsSaveDisabled] =
|
|
984
|
-
const [isDirty, setIsDirty] =
|
|
985
|
-
const [isSaving, setIsSaving] =
|
|
986
|
-
const [searchValue, setSearchValue] =
|
|
1047
|
+
const [variables, setVariables] = useState3(() => getVariables(false));
|
|
1048
|
+
const [deletedVariables, setDeletedVariables] = useState3([]);
|
|
1049
|
+
const [isSaveDisabled, setIsSaveDisabled] = useState3(false);
|
|
1050
|
+
const [isDirty, setIsDirty] = useState3(false);
|
|
1051
|
+
const [isSaving, setIsSaving] = useState3(false);
|
|
1052
|
+
const [searchValue, setSearchValue] = useState3("");
|
|
987
1053
|
const handleOnChange = useCallback3(
|
|
988
1054
|
(newVariables) => {
|
|
989
1055
|
setVariables({ ...variables, ...newVariables });
|
|
@@ -1008,6 +1074,20 @@ var useVariablesManagerState = () => {
|
|
|
1008
1074
|
setVariables((prev) => ({ ...prev, [itemId]: { ...prev[itemId], deleted: true } }));
|
|
1009
1075
|
setIsDirty(true);
|
|
1010
1076
|
}, []);
|
|
1077
|
+
const handleStartSync = useCallback3((itemId) => {
|
|
1078
|
+
setVariables((prev) => ({
|
|
1079
|
+
...prev,
|
|
1080
|
+
[itemId]: { ...prev[itemId], sync_to_v3: true }
|
|
1081
|
+
}));
|
|
1082
|
+
setIsDirty(true);
|
|
1083
|
+
}, []);
|
|
1084
|
+
const handleStopSync = useCallback3((itemId) => {
|
|
1085
|
+
setVariables((prev) => ({
|
|
1086
|
+
...prev,
|
|
1087
|
+
[itemId]: { ...prev[itemId], sync_to_v3: false }
|
|
1088
|
+
}));
|
|
1089
|
+
setIsDirty(true);
|
|
1090
|
+
}, []);
|
|
1011
1091
|
const handleSearch = (searchTerm) => {
|
|
1012
1092
|
setSearchValue(searchTerm);
|
|
1013
1093
|
};
|
|
@@ -1038,6 +1118,8 @@ var useVariablesManagerState = () => {
|
|
|
1038
1118
|
handleOnChange,
|
|
1039
1119
|
createVariable: createVariable2,
|
|
1040
1120
|
handleDeleteVariable,
|
|
1121
|
+
handleStartSync,
|
|
1122
|
+
handleStopSync,
|
|
1041
1123
|
handleSave,
|
|
1042
1124
|
isSaving,
|
|
1043
1125
|
handleSearch,
|
|
@@ -1048,13 +1130,13 @@ var useVariablesManagerState = () => {
|
|
|
1048
1130
|
};
|
|
1049
1131
|
|
|
1050
1132
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1051
|
-
import * as
|
|
1052
|
-
import { createElement as
|
|
1133
|
+
import * as React7 from "react";
|
|
1134
|
+
import { createElement as createElement8, useMemo as useMemo2, useRef as useRef2, useState as useState4 } from "react";
|
|
1053
1135
|
import { PromotionChip, PromotionPopover } from "@elementor/editor-ui";
|
|
1054
1136
|
import { PlusIcon } from "@elementor/icons";
|
|
1055
|
-
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as
|
|
1137
|
+
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography6 } from "@elementor/ui";
|
|
1056
1138
|
import { capitalize } from "@elementor/utils";
|
|
1057
|
-
import { __ as
|
|
1139
|
+
import { __ as __8, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
1058
1140
|
|
|
1059
1141
|
// src/sync/license-info.ts
|
|
1060
1142
|
function getLicenseInfo() {
|
|
@@ -1094,17 +1176,17 @@ var VariableManagerCreateMenu = ({
|
|
|
1094
1176
|
})),
|
|
1095
1177
|
[variableTypes]
|
|
1096
1178
|
);
|
|
1097
|
-
return /* @__PURE__ */
|
|
1179
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
1098
1180
|
IconButton,
|
|
1099
1181
|
{
|
|
1100
1182
|
...bindTrigger(menuState),
|
|
1101
1183
|
ref: buttonRef,
|
|
1102
1184
|
disabled,
|
|
1103
1185
|
size: SIZE,
|
|
1104
|
-
"aria-label":
|
|
1186
|
+
"aria-label": __8("Add variable", "elementor")
|
|
1105
1187
|
},
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
), /* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ React7.createElement(PlusIcon, { fontSize: SIZE })
|
|
1189
|
+
), /* @__PURE__ */ React7.createElement(
|
|
1108
1190
|
Menu,
|
|
1109
1191
|
{
|
|
1110
1192
|
disablePortal: true,
|
|
@@ -1126,7 +1208,7 @@ var VariableManagerCreateMenu = ({
|
|
|
1126
1208
|
},
|
|
1127
1209
|
"data-testid": "variable-manager-create-menu"
|
|
1128
1210
|
},
|
|
1129
|
-
menuOptionConfigs.map((config) => /* @__PURE__ */
|
|
1211
|
+
menuOptionConfigs.map((config) => /* @__PURE__ */ React7.createElement(
|
|
1130
1212
|
MenuOption,
|
|
1131
1213
|
{
|
|
1132
1214
|
key: config.key,
|
|
@@ -1144,7 +1226,7 @@ var MenuOption = ({
|
|
|
1144
1226
|
onCreate,
|
|
1145
1227
|
onClose
|
|
1146
1228
|
}) => {
|
|
1147
|
-
const [isPopoverOpen, setIsPopoverOpen] =
|
|
1229
|
+
const [isPopoverOpen, setIsPopoverOpen] = useState4(false);
|
|
1148
1230
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1149
1231
|
const displayName = capitalize(config.variableType);
|
|
1150
1232
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
@@ -1162,27 +1244,27 @@ var MenuOption = ({
|
|
|
1162
1244
|
};
|
|
1163
1245
|
const title = sprintf2(
|
|
1164
1246
|
/* translators: %s: Variable Type. */
|
|
1165
|
-
|
|
1247
|
+
__8("%s variables", "elementor"),
|
|
1166
1248
|
capitalize(config.variableType)
|
|
1167
1249
|
);
|
|
1168
1250
|
const content = sprintf2(
|
|
1169
1251
|
/* translators: %s: Variable Type. */
|
|
1170
|
-
|
|
1252
|
+
__8("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1171
1253
|
config.variableType
|
|
1172
1254
|
);
|
|
1173
|
-
return /* @__PURE__ */
|
|
1255
|
+
return /* @__PURE__ */ React7.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, createElement8(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React7.createElement(Typography6, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React7.createElement(
|
|
1174
1256
|
PromotionPopover,
|
|
1175
1257
|
{
|
|
1176
1258
|
open: isPopoverOpen,
|
|
1177
1259
|
title,
|
|
1178
1260
|
content,
|
|
1179
|
-
ctaText:
|
|
1261
|
+
ctaText: __8("Upgrade now", "elementor"),
|
|
1180
1262
|
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1181
1263
|
onClose: () => {
|
|
1182
1264
|
setIsPopoverOpen(false);
|
|
1183
1265
|
}
|
|
1184
1266
|
},
|
|
1185
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ React7.createElement(PromotionChip, null)
|
|
1186
1268
|
));
|
|
1187
1269
|
};
|
|
1188
1270
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1197,8 +1279,8 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1197
1279
|
};
|
|
1198
1280
|
|
|
1199
1281
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1200
|
-
import * as
|
|
1201
|
-
import { createElement as
|
|
1282
|
+
import * as React12 from "react";
|
|
1283
|
+
import { createElement as createElement15, useEffect as useEffect2, useRef as useRef5 } from "react";
|
|
1202
1284
|
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1203
1285
|
import { GripVerticalIcon } from "@elementor/icons";
|
|
1204
1286
|
import {
|
|
@@ -1212,18 +1294,18 @@ import {
|
|
|
1212
1294
|
UnstableSortableItem,
|
|
1213
1295
|
UnstableSortableProvider
|
|
1214
1296
|
} from "@elementor/ui";
|
|
1215
|
-
import { __ as
|
|
1297
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
1216
1298
|
|
|
1217
1299
|
// src/components/fields/label-field.tsx
|
|
1218
|
-
import * as
|
|
1219
|
-
import { useRef as useRef3, useState as
|
|
1300
|
+
import * as React8 from "react";
|
|
1301
|
+
import { useRef as useRef3, useState as useState5 } from "react";
|
|
1220
1302
|
import { WarningInfotip } from "@elementor/editor-ui";
|
|
1221
1303
|
import { TextField } from "@elementor/ui";
|
|
1222
1304
|
function isLabelEqual(a, b) {
|
|
1223
1305
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1224
1306
|
}
|
|
1225
1307
|
var useLabelError = (initialError) => {
|
|
1226
|
-
const [error, setError] =
|
|
1308
|
+
const [error, setError] = useState5(initialError ?? { value: "", message: "" });
|
|
1227
1309
|
return {
|
|
1228
1310
|
labelFieldError: error,
|
|
1229
1311
|
setLabelFieldError: setError
|
|
@@ -1242,8 +1324,8 @@ var LabelField = ({
|
|
|
1242
1324
|
variables,
|
|
1243
1325
|
onKeyDown
|
|
1244
1326
|
}) => {
|
|
1245
|
-
const [label, setLabel] =
|
|
1246
|
-
const [errorMessage, setErrorMessage] =
|
|
1327
|
+
const [label, setLabel] = useState5(value);
|
|
1328
|
+
const [errorMessage, setErrorMessage] = useState5("");
|
|
1247
1329
|
const fieldRef = useRef3(null);
|
|
1248
1330
|
const handleChange = (newValue) => {
|
|
1249
1331
|
setLabel(newValue);
|
|
@@ -1257,7 +1339,7 @@ var LabelField = ({
|
|
|
1257
1339
|
errorMsg = error.message;
|
|
1258
1340
|
}
|
|
1259
1341
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1260
|
-
const textField = /* @__PURE__ */
|
|
1342
|
+
const textField = /* @__PURE__ */ React8.createElement(
|
|
1261
1343
|
TextField,
|
|
1262
1344
|
{
|
|
1263
1345
|
ref: fieldRef,
|
|
@@ -1278,7 +1360,7 @@ var LabelField = ({
|
|
|
1278
1360
|
);
|
|
1279
1361
|
if (showWarningInfotip) {
|
|
1280
1362
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1281
|
-
return /* @__PURE__ */
|
|
1363
|
+
return /* @__PURE__ */ React8.createElement(
|
|
1282
1364
|
WarningInfotip,
|
|
1283
1365
|
{
|
|
1284
1366
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1295,15 +1377,15 @@ var LabelField = ({
|
|
|
1295
1377
|
};
|
|
1296
1378
|
|
|
1297
1379
|
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1298
|
-
import * as
|
|
1299
|
-
import { createElement as
|
|
1380
|
+
import * as React9 from "react";
|
|
1381
|
+
import { createElement as createElement11 } from "react";
|
|
1300
1382
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1301
1383
|
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1302
1384
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1303
1385
|
const menuState = usePopupState({
|
|
1304
1386
|
variant: "popover"
|
|
1305
1387
|
});
|
|
1306
|
-
return /* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(IconButton2, { ...bindTrigger2(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React9.createElement(DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React9.createElement(
|
|
1307
1389
|
Menu2,
|
|
1308
1390
|
{
|
|
1309
1391
|
disablePortal: true,
|
|
@@ -1326,7 +1408,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1326
1408
|
open: menuState.isOpen,
|
|
1327
1409
|
onClose: menuState.close
|
|
1328
1410
|
},
|
|
1329
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
1411
|
+
menuActions.map((action) => /* @__PURE__ */ React9.createElement(
|
|
1330
1412
|
MenuItem2,
|
|
1331
1413
|
{
|
|
1332
1414
|
key: action.name,
|
|
@@ -1339,7 +1421,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1339
1421
|
gap: 1
|
|
1340
1422
|
}
|
|
1341
1423
|
},
|
|
1342
|
-
action.icon &&
|
|
1424
|
+
action.icon && createElement11(action.icon, {
|
|
1343
1425
|
fontSize: "inherit"
|
|
1344
1426
|
}),
|
|
1345
1427
|
" ",
|
|
@@ -1349,7 +1431,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1349
1431
|
};
|
|
1350
1432
|
|
|
1351
1433
|
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1352
|
-
import * as
|
|
1434
|
+
import * as React10 from "react";
|
|
1353
1435
|
import { TableCell } from "@elementor/ui";
|
|
1354
1436
|
var VariableTableCell = ({
|
|
1355
1437
|
children,
|
|
@@ -1369,14 +1451,14 @@ var VariableTableCell = ({
|
|
|
1369
1451
|
...width && { width },
|
|
1370
1452
|
...sx
|
|
1371
1453
|
};
|
|
1372
|
-
return /* @__PURE__ */
|
|
1454
|
+
return /* @__PURE__ */ React10.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1373
1455
|
};
|
|
1374
1456
|
|
|
1375
1457
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1376
|
-
import * as
|
|
1377
|
-
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as
|
|
1458
|
+
import * as React11 from "react";
|
|
1459
|
+
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as useState6 } from "react";
|
|
1378
1460
|
import { ClickAwayListener, Stack as Stack4 } from "@elementor/ui";
|
|
1379
|
-
var VariableEditableCell =
|
|
1461
|
+
var VariableEditableCell = React11.memo(
|
|
1380
1462
|
({
|
|
1381
1463
|
initialValue,
|
|
1382
1464
|
children,
|
|
@@ -1389,10 +1471,10 @@ var VariableEditableCell = React10.memo(
|
|
|
1389
1471
|
gap = 1,
|
|
1390
1472
|
fieldType
|
|
1391
1473
|
}) => {
|
|
1392
|
-
const [value, setValue] =
|
|
1393
|
-
const [isEditing, setIsEditing] =
|
|
1474
|
+
const [value, setValue] = useState6(initialValue);
|
|
1475
|
+
const [isEditing, setIsEditing] = useState6(false);
|
|
1394
1476
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1395
|
-
const [valueFieldError, setValueFieldError] =
|
|
1477
|
+
const [valueFieldError, setValueFieldError] = useState6("");
|
|
1396
1478
|
const rowRef = useRef4(null);
|
|
1397
1479
|
const handleSave = useCallback4(() => {
|
|
1398
1480
|
const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
|
|
@@ -1453,7 +1535,7 @@ var VariableEditableCell = React10.memo(
|
|
|
1453
1535
|
error: currentError
|
|
1454
1536
|
});
|
|
1455
1537
|
if (isEditing) {
|
|
1456
|
-
return /* @__PURE__ */
|
|
1538
|
+
return /* @__PURE__ */ React11.createElement(ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React11.createElement(
|
|
1457
1539
|
Stack4,
|
|
1458
1540
|
{
|
|
1459
1541
|
ref: rowRef,
|
|
@@ -1470,7 +1552,7 @@ var VariableEditableCell = React10.memo(
|
|
|
1470
1552
|
editableContent
|
|
1471
1553
|
));
|
|
1472
1554
|
}
|
|
1473
|
-
return /* @__PURE__ */
|
|
1555
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1474
1556
|
Stack4,
|
|
1475
1557
|
{
|
|
1476
1558
|
ref: rowRef,
|
|
@@ -1551,16 +1633,16 @@ var VariablesManagerTable = ({
|
|
|
1551
1633
|
});
|
|
1552
1634
|
handleOnChange(updatedVariables);
|
|
1553
1635
|
};
|
|
1554
|
-
return /* @__PURE__ */
|
|
1636
|
+
return /* @__PURE__ */ React12.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React12.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React12.createElement(TableHead, null, /* @__PURE__ */ React12.createElement(TableRow, null, /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true }, __9("Name", "elementor")), /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true }, __9("Value", "elementor")), /* @__PURE__ */ React12.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React12.createElement(TableBody, null, /* @__PURE__ */ React12.createElement(
|
|
1555
1637
|
UnstableSortableProvider,
|
|
1556
1638
|
{
|
|
1557
1639
|
value: ids,
|
|
1558
1640
|
onChange: handleReorder,
|
|
1559
1641
|
variant: "static",
|
|
1560
1642
|
restrictAxis: true,
|
|
1561
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1643
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React12.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React12.createElement(TableBody, null, dragOverlayChildren))
|
|
1562
1644
|
},
|
|
1563
|
-
rows.map((row) => /* @__PURE__ */
|
|
1645
|
+
rows.map((row) => /* @__PURE__ */ React12.createElement(
|
|
1564
1646
|
UnstableSortableItem,
|
|
1565
1647
|
{
|
|
1566
1648
|
key: row.id,
|
|
@@ -1578,7 +1660,7 @@ var VariablesManagerTable = ({
|
|
|
1578
1660
|
}) => {
|
|
1579
1661
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1580
1662
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1581
|
-
return /* @__PURE__ */
|
|
1663
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1582
1664
|
TableRow,
|
|
1583
1665
|
{
|
|
1584
1666
|
...itemProps,
|
|
@@ -1609,7 +1691,7 @@ var VariablesManagerTable = ({
|
|
|
1609
1691
|
},
|
|
1610
1692
|
style: { ...itemStyle, ...triggerStyle }
|
|
1611
1693
|
},
|
|
1612
|
-
/* @__PURE__ */
|
|
1694
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(
|
|
1613
1695
|
IconButton3,
|
|
1614
1696
|
{
|
|
1615
1697
|
size: "small",
|
|
@@ -1618,9 +1700,9 @@ var VariablesManagerTable = ({
|
|
|
1618
1700
|
disabled: isSorting,
|
|
1619
1701
|
draggable: true
|
|
1620
1702
|
},
|
|
1621
|
-
/* @__PURE__ */
|
|
1703
|
+
/* @__PURE__ */ React12.createElement(GripVerticalIcon, { fontSize: "inherit" })
|
|
1622
1704
|
)),
|
|
1623
|
-
/* @__PURE__ */
|
|
1705
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1624
1706
|
VariableEditableCell,
|
|
1625
1707
|
{
|
|
1626
1708
|
initialValue: row.name,
|
|
@@ -1632,13 +1714,13 @@ var VariablesManagerTable = ({
|
|
|
1632
1714
|
});
|
|
1633
1715
|
}
|
|
1634
1716
|
},
|
|
1635
|
-
prefixElement:
|
|
1717
|
+
prefixElement: createElement15(row.icon, { fontSize: "inherit" }),
|
|
1636
1718
|
editableElement: ({
|
|
1637
1719
|
value,
|
|
1638
1720
|
onChange,
|
|
1639
1721
|
onValidationChange,
|
|
1640
1722
|
error
|
|
1641
|
-
}) => /* @__PURE__ */
|
|
1723
|
+
}) => /* @__PURE__ */ React12.createElement(
|
|
1642
1724
|
LabelField,
|
|
1643
1725
|
{
|
|
1644
1726
|
id: "variable-label-" + row.id,
|
|
@@ -1661,7 +1743,7 @@ var VariablesManagerTable = ({
|
|
|
1661
1743
|
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1662
1744
|
fieldType: "label"
|
|
1663
1745
|
},
|
|
1664
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ React12.createElement(
|
|
1665
1747
|
EllipsisWithTooltip,
|
|
1666
1748
|
{
|
|
1667
1749
|
title: row.name,
|
|
@@ -1670,7 +1752,7 @@ var VariablesManagerTable = ({
|
|
|
1670
1752
|
row.name
|
|
1671
1753
|
)
|
|
1672
1754
|
)),
|
|
1673
|
-
/* @__PURE__ */
|
|
1755
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1674
1756
|
VariableEditableCell,
|
|
1675
1757
|
{
|
|
1676
1758
|
initialValue: row.value,
|
|
@@ -1702,13 +1784,13 @@ var VariablesManagerTable = ({
|
|
|
1702
1784
|
onFieldError?.(!!errorMsg);
|
|
1703
1785
|
},
|
|
1704
1786
|
error
|
|
1705
|
-
}) ?? /* @__PURE__ */
|
|
1787
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1706
1788
|
onRowRef: handleRowRef(row.id),
|
|
1707
1789
|
gap: 0.25,
|
|
1708
1790
|
fieldType: "value"
|
|
1709
1791
|
},
|
|
1710
1792
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1711
|
-
/* @__PURE__ */
|
|
1793
|
+
/* @__PURE__ */ React12.createElement(
|
|
1712
1794
|
EllipsisWithTooltip,
|
|
1713
1795
|
{
|
|
1714
1796
|
title: row.value,
|
|
@@ -1721,7 +1803,7 @@ var VariablesManagerTable = ({
|
|
|
1721
1803
|
row.value
|
|
1722
1804
|
)
|
|
1723
1805
|
)),
|
|
1724
|
-
/* @__PURE__ */
|
|
1806
|
+
/* @__PURE__ */ React12.createElement(
|
|
1725
1807
|
VariableTableCell,
|
|
1726
1808
|
{
|
|
1727
1809
|
align: "right",
|
|
@@ -1730,10 +1812,10 @@ var VariablesManagerTable = ({
|
|
|
1730
1812
|
maxWidth: 16,
|
|
1731
1813
|
sx: { paddingInlineEnd: 1 }
|
|
1732
1814
|
},
|
|
1733
|
-
/* @__PURE__ */
|
|
1815
|
+
/* @__PURE__ */ React12.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React12.createElement(
|
|
1734
1816
|
VariableEditMenu,
|
|
1735
1817
|
{
|
|
1736
|
-
menuActions,
|
|
1818
|
+
menuActions: menuActions(row.id),
|
|
1737
1819
|
disabled: isSorting,
|
|
1738
1820
|
itemId: row.id
|
|
1739
1821
|
}
|
|
@@ -1781,6 +1863,8 @@ function VariablesManagerPanel() {
|
|
|
1781
1863
|
handleOnChange,
|
|
1782
1864
|
createVariable: createVariable2,
|
|
1783
1865
|
handleDeleteVariable,
|
|
1866
|
+
handleStartSync,
|
|
1867
|
+
handleStopSync,
|
|
1784
1868
|
handleSave,
|
|
1785
1869
|
isSaving,
|
|
1786
1870
|
handleSearch,
|
|
@@ -1789,8 +1873,9 @@ function VariablesManagerPanel() {
|
|
|
1789
1873
|
} = useVariablesManagerState();
|
|
1790
1874
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1791
1875
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1792
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
1793
|
-
const [
|
|
1876
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState7(null);
|
|
1877
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = useState7(null);
|
|
1878
|
+
const [serverError, setServerError] = useState7(null);
|
|
1794
1879
|
usePreventUnload(isDirty);
|
|
1795
1880
|
const handleClosePanel = () => {
|
|
1796
1881
|
if (isDirty) {
|
|
@@ -1840,37 +1925,60 @@ function VariablesManagerPanel() {
|
|
|
1840
1925
|
},
|
|
1841
1926
|
[handleDeleteVariable]
|
|
1842
1927
|
);
|
|
1843
|
-
const
|
|
1844
|
-
{
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1928
|
+
const handleStopSyncWithConfirmation = useCallback5(
|
|
1929
|
+
(itemId) => {
|
|
1930
|
+
handleStopSync(itemId);
|
|
1931
|
+
setStopSyncConfirmation(null);
|
|
1932
|
+
},
|
|
1933
|
+
[handleStopSync]
|
|
1934
|
+
);
|
|
1935
|
+
const buildMenuActions = useCallback5(
|
|
1936
|
+
(variableId) => {
|
|
1937
|
+
const variable = variables[variableId];
|
|
1938
|
+
if (!variable) {
|
|
1939
|
+
return [];
|
|
1940
|
+
}
|
|
1941
|
+
const typeActions = getMenuActionsForVariable(variable.type, {
|
|
1942
|
+
variable,
|
|
1943
|
+
variableId,
|
|
1944
|
+
handlers: {
|
|
1945
|
+
onStartSync: handleStartSync,
|
|
1946
|
+
onStopSync: (itemId) => setStopSyncConfirmation(itemId)
|
|
1854
1947
|
}
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1948
|
+
});
|
|
1949
|
+
const deleteAction = {
|
|
1950
|
+
name: __10("Delete", "elementor"),
|
|
1951
|
+
icon: TrashIcon,
|
|
1952
|
+
color: "error.main",
|
|
1953
|
+
onClick: (itemId) => {
|
|
1954
|
+
const v = variables[itemId];
|
|
1955
|
+
if (v) {
|
|
1956
|
+
setDeleteConfirmation({ id: itemId, label: v.label });
|
|
1957
|
+
const variableTypeOptions = getVariableType(v.type);
|
|
1958
|
+
trackVariablesManagerEvent({ action: "delete", varType: variableTypeOptions?.variableType });
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
return [...typeActions, deleteAction];
|
|
1963
|
+
},
|
|
1964
|
+
[variables, handleStartSync]
|
|
1965
|
+
);
|
|
1858
1966
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1859
|
-
return /* @__PURE__ */
|
|
1967
|
+
return /* @__PURE__ */ React13.createElement(ThemeProvider, null, /* @__PURE__ */ React13.createElement(Panel, null, /* @__PURE__ */ React13.createElement(
|
|
1860
1968
|
PanelHeader,
|
|
1861
1969
|
{
|
|
1862
1970
|
sx: {
|
|
1863
1971
|
height: "unset"
|
|
1864
1972
|
}
|
|
1865
1973
|
},
|
|
1866
|
-
/* @__PURE__ */
|
|
1974
|
+
/* @__PURE__ */ React13.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React13.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React13.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React13.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React13.createElement(ColorFilterIcon, { fontSize: "inherit" }), __10("Variables Manager", "elementor"))), /* @__PURE__ */ React13.createElement(Stack6, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React13.createElement(
|
|
1867
1975
|
VariableManagerCreateMenu,
|
|
1868
1976
|
{
|
|
1869
1977
|
onCreate: handleCreateVariable,
|
|
1870
1978
|
variables,
|
|
1871
1979
|
menuState: createMenuState
|
|
1872
1980
|
}
|
|
1873
|
-
), /* @__PURE__ */
|
|
1981
|
+
), /* @__PURE__ */ React13.createElement(
|
|
1874
1982
|
CloseButton,
|
|
1875
1983
|
{
|
|
1876
1984
|
"aria-label": "Close",
|
|
@@ -1879,19 +1987,19 @@ function VariablesManagerPanel() {
|
|
|
1879
1987
|
handleClosePanel();
|
|
1880
1988
|
}
|
|
1881
1989
|
}
|
|
1882
|
-
))), /* @__PURE__ */
|
|
1990
|
+
))), /* @__PURE__ */ React13.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React13.createElement(
|
|
1883
1991
|
SearchField,
|
|
1884
1992
|
{
|
|
1885
1993
|
sx: {
|
|
1886
1994
|
display: "flex",
|
|
1887
1995
|
flex: 1
|
|
1888
1996
|
},
|
|
1889
|
-
placeholder:
|
|
1997
|
+
placeholder: __10("Search", "elementor"),
|
|
1890
1998
|
value: searchValue,
|
|
1891
1999
|
onSearch: handleSearch
|
|
1892
2000
|
}
|
|
1893
|
-
)), /* @__PURE__ */
|
|
1894
|
-
), /* @__PURE__ */
|
|
2001
|
+
)), /* @__PURE__ */ React13.createElement(Divider, { sx: { width: "100%" } }))
|
|
2002
|
+
), /* @__PURE__ */ React13.createElement(
|
|
1895
2003
|
PanelBody,
|
|
1896
2004
|
{
|
|
1897
2005
|
sx: {
|
|
@@ -1900,10 +2008,10 @@ function VariablesManagerPanel() {
|
|
|
1900
2008
|
height: "100%"
|
|
1901
2009
|
}
|
|
1902
2010
|
},
|
|
1903
|
-
hasVariables && /* @__PURE__ */
|
|
2011
|
+
hasVariables && /* @__PURE__ */ React13.createElement(
|
|
1904
2012
|
VariablesManagerTable,
|
|
1905
2013
|
{
|
|
1906
|
-
menuActions,
|
|
2014
|
+
menuActions: buildMenuActions,
|
|
1907
2015
|
variables,
|
|
1908
2016
|
onChange: handleOnChange,
|
|
1909
2017
|
autoEditVariableId,
|
|
@@ -1911,43 +2019,43 @@ function VariablesManagerPanel() {
|
|
|
1911
2019
|
onFieldError: setIsSaveDisabled
|
|
1912
2020
|
}
|
|
1913
2021
|
),
|
|
1914
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2022
|
+
!hasVariables && searchValue && /* @__PURE__ */ React13.createElement(
|
|
1915
2023
|
NoSearchResults,
|
|
1916
2024
|
{
|
|
1917
2025
|
searchValue,
|
|
1918
2026
|
onClear: () => handleSearch(""),
|
|
1919
|
-
icon: /* @__PURE__ */
|
|
2027
|
+
icon: /* @__PURE__ */ React13.createElement(ColorFilterIcon, { fontSize: "large" })
|
|
1920
2028
|
}
|
|
1921
2029
|
),
|
|
1922
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2030
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React13.createElement(
|
|
1923
2031
|
EmptyState,
|
|
1924
2032
|
{
|
|
1925
|
-
title:
|
|
1926
|
-
message:
|
|
2033
|
+
title: __10("Create your first variable", "elementor"),
|
|
2034
|
+
message: __10(
|
|
1927
2035
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1928
2036
|
"elementor"
|
|
1929
2037
|
),
|
|
1930
|
-
icon: /* @__PURE__ */
|
|
2038
|
+
icon: /* @__PURE__ */ React13.createElement(ColorFilterIcon, { fontSize: "large" }),
|
|
1931
2039
|
onAdd: createMenuState.open
|
|
1932
2040
|
}
|
|
1933
2041
|
)
|
|
1934
|
-
), /* @__PURE__ */
|
|
2042
|
+
), /* @__PURE__ */ React13.createElement(PanelFooter, null, /* @__PURE__ */ React13.createElement(
|
|
1935
2043
|
Infotip,
|
|
1936
2044
|
{
|
|
1937
2045
|
placement: "right",
|
|
1938
2046
|
open: !!serverError,
|
|
1939
|
-
content: serverError ? /* @__PURE__ */
|
|
2047
|
+
content: serverError ? /* @__PURE__ */ React13.createElement(
|
|
1940
2048
|
Alert,
|
|
1941
2049
|
{
|
|
1942
2050
|
severity: serverError.severity ?? "error",
|
|
1943
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2051
|
+
action: serverError.action?.label ? /* @__PURE__ */ React13.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
1944
2052
|
onClose: !serverError.action?.label ? () => {
|
|
1945
2053
|
setServerError(null);
|
|
1946
2054
|
setIsSaveDisabled(false);
|
|
1947
2055
|
} : void 0,
|
|
1948
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2056
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React13.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React13.createElement(AlertTriangleFilledIcon2, null)
|
|
1949
2057
|
},
|
|
1950
|
-
/* @__PURE__ */
|
|
2058
|
+
/* @__PURE__ */ React13.createElement(AlertTitle, null, serverError.message),
|
|
1951
2059
|
serverError.action?.message
|
|
1952
2060
|
) : null,
|
|
1953
2061
|
arrow: false,
|
|
@@ -1962,8 +2070,8 @@ function VariablesManagerPanel() {
|
|
|
1962
2070
|
}
|
|
1963
2071
|
}
|
|
1964
2072
|
},
|
|
1965
|
-
/* @__PURE__ */
|
|
1966
|
-
|
|
2073
|
+
/* @__PURE__ */ React13.createElement(
|
|
2074
|
+
Button3,
|
|
1967
2075
|
{
|
|
1968
2076
|
fullWidth: true,
|
|
1969
2077
|
size: "small",
|
|
@@ -1973,9 +2081,9 @@ function VariablesManagerPanel() {
|
|
|
1973
2081
|
onClick: handleSaveClick,
|
|
1974
2082
|
loading: isSaving
|
|
1975
2083
|
},
|
|
1976
|
-
|
|
2084
|
+
__10("Save changes", "elementor")
|
|
1977
2085
|
)
|
|
1978
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2086
|
+
))), deleteConfirmation && /* @__PURE__ */ React13.createElement(
|
|
1979
2087
|
DeleteConfirmationDialog,
|
|
1980
2088
|
{
|
|
1981
2089
|
open: true,
|
|
@@ -1983,19 +2091,26 @@ function VariablesManagerPanel() {
|
|
|
1983
2091
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1984
2092
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1985
2093
|
}
|
|
1986
|
-
),
|
|
2094
|
+
), stopSyncConfirmation && /* @__PURE__ */ React13.createElement(
|
|
2095
|
+
StopSyncConfirmationDialog,
|
|
2096
|
+
{
|
|
2097
|
+
open: true,
|
|
2098
|
+
closeDialog: () => setStopSyncConfirmation(null),
|
|
2099
|
+
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2100
|
+
}
|
|
2101
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React13.createElement(SaveChangesDialog, null, /* @__PURE__ */ React13.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __10("You have unsaved changes", "elementor")), /* @__PURE__ */ React13.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React13.createElement(SaveChangesDialog.ContentText, null, __10("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React13.createElement(
|
|
1987
2102
|
SaveChangesDialog.Actions,
|
|
1988
2103
|
{
|
|
1989
2104
|
actions: {
|
|
1990
2105
|
discard: {
|
|
1991
|
-
label:
|
|
2106
|
+
label: __10("Discard", "elementor"),
|
|
1992
2107
|
action: () => {
|
|
1993
2108
|
closeSaveChangesDialog();
|
|
1994
2109
|
closePanel();
|
|
1995
2110
|
}
|
|
1996
2111
|
},
|
|
1997
2112
|
confirm: {
|
|
1998
|
-
label:
|
|
2113
|
+
label: __10("Save", "elementor"),
|
|
1999
2114
|
action: async () => {
|
|
2000
2115
|
const result = await handleSaveClick();
|
|
2001
2116
|
closeSaveChangesDialog();
|
|
@@ -2050,12 +2165,12 @@ function OpenPanelFromUrl() {
|
|
|
2050
2165
|
}
|
|
2051
2166
|
|
|
2052
2167
|
// src/controls/variable-control.tsx
|
|
2053
|
-
import * as
|
|
2168
|
+
import * as React32 from "react";
|
|
2054
2169
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
|
|
2055
2170
|
|
|
2056
2171
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2057
2172
|
import { useId, useRef as useRef7 } from "react";
|
|
2058
|
-
import * as
|
|
2173
|
+
import * as React23 from "react";
|
|
2059
2174
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
2060
2175
|
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
2061
2176
|
import { bindPopover, bindTrigger as bindTrigger3, Box as Box4, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
@@ -2077,31 +2192,31 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2077
2192
|
}
|
|
2078
2193
|
|
|
2079
2194
|
// src/components/variable-selection-popover.tsx
|
|
2080
|
-
import * as
|
|
2081
|
-
import { useState as
|
|
2195
|
+
import * as React21 from "react";
|
|
2196
|
+
import { useState as useState13 } from "react";
|
|
2082
2197
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
2083
2198
|
|
|
2084
2199
|
// src/context/variable-selection-popover.context.tsx
|
|
2085
|
-
import * as
|
|
2086
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
2200
|
+
import * as React14 from "react";
|
|
2201
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState8 } from "react";
|
|
2087
2202
|
import { Box } from "@elementor/ui";
|
|
2088
2203
|
var PopoverContentRefContext = createContext2(null);
|
|
2089
2204
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2090
|
-
const [anchorRef, setAnchorRef] =
|
|
2091
|
-
return /* @__PURE__ */
|
|
2205
|
+
const [anchorRef, setAnchorRef] = useState8(null);
|
|
2206
|
+
return /* @__PURE__ */ React14.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React14.createElement(Box, { ref: setAnchorRef }, children));
|
|
2092
2207
|
};
|
|
2093
2208
|
var usePopoverContentRef = () => {
|
|
2094
2209
|
return useContext2(PopoverContentRefContext);
|
|
2095
2210
|
};
|
|
2096
2211
|
|
|
2097
2212
|
// src/components/variable-creation.tsx
|
|
2098
|
-
import * as
|
|
2099
|
-
import { useState as
|
|
2213
|
+
import * as React16 from "react";
|
|
2214
|
+
import { useState as useState9 } from "react";
|
|
2100
2215
|
import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
2101
2216
|
import { PopoverHeader, SectionPopoverBody } from "@elementor/editor-ui";
|
|
2102
2217
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
2103
|
-
import { Button as
|
|
2104
|
-
import { __ as
|
|
2218
|
+
import { Button as Button4, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography7 } from "@elementor/ui";
|
|
2219
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
2105
2220
|
|
|
2106
2221
|
// src/hooks/use-initial-value.ts
|
|
2107
2222
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
@@ -2144,10 +2259,10 @@ var unwrapValue = (input) => {
|
|
|
2144
2259
|
};
|
|
2145
2260
|
|
|
2146
2261
|
// src/components/ui/form-field.tsx
|
|
2147
|
-
import * as
|
|
2262
|
+
import * as React15 from "react";
|
|
2148
2263
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
2149
2264
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2150
|
-
return /* @__PURE__ */
|
|
2265
|
+
return /* @__PURE__ */ React15.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React15.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React15.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React15.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React15.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React15.createElement(FormHelperText, null, noticeMsg)));
|
|
2151
2266
|
};
|
|
2152
2267
|
|
|
2153
2268
|
// src/components/variable-creation.tsx
|
|
@@ -2157,11 +2272,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2157
2272
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2158
2273
|
const { propType } = useBoundProp4();
|
|
2159
2274
|
const initialValue = useInitialValue();
|
|
2160
|
-
const [value, setValue] =
|
|
2161
|
-
const [label, setLabel] =
|
|
2162
|
-
const [errorMessage, setErrorMessage] =
|
|
2163
|
-
const [valueFieldError, setValueFieldError] =
|
|
2164
|
-
const [propTypeKey, setPropTypeKey] =
|
|
2275
|
+
const [value, setValue] = useState9(initialValue);
|
|
2276
|
+
const [label, setLabel] = useState9("");
|
|
2277
|
+
const [errorMessage, setErrorMessage] = useState9("");
|
|
2278
|
+
const [valueFieldError, setValueFieldError] = useState9("");
|
|
2279
|
+
const [propTypeKey, setPropTypeKey] = useState9(propTypeUtil.key);
|
|
2165
2280
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2166
2281
|
const resetFields = () => {
|
|
2167
2282
|
setValue("");
|
|
@@ -2218,22 +2333,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2218
2333
|
handleCreateAndTrack();
|
|
2219
2334
|
}
|
|
2220
2335
|
};
|
|
2221
|
-
return /* @__PURE__ */
|
|
2336
|
+
return /* @__PURE__ */ React16.createElement(SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React16.createElement(
|
|
2222
2337
|
PopoverHeader,
|
|
2223
2338
|
{
|
|
2224
|
-
icon: /* @__PURE__ */
|
|
2225
|
-
title:
|
|
2339
|
+
icon: /* @__PURE__ */ React16.createElement(React16.Fragment, null, onGoBack && /* @__PURE__ */ React16.createElement(IconButton4, { size: SIZE2, "aria-label": __11("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React16.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React16.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2340
|
+
title: __11("Create variable", "elementor"),
|
|
2226
2341
|
onClose: closePopover
|
|
2227
2342
|
}
|
|
2228
|
-
), /* @__PURE__ */
|
|
2343
|
+
), /* @__PURE__ */ React16.createElement(Divider2, null), /* @__PURE__ */ React16.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React16.createElement(
|
|
2229
2344
|
FormField,
|
|
2230
2345
|
{
|
|
2231
2346
|
id: "variable-label",
|
|
2232
|
-
label:
|
|
2347
|
+
label: __11("Name", "elementor"),
|
|
2233
2348
|
errorMsg: labelFieldError?.message,
|
|
2234
2349
|
noticeMsg: labelHint(label)
|
|
2235
2350
|
},
|
|
2236
|
-
/* @__PURE__ */
|
|
2351
|
+
/* @__PURE__ */ React16.createElement(
|
|
2237
2352
|
LabelField,
|
|
2238
2353
|
{
|
|
2239
2354
|
id: "variable-label",
|
|
@@ -2252,7 +2367,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2252
2367
|
onKeyDown: handleKeyDown
|
|
2253
2368
|
}
|
|
2254
2369
|
)
|
|
2255
|
-
), ValueField && /* @__PURE__ */
|
|
2370
|
+
), ValueField && /* @__PURE__ */ React16.createElement(FormField, { errorMsg: valueFieldError, label: __11("Value", "elementor") }, /* @__PURE__ */ React16.createElement(Typography7, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React16.createElement(
|
|
2256
2371
|
ValueField,
|
|
2257
2372
|
{
|
|
2258
2373
|
value,
|
|
@@ -2266,8 +2381,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2266
2381
|
propType,
|
|
2267
2382
|
onKeyDown: handleKeyDown
|
|
2268
2383
|
}
|
|
2269
|
-
))), errorMessage && /* @__PURE__ */
|
|
2270
|
-
|
|
2384
|
+
))), errorMessage && /* @__PURE__ */ React16.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React16.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React16.createElement(
|
|
2385
|
+
Button4,
|
|
2271
2386
|
{
|
|
2272
2387
|
id: "create-variable-button",
|
|
2273
2388
|
size: "small",
|
|
@@ -2275,89 +2390,89 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2275
2390
|
disabled: isSubmitDisabled,
|
|
2276
2391
|
onClick: handleCreateAndTrack
|
|
2277
2392
|
},
|
|
2278
|
-
|
|
2393
|
+
__11("Create", "elementor")
|
|
2279
2394
|
)));
|
|
2280
2395
|
};
|
|
2281
2396
|
|
|
2282
2397
|
// src/components/variable-edit.tsx
|
|
2283
|
-
import * as
|
|
2284
|
-
import { useEffect as useEffect5, useState as
|
|
2398
|
+
import * as React18 from "react";
|
|
2399
|
+
import { useEffect as useEffect5, useState as useState11 } from "react";
|
|
2285
2400
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
2286
2401
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
2287
2402
|
import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
|
|
2288
2403
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
2289
|
-
import { Button as
|
|
2290
|
-
import { __ as
|
|
2404
|
+
import { Button as Button6, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Tooltip, Typography as Typography9 } from "@elementor/ui";
|
|
2405
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2291
2406
|
|
|
2292
2407
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2293
|
-
import * as
|
|
2294
|
-
import { useState as
|
|
2408
|
+
import * as React17 from "react";
|
|
2409
|
+
import { useState as useState10 } from "react";
|
|
2295
2410
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2296
2411
|
import {
|
|
2297
|
-
Button as
|
|
2298
|
-
Checkbox,
|
|
2299
|
-
Dialog,
|
|
2300
|
-
DialogActions,
|
|
2301
|
-
DialogContent,
|
|
2302
|
-
DialogContentText,
|
|
2303
|
-
DialogTitle,
|
|
2304
|
-
FormControlLabel,
|
|
2305
|
-
Typography as
|
|
2412
|
+
Button as Button5,
|
|
2413
|
+
Checkbox as Checkbox2,
|
|
2414
|
+
Dialog as Dialog2,
|
|
2415
|
+
DialogActions as DialogActions2,
|
|
2416
|
+
DialogContent as DialogContent2,
|
|
2417
|
+
DialogContentText as DialogContentText2,
|
|
2418
|
+
DialogTitle as DialogTitle2,
|
|
2419
|
+
FormControlLabel as FormControlLabel2,
|
|
2420
|
+
Typography as Typography8
|
|
2306
2421
|
} from "@elementor/ui";
|
|
2307
|
-
import { __ as
|
|
2422
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
2308
2423
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
2309
2424
|
var EditConfirmationDialog = ({
|
|
2310
2425
|
closeDialog,
|
|
2311
2426
|
onConfirm,
|
|
2312
2427
|
onSuppressMessage
|
|
2313
2428
|
}) => {
|
|
2314
|
-
const [dontShowAgain, setDontShowAgain] =
|
|
2429
|
+
const [dontShowAgain, setDontShowAgain] = useState10(false);
|
|
2315
2430
|
const handleSave = () => {
|
|
2316
2431
|
if (dontShowAgain) {
|
|
2317
2432
|
onSuppressMessage?.();
|
|
2318
2433
|
}
|
|
2319
2434
|
onConfirm?.();
|
|
2320
2435
|
};
|
|
2321
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ React17.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React17.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React17.createElement(AlertTriangleFilledIcon3, { color: "secondary" }), __12("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React17.createElement(DialogContent2, null, /* @__PURE__ */ React17.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __12(
|
|
2322
2437
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2323
2438
|
"elementor"
|
|
2324
|
-
))), /* @__PURE__ */
|
|
2325
|
-
|
|
2439
|
+
))), /* @__PURE__ */ React17.createElement(DialogActions2, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React17.createElement(
|
|
2440
|
+
FormControlLabel2,
|
|
2326
2441
|
{
|
|
2327
|
-
control: /* @__PURE__ */
|
|
2328
|
-
|
|
2442
|
+
control: /* @__PURE__ */ React17.createElement(
|
|
2443
|
+
Checkbox2,
|
|
2329
2444
|
{
|
|
2330
2445
|
checked: dontShowAgain,
|
|
2331
2446
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2332
2447
|
size: "small"
|
|
2333
2448
|
}
|
|
2334
2449
|
),
|
|
2335
|
-
label: /* @__PURE__ */
|
|
2450
|
+
label: /* @__PURE__ */ React17.createElement(Typography8, { variant: "body2" }, __12("Don't show me again", "elementor"))
|
|
2336
2451
|
}
|
|
2337
|
-
), /* @__PURE__ */
|
|
2452
|
+
), /* @__PURE__ */ React17.createElement("div", null, /* @__PURE__ */ React17.createElement(Button5, { color: "secondary", onClick: closeDialog }, __12("Keep editing", "elementor")), /* @__PURE__ */ React17.createElement(Button5, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __12("Save", "elementor")))));
|
|
2338
2453
|
};
|
|
2339
2454
|
|
|
2340
2455
|
// src/components/variable-edit.tsx
|
|
2341
2456
|
var SIZE3 = "tiny";
|
|
2342
|
-
var DELETE_LABEL =
|
|
2457
|
+
var DELETE_LABEL = __13("Delete variable", "elementor");
|
|
2343
2458
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
2344
2459
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
2345
2460
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2346
2461
|
const { propType } = useBoundProp5();
|
|
2347
2462
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2348
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
2349
|
-
const [editConfirmation, setEditConfirmation] =
|
|
2350
|
-
const [errorMessage, setErrorMessage] =
|
|
2351
|
-
const [valueFieldError, setValueFieldError] =
|
|
2463
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState11(false);
|
|
2464
|
+
const [editConfirmation, setEditConfirmation] = useState11(false);
|
|
2465
|
+
const [errorMessage, setErrorMessage] = useState11("");
|
|
2466
|
+
const [valueFieldError, setValueFieldError] = useState11("");
|
|
2352
2467
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2353
2468
|
const variable = useVariable(editId);
|
|
2354
|
-
const [propTypeKey, setPropTypeKey] =
|
|
2469
|
+
const [propTypeKey, setPropTypeKey] = useState11(variable?.type ?? propTypeUtil.key);
|
|
2355
2470
|
if (!variable) {
|
|
2356
2471
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2357
2472
|
}
|
|
2358
2473
|
const userPermissions = usePermissions();
|
|
2359
|
-
const [value, setValue] =
|
|
2360
|
-
const [label, setLabel] =
|
|
2474
|
+
const [value, setValue] = useState11(() => variable.value);
|
|
2475
|
+
const [label, setLabel] = useState11(() => variable.label);
|
|
2361
2476
|
useEffect5(() => {
|
|
2362
2477
|
styleVariablesRepository.update({
|
|
2363
2478
|
[editId]: {
|
|
@@ -2420,7 +2535,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2420
2535
|
const actions = [];
|
|
2421
2536
|
if (userPermissions.canDelete()) {
|
|
2422
2537
|
actions.push(
|
|
2423
|
-
/* @__PURE__ */
|
|
2538
|
+
/* @__PURE__ */ React18.createElement(Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React18.createElement(IconButton5, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React18.createElement(TrashIcon2, { fontSize: SIZE3 })))
|
|
2424
2539
|
);
|
|
2425
2540
|
}
|
|
2426
2541
|
const hasEmptyFields = () => {
|
|
@@ -2445,31 +2560,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2445
2560
|
handleUpdate();
|
|
2446
2561
|
}
|
|
2447
2562
|
};
|
|
2448
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SectionPopoverBody2, { height: "auto" }, /* @__PURE__ */ React18.createElement(
|
|
2449
2564
|
PopoverHeader2,
|
|
2450
2565
|
{
|
|
2451
|
-
title:
|
|
2566
|
+
title: __13("Edit variable", "elementor"),
|
|
2452
2567
|
onClose,
|
|
2453
|
-
icon: /* @__PURE__ */
|
|
2568
|
+
icon: /* @__PURE__ */ React18.createElement(React18.Fragment, null, onGoBack && /* @__PURE__ */ React18.createElement(
|
|
2454
2569
|
IconButton5,
|
|
2455
2570
|
{
|
|
2456
2571
|
size: SIZE3,
|
|
2457
|
-
"aria-label":
|
|
2572
|
+
"aria-label": __13("Go Back", "elementor"),
|
|
2458
2573
|
onClick: onGoBack
|
|
2459
2574
|
},
|
|
2460
|
-
/* @__PURE__ */
|
|
2461
|
-
), /* @__PURE__ */
|
|
2575
|
+
/* @__PURE__ */ React18.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
2576
|
+
), /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2462
2577
|
actions
|
|
2463
2578
|
}
|
|
2464
|
-
), /* @__PURE__ */
|
|
2579
|
+
), /* @__PURE__ */ React18.createElement(Divider3, null), /* @__PURE__ */ React18.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React18.createElement(
|
|
2465
2580
|
FormField,
|
|
2466
2581
|
{
|
|
2467
2582
|
id: "variable-label",
|
|
2468
|
-
label:
|
|
2583
|
+
label: __13("Name", "elementor"),
|
|
2469
2584
|
errorMsg: labelFieldError?.message,
|
|
2470
2585
|
noticeMsg: labelHint(label)
|
|
2471
2586
|
},
|
|
2472
|
-
/* @__PURE__ */
|
|
2587
|
+
/* @__PURE__ */ React18.createElement(
|
|
2473
2588
|
LabelField,
|
|
2474
2589
|
{
|
|
2475
2590
|
id: "variable-label",
|
|
@@ -2488,7 +2603,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2488
2603
|
onKeyDown: handleKeyDown
|
|
2489
2604
|
}
|
|
2490
2605
|
)
|
|
2491
|
-
), ValueField && /* @__PURE__ */
|
|
2606
|
+
), ValueField && /* @__PURE__ */ React18.createElement(FormField, { errorMsg: valueFieldError, label: __13("Value", "elementor") }, /* @__PURE__ */ React18.createElement(Typography9, { variant: "h5" }, /* @__PURE__ */ React18.createElement(
|
|
2492
2607
|
ValueField,
|
|
2493
2608
|
{
|
|
2494
2609
|
propTypeKey: variable.type,
|
|
@@ -2503,7 +2618,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2503
2618
|
onValidationChange: setValueFieldError,
|
|
2504
2619
|
propType
|
|
2505
2620
|
}
|
|
2506
|
-
))), errorMessage && /* @__PURE__ */
|
|
2621
|
+
))), errorMessage && /* @__PURE__ */ React18.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React18.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React18.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __13("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React18.createElement(
|
|
2507
2622
|
DeleteConfirmationDialog,
|
|
2508
2623
|
{
|
|
2509
2624
|
open: true,
|
|
@@ -2511,7 +2626,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2511
2626
|
onConfirm: handleDelete,
|
|
2512
2627
|
closeDialog: closeDeleteDialog()
|
|
2513
2628
|
}
|
|
2514
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2629
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React18.createElement(
|
|
2515
2630
|
EditConfirmationDialog,
|
|
2516
2631
|
{
|
|
2517
2632
|
closeDialog: closeEditDialog(),
|
|
@@ -2522,25 +2637,25 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2522
2637
|
};
|
|
2523
2638
|
|
|
2524
2639
|
// src/components/variables-selection.tsx
|
|
2525
|
-
import * as
|
|
2526
|
-
import { useState as
|
|
2640
|
+
import * as React20 from "react";
|
|
2641
|
+
import { useState as useState12 } from "react";
|
|
2527
2642
|
import { SectionPopoverBody as SectionPopoverBody3 } from "@elementor/editor-ui";
|
|
2528
2643
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, SearchField as SearchField2 } from "@elementor/editor-ui";
|
|
2529
2644
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2530
2645
|
import { Divider as Divider4, IconButton as IconButton7, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
2531
|
-
import { __ as
|
|
2646
|
+
import { __ as __15, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
2532
2647
|
|
|
2533
2648
|
// src/components/ui/menu-item-content.tsx
|
|
2534
|
-
import * as
|
|
2649
|
+
import * as React19 from "react";
|
|
2535
2650
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2536
2651
|
import { EditIcon } from "@elementor/icons";
|
|
2537
|
-
import { Box as Box2, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as
|
|
2538
|
-
import { __ as
|
|
2652
|
+
import { Box as Box2, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography10 } from "@elementor/ui";
|
|
2653
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2539
2654
|
var SIZE4 = "tiny";
|
|
2540
|
-
var EDIT_LABEL =
|
|
2655
|
+
var EDIT_LABEL = __14("Edit variable", "elementor");
|
|
2541
2656
|
var MenuItemContent = ({ item }) => {
|
|
2542
2657
|
const onEdit = item.onEdit;
|
|
2543
|
-
return /* @__PURE__ */
|
|
2658
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React19.createElement(
|
|
2544
2659
|
Box2,
|
|
2545
2660
|
{
|
|
2546
2661
|
sx: {
|
|
@@ -2551,29 +2666,29 @@ var MenuItemContent = ({ item }) => {
|
|
|
2551
2666
|
gap: 1
|
|
2552
2667
|
}
|
|
2553
2668
|
},
|
|
2554
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ React19.createElement(
|
|
2555
2670
|
EllipsisWithTooltip2,
|
|
2556
2671
|
{
|
|
2557
2672
|
title: item.label || item.value,
|
|
2558
|
-
as:
|
|
2673
|
+
as: Typography10,
|
|
2559
2674
|
variant: "caption",
|
|
2560
2675
|
color: "text.primary",
|
|
2561
2676
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2562
2677
|
maxWidth: "50%"
|
|
2563
2678
|
}
|
|
2564
2679
|
),
|
|
2565
|
-
item.secondaryText && /* @__PURE__ */
|
|
2680
|
+
item.secondaryText && /* @__PURE__ */ React19.createElement(
|
|
2566
2681
|
EllipsisWithTooltip2,
|
|
2567
2682
|
{
|
|
2568
2683
|
title: item.secondaryText,
|
|
2569
|
-
as:
|
|
2684
|
+
as: Typography10,
|
|
2570
2685
|
variant: "caption",
|
|
2571
2686
|
color: "text.tertiary",
|
|
2572
2687
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2573
2688
|
maxWidth: "50%"
|
|
2574
2689
|
}
|
|
2575
2690
|
)
|
|
2576
|
-
), !!onEdit && /* @__PURE__ */
|
|
2691
|
+
), !!onEdit && /* @__PURE__ */ React19.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2577
2692
|
IconButton6,
|
|
2578
2693
|
{
|
|
2579
2694
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2583,7 +2698,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
2583
2698
|
},
|
|
2584
2699
|
"aria-label": EDIT_LABEL
|
|
2585
2700
|
},
|
|
2586
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ React19.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2587
2702
|
)));
|
|
2588
2703
|
};
|
|
2589
2704
|
|
|
@@ -2621,12 +2736,12 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
2621
2736
|
|
|
2622
2737
|
// src/components/variables-selection.tsx
|
|
2623
2738
|
var SIZE5 = "tiny";
|
|
2624
|
-
var CREATE_LABEL =
|
|
2625
|
-
var MANAGER_LABEL =
|
|
2739
|
+
var CREATE_LABEL = __15("Create variable", "elementor");
|
|
2740
|
+
var MANAGER_LABEL = __15("Variables Manager", "elementor");
|
|
2626
2741
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2627
2742
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2628
2743
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2629
|
-
const [searchValue, setSearchValue] =
|
|
2744
|
+
const [searchValue, setSearchValue] = useState12("");
|
|
2630
2745
|
const {
|
|
2631
2746
|
list: variables,
|
|
2632
2747
|
hasMatches: hasSearchResults,
|
|
@@ -2653,7 +2768,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2653
2768
|
const actions = [];
|
|
2654
2769
|
if (onAdd) {
|
|
2655
2770
|
actions.push(
|
|
2656
|
-
/* @__PURE__ */
|
|
2771
|
+
/* @__PURE__ */ React20.createElement(Tooltip3, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React20.createElement("span", null, /* @__PURE__ */ React20.createElement(
|
|
2657
2772
|
IconButton7,
|
|
2658
2773
|
{
|
|
2659
2774
|
id: "add-variable-button",
|
|
@@ -2662,7 +2777,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2662
2777
|
"aria-label": CREATE_LABEL,
|
|
2663
2778
|
disabled
|
|
2664
2779
|
},
|
|
2665
|
-
/* @__PURE__ */
|
|
2780
|
+
/* @__PURE__ */ React20.createElement(PlusIcon2, { fontSize: SIZE5 })
|
|
2666
2781
|
)))
|
|
2667
2782
|
);
|
|
2668
2783
|
}
|
|
@@ -2676,7 +2791,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2676
2791
|
});
|
|
2677
2792
|
};
|
|
2678
2793
|
actions.push(
|
|
2679
|
-
/* @__PURE__ */
|
|
2794
|
+
/* @__PURE__ */ React20.createElement(Tooltip3, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2680
2795
|
IconButton7,
|
|
2681
2796
|
{
|
|
2682
2797
|
id: "variables-manager-button",
|
|
@@ -2684,16 +2799,16 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2684
2799
|
onClick: handleOpenManager,
|
|
2685
2800
|
"aria-label": MANAGER_LABEL
|
|
2686
2801
|
},
|
|
2687
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ React20.createElement(SettingsIcon, { fontSize: SIZE5 })
|
|
2688
2803
|
))
|
|
2689
2804
|
);
|
|
2690
2805
|
}
|
|
2691
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2806
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2692
2807
|
const items = variables.map(({ value, label, key }) => ({
|
|
2693
2808
|
type: "item",
|
|
2694
2809
|
value: key,
|
|
2695
2810
|
label,
|
|
2696
|
-
icon: /* @__PURE__ */
|
|
2811
|
+
icon: /* @__PURE__ */ React20.createElement(StartIcon, { value }),
|
|
2697
2812
|
secondaryText: value,
|
|
2698
2813
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2699
2814
|
}));
|
|
@@ -2703,22 +2818,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2703
2818
|
const handleClearSearch = () => {
|
|
2704
2819
|
setSearchValue("");
|
|
2705
2820
|
};
|
|
2706
|
-
return /* @__PURE__ */
|
|
2821
|
+
return /* @__PURE__ */ React20.createElement(SectionPopoverBody3, null, /* @__PURE__ */ React20.createElement(
|
|
2707
2822
|
PopoverHeader3,
|
|
2708
2823
|
{
|
|
2709
|
-
title:
|
|
2710
|
-
icon: /* @__PURE__ */
|
|
2824
|
+
title: __15("Variables", "elementor"),
|
|
2825
|
+
icon: /* @__PURE__ */ React20.createElement(ColorFilterIcon2, { fontSize: SIZE5 }),
|
|
2711
2826
|
onClose: closePopover,
|
|
2712
2827
|
actions
|
|
2713
2828
|
}
|
|
2714
|
-
), hasVariables && /* @__PURE__ */
|
|
2829
|
+
), hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2715
2830
|
SearchField2,
|
|
2716
2831
|
{
|
|
2717
2832
|
value: searchValue,
|
|
2718
2833
|
onSearch: handleSearch,
|
|
2719
|
-
placeholder:
|
|
2834
|
+
placeholder: __15("Search", "elementor")
|
|
2720
2835
|
}
|
|
2721
|
-
), /* @__PURE__ */
|
|
2836
|
+
), /* @__PURE__ */ React20.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React20.createElement(
|
|
2722
2837
|
PopoverMenuList,
|
|
2723
2838
|
{
|
|
2724
2839
|
items,
|
|
@@ -2728,55 +2843,55 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2728
2843
|
selectedValue: variable,
|
|
2729
2844
|
"data-testid": `${variableType}-variables-list`,
|
|
2730
2845
|
menuListTemplate: VariablesStyledMenuList,
|
|
2731
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2846
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React20.createElement(MenuItemContent, { item })
|
|
2732
2847
|
}
|
|
2733
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2848
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2734
2849
|
NoSearchResults,
|
|
2735
2850
|
{
|
|
2736
2851
|
searchValue,
|
|
2737
2852
|
onClear: handleClearSearch,
|
|
2738
|
-
icon: /* @__PURE__ */
|
|
2853
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" })
|
|
2739
2854
|
}
|
|
2740
|
-
), disabled && /* @__PURE__ */
|
|
2855
|
+
), disabled && /* @__PURE__ */ React20.createElement(
|
|
2741
2856
|
EmptyState,
|
|
2742
2857
|
{
|
|
2743
2858
|
title: sprintf3(
|
|
2744
2859
|
/* translators: %s: Variable Type. */
|
|
2745
|
-
|
|
2860
|
+
__15("No %s variables yet", "elementor"),
|
|
2746
2861
|
variableType
|
|
2747
2862
|
),
|
|
2748
2863
|
message: sprintf3(
|
|
2749
2864
|
/* translators: %s: Variable Type. */
|
|
2750
|
-
|
|
2865
|
+
__15("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2751
2866
|
variableType
|
|
2752
2867
|
),
|
|
2753
|
-
icon: /* @__PURE__ */
|
|
2868
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" })
|
|
2754
2869
|
},
|
|
2755
2870
|
emptyState
|
|
2756
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2871
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React20.createElement(
|
|
2757
2872
|
EmptyState,
|
|
2758
2873
|
{
|
|
2759
2874
|
title: sprintf3(
|
|
2760
2875
|
/* translators: %s: Variable Type. */
|
|
2761
|
-
|
|
2876
|
+
__15("Create your first %s variable", "elementor"),
|
|
2762
2877
|
variableType
|
|
2763
2878
|
),
|
|
2764
|
-
message:
|
|
2879
|
+
message: __15(
|
|
2765
2880
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2766
2881
|
"elementor"
|
|
2767
2882
|
),
|
|
2768
|
-
icon: /* @__PURE__ */
|
|
2883
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" }),
|
|
2769
2884
|
onAdd
|
|
2770
2885
|
}
|
|
2771
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2886
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React20.createElement(
|
|
2772
2887
|
EmptyState,
|
|
2773
2888
|
{
|
|
2774
|
-
title:
|
|
2775
|
-
message:
|
|
2889
|
+
title: __15("No compatible variables", "elementor"),
|
|
2890
|
+
message: __15(
|
|
2776
2891
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2777
2892
|
"elementor"
|
|
2778
2893
|
),
|
|
2779
|
-
icon: /* @__PURE__ */
|
|
2894
|
+
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" }),
|
|
2780
2895
|
onAdd
|
|
2781
2896
|
}
|
|
2782
2897
|
));
|
|
@@ -2787,13 +2902,13 @@ var VIEW_LIST = "list";
|
|
|
2787
2902
|
var VIEW_ADD = "add";
|
|
2788
2903
|
var VIEW_EDIT = "edit";
|
|
2789
2904
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2790
|
-
const [currentView, setCurrentView] =
|
|
2791
|
-
const [editId, setEditId] =
|
|
2905
|
+
const [currentView, setCurrentView] = useState13(VIEW_LIST);
|
|
2906
|
+
const [editId, setEditId] = useState13("");
|
|
2792
2907
|
const { open } = usePanelActions();
|
|
2793
2908
|
const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
|
|
2794
2909
|
open();
|
|
2795
2910
|
} : void 0;
|
|
2796
|
-
return /* @__PURE__ */
|
|
2911
|
+
return /* @__PURE__ */ React21.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React21.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2797
2912
|
propTypeKey,
|
|
2798
2913
|
currentView,
|
|
2799
2914
|
selectedVariable,
|
|
@@ -2840,7 +2955,7 @@ function RenderView(props) {
|
|
|
2840
2955
|
}
|
|
2841
2956
|
};
|
|
2842
2957
|
if (VIEW_LIST === props.currentView) {
|
|
2843
|
-
return /* @__PURE__ */
|
|
2958
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2844
2959
|
VariablesSelection,
|
|
2845
2960
|
{
|
|
2846
2961
|
closePopover: handlers.onClose,
|
|
@@ -2852,10 +2967,10 @@ function RenderView(props) {
|
|
|
2852
2967
|
);
|
|
2853
2968
|
}
|
|
2854
2969
|
if (VIEW_ADD === props.currentView) {
|
|
2855
|
-
return /* @__PURE__ */
|
|
2970
|
+
return /* @__PURE__ */ React21.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2856
2971
|
}
|
|
2857
2972
|
if (VIEW_EDIT === props.currentView) {
|
|
2858
|
-
return /* @__PURE__ */
|
|
2973
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2859
2974
|
VariableEdit,
|
|
2860
2975
|
{
|
|
2861
2976
|
editId: props.editId,
|
|
@@ -2869,26 +2984,26 @@ function RenderView(props) {
|
|
|
2869
2984
|
}
|
|
2870
2985
|
|
|
2871
2986
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2872
|
-
import * as
|
|
2987
|
+
import * as React22 from "react";
|
|
2873
2988
|
import { DetachIcon } from "@elementor/icons";
|
|
2874
|
-
import { Box as Box3, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as
|
|
2875
|
-
import { __ as
|
|
2989
|
+
import { Box as Box3, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography11, UnstableTag as Tag } from "@elementor/ui";
|
|
2990
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2876
2991
|
var SIZE6 = "tiny";
|
|
2877
|
-
var UNLINK_LABEL =
|
|
2992
|
+
var UNLINK_LABEL = __16("Unlink variable", "elementor");
|
|
2878
2993
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2879
2994
|
const actions = [];
|
|
2880
2995
|
if (onUnlink) {
|
|
2881
2996
|
actions.push(
|
|
2882
|
-
/* @__PURE__ */
|
|
2997
|
+
/* @__PURE__ */ React22.createElement(Tooltip4, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React22.createElement(IconButton8, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React22.createElement(DetachIcon, { fontSize: SIZE6 })))
|
|
2883
2998
|
);
|
|
2884
2999
|
}
|
|
2885
|
-
return /* @__PURE__ */
|
|
3000
|
+
return /* @__PURE__ */ React22.createElement(Tooltip4, { title: label, placement: "top" }, /* @__PURE__ */ React22.createElement(
|
|
2886
3001
|
Tag,
|
|
2887
3002
|
{
|
|
2888
3003
|
fullWidth: true,
|
|
2889
3004
|
showActionsOnHover: true,
|
|
2890
|
-
startIcon: /* @__PURE__ */
|
|
2891
|
-
label: /* @__PURE__ */
|
|
3005
|
+
startIcon: /* @__PURE__ */ React22.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
3006
|
+
label: /* @__PURE__ */ React22.createElement(Box3, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React22.createElement(Typography11, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
2892
3007
|
actions,
|
|
2893
3008
|
...props
|
|
2894
3009
|
}
|
|
@@ -2907,15 +3022,15 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2907
3022
|
});
|
|
2908
3023
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
2909
3024
|
const StartIcon = startIcon || (() => null);
|
|
2910
|
-
return /* @__PURE__ */
|
|
3025
|
+
return /* @__PURE__ */ React23.createElement(Box4, { ref: anchorRef }, /* @__PURE__ */ React23.createElement(
|
|
2911
3026
|
AssignedTag,
|
|
2912
3027
|
{
|
|
2913
3028
|
label: variable.label,
|
|
2914
|
-
startIcon: /* @__PURE__ */
|
|
3029
|
+
startIcon: /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(ColorFilterIcon3, { fontSize: SIZE6 }), /* @__PURE__ */ React23.createElement(StartIcon, { value: variable.value })),
|
|
2915
3030
|
onUnlink: unlinkVariable,
|
|
2916
3031
|
...bindTrigger3(popupState)
|
|
2917
3032
|
}
|
|
2918
|
-
), /* @__PURE__ */
|
|
3033
|
+
), /* @__PURE__ */ React23.createElement(
|
|
2919
3034
|
Popover,
|
|
2920
3035
|
{
|
|
2921
3036
|
disableScrollLock: true,
|
|
@@ -2927,7 +3042,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2927
3042
|
},
|
|
2928
3043
|
...bindPopover(popupState)
|
|
2929
3044
|
},
|
|
2930
|
-
/* @__PURE__ */
|
|
3045
|
+
/* @__PURE__ */ React23.createElement(
|
|
2931
3046
|
VariableSelectionPopover,
|
|
2932
3047
|
{
|
|
2933
3048
|
selectedVariable: variable,
|
|
@@ -2939,19 +3054,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2939
3054
|
};
|
|
2940
3055
|
|
|
2941
3056
|
// src/components/ui/variable/deleted-variable.tsx
|
|
2942
|
-
import * as
|
|
2943
|
-
import { useId as useId2, useRef as useRef8, useState as
|
|
3057
|
+
import * as React27 from "react";
|
|
3058
|
+
import { useId as useId2, useRef as useRef8, useState as useState15 } from "react";
|
|
2944
3059
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
2945
3060
|
import { Backdrop, bindPopover as bindPopover2, Box as Box6, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2946
|
-
import { __ as
|
|
3061
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2947
3062
|
|
|
2948
3063
|
// src/components/variable-restore.tsx
|
|
2949
|
-
import * as
|
|
2950
|
-
import { useState as
|
|
3064
|
+
import * as React24 from "react";
|
|
3065
|
+
import { useState as useState14 } from "react";
|
|
2951
3066
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
2952
3067
|
import { PopoverHeader as PopoverHeader4, SectionPopoverBody as SectionPopoverBody4 } from "@elementor/editor-ui";
|
|
2953
|
-
import { Button as
|
|
2954
|
-
import { __ as
|
|
3068
|
+
import { Button as Button7, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography12 } from "@elementor/ui";
|
|
3069
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
2955
3070
|
var SIZE7 = "tiny";
|
|
2956
3071
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
2957
3072
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -2961,11 +3076,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2961
3076
|
if (!variable) {
|
|
2962
3077
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2963
3078
|
}
|
|
2964
|
-
const [errorMessage, setErrorMessage] =
|
|
2965
|
-
const [valueFieldError, setValueFieldError] =
|
|
2966
|
-
const [label, setLabel] =
|
|
2967
|
-
const [value, setValue] =
|
|
2968
|
-
const [propTypeKey, setPropTypeKey] =
|
|
3079
|
+
const [errorMessage, setErrorMessage] = useState14("");
|
|
3080
|
+
const [valueFieldError, setValueFieldError] = useState14("");
|
|
3081
|
+
const [label, setLabel] = useState14(variable.label);
|
|
3082
|
+
const [value, setValue] = useState14(variable.value);
|
|
3083
|
+
const [propTypeKey, setPropTypeKey] = useState14(variable?.type ?? propTypeUtil.key);
|
|
2969
3084
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
2970
3085
|
value: variable.label,
|
|
2971
3086
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3011,22 +3126,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3011
3126
|
handleRestore();
|
|
3012
3127
|
}
|
|
3013
3128
|
};
|
|
3014
|
-
return /* @__PURE__ */
|
|
3129
|
+
return /* @__PURE__ */ React24.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React24.createElement(SectionPopoverBody4, { height: "auto" }, /* @__PURE__ */ React24.createElement(
|
|
3015
3130
|
PopoverHeader4,
|
|
3016
3131
|
{
|
|
3017
|
-
icon: /* @__PURE__ */
|
|
3018
|
-
title:
|
|
3132
|
+
icon: /* @__PURE__ */ React24.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3133
|
+
title: __17("Restore variable", "elementor"),
|
|
3019
3134
|
onClose
|
|
3020
3135
|
}
|
|
3021
|
-
), /* @__PURE__ */
|
|
3136
|
+
), /* @__PURE__ */ React24.createElement(Divider5, null), /* @__PURE__ */ React24.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React24.createElement(
|
|
3022
3137
|
FormField,
|
|
3023
3138
|
{
|
|
3024
3139
|
id: "variable-label",
|
|
3025
|
-
label:
|
|
3140
|
+
label: __17("Name", "elementor"),
|
|
3026
3141
|
errorMsg: labelFieldError?.message,
|
|
3027
3142
|
noticeMsg: labelHint(label)
|
|
3028
3143
|
},
|
|
3029
|
-
/* @__PURE__ */
|
|
3144
|
+
/* @__PURE__ */ React24.createElement(
|
|
3030
3145
|
LabelField,
|
|
3031
3146
|
{
|
|
3032
3147
|
id: "variable-label",
|
|
@@ -3045,7 +3160,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3045
3160
|
onKeyDown: handleKeyDown
|
|
3046
3161
|
}
|
|
3047
3162
|
)
|
|
3048
|
-
), ValueField && /* @__PURE__ */
|
|
3163
|
+
), ValueField && /* @__PURE__ */ React24.createElement(FormField, { errorMsg: valueFieldError, label: __17("Value", "elementor") }, /* @__PURE__ */ React24.createElement(Typography12, { variant: "h5" }, /* @__PURE__ */ React24.createElement(
|
|
3049
3164
|
ValueField,
|
|
3050
3165
|
{
|
|
3051
3166
|
propTypeKey,
|
|
@@ -3060,25 +3175,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3060
3175
|
propType,
|
|
3061
3176
|
onKeyDown: handleKeyDown
|
|
3062
3177
|
}
|
|
3063
|
-
))), errorMessage && /* @__PURE__ */
|
|
3178
|
+
))), errorMessage && /* @__PURE__ */ React24.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React24.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React24.createElement(Button7, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __17("Restore", "elementor")))));
|
|
3064
3179
|
};
|
|
3065
3180
|
|
|
3066
3181
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3067
|
-
import * as
|
|
3068
|
-
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as
|
|
3069
|
-
import { __ as
|
|
3182
|
+
import * as React25 from "react";
|
|
3183
|
+
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as Typography13 } from "@elementor/ui";
|
|
3184
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
3070
3185
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3071
|
-
return /* @__PURE__ */
|
|
3186
|
+
return /* @__PURE__ */ React25.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React25.createElement(
|
|
3072
3187
|
Alert2,
|
|
3073
3188
|
{
|
|
3074
3189
|
variant: "standard",
|
|
3075
3190
|
severity: "warning",
|
|
3076
3191
|
onClose,
|
|
3077
|
-
action: /* @__PURE__ */
|
|
3192
|
+
action: /* @__PURE__ */ React25.createElement(React25.Fragment, null, onUnlink && /* @__PURE__ */ React25.createElement(AlertAction2, { variant: "contained", onClick: onUnlink }, __18("Unlink", "elementor")), onRestore && /* @__PURE__ */ React25.createElement(AlertAction2, { variant: "outlined", onClick: onRestore }, __18("Restore", "elementor"))),
|
|
3078
3193
|
sx: { maxWidth: 300 }
|
|
3079
3194
|
},
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3195
|
+
/* @__PURE__ */ React25.createElement(AlertTitle2, null, __18("Deleted variable", "elementor")),
|
|
3196
|
+
/* @__PURE__ */ React25.createElement(Typography13, { variant: "body2", color: "textPrimary" }, __18("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React25.createElement(Typography13, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", __18(
|
|
3082
3197
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3083
3198
|
"elementor"
|
|
3084
3199
|
))
|
|
@@ -3086,13 +3201,13 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3086
3201
|
};
|
|
3087
3202
|
|
|
3088
3203
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3089
|
-
import * as
|
|
3204
|
+
import * as React26 from "react";
|
|
3090
3205
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon4 } from "@elementor/icons";
|
|
3091
|
-
import { Box as Box5, Chip, Tooltip as Tooltip5, Typography as
|
|
3092
|
-
var WarningVariableTag =
|
|
3206
|
+
import { Box as Box5, Chip, Tooltip as Tooltip5, Typography as Typography14 } from "@elementor/ui";
|
|
3207
|
+
var WarningVariableTag = React26.forwardRef(
|
|
3093
3208
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3094
3209
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3095
|
-
return /* @__PURE__ */
|
|
3210
|
+
return /* @__PURE__ */ React26.createElement(
|
|
3096
3211
|
Chip,
|
|
3097
3212
|
{
|
|
3098
3213
|
ref,
|
|
@@ -3101,8 +3216,8 @@ var WarningVariableTag = React25.forwardRef(
|
|
|
3101
3216
|
shape: "rounded",
|
|
3102
3217
|
variant: "standard",
|
|
3103
3218
|
onClick,
|
|
3104
|
-
icon: /* @__PURE__ */
|
|
3105
|
-
label: /* @__PURE__ */
|
|
3219
|
+
icon: /* @__PURE__ */ React26.createElement(AlertTriangleFilledIcon4, null),
|
|
3220
|
+
label: /* @__PURE__ */ React26.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React26.createElement(Box5, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React26.createElement(Typography14, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3106
3221
|
sx: {
|
|
3107
3222
|
height: (theme) => theme.spacing(3.5),
|
|
3108
3223
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3121,7 +3236,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3121
3236
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3122
3237
|
const boundProp = useBoundProp8();
|
|
3123
3238
|
const userPermissions = usePermissions();
|
|
3124
|
-
const [showInfotip, setShowInfotip] =
|
|
3239
|
+
const [showInfotip, setShowInfotip] = useState15(false);
|
|
3125
3240
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3126
3241
|
const closeInfotip = () => setShowInfotip(false);
|
|
3127
3242
|
const deletedChipAnchorRef = useRef8(null);
|
|
@@ -3152,7 +3267,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3152
3267
|
const handleRestoreWithOverrides = () => {
|
|
3153
3268
|
popupState.close();
|
|
3154
3269
|
};
|
|
3155
|
-
return /* @__PURE__ */
|
|
3270
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(Box6, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React27.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React27.createElement(
|
|
3156
3271
|
Infotip2,
|
|
3157
3272
|
{
|
|
3158
3273
|
color: "warning",
|
|
@@ -3160,7 +3275,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3160
3275
|
open: showInfotip,
|
|
3161
3276
|
disableHoverListener: true,
|
|
3162
3277
|
onClose: closeInfotip,
|
|
3163
|
-
content: /* @__PURE__ */
|
|
3278
|
+
content: /* @__PURE__ */ React27.createElement(
|
|
3164
3279
|
DeletedVariableAlert,
|
|
3165
3280
|
{
|
|
3166
3281
|
onClose: closeInfotip,
|
|
@@ -3180,15 +3295,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3180
3295
|
}
|
|
3181
3296
|
}
|
|
3182
3297
|
},
|
|
3183
|
-
/* @__PURE__ */
|
|
3298
|
+
/* @__PURE__ */ React27.createElement(
|
|
3184
3299
|
WarningVariableTag,
|
|
3185
3300
|
{
|
|
3186
3301
|
label: variable.label,
|
|
3187
3302
|
onClick: toggleInfotip,
|
|
3188
|
-
suffix:
|
|
3303
|
+
suffix: __19("deleted", "elementor")
|
|
3189
3304
|
}
|
|
3190
3305
|
)
|
|
3191
|
-
), /* @__PURE__ */
|
|
3306
|
+
), /* @__PURE__ */ React27.createElement(
|
|
3192
3307
|
Popover2,
|
|
3193
3308
|
{
|
|
3194
3309
|
disableScrollLock: true,
|
|
@@ -3199,7 +3314,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3199
3314
|
},
|
|
3200
3315
|
...bindPopover2(popupState)
|
|
3201
3316
|
},
|
|
3202
|
-
/* @__PURE__ */
|
|
3317
|
+
/* @__PURE__ */ React27.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React27.createElement(
|
|
3203
3318
|
VariableRestore,
|
|
3204
3319
|
{
|
|
3205
3320
|
variableId: variable.key ?? "",
|
|
@@ -3211,39 +3326,39 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3211
3326
|
};
|
|
3212
3327
|
|
|
3213
3328
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3214
|
-
import * as
|
|
3215
|
-
import { useId as useId3, useRef as useRef9, useState as
|
|
3329
|
+
import * as React29 from "react";
|
|
3330
|
+
import { useId as useId3, useRef as useRef9, useState as useState16 } from "react";
|
|
3216
3331
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
3217
3332
|
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box7, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
3218
|
-
import { __ as
|
|
3333
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
3219
3334
|
|
|
3220
3335
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3221
|
-
import * as
|
|
3222
|
-
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as
|
|
3223
|
-
import { __ as
|
|
3336
|
+
import * as React28 from "react";
|
|
3337
|
+
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as Typography15 } from "@elementor/ui";
|
|
3338
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
3224
3339
|
var i18n = {
|
|
3225
|
-
title:
|
|
3226
|
-
message:
|
|
3340
|
+
title: __20("Variable has changed", "elementor"),
|
|
3341
|
+
message: __20(
|
|
3227
3342
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
3228
3343
|
"elementor"
|
|
3229
3344
|
),
|
|
3230
3345
|
buttons: {
|
|
3231
|
-
clear:
|
|
3232
|
-
select:
|
|
3346
|
+
clear: __20("Clear", "elementor"),
|
|
3347
|
+
select: __20("Select variable", "elementor")
|
|
3233
3348
|
}
|
|
3234
3349
|
};
|
|
3235
3350
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3236
|
-
return /* @__PURE__ */
|
|
3351
|
+
return /* @__PURE__ */ React28.createElement(ClickAwayListener3, { onClickAway: onClose }, /* @__PURE__ */ React28.createElement(
|
|
3237
3352
|
Alert3,
|
|
3238
3353
|
{
|
|
3239
3354
|
variant: "standard",
|
|
3240
3355
|
severity: "warning",
|
|
3241
3356
|
onClose,
|
|
3242
|
-
action: /* @__PURE__ */
|
|
3357
|
+
action: /* @__PURE__ */ React28.createElement(React28.Fragment, null, onClear && /* @__PURE__ */ React28.createElement(AlertAction3, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React28.createElement(AlertAction3, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3243
3358
|
sx: { maxWidth: 300 }
|
|
3244
3359
|
},
|
|
3245
|
-
/* @__PURE__ */
|
|
3246
|
-
/* @__PURE__ */
|
|
3360
|
+
/* @__PURE__ */ React28.createElement(AlertTitle3, null, i18n.title),
|
|
3361
|
+
/* @__PURE__ */ React28.createElement(Typography15, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3247
3362
|
));
|
|
3248
3363
|
};
|
|
3249
3364
|
|
|
@@ -3256,7 +3371,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3256
3371
|
variant: "popover",
|
|
3257
3372
|
popupId: `elementor-variables-list-${popupId}`
|
|
3258
3373
|
});
|
|
3259
|
-
const [infotipVisible, setInfotipVisible] =
|
|
3374
|
+
const [infotipVisible, setInfotipVisible] = useState16(false);
|
|
3260
3375
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3261
3376
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3262
3377
|
const triggerSelect = () => {
|
|
@@ -3269,7 +3384,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3269
3384
|
setValue(null);
|
|
3270
3385
|
};
|
|
3271
3386
|
const showClearButton = !!value;
|
|
3272
|
-
return /* @__PURE__ */
|
|
3387
|
+
return /* @__PURE__ */ React29.createElement(Box7, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React29.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React29.createElement(
|
|
3273
3388
|
Infotip3,
|
|
3274
3389
|
{
|
|
3275
3390
|
color: "warning",
|
|
@@ -3277,7 +3392,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3277
3392
|
open: infotipVisible,
|
|
3278
3393
|
disableHoverListener: true,
|
|
3279
3394
|
onClose: closeInfotip,
|
|
3280
|
-
content: /* @__PURE__ */
|
|
3395
|
+
content: /* @__PURE__ */ React29.createElement(
|
|
3281
3396
|
MismatchVariableAlert,
|
|
3282
3397
|
{
|
|
3283
3398
|
onClose: closeInfotip,
|
|
@@ -3296,15 +3411,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3296
3411
|
}
|
|
3297
3412
|
}
|
|
3298
3413
|
},
|
|
3299
|
-
/* @__PURE__ */
|
|
3414
|
+
/* @__PURE__ */ React29.createElement(
|
|
3300
3415
|
WarningVariableTag,
|
|
3301
3416
|
{
|
|
3302
3417
|
label: variable.label,
|
|
3303
3418
|
onClick: toggleInfotip,
|
|
3304
|
-
suffix:
|
|
3419
|
+
suffix: __21("changed", "elementor")
|
|
3305
3420
|
}
|
|
3306
3421
|
)
|
|
3307
|
-
), /* @__PURE__ */
|
|
3422
|
+
), /* @__PURE__ */ React29.createElement(
|
|
3308
3423
|
Popover3,
|
|
3309
3424
|
{
|
|
3310
3425
|
disableScrollLock: true,
|
|
@@ -3316,7 +3431,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3316
3431
|
},
|
|
3317
3432
|
...bindPopover3(popupState)
|
|
3318
3433
|
},
|
|
3319
|
-
/* @__PURE__ */
|
|
3434
|
+
/* @__PURE__ */ React29.createElement(
|
|
3320
3435
|
VariableSelectionPopover,
|
|
3321
3436
|
{
|
|
3322
3437
|
selectedVariable: variable,
|
|
@@ -3328,28 +3443,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3328
3443
|
};
|
|
3329
3444
|
|
|
3330
3445
|
// src/components/ui/variable/missing-variable.tsx
|
|
3331
|
-
import * as
|
|
3332
|
-
import { useState as
|
|
3446
|
+
import * as React31 from "react";
|
|
3447
|
+
import { useState as useState17 } from "react";
|
|
3333
3448
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
3334
3449
|
import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
|
|
3335
|
-
import { __ as
|
|
3450
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3336
3451
|
|
|
3337
3452
|
// src/components/ui/missing-variable-alert.tsx
|
|
3338
|
-
import * as
|
|
3339
|
-
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as
|
|
3340
|
-
import { __ as
|
|
3453
|
+
import * as React30 from "react";
|
|
3454
|
+
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as Typography16 } from "@elementor/ui";
|
|
3455
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
3341
3456
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3342
|
-
return /* @__PURE__ */
|
|
3457
|
+
return /* @__PURE__ */ React30.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React30.createElement(
|
|
3343
3458
|
Alert4,
|
|
3344
3459
|
{
|
|
3345
3460
|
variant: "standard",
|
|
3346
3461
|
severity: "warning",
|
|
3347
3462
|
onClose,
|
|
3348
|
-
action: /* @__PURE__ */
|
|
3463
|
+
action: /* @__PURE__ */ React30.createElement(React30.Fragment, null, onClear && /* @__PURE__ */ React30.createElement(AlertAction4, { variant: "contained", onClick: onClear }, __22("Clear", "elementor"))),
|
|
3349
3464
|
sx: { maxWidth: 300 }
|
|
3350
3465
|
},
|
|
3351
|
-
/* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3466
|
+
/* @__PURE__ */ React30.createElement(AlertTitle4, null, __22("This variable is missing", "elementor")),
|
|
3467
|
+
/* @__PURE__ */ React30.createElement(Typography16, { variant: "body2", color: "textPrimary" }, __22(
|
|
3353
3468
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3354
3469
|
"elementor"
|
|
3355
3470
|
))
|
|
@@ -3359,11 +3474,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3359
3474
|
// src/components/ui/variable/missing-variable.tsx
|
|
3360
3475
|
var MissingVariable = () => {
|
|
3361
3476
|
const { setValue } = useBoundProp10();
|
|
3362
|
-
const [infotipVisible, setInfotipVisible] =
|
|
3477
|
+
const [infotipVisible, setInfotipVisible] = useState17(false);
|
|
3363
3478
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3364
3479
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3365
3480
|
const clearValue = () => setValue(null);
|
|
3366
|
-
return /* @__PURE__ */
|
|
3481
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, infotipVisible && /* @__PURE__ */ React31.createElement(Backdrop3, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React31.createElement(
|
|
3367
3482
|
Infotip4,
|
|
3368
3483
|
{
|
|
3369
3484
|
color: "warning",
|
|
@@ -3371,7 +3486,7 @@ var MissingVariable = () => {
|
|
|
3371
3486
|
open: infotipVisible,
|
|
3372
3487
|
disableHoverListener: true,
|
|
3373
3488
|
onClose: closeInfotip,
|
|
3374
|
-
content: /* @__PURE__ */
|
|
3489
|
+
content: /* @__PURE__ */ React31.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3375
3490
|
slotProps: {
|
|
3376
3491
|
popper: {
|
|
3377
3492
|
modifiers: [
|
|
@@ -3383,7 +3498,7 @@ var MissingVariable = () => {
|
|
|
3383
3498
|
}
|
|
3384
3499
|
}
|
|
3385
3500
|
},
|
|
3386
|
-
/* @__PURE__ */
|
|
3501
|
+
/* @__PURE__ */ React31.createElement(WarningVariableTag, { label: __23("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3387
3502
|
));
|
|
3388
3503
|
};
|
|
3389
3504
|
|
|
@@ -3393,37 +3508,37 @@ var VariableControl = () => {
|
|
|
3393
3508
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3394
3509
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3395
3510
|
if (!assignedVariable) {
|
|
3396
|
-
return /* @__PURE__ */
|
|
3511
|
+
return /* @__PURE__ */ React32.createElement(MissingVariable, null);
|
|
3397
3512
|
}
|
|
3398
3513
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3399
3514
|
if (assignedVariable?.deleted) {
|
|
3400
|
-
return /* @__PURE__ */
|
|
3515
|
+
return /* @__PURE__ */ React32.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3401
3516
|
}
|
|
3402
3517
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3403
3518
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3404
|
-
return /* @__PURE__ */
|
|
3519
|
+
return /* @__PURE__ */ React32.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3405
3520
|
}
|
|
3406
|
-
return /* @__PURE__ */
|
|
3521
|
+
return /* @__PURE__ */ React32.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3407
3522
|
};
|
|
3408
3523
|
|
|
3409
3524
|
// src/hooks/use-prop-variable-action.tsx
|
|
3410
|
-
import * as
|
|
3525
|
+
import * as React33 from "react";
|
|
3411
3526
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-controls";
|
|
3412
3527
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
3413
|
-
import { __ as
|
|
3528
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3414
3529
|
var usePropVariableAction = () => {
|
|
3415
3530
|
const { propType, path } = useBoundProp12();
|
|
3416
3531
|
const variable = resolveVariableFromPropType(propType);
|
|
3417
3532
|
return {
|
|
3418
3533
|
visible: Boolean(variable),
|
|
3419
3534
|
icon: ColorFilterIcon4,
|
|
3420
|
-
title:
|
|
3535
|
+
title: __24("Variables", "elementor"),
|
|
3421
3536
|
content: ({ close: closePopover }) => {
|
|
3422
3537
|
if (!variable) {
|
|
3423
3538
|
return null;
|
|
3424
3539
|
}
|
|
3425
3540
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3426
|
-
return /* @__PURE__ */
|
|
3541
|
+
return /* @__PURE__ */ React33.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3427
3542
|
}
|
|
3428
3543
|
};
|
|
3429
3544
|
};
|
|
@@ -3564,18 +3679,20 @@ function initMcp() {
|
|
|
3564
3679
|
}
|
|
3565
3680
|
|
|
3566
3681
|
// src/register-variable-types.tsx
|
|
3567
|
-
import * as
|
|
3682
|
+
import * as React36 from "react";
|
|
3568
3683
|
import { colorPropTypeUtil, sizePropTypeUtil, stringPropTypeUtil } from "@elementor/editor-props";
|
|
3569
3684
|
import { CtaButton } from "@elementor/editor-ui";
|
|
3570
|
-
import {
|
|
3685
|
+
import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
|
|
3686
|
+
import { BrushIcon as BrushIcon2, ExpandDiagonalIcon, ResetIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
3687
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
3571
3688
|
|
|
3572
3689
|
// src/components/fields/color-field.tsx
|
|
3573
|
-
import * as
|
|
3574
|
-
import { useRef as useRef10, useState as
|
|
3690
|
+
import * as React34 from "react";
|
|
3691
|
+
import { useRef as useRef10, useState as useState18 } from "react";
|
|
3575
3692
|
import { UnstableColorField } from "@elementor/ui";
|
|
3576
3693
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3577
|
-
const [color, setColor] =
|
|
3578
|
-
const [errorMessage, setErrorMessage] =
|
|
3694
|
+
const [color, setColor] = useState18(value);
|
|
3695
|
+
const [errorMessage, setErrorMessage] = useState18("");
|
|
3579
3696
|
const defaultRef = useRef10(null);
|
|
3580
3697
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3581
3698
|
const handleChange = (newValue) => {
|
|
@@ -3585,7 +3702,7 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3585
3702
|
onValidationChange?.(errorMsg);
|
|
3586
3703
|
onChange(errorMsg ? "" : newValue);
|
|
3587
3704
|
};
|
|
3588
|
-
return /* @__PURE__ */
|
|
3705
|
+
return /* @__PURE__ */ React34.createElement(
|
|
3589
3706
|
UnstableColorField,
|
|
3590
3707
|
{
|
|
3591
3708
|
id: "color-variable-field",
|
|
@@ -3614,21 +3731,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3614
3731
|
};
|
|
3615
3732
|
|
|
3616
3733
|
// src/components/fields/font-field.tsx
|
|
3617
|
-
import * as
|
|
3618
|
-
import { useId as useId4, useRef as useRef11, useState as
|
|
3734
|
+
import * as React35 from "react";
|
|
3735
|
+
import { useId as useId4, useRef as useRef11, useState as useState19 } from "react";
|
|
3619
3736
|
import { enqueueFont as enqueueFont2, ItemSelector, useFontFamilies } from "@elementor/editor-controls";
|
|
3620
3737
|
import { useSectionWidth } from "@elementor/editor-ui";
|
|
3621
3738
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
3622
3739
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
3623
|
-
import { __ as
|
|
3740
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3624
3741
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3625
|
-
const [fontFamily, setFontFamily] =
|
|
3742
|
+
const [fontFamily, setFontFamily] = useState19(value);
|
|
3626
3743
|
const defaultRef = useRef11(null);
|
|
3627
3744
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3628
3745
|
const fontPopoverState = usePopupState6({ variant: "popover" });
|
|
3629
3746
|
const fontFamilies = useFontFamilies();
|
|
3630
3747
|
const sectionWidth = useSectionWidth();
|
|
3631
|
-
const mapFontSubs =
|
|
3748
|
+
const mapFontSubs = React35.useMemo(() => {
|
|
3632
3749
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3633
3750
|
label,
|
|
3634
3751
|
items: fonts
|
|
@@ -3645,17 +3762,17 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3645
3762
|
fontPopoverState.close();
|
|
3646
3763
|
};
|
|
3647
3764
|
const id2 = useId4();
|
|
3648
|
-
return /* @__PURE__ */
|
|
3765
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, /* @__PURE__ */ React35.createElement(
|
|
3649
3766
|
UnstableTag,
|
|
3650
3767
|
{
|
|
3651
3768
|
id: id2,
|
|
3652
3769
|
variant: "outlined",
|
|
3653
3770
|
label: fontFamily,
|
|
3654
|
-
endIcon: /* @__PURE__ */
|
|
3771
|
+
endIcon: /* @__PURE__ */ React35.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
3655
3772
|
...bindTrigger4(fontPopoverState),
|
|
3656
3773
|
fullWidth: true
|
|
3657
3774
|
}
|
|
3658
|
-
), /* @__PURE__ */
|
|
3775
|
+
), /* @__PURE__ */ React35.createElement(
|
|
3659
3776
|
Popover4,
|
|
3660
3777
|
{
|
|
3661
3778
|
disablePortal: true,
|
|
@@ -3665,7 +3782,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3665
3782
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3666
3783
|
...bindPopover4(fontPopoverState)
|
|
3667
3784
|
},
|
|
3668
|
-
/* @__PURE__ */
|
|
3785
|
+
/* @__PURE__ */ React35.createElement(
|
|
3669
3786
|
ItemSelector,
|
|
3670
3787
|
{
|
|
3671
3788
|
id: "font-family-variables-selector",
|
|
@@ -3674,7 +3791,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3674
3791
|
onItemChange: handleFontFamilyChange,
|
|
3675
3792
|
onClose: fontPopoverState.close,
|
|
3676
3793
|
sectionWidth,
|
|
3677
|
-
title:
|
|
3794
|
+
title: __25("Font family", "elementor"),
|
|
3678
3795
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
3679
3796
|
onDebounce: enqueueFont2,
|
|
3680
3797
|
icon: TextIcon
|
|
@@ -3699,12 +3816,34 @@ function registerVariableTypes() {
|
|
|
3699
3816
|
registerVariableType({
|
|
3700
3817
|
key: colorVariablePropTypeUtil.key,
|
|
3701
3818
|
valueField: ColorField,
|
|
3702
|
-
icon:
|
|
3819
|
+
icon: BrushIcon2,
|
|
3703
3820
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3704
3821
|
fallbackPropTypeUtil: colorPropTypeUtil,
|
|
3705
3822
|
variableType: "color",
|
|
3706
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3707
|
-
defaultValue: "#ffffff"
|
|
3823
|
+
startIcon: ({ value }) => /* @__PURE__ */ React36.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3824
|
+
defaultValue: "#ffffff",
|
|
3825
|
+
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3826
|
+
const actions = [];
|
|
3827
|
+
if (!isExperimentActive2("e_design_system_sync")) {
|
|
3828
|
+
return [];
|
|
3829
|
+
}
|
|
3830
|
+
if (variable.sync_to_v3) {
|
|
3831
|
+
actions.push({
|
|
3832
|
+
name: __26("Stop syncing to Version 3", "elementor"),
|
|
3833
|
+
icon: ResetIcon,
|
|
3834
|
+
color: "text.primary",
|
|
3835
|
+
onClick: () => handlers.onStopSync(variableId)
|
|
3836
|
+
});
|
|
3837
|
+
} else {
|
|
3838
|
+
actions.push({
|
|
3839
|
+
name: __26("Sync to Version 3", "elementor"),
|
|
3840
|
+
icon: ResetIcon,
|
|
3841
|
+
color: "text.primary",
|
|
3842
|
+
onClick: () => handlers.onStartSync(variableId)
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3845
|
+
return actions;
|
|
3846
|
+
}
|
|
3708
3847
|
});
|
|
3709
3848
|
registerVariableType({
|
|
3710
3849
|
key: fontVariablePropTypeUtil.key,
|
|
@@ -3723,7 +3862,7 @@ function registerVariableTypes() {
|
|
|
3723
3862
|
styleTransformer: EmptyTransformer,
|
|
3724
3863
|
variableType: "size",
|
|
3725
3864
|
selectionFilter: () => [],
|
|
3726
|
-
emptyState: /* @__PURE__ */
|
|
3865
|
+
emptyState: /* @__PURE__ */ React36.createElement(CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3727
3866
|
};
|
|
3728
3867
|
registerVariableType({
|
|
3729
3868
|
...sizePromotions,
|
|
@@ -3737,8 +3876,8 @@ function registerVariableTypes() {
|
|
|
3737
3876
|
}
|
|
3738
3877
|
|
|
3739
3878
|
// src/renderers/style-variables-renderer.tsx
|
|
3740
|
-
import * as
|
|
3741
|
-
import { useEffect as useEffect6, useState as
|
|
3879
|
+
import * as React37 from "react";
|
|
3880
|
+
import { useEffect as useEffect6, useState as useState20 } from "react";
|
|
3742
3881
|
import {
|
|
3743
3882
|
__privateUseListenTo as useListenTo,
|
|
3744
3883
|
commandEndEvent,
|
|
@@ -3755,13 +3894,13 @@ function StyleVariablesRenderer() {
|
|
|
3755
3894
|
}
|
|
3756
3895
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3757
3896
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3758
|
-
return /* @__PURE__ */
|
|
3897
|
+
return /* @__PURE__ */ React37.createElement(Portal, { container }, /* @__PURE__ */ React37.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3759
3898
|
}
|
|
3760
3899
|
function usePortalContainer() {
|
|
3761
3900
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
3762
3901
|
}
|
|
3763
3902
|
function useStyleVariables() {
|
|
3764
|
-
const [variables, setVariables] =
|
|
3903
|
+
const [variables, setVariables] = useState20({});
|
|
3765
3904
|
useEffect6(() => {
|
|
3766
3905
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3767
3906
|
return () => {
|
|
@@ -3785,22 +3924,22 @@ import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elemen
|
|
|
3785
3924
|
import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
3786
3925
|
|
|
3787
3926
|
// src/components/variables-repeater-item-slot.tsx
|
|
3788
|
-
import * as
|
|
3927
|
+
import * as React38 from "react";
|
|
3789
3928
|
var useColorVariable = (value) => {
|
|
3790
3929
|
const variableId = value?.value?.color?.value;
|
|
3791
3930
|
return useVariable(variableId || "");
|
|
3792
3931
|
};
|
|
3793
3932
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3794
3933
|
const colorVariable = useColorVariable(value);
|
|
3795
|
-
return /* @__PURE__ */
|
|
3934
|
+
return /* @__PURE__ */ React38.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3796
3935
|
};
|
|
3797
3936
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3798
3937
|
const colorVariable = useColorVariable(value);
|
|
3799
|
-
return /* @__PURE__ */
|
|
3938
|
+
return /* @__PURE__ */ React38.createElement("span", null, colorVariable?.label);
|
|
3800
3939
|
};
|
|
3801
3940
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3802
3941
|
const colorVariable = useColorVariable(value);
|
|
3803
|
-
return /* @__PURE__ */
|
|
3942
|
+
return /* @__PURE__ */ React38.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3804
3943
|
};
|
|
3805
3944
|
|
|
3806
3945
|
// src/repeater-injections.ts
|
|
@@ -3893,6 +4032,7 @@ var Utils = {
|
|
|
3893
4032
|
export {
|
|
3894
4033
|
GLOBAL_VARIABLES_URI,
|
|
3895
4034
|
Utils,
|
|
4035
|
+
getMenuActionsForVariable,
|
|
3896
4036
|
hasVariable,
|
|
3897
4037
|
init,
|
|
3898
4038
|
registerVariableType,
|