@elementor/editor-variables 4.0.0-552 → 4.0.0-573
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +740 -706
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +655 -633
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/ui/variable-promotion-chip.tsx +63 -0
- package/src/components/variables-manager/ui/variable-edit-menu.tsx +14 -3
- package/src/components/variables-manager/ui/variable-table-row.tsx +210 -0
- package/src/components/variables-manager/variable-editable-cell.tsx +12 -4
- package/src/components/variables-manager/variables-manager-create-menu.tsx +11 -38
- package/src/components/variables-manager/variables-manager-panel.tsx +31 -3
- package/src/components/variables-manager/variables-manager-table.tsx +17 -188
- package/src/hooks/use-quota-permissions.ts +2 -2
- package/src/components/ui/stop-sync-confirmation-dialog.tsx +0 -77
package/dist/index.mjs
CHANGED
|
@@ -6,12 +6,12 @@ import { isTransformable as isTransformable2 } from "@elementor/editor-props";
|
|
|
6
6
|
import { controlActionsMenu } from "@elementor/menus";
|
|
7
7
|
|
|
8
8
|
// src/components/open-panel-from-url.tsx
|
|
9
|
-
import { useEffect as useEffect4, useRef as
|
|
9
|
+
import { useEffect as useEffect4, useRef as useRef7 } 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 React14 from "react";
|
|
14
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState6 } from "react";
|
|
15
15
|
import {
|
|
16
16
|
__createPanel as createPanel,
|
|
17
17
|
Panel,
|
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
PanelHeader,
|
|
21
21
|
PanelHeaderTitle
|
|
22
22
|
} from "@elementor/editor-panels";
|
|
23
|
-
import { SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
23
|
+
import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
24
24
|
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
25
25
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2, ColorFilterIcon, TrashIcon } from "@elementor/icons";
|
|
26
26
|
import {
|
|
27
27
|
Alert,
|
|
28
28
|
AlertAction,
|
|
29
29
|
AlertTitle,
|
|
30
|
-
Button as
|
|
30
|
+
Button as Button2,
|
|
31
31
|
CloseButton,
|
|
32
32
|
Divider,
|
|
33
33
|
Infotip,
|
|
@@ -805,58 +805,10 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
805
805
|
);
|
|
806
806
|
};
|
|
807
807
|
|
|
808
|
-
// src/components/ui/stop-sync-confirmation-dialog.tsx
|
|
809
|
-
import * as React5 from "react";
|
|
810
|
-
import { useState } from "react";
|
|
811
|
-
import { BrushIcon } from "@elementor/icons";
|
|
812
|
-
import {
|
|
813
|
-
Button as Button2,
|
|
814
|
-
Checkbox,
|
|
815
|
-
Dialog,
|
|
816
|
-
DialogActions,
|
|
817
|
-
DialogContent,
|
|
818
|
-
DialogContentText,
|
|
819
|
-
DialogTitle,
|
|
820
|
-
FormControlLabel,
|
|
821
|
-
Typography as Typography5
|
|
822
|
-
} from "@elementor/ui";
|
|
823
|
-
import { __ as __7 } from "@wordpress/i18n";
|
|
824
|
-
var StopSyncConfirmationDialog = ({
|
|
825
|
-
open,
|
|
826
|
-
closeDialog,
|
|
827
|
-
onConfirm,
|
|
828
|
-
onSuppressMessage
|
|
829
|
-
}) => {
|
|
830
|
-
const [dontShowAgain, setDontShowAgain] = useState(false);
|
|
831
|
-
const handleConfirm = () => {
|
|
832
|
-
if (dontShowAgain) {
|
|
833
|
-
onSuppressMessage?.();
|
|
834
|
-
}
|
|
835
|
-
onConfirm();
|
|
836
|
-
};
|
|
837
|
-
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(
|
|
838
|
-
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
839
|
-
"elementor"
|
|
840
|
-
))), /* @__PURE__ */ React5.createElement(DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React5.createElement(
|
|
841
|
-
FormControlLabel,
|
|
842
|
-
{
|
|
843
|
-
control: /* @__PURE__ */ React5.createElement(
|
|
844
|
-
Checkbox,
|
|
845
|
-
{
|
|
846
|
-
checked: dontShowAgain,
|
|
847
|
-
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
848
|
-
size: "small"
|
|
849
|
-
}
|
|
850
|
-
),
|
|
851
|
-
label: /* @__PURE__ */ React5.createElement(Typography5, { variant: "body2" }, __7("Don't show this again", "elementor"))
|
|
852
|
-
}
|
|
853
|
-
), /* @__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")))));
|
|
854
|
-
};
|
|
855
|
-
|
|
856
808
|
// src/components/variables-manager/hooks/use-auto-edit.ts
|
|
857
|
-
import { useCallback, useState
|
|
809
|
+
import { useCallback, useState } from "react";
|
|
858
810
|
var useAutoEdit = () => {
|
|
859
|
-
const [autoEditVariableId, setAutoEditVariableId] =
|
|
811
|
+
const [autoEditVariableId, setAutoEditVariableId] = useState(void 0);
|
|
860
812
|
const startAutoEdit = useCallback((variableId) => {
|
|
861
813
|
setAutoEditVariableId(variableId);
|
|
862
814
|
}, []);
|
|
@@ -908,18 +860,18 @@ var useErrorNavigation = () => {
|
|
|
908
860
|
};
|
|
909
861
|
|
|
910
862
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
911
|
-
import { useCallback as useCallback3, useState as
|
|
863
|
+
import { useCallback as useCallback3, useState as useState2 } from "react";
|
|
912
864
|
|
|
913
865
|
// src/hooks/use-prop-variables.ts
|
|
914
866
|
import { useMemo } from "react";
|
|
915
867
|
import { useBoundProp } from "@elementor/editor-controls";
|
|
916
868
|
|
|
917
869
|
// src/context/variable-type-context.tsx
|
|
918
|
-
import * as
|
|
870
|
+
import * as React5 from "react";
|
|
919
871
|
import { createContext, useContext } from "react";
|
|
920
872
|
var VariableTypeContext = createContext(null);
|
|
921
873
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
922
|
-
return /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ React5.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
923
875
|
}
|
|
924
876
|
function useVariableType() {
|
|
925
877
|
const context = useContext(VariableTypeContext);
|
|
@@ -1039,12 +991,12 @@ var restoreVariable = (restoreId, label, value, type) => {
|
|
|
1039
991
|
|
|
1040
992
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
1041
993
|
var useVariablesManagerState = () => {
|
|
1042
|
-
const [variables, setVariables] =
|
|
1043
|
-
const [deletedVariables, setDeletedVariables] =
|
|
1044
|
-
const [isSaveDisabled, setIsSaveDisabled] =
|
|
1045
|
-
const [isDirty, setIsDirty] =
|
|
1046
|
-
const [isSaving, setIsSaving] =
|
|
1047
|
-
const [searchValue, setSearchValue] =
|
|
994
|
+
const [variables, setVariables] = useState2(() => getVariables(false));
|
|
995
|
+
const [deletedVariables, setDeletedVariables] = useState2([]);
|
|
996
|
+
const [isSaveDisabled, setIsSaveDisabled] = useState2(false);
|
|
997
|
+
const [isDirty, setIsDirty] = useState2(false);
|
|
998
|
+
const [isSaving, setIsSaving] = useState2(false);
|
|
999
|
+
const [searchValue, setSearchValue] = useState2("");
|
|
1048
1000
|
const handleOnChange = useCallback3(
|
|
1049
1001
|
(newVariables) => {
|
|
1050
1002
|
setVariables({ ...variables, ...newVariables });
|
|
@@ -1126,18 +1078,17 @@ var useVariablesManagerState = () => {
|
|
|
1126
1078
|
|
|
1127
1079
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1128
1080
|
import * as React7 from "react";
|
|
1129
|
-
import { createElement as createElement8, useMemo as useMemo2, useRef as useRef2
|
|
1130
|
-
import { PromotionChip, PromotionPopover } from "@elementor/editor-ui";
|
|
1081
|
+
import { createElement as createElement8, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
1131
1082
|
import { PlusIcon } from "@elementor/icons";
|
|
1132
|
-
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as
|
|
1133
|
-
import { capitalize } from "@elementor/utils";
|
|
1134
|
-
import { __ as __8
|
|
1083
|
+
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography5 } from "@elementor/ui";
|
|
1084
|
+
import { capitalize as capitalize2 } from "@elementor/utils";
|
|
1085
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
1135
1086
|
|
|
1136
1087
|
// src/hooks/use-quota-permissions.ts
|
|
1137
1088
|
var useQuotaPermissions = (variableType) => {
|
|
1138
1089
|
const quotaConfig = {
|
|
1139
|
-
...window.ElementorVariablesQuotaConfig
|
|
1140
|
-
...window.ElementorVariablesQuotaConfigExtended
|
|
1090
|
+
...window.ElementorVariablesQuotaConfig ?? {},
|
|
1091
|
+
...window.ElementorVariablesQuotaConfigExtended ?? {}
|
|
1141
1092
|
};
|
|
1142
1093
|
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1143
1094
|
const limit = quotaConfig[variableType] || 0;
|
|
@@ -1148,14 +1099,60 @@ var useQuotaPermissions = (variableType) => {
|
|
|
1148
1099
|
};
|
|
1149
1100
|
};
|
|
1150
1101
|
|
|
1102
|
+
// src/components/ui/variable-promotion-chip.tsx
|
|
1103
|
+
import * as React6 from "react";
|
|
1104
|
+
import { forwardRef, useImperativeHandle, useState as useState3 } from "react";
|
|
1105
|
+
import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
|
|
1106
|
+
import { Box } from "@elementor/ui";
|
|
1107
|
+
import { capitalize } from "@elementor/utils";
|
|
1108
|
+
import { __ as __7, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
1109
|
+
var VariablePromotionChip = forwardRef(
|
|
1110
|
+
({ variableType, upgradeUrl }, ref) => {
|
|
1111
|
+
const [isOpen, setIsOpen] = useState3(false);
|
|
1112
|
+
useCanvasClickHandler(isOpen, () => setIsOpen(false));
|
|
1113
|
+
const toggle = () => setIsOpen((prev) => !prev);
|
|
1114
|
+
useImperativeHandle(ref, () => ({ toggle }), []);
|
|
1115
|
+
const title = sprintf2(
|
|
1116
|
+
/* translators: %s: Variable Type. */
|
|
1117
|
+
__7("%s variables", "elementor"),
|
|
1118
|
+
capitalize(variableType)
|
|
1119
|
+
);
|
|
1120
|
+
const content = sprintf2(
|
|
1121
|
+
/* translators: %s: Variable Type. */
|
|
1122
|
+
__7("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1123
|
+
variableType
|
|
1124
|
+
);
|
|
1125
|
+
return /* @__PURE__ */ React6.createElement(
|
|
1126
|
+
PromotionPopover,
|
|
1127
|
+
{
|
|
1128
|
+
open: isOpen,
|
|
1129
|
+
title,
|
|
1130
|
+
content,
|
|
1131
|
+
ctaText: __7("Upgrade now", "elementor"),
|
|
1132
|
+
ctaUrl: upgradeUrl,
|
|
1133
|
+
onClose: (e) => {
|
|
1134
|
+
e.stopPropagation();
|
|
1135
|
+
setIsOpen(false);
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
/* @__PURE__ */ React6.createElement(
|
|
1139
|
+
Box,
|
|
1140
|
+
{
|
|
1141
|
+
onClick: (e) => {
|
|
1142
|
+
e.stopPropagation();
|
|
1143
|
+
toggle();
|
|
1144
|
+
},
|
|
1145
|
+
sx: { cursor: "pointer", display: "inline-flex" }
|
|
1146
|
+
},
|
|
1147
|
+
/* @__PURE__ */ React6.createElement(PromotionChip, null)
|
|
1148
|
+
)
|
|
1149
|
+
);
|
|
1150
|
+
}
|
|
1151
|
+
);
|
|
1152
|
+
|
|
1151
1153
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
1152
1154
|
var SIZE = "tiny";
|
|
1153
|
-
var VariableManagerCreateMenu = ({
|
|
1154
|
-
variables,
|
|
1155
|
-
onCreate,
|
|
1156
|
-
disabled,
|
|
1157
|
-
menuState
|
|
1158
|
-
}) => {
|
|
1155
|
+
var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
|
|
1159
1156
|
const buttonRef = useRef2(null);
|
|
1160
1157
|
const variableTypes = getVariableTypes();
|
|
1161
1158
|
const menuOptionConfigs = useMemo2(
|
|
@@ -1173,7 +1170,6 @@ var VariableManagerCreateMenu = ({
|
|
|
1173
1170
|
{
|
|
1174
1171
|
...bindTrigger(menuState),
|
|
1175
1172
|
ref: buttonRef,
|
|
1176
|
-
disabled,
|
|
1177
1173
|
size: SIZE,
|
|
1178
1174
|
"aria-label": __8("Add variable", "elementor")
|
|
1179
1175
|
},
|
|
@@ -1218,15 +1214,13 @@ var MenuOption = ({
|
|
|
1218
1214
|
onCreate,
|
|
1219
1215
|
onClose
|
|
1220
1216
|
}) => {
|
|
1221
|
-
const
|
|
1217
|
+
const promotionRef = useRef2(null);
|
|
1222
1218
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1223
|
-
const displayName =
|
|
1219
|
+
const displayName = capitalize2(config.variableType);
|
|
1224
1220
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
1225
1221
|
const handleClick = () => {
|
|
1226
1222
|
if (isDisabled) {
|
|
1227
|
-
|
|
1228
|
-
setIsPopoverOpen(true);
|
|
1229
|
-
}
|
|
1223
|
+
promotionRef.current?.toggle();
|
|
1230
1224
|
return;
|
|
1231
1225
|
}
|
|
1232
1226
|
const defaultName = getDefaultName(variables, config.key, config.variableType);
|
|
@@ -1234,29 +1228,13 @@ var MenuOption = ({
|
|
|
1234
1228
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1235
1229
|
onClose();
|
|
1236
1230
|
};
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
__8("%s variables", "elementor"),
|
|
1240
|
-
capitalize(config.variableType)
|
|
1241
|
-
);
|
|
1242
|
-
const content = sprintf2(
|
|
1243
|
-
/* translators: %s: Variable Type. */
|
|
1244
|
-
__8("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1245
|
-
config.variableType
|
|
1246
|
-
);
|
|
1247
|
-
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(
|
|
1248
|
-
PromotionPopover,
|
|
1231
|
+
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(Typography5, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React7.createElement(
|
|
1232
|
+
VariablePromotionChip,
|
|
1249
1233
|
{
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1255
|
-
onClose: () => {
|
|
1256
|
-
setIsPopoverOpen(false);
|
|
1257
|
-
}
|
|
1258
|
-
},
|
|
1259
|
-
/* @__PURE__ */ React7.createElement(PromotionChip, null)
|
|
1234
|
+
variableType: config.variableType,
|
|
1235
|
+
upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1236
|
+
ref: promotionRef
|
|
1237
|
+
}
|
|
1260
1238
|
));
|
|
1261
1239
|
};
|
|
1262
1240
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1271,33 +1249,60 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
1271
1249
|
};
|
|
1272
1250
|
|
|
1273
1251
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1274
|
-
import * as
|
|
1275
|
-
import {
|
|
1276
|
-
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1277
|
-
import { GripVerticalIcon } from "@elementor/icons";
|
|
1252
|
+
import * as React13 from "react";
|
|
1253
|
+
import { useEffect as useEffect2, useRef as useRef6 } from "react";
|
|
1278
1254
|
import {
|
|
1279
|
-
IconButton as IconButton3,
|
|
1280
|
-
Stack as Stack5,
|
|
1281
1255
|
Table,
|
|
1282
1256
|
TableBody,
|
|
1283
1257
|
TableContainer,
|
|
1284
1258
|
TableHead,
|
|
1285
|
-
TableRow,
|
|
1259
|
+
TableRow as TableRow2,
|
|
1286
1260
|
UnstableSortableItem,
|
|
1287
1261
|
UnstableSortableProvider
|
|
1288
1262
|
} from "@elementor/ui";
|
|
1289
1263
|
import { __ as __9 } from "@wordpress/i18n";
|
|
1290
1264
|
|
|
1291
|
-
// src/components/
|
|
1265
|
+
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1292
1266
|
import * as React8 from "react";
|
|
1293
|
-
import {
|
|
1267
|
+
import { TableCell } from "@elementor/ui";
|
|
1268
|
+
var VariableTableCell = ({
|
|
1269
|
+
children,
|
|
1270
|
+
isHeader,
|
|
1271
|
+
width,
|
|
1272
|
+
maxWidth,
|
|
1273
|
+
align,
|
|
1274
|
+
noPadding,
|
|
1275
|
+
sx
|
|
1276
|
+
}) => {
|
|
1277
|
+
const baseSx = {
|
|
1278
|
+
maxWidth: maxWidth ?? 150,
|
|
1279
|
+
cursor: "initial",
|
|
1280
|
+
typography: "caption",
|
|
1281
|
+
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1282
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1283
|
+
...width && { width },
|
|
1284
|
+
...sx
|
|
1285
|
+
};
|
|
1286
|
+
return /* @__PURE__ */ React8.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1290
|
+
import * as React12 from "react";
|
|
1291
|
+
import { createElement as createElement15, useRef as useRef5 } from "react";
|
|
1292
|
+
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
1293
|
+
import { GripVerticalIcon } from "@elementor/icons";
|
|
1294
|
+
import { IconButton as IconButton3, Stack as Stack5, TableRow } from "@elementor/ui";
|
|
1295
|
+
|
|
1296
|
+
// src/components/fields/label-field.tsx
|
|
1297
|
+
import * as React9 from "react";
|
|
1298
|
+
import { useRef as useRef3, useState as useState4 } from "react";
|
|
1294
1299
|
import { WarningInfotip } from "@elementor/editor-ui";
|
|
1295
1300
|
import { TextField } from "@elementor/ui";
|
|
1296
1301
|
function isLabelEqual(a, b) {
|
|
1297
1302
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1298
1303
|
}
|
|
1299
1304
|
var useLabelError = (initialError) => {
|
|
1300
|
-
const [error, setError] =
|
|
1305
|
+
const [error, setError] = useState4(initialError ?? { value: "", message: "" });
|
|
1301
1306
|
return {
|
|
1302
1307
|
labelFieldError: error,
|
|
1303
1308
|
setLabelFieldError: setError
|
|
@@ -1316,8 +1321,8 @@ var LabelField = ({
|
|
|
1316
1321
|
variables,
|
|
1317
1322
|
onKeyDown
|
|
1318
1323
|
}) => {
|
|
1319
|
-
const [label, setLabel] =
|
|
1320
|
-
const [errorMessage, setErrorMessage] =
|
|
1324
|
+
const [label, setLabel] = useState4(value);
|
|
1325
|
+
const [errorMessage, setErrorMessage] = useState4("");
|
|
1321
1326
|
const fieldRef = useRef3(null);
|
|
1322
1327
|
const handleChange = (newValue) => {
|
|
1323
1328
|
setLabel(newValue);
|
|
@@ -1331,7 +1336,7 @@ var LabelField = ({
|
|
|
1331
1336
|
errorMsg = error.message;
|
|
1332
1337
|
}
|
|
1333
1338
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1334
|
-
const textField = /* @__PURE__ */
|
|
1339
|
+
const textField = /* @__PURE__ */ React9.createElement(
|
|
1335
1340
|
TextField,
|
|
1336
1341
|
{
|
|
1337
1342
|
ref: fieldRef,
|
|
@@ -1352,7 +1357,7 @@ var LabelField = ({
|
|
|
1352
1357
|
);
|
|
1353
1358
|
if (showWarningInfotip) {
|
|
1354
1359
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1355
|
-
return /* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1356
1361
|
WarningInfotip,
|
|
1357
1362
|
{
|
|
1358
1363
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1368,89 +1373,11 @@ var LabelField = ({
|
|
|
1368
1373
|
return textField;
|
|
1369
1374
|
};
|
|
1370
1375
|
|
|
1371
|
-
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1372
|
-
import * as React9 from "react";
|
|
1373
|
-
import { createElement as createElement11 } from "react";
|
|
1374
|
-
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1375
|
-
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1376
|
-
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1377
|
-
const menuState = usePopupState({
|
|
1378
|
-
variant: "popover"
|
|
1379
|
-
});
|
|
1380
|
-
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(
|
|
1381
|
-
Menu2,
|
|
1382
|
-
{
|
|
1383
|
-
disablePortal: true,
|
|
1384
|
-
MenuListProps: {
|
|
1385
|
-
dense: true
|
|
1386
|
-
},
|
|
1387
|
-
PaperProps: {
|
|
1388
|
-
elevation: 6
|
|
1389
|
-
},
|
|
1390
|
-
...bindMenu2(menuState),
|
|
1391
|
-
anchorEl: menuState.anchorEl,
|
|
1392
|
-
anchorOrigin: {
|
|
1393
|
-
vertical: "bottom",
|
|
1394
|
-
horizontal: "right"
|
|
1395
|
-
},
|
|
1396
|
-
transformOrigin: {
|
|
1397
|
-
vertical: "top",
|
|
1398
|
-
horizontal: "right"
|
|
1399
|
-
},
|
|
1400
|
-
open: menuState.isOpen,
|
|
1401
|
-
onClose: menuState.close
|
|
1402
|
-
},
|
|
1403
|
-
menuActions.map((action) => /* @__PURE__ */ React9.createElement(
|
|
1404
|
-
MenuItem2,
|
|
1405
|
-
{
|
|
1406
|
-
key: action.name,
|
|
1407
|
-
onClick: () => {
|
|
1408
|
-
action.onClick?.(itemId);
|
|
1409
|
-
menuState.close();
|
|
1410
|
-
},
|
|
1411
|
-
sx: {
|
|
1412
|
-
color: action.color,
|
|
1413
|
-
gap: 1
|
|
1414
|
-
}
|
|
1415
|
-
},
|
|
1416
|
-
action.icon && createElement11(action.icon, {
|
|
1417
|
-
fontSize: "inherit"
|
|
1418
|
-
}),
|
|
1419
|
-
" ",
|
|
1420
|
-
action.name
|
|
1421
|
-
))
|
|
1422
|
-
));
|
|
1423
|
-
};
|
|
1424
|
-
|
|
1425
|
-
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1426
|
-
import * as React10 from "react";
|
|
1427
|
-
import { TableCell } from "@elementor/ui";
|
|
1428
|
-
var VariableTableCell = ({
|
|
1429
|
-
children,
|
|
1430
|
-
isHeader,
|
|
1431
|
-
width,
|
|
1432
|
-
maxWidth,
|
|
1433
|
-
align,
|
|
1434
|
-
noPadding,
|
|
1435
|
-
sx
|
|
1436
|
-
}) => {
|
|
1437
|
-
const baseSx = {
|
|
1438
|
-
maxWidth: maxWidth ?? 150,
|
|
1439
|
-
cursor: "initial",
|
|
1440
|
-
typography: "caption",
|
|
1441
|
-
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
1442
|
-
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
1443
|
-
...width && { width },
|
|
1444
|
-
...sx
|
|
1445
|
-
};
|
|
1446
|
-
return /* @__PURE__ */ React10.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1447
|
-
};
|
|
1448
|
-
|
|
1449
1376
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1450
|
-
import * as
|
|
1451
|
-
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as
|
|
1377
|
+
import * as React10 from "react";
|
|
1378
|
+
import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as useState5 } from "react";
|
|
1452
1379
|
import { ClickAwayListener, Stack as Stack4 } from "@elementor/ui";
|
|
1453
|
-
var VariableEditableCell =
|
|
1380
|
+
var VariableEditableCell = React10.memo(
|
|
1454
1381
|
({
|
|
1455
1382
|
initialValue,
|
|
1456
1383
|
children,
|
|
@@ -1461,12 +1388,13 @@ var VariableEditableCell = React11.memo(
|
|
|
1461
1388
|
onRowRef,
|
|
1462
1389
|
onAutoEditComplete,
|
|
1463
1390
|
gap = 1,
|
|
1464
|
-
fieldType
|
|
1391
|
+
fieldType,
|
|
1392
|
+
disabled = false
|
|
1465
1393
|
}) => {
|
|
1466
|
-
const [value, setValue] =
|
|
1467
|
-
const [isEditing, setIsEditing] =
|
|
1394
|
+
const [value, setValue] = useState5(initialValue);
|
|
1395
|
+
const [isEditing, setIsEditing] = useState5(false);
|
|
1468
1396
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1469
|
-
const [valueFieldError, setValueFieldError] =
|
|
1397
|
+
const [valueFieldError, setValueFieldError] = useState5("");
|
|
1470
1398
|
const rowRef = useRef4(null);
|
|
1471
1399
|
const handleSave = useCallback4(() => {
|
|
1472
1400
|
const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
|
|
@@ -1479,15 +1407,21 @@ var VariableEditableCell = React11.memo(
|
|
|
1479
1407
|
onRowRef?.(rowRef?.current);
|
|
1480
1408
|
}, [onRowRef]);
|
|
1481
1409
|
useEffect(() => {
|
|
1482
|
-
if (autoEdit && !isEditing) {
|
|
1410
|
+
if (autoEdit && !isEditing && !disabled) {
|
|
1483
1411
|
setIsEditing(true);
|
|
1484
1412
|
onAutoEditComplete?.();
|
|
1485
1413
|
}
|
|
1486
|
-
}, [autoEdit, isEditing, onAutoEditComplete]);
|
|
1414
|
+
}, [autoEdit, isEditing, onAutoEditComplete, disabled]);
|
|
1487
1415
|
const handleDoubleClick = () => {
|
|
1416
|
+
if (disabled) {
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1488
1419
|
setIsEditing(true);
|
|
1489
1420
|
};
|
|
1490
1421
|
const handleKeyDown = (event) => {
|
|
1422
|
+
if (disabled) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1491
1425
|
if (event.key === "Enter") {
|
|
1492
1426
|
handleSave();
|
|
1493
1427
|
} else if (event.key === "Escape") {
|
|
@@ -1527,7 +1461,7 @@ var VariableEditableCell = React11.memo(
|
|
|
1527
1461
|
error: currentError
|
|
1528
1462
|
});
|
|
1529
1463
|
if (isEditing) {
|
|
1530
|
-
return /* @__PURE__ */
|
|
1464
|
+
return /* @__PURE__ */ React10.createElement(ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React10.createElement(
|
|
1531
1465
|
Stack4,
|
|
1532
1466
|
{
|
|
1533
1467
|
ref: rowRef,
|
|
@@ -1544,7 +1478,7 @@ var VariableEditableCell = React11.memo(
|
|
|
1544
1478
|
editableContent
|
|
1545
1479
|
));
|
|
1546
1480
|
}
|
|
1547
|
-
return /* @__PURE__ */
|
|
1481
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1548
1482
|
Stack4,
|
|
1549
1483
|
{
|
|
1550
1484
|
ref: rowRef,
|
|
@@ -1553,9 +1487,9 @@ var VariableEditableCell = React11.memo(
|
|
|
1553
1487
|
gap,
|
|
1554
1488
|
onDoubleClick: handleDoubleClick,
|
|
1555
1489
|
onKeyDown: handleKeyDown,
|
|
1556
|
-
tabIndex: 0,
|
|
1490
|
+
tabIndex: disabled ? -1 : 0,
|
|
1557
1491
|
role: "button",
|
|
1558
|
-
"aria-label": "Double click or press Space to edit"
|
|
1492
|
+
"aria-label": disabled ? "" : "Double click or press Space to edit"
|
|
1559
1493
|
},
|
|
1560
1494
|
prefixElement,
|
|
1561
1495
|
children
|
|
@@ -1563,6 +1497,243 @@ var VariableEditableCell = React11.memo(
|
|
|
1563
1497
|
}
|
|
1564
1498
|
);
|
|
1565
1499
|
|
|
1500
|
+
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1501
|
+
import * as React11 from "react";
|
|
1502
|
+
import { createElement as createElement13 } from "react";
|
|
1503
|
+
import { DotsVerticalIcon } from "@elementor/icons";
|
|
1504
|
+
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
1505
|
+
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1506
|
+
const menuState = usePopupState({
|
|
1507
|
+
variant: "popover"
|
|
1508
|
+
});
|
|
1509
|
+
const triggerProps = bindTrigger2(menuState);
|
|
1510
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1511
|
+
IconButton2,
|
|
1512
|
+
{
|
|
1513
|
+
...triggerProps,
|
|
1514
|
+
disabled,
|
|
1515
|
+
size: "tiny",
|
|
1516
|
+
onClick: (e) => {
|
|
1517
|
+
e.stopPropagation();
|
|
1518
|
+
triggerProps.onClick?.(e);
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1521
|
+
/* @__PURE__ */ React11.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
1522
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1523
|
+
Menu2,
|
|
1524
|
+
{
|
|
1525
|
+
disablePortal: true,
|
|
1526
|
+
MenuListProps: {
|
|
1527
|
+
dense: true
|
|
1528
|
+
},
|
|
1529
|
+
PaperProps: {
|
|
1530
|
+
elevation: 6
|
|
1531
|
+
},
|
|
1532
|
+
...bindMenu2(menuState),
|
|
1533
|
+
anchorEl: menuState.anchorEl,
|
|
1534
|
+
anchorOrigin: {
|
|
1535
|
+
vertical: "bottom",
|
|
1536
|
+
horizontal: "right"
|
|
1537
|
+
},
|
|
1538
|
+
transformOrigin: {
|
|
1539
|
+
vertical: "top",
|
|
1540
|
+
horizontal: "right"
|
|
1541
|
+
},
|
|
1542
|
+
open: menuState.isOpen,
|
|
1543
|
+
onClose: menuState.close
|
|
1544
|
+
},
|
|
1545
|
+
menuActions.map((action) => /* @__PURE__ */ React11.createElement(
|
|
1546
|
+
MenuItem2,
|
|
1547
|
+
{
|
|
1548
|
+
key: action.name,
|
|
1549
|
+
onClick: (e) => {
|
|
1550
|
+
e.stopPropagation();
|
|
1551
|
+
action.onClick?.(itemId);
|
|
1552
|
+
menuState.close();
|
|
1553
|
+
},
|
|
1554
|
+
sx: {
|
|
1555
|
+
color: action.color,
|
|
1556
|
+
gap: 1
|
|
1557
|
+
}
|
|
1558
|
+
},
|
|
1559
|
+
action.icon && createElement13(action.icon, {
|
|
1560
|
+
fontSize: "inherit"
|
|
1561
|
+
}),
|
|
1562
|
+
" ",
|
|
1563
|
+
action.name
|
|
1564
|
+
))
|
|
1565
|
+
));
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
// src/components/variables-manager/ui/variable-table-row.tsx
|
|
1569
|
+
var VariableRow = (props) => {
|
|
1570
|
+
const {
|
|
1571
|
+
row,
|
|
1572
|
+
variables,
|
|
1573
|
+
handleOnChange,
|
|
1574
|
+
autoEditVariableId,
|
|
1575
|
+
onAutoEditComplete,
|
|
1576
|
+
onFieldError,
|
|
1577
|
+
menuActions,
|
|
1578
|
+
handleRowRef,
|
|
1579
|
+
itemProps,
|
|
1580
|
+
showDropIndication,
|
|
1581
|
+
triggerProps,
|
|
1582
|
+
itemStyle,
|
|
1583
|
+
triggerStyle,
|
|
1584
|
+
isDragged,
|
|
1585
|
+
dropPosition,
|
|
1586
|
+
setTriggerRef,
|
|
1587
|
+
isSorting
|
|
1588
|
+
} = props;
|
|
1589
|
+
const promotionRef = useRef5(null);
|
|
1590
|
+
const isDisabled = !useQuotaPermissions(row.type).canEdit();
|
|
1591
|
+
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1592
|
+
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1593
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1594
|
+
TableRow,
|
|
1595
|
+
{
|
|
1596
|
+
...itemProps,
|
|
1597
|
+
ref: itemProps.ref,
|
|
1598
|
+
selected: isDragged,
|
|
1599
|
+
sx: {
|
|
1600
|
+
...isDisabled && {
|
|
1601
|
+
"& td, & th": {
|
|
1602
|
+
color: "text.disabled"
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
...showIndicationBefore && {
|
|
1606
|
+
"& td, & th": {
|
|
1607
|
+
borderTop: "2px solid",
|
|
1608
|
+
borderTopColor: "primary.main"
|
|
1609
|
+
}
|
|
1610
|
+
},
|
|
1611
|
+
...showIndicationAfter && {
|
|
1612
|
+
"& td, & th": {
|
|
1613
|
+
borderBottom: "2px solid",
|
|
1614
|
+
borderBottomColor: "primary.main"
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
"&:hover, &:focus-within": {
|
|
1618
|
+
backgroundColor: "action.hover",
|
|
1619
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1620
|
+
opacity: 1
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
'& [role="toolbar"], & [draggable]': {
|
|
1624
|
+
opacity: 0
|
|
1625
|
+
}
|
|
1626
|
+
},
|
|
1627
|
+
style: { ...itemStyle, ...triggerStyle },
|
|
1628
|
+
onClick: () => {
|
|
1629
|
+
if (isDisabled) {
|
|
1630
|
+
promotionRef.current?.toggle();
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
},
|
|
1634
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(IconButton3, { size: "small", ref: setTriggerRef, ...triggerProps, disabled: isSorting, draggable: true }, /* @__PURE__ */ React12.createElement(GripVerticalIcon, { fontSize: "inherit" }))),
|
|
1635
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1636
|
+
VariableEditableCell,
|
|
1637
|
+
{
|
|
1638
|
+
initialValue: row.name,
|
|
1639
|
+
onChange: (value) => {
|
|
1640
|
+
if (value !== row.name && !isDisabled) {
|
|
1641
|
+
handleOnChange({
|
|
1642
|
+
...variables,
|
|
1643
|
+
[row.id]: { ...variables[row.id], label: value }
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
prefixElement: createElement15(row.icon, {
|
|
1648
|
+
fontSize: "inherit",
|
|
1649
|
+
color: isDisabled ? "disabled" : "inherit"
|
|
1650
|
+
}),
|
|
1651
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => /* @__PURE__ */ React12.createElement(
|
|
1652
|
+
LabelField,
|
|
1653
|
+
{
|
|
1654
|
+
id: "variable-label-" + row.id,
|
|
1655
|
+
size: "tiny",
|
|
1656
|
+
value,
|
|
1657
|
+
onChange,
|
|
1658
|
+
onErrorChange: (errorMsg) => {
|
|
1659
|
+
onValidationChange?.(errorMsg);
|
|
1660
|
+
onFieldError?.(!!errorMsg);
|
|
1661
|
+
},
|
|
1662
|
+
error,
|
|
1663
|
+
focusOnShow: true,
|
|
1664
|
+
selectOnShow: autoEditVariableId === row.id,
|
|
1665
|
+
showWarningInfotip: true,
|
|
1666
|
+
variables
|
|
1667
|
+
}
|
|
1668
|
+
),
|
|
1669
|
+
autoEdit: autoEditVariableId === row.id && !isDisabled,
|
|
1670
|
+
onRowRef: handleRowRef(row.id),
|
|
1671
|
+
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1672
|
+
fieldType: "label",
|
|
1673
|
+
disabled: isDisabled
|
|
1674
|
+
},
|
|
1675
|
+
/* @__PURE__ */ React12.createElement(EllipsisWithTooltip, { title: row.name, sx: { border: "4px solid transparent" } }, row.name)
|
|
1676
|
+
)),
|
|
1677
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1678
|
+
VariableEditableCell,
|
|
1679
|
+
{
|
|
1680
|
+
initialValue: row.value,
|
|
1681
|
+
onChange: (value) => {
|
|
1682
|
+
if (value !== row.value && !isDisabled) {
|
|
1683
|
+
handleOnChange({
|
|
1684
|
+
...variables,
|
|
1685
|
+
[row.id]: { ...variables[row.id], value }
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
editableElement: ({ value, onChange, onValidationChange, error }) => row.valueField?.({
|
|
1690
|
+
value,
|
|
1691
|
+
onChange,
|
|
1692
|
+
onPropTypeKeyChange: (type) => {
|
|
1693
|
+
if (!isDisabled) {
|
|
1694
|
+
handleOnChange({
|
|
1695
|
+
...variables,
|
|
1696
|
+
[row.id]: { ...variables[row.id], type }
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
propTypeKey: row.type,
|
|
1701
|
+
onValidationChange: (errorMsg) => {
|
|
1702
|
+
onValidationChange?.(errorMsg);
|
|
1703
|
+
onFieldError?.(!!errorMsg);
|
|
1704
|
+
},
|
|
1705
|
+
error
|
|
1706
|
+
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1707
|
+
onRowRef: handleRowRef(row.id),
|
|
1708
|
+
gap: 0.25,
|
|
1709
|
+
fieldType: "value",
|
|
1710
|
+
disabled: isDisabled
|
|
1711
|
+
},
|
|
1712
|
+
row.startIcon && row.startIcon({ value: row.value }),
|
|
1713
|
+
/* @__PURE__ */ React12.createElement(
|
|
1714
|
+
EllipsisWithTooltip,
|
|
1715
|
+
{
|
|
1716
|
+
title: row.value,
|
|
1717
|
+
sx: {
|
|
1718
|
+
border: "4px solid transparent",
|
|
1719
|
+
lineHeight: "1",
|
|
1720
|
+
pt: 0.25
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1723
|
+
row.value
|
|
1724
|
+
)
|
|
1725
|
+
)),
|
|
1726
|
+
/* @__PURE__ */ React12.createElement(VariableTableCell, { align: "right", noPadding: true, width: 16, maxWidth: 16, sx: { paddingInlineEnd: 1 } }, /* @__PURE__ */ React12.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end", alignItems: "center" }, isDisabled && /* @__PURE__ */ React12.createElement(
|
|
1727
|
+
VariablePromotionChip,
|
|
1728
|
+
{
|
|
1729
|
+
variableType: row.variableType,
|
|
1730
|
+
upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
|
|
1731
|
+
ref: promotionRef
|
|
1732
|
+
}
|
|
1733
|
+
), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
|
|
1734
|
+
);
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1566
1737
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
1567
1738
|
var VariablesManagerTable = ({
|
|
1568
1739
|
menuActions,
|
|
@@ -1572,8 +1743,8 @@ var VariablesManagerTable = ({
|
|
|
1572
1743
|
onAutoEditComplete,
|
|
1573
1744
|
onFieldError
|
|
1574
1745
|
}) => {
|
|
1575
|
-
const tableContainerRef =
|
|
1576
|
-
const variableRowRefs =
|
|
1746
|
+
const tableContainerRef = useRef6(null);
|
|
1747
|
+
const variableRowRefs = useRef6(/* @__PURE__ */ new Map());
|
|
1577
1748
|
useEffect2(() => {
|
|
1578
1749
|
if (autoEditVariableId && tableContainerRef.current) {
|
|
1579
1750
|
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
@@ -1625,196 +1796,34 @@ var VariablesManagerTable = ({
|
|
|
1625
1796
|
});
|
|
1626
1797
|
handleOnChange(updatedVariables);
|
|
1627
1798
|
};
|
|
1628
|
-
return /* @__PURE__ */
|
|
1799
|
+
return /* @__PURE__ */ React13.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React13.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React13.createElement(TableHead, null, /* @__PURE__ */ React13.createElement(TableRow2, null, /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, __9("Name", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true }, __9("Value", "elementor")), /* @__PURE__ */ React13.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React13.createElement(TableBody, null, /* @__PURE__ */ React13.createElement(
|
|
1629
1800
|
UnstableSortableProvider,
|
|
1630
1801
|
{
|
|
1631
1802
|
value: ids,
|
|
1632
1803
|
onChange: handleReorder,
|
|
1633
1804
|
variant: "static",
|
|
1634
1805
|
restrictAxis: true,
|
|
1635
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1806
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React13.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React13.createElement(TableBody, null, dragOverlayChildren))
|
|
1636
1807
|
},
|
|
1637
|
-
rows.map((row) => /* @__PURE__ */
|
|
1808
|
+
rows.map((row) => /* @__PURE__ */ React13.createElement(
|
|
1638
1809
|
UnstableSortableItem,
|
|
1639
1810
|
{
|
|
1640
1811
|
key: row.id,
|
|
1641
1812
|
id: row.id,
|
|
1642
|
-
render: (
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
TableRow,
|
|
1657
|
-
{
|
|
1658
|
-
...itemProps,
|
|
1659
|
-
ref: itemProps.ref,
|
|
1660
|
-
selected: isDragged,
|
|
1661
|
-
sx: {
|
|
1662
|
-
...showIndicationBefore && {
|
|
1663
|
-
"& td, & th": {
|
|
1664
|
-
borderTop: "2px solid",
|
|
1665
|
-
borderTopColor: "primary.main"
|
|
1666
|
-
}
|
|
1667
|
-
},
|
|
1668
|
-
...showIndicationAfter && {
|
|
1669
|
-
"& td, & th": {
|
|
1670
|
-
borderBottom: "2px solid",
|
|
1671
|
-
borderBottomColor: "primary.main"
|
|
1672
|
-
}
|
|
1673
|
-
},
|
|
1674
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1675
|
-
opacity: 0
|
|
1676
|
-
},
|
|
1677
|
-
"&:hover, &:focus-within": {
|
|
1678
|
-
backgroundColor: "action.hover",
|
|
1679
|
-
'& [role="toolbar"], & [draggable]': {
|
|
1680
|
-
opacity: 1
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
},
|
|
1684
|
-
style: { ...itemStyle, ...triggerStyle }
|
|
1685
|
-
},
|
|
1686
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React12.createElement(
|
|
1687
|
-
IconButton3,
|
|
1688
|
-
{
|
|
1689
|
-
size: "small",
|
|
1690
|
-
ref: setTriggerRef,
|
|
1691
|
-
...triggerProps,
|
|
1692
|
-
disabled: isSorting,
|
|
1693
|
-
draggable: true
|
|
1694
|
-
},
|
|
1695
|
-
/* @__PURE__ */ React12.createElement(GripVerticalIcon, { fontSize: "inherit" })
|
|
1696
|
-
)),
|
|
1697
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1698
|
-
VariableEditableCell,
|
|
1699
|
-
{
|
|
1700
|
-
initialValue: row.name,
|
|
1701
|
-
onChange: (value) => {
|
|
1702
|
-
if (value !== row.name) {
|
|
1703
|
-
handleOnChange({
|
|
1704
|
-
...variables,
|
|
1705
|
-
[row.id]: { ...variables[row.id], label: value }
|
|
1706
|
-
});
|
|
1707
|
-
}
|
|
1708
|
-
},
|
|
1709
|
-
prefixElement: createElement15(row.icon, { fontSize: "inherit" }),
|
|
1710
|
-
editableElement: ({
|
|
1711
|
-
value,
|
|
1712
|
-
onChange,
|
|
1713
|
-
onValidationChange,
|
|
1714
|
-
error
|
|
1715
|
-
}) => /* @__PURE__ */ React12.createElement(
|
|
1716
|
-
LabelField,
|
|
1717
|
-
{
|
|
1718
|
-
id: "variable-label-" + row.id,
|
|
1719
|
-
size: "tiny",
|
|
1720
|
-
value,
|
|
1721
|
-
onChange,
|
|
1722
|
-
onErrorChange: (errorMsg) => {
|
|
1723
|
-
onValidationChange?.(errorMsg);
|
|
1724
|
-
onFieldError?.(!!errorMsg);
|
|
1725
|
-
},
|
|
1726
|
-
error,
|
|
1727
|
-
focusOnShow: true,
|
|
1728
|
-
selectOnShow: autoEditVariableId === row.id,
|
|
1729
|
-
showWarningInfotip: true,
|
|
1730
|
-
variables
|
|
1731
|
-
}
|
|
1732
|
-
),
|
|
1733
|
-
autoEdit: autoEditVariableId === row.id,
|
|
1734
|
-
onRowRef: handleRowRef(row.id),
|
|
1735
|
-
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1736
|
-
fieldType: "label"
|
|
1737
|
-
},
|
|
1738
|
-
/* @__PURE__ */ React12.createElement(
|
|
1739
|
-
EllipsisWithTooltip,
|
|
1740
|
-
{
|
|
1741
|
-
title: row.name,
|
|
1742
|
-
sx: { border: "4px solid transparent" }
|
|
1743
|
-
},
|
|
1744
|
-
row.name
|
|
1745
|
-
)
|
|
1746
|
-
)),
|
|
1747
|
-
/* @__PURE__ */ React12.createElement(VariableTableCell, null, /* @__PURE__ */ React12.createElement(
|
|
1748
|
-
VariableEditableCell,
|
|
1749
|
-
{
|
|
1750
|
-
initialValue: row.value,
|
|
1751
|
-
onChange: (value) => {
|
|
1752
|
-
if (value !== row.value) {
|
|
1753
|
-
handleOnChange({
|
|
1754
|
-
...variables,
|
|
1755
|
-
[row.id]: { ...variables[row.id], value }
|
|
1756
|
-
});
|
|
1757
|
-
}
|
|
1758
|
-
},
|
|
1759
|
-
editableElement: ({
|
|
1760
|
-
value,
|
|
1761
|
-
onChange,
|
|
1762
|
-
onValidationChange,
|
|
1763
|
-
error
|
|
1764
|
-
}) => row.valueField?.({
|
|
1765
|
-
value,
|
|
1766
|
-
onChange,
|
|
1767
|
-
onPropTypeKeyChange: (type) => {
|
|
1768
|
-
handleOnChange({
|
|
1769
|
-
...variables,
|
|
1770
|
-
[row.id]: { ...variables[row.id], type }
|
|
1771
|
-
});
|
|
1772
|
-
},
|
|
1773
|
-
propTypeKey: row.type,
|
|
1774
|
-
onValidationChange: (errorMsg) => {
|
|
1775
|
-
onValidationChange?.(errorMsg);
|
|
1776
|
-
onFieldError?.(!!errorMsg);
|
|
1777
|
-
},
|
|
1778
|
-
error
|
|
1779
|
-
}) ?? /* @__PURE__ */ React12.createElement(React12.Fragment, null),
|
|
1780
|
-
onRowRef: handleRowRef(row.id),
|
|
1781
|
-
gap: 0.25,
|
|
1782
|
-
fieldType: "value"
|
|
1783
|
-
},
|
|
1784
|
-
row.startIcon && row.startIcon({ value: row.value }),
|
|
1785
|
-
/* @__PURE__ */ React12.createElement(
|
|
1786
|
-
EllipsisWithTooltip,
|
|
1787
|
-
{
|
|
1788
|
-
title: row.value,
|
|
1789
|
-
sx: {
|
|
1790
|
-
border: "4px solid transparent",
|
|
1791
|
-
lineHeight: "1",
|
|
1792
|
-
pt: 0.25
|
|
1793
|
-
}
|
|
1794
|
-
},
|
|
1795
|
-
row.value
|
|
1796
|
-
)
|
|
1797
|
-
)),
|
|
1798
|
-
/* @__PURE__ */ React12.createElement(
|
|
1799
|
-
VariableTableCell,
|
|
1800
|
-
{
|
|
1801
|
-
align: "right",
|
|
1802
|
-
noPadding: true,
|
|
1803
|
-
width: 16,
|
|
1804
|
-
maxWidth: 16,
|
|
1805
|
-
sx: { paddingInlineEnd: 1 }
|
|
1806
|
-
},
|
|
1807
|
-
/* @__PURE__ */ React12.createElement(Stack5, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React12.createElement(
|
|
1808
|
-
VariableEditMenu,
|
|
1809
|
-
{
|
|
1810
|
-
menuActions: menuActions(row.id),
|
|
1811
|
-
disabled: isSorting,
|
|
1812
|
-
itemId: row.id
|
|
1813
|
-
}
|
|
1814
|
-
))
|
|
1815
|
-
)
|
|
1816
|
-
);
|
|
1817
|
-
}
|
|
1813
|
+
render: (props) => /* @__PURE__ */ React13.createElement(
|
|
1814
|
+
VariableRow,
|
|
1815
|
+
{
|
|
1816
|
+
...props,
|
|
1817
|
+
row,
|
|
1818
|
+
variables,
|
|
1819
|
+
handleOnChange,
|
|
1820
|
+
autoEditVariableId,
|
|
1821
|
+
onAutoEditComplete,
|
|
1822
|
+
onFieldError,
|
|
1823
|
+
menuActions,
|
|
1824
|
+
handleRowRef
|
|
1825
|
+
}
|
|
1826
|
+
)
|
|
1818
1827
|
}
|
|
1819
1828
|
))
|
|
1820
1829
|
))));
|
|
@@ -1865,9 +1874,9 @@ function VariablesManagerPanel() {
|
|
|
1865
1874
|
} = useVariablesManagerState();
|
|
1866
1875
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
1867
1876
|
const { createNavigationCallback, resetNavigation } = useErrorNavigation();
|
|
1868
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
1869
|
-
const [stopSyncConfirmation, setStopSyncConfirmation] =
|
|
1870
|
-
const [serverError, setServerError] =
|
|
1877
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState6(null);
|
|
1878
|
+
const [stopSyncConfirmation, setStopSyncConfirmation] = useState6(null);
|
|
1879
|
+
const [serverError, setServerError] = useState6(null);
|
|
1871
1880
|
usePreventUnload(isDirty);
|
|
1872
1881
|
const handleClosePanel = () => {
|
|
1873
1882
|
if (isDirty) {
|
|
@@ -1956,21 +1965,21 @@ function VariablesManagerPanel() {
|
|
|
1956
1965
|
[variables, handleStartSync]
|
|
1957
1966
|
);
|
|
1958
1967
|
const hasVariables = Object.keys(variables).length > 0;
|
|
1959
|
-
return /* @__PURE__ */
|
|
1968
|
+
return /* @__PURE__ */ React14.createElement(ThemeProvider, null, /* @__PURE__ */ React14.createElement(Panel, null, /* @__PURE__ */ React14.createElement(
|
|
1960
1969
|
PanelHeader,
|
|
1961
1970
|
{
|
|
1962
1971
|
sx: {
|
|
1963
1972
|
height: "unset"
|
|
1964
1973
|
}
|
|
1965
1974
|
},
|
|
1966
|
-
/* @__PURE__ */
|
|
1975
|
+
/* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "inherit" }), __10("Variables Manager", "elementor"))), /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React14.createElement(
|
|
1967
1976
|
VariableManagerCreateMenu,
|
|
1968
1977
|
{
|
|
1969
1978
|
onCreate: handleCreateVariable,
|
|
1970
1979
|
variables,
|
|
1971
1980
|
menuState: createMenuState
|
|
1972
1981
|
}
|
|
1973
|
-
), /* @__PURE__ */
|
|
1982
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1974
1983
|
CloseButton,
|
|
1975
1984
|
{
|
|
1976
1985
|
"aria-label": "Close",
|
|
@@ -1979,7 +1988,7 @@ function VariablesManagerPanel() {
|
|
|
1979
1988
|
handleClosePanel();
|
|
1980
1989
|
}
|
|
1981
1990
|
}
|
|
1982
|
-
))), /* @__PURE__ */
|
|
1991
|
+
))), /* @__PURE__ */ React14.createElement(Stack6, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React14.createElement(
|
|
1983
1992
|
SearchField,
|
|
1984
1993
|
{
|
|
1985
1994
|
sx: {
|
|
@@ -1990,8 +1999,8 @@ function VariablesManagerPanel() {
|
|
|
1990
1999
|
value: searchValue,
|
|
1991
2000
|
onSearch: handleSearch
|
|
1992
2001
|
}
|
|
1993
|
-
)), /* @__PURE__ */
|
|
1994
|
-
), /* @__PURE__ */
|
|
2002
|
+
)), /* @__PURE__ */ React14.createElement(Divider, { sx: { width: "100%" } }))
|
|
2003
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1995
2004
|
PanelBody,
|
|
1996
2005
|
{
|
|
1997
2006
|
sx: {
|
|
@@ -2000,7 +2009,7 @@ function VariablesManagerPanel() {
|
|
|
2000
2009
|
height: "100%"
|
|
2001
2010
|
}
|
|
2002
2011
|
},
|
|
2003
|
-
hasVariables && /* @__PURE__ */
|
|
2012
|
+
hasVariables && /* @__PURE__ */ React14.createElement(
|
|
2004
2013
|
VariablesManagerTable,
|
|
2005
2014
|
{
|
|
2006
2015
|
menuActions: buildMenuActions,
|
|
@@ -2011,15 +2020,15 @@ function VariablesManagerPanel() {
|
|
|
2011
2020
|
onFieldError: setIsSaveDisabled
|
|
2012
2021
|
}
|
|
2013
2022
|
),
|
|
2014
|
-
!hasVariables && searchValue && /* @__PURE__ */
|
|
2023
|
+
!hasVariables && searchValue && /* @__PURE__ */ React14.createElement(
|
|
2015
2024
|
NoSearchResults,
|
|
2016
2025
|
{
|
|
2017
2026
|
searchValue,
|
|
2018
2027
|
onClear: () => handleSearch(""),
|
|
2019
|
-
icon: /* @__PURE__ */
|
|
2028
|
+
icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" })
|
|
2020
2029
|
}
|
|
2021
2030
|
),
|
|
2022
|
-
!hasVariables && !searchValue && /* @__PURE__ */
|
|
2031
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React14.createElement(
|
|
2023
2032
|
EmptyState,
|
|
2024
2033
|
{
|
|
2025
2034
|
title: __10("Create your first variable", "elementor"),
|
|
@@ -2027,27 +2036,27 @@ function VariablesManagerPanel() {
|
|
|
2027
2036
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2028
2037
|
"elementor"
|
|
2029
2038
|
),
|
|
2030
|
-
icon: /* @__PURE__ */
|
|
2039
|
+
icon: /* @__PURE__ */ React14.createElement(ColorFilterIcon, { fontSize: "large" }),
|
|
2031
2040
|
onAdd: createMenuState.open
|
|
2032
2041
|
}
|
|
2033
2042
|
)
|
|
2034
|
-
), /* @__PURE__ */
|
|
2043
|
+
), /* @__PURE__ */ React14.createElement(PanelFooter, null, /* @__PURE__ */ React14.createElement(
|
|
2035
2044
|
Infotip,
|
|
2036
2045
|
{
|
|
2037
2046
|
placement: "right",
|
|
2038
2047
|
open: !!serverError,
|
|
2039
|
-
content: serverError ? /* @__PURE__ */
|
|
2048
|
+
content: serverError ? /* @__PURE__ */ React14.createElement(
|
|
2040
2049
|
Alert,
|
|
2041
2050
|
{
|
|
2042
2051
|
severity: serverError.severity ?? "error",
|
|
2043
|
-
action: serverError.action?.label ? /* @__PURE__ */
|
|
2052
|
+
action: serverError.action?.label ? /* @__PURE__ */ React14.createElement(AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
|
|
2044
2053
|
onClose: !serverError.action?.label ? () => {
|
|
2045
2054
|
setServerError(null);
|
|
2046
2055
|
setIsSaveDisabled(false);
|
|
2047
2056
|
} : void 0,
|
|
2048
|
-
icon: serverError.IconComponent ? /* @__PURE__ */
|
|
2057
|
+
icon: serverError.IconComponent ? /* @__PURE__ */ React14.createElement(serverError.IconComponent, null) : /* @__PURE__ */ React14.createElement(AlertTriangleFilledIcon2, null)
|
|
2049
2058
|
},
|
|
2050
|
-
/* @__PURE__ */
|
|
2059
|
+
/* @__PURE__ */ React14.createElement(AlertTitle, null, serverError.message),
|
|
2051
2060
|
serverError.action?.message
|
|
2052
2061
|
) : null,
|
|
2053
2062
|
arrow: false,
|
|
@@ -2062,8 +2071,8 @@ function VariablesManagerPanel() {
|
|
|
2062
2071
|
}
|
|
2063
2072
|
}
|
|
2064
2073
|
},
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
|
|
2074
|
+
/* @__PURE__ */ React14.createElement(
|
|
2075
|
+
Button2,
|
|
2067
2076
|
{
|
|
2068
2077
|
fullWidth: true,
|
|
2069
2078
|
size: "small",
|
|
@@ -2075,7 +2084,7 @@ function VariablesManagerPanel() {
|
|
|
2075
2084
|
},
|
|
2076
2085
|
__10("Save changes", "elementor")
|
|
2077
2086
|
)
|
|
2078
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
2087
|
+
))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2079
2088
|
DeleteConfirmationDialog,
|
|
2080
2089
|
{
|
|
2081
2090
|
open: true,
|
|
@@ -2083,14 +2092,14 @@ function VariablesManagerPanel() {
|
|
|
2083
2092
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
2084
2093
|
closeDialog: () => setDeleteConfirmation(null)
|
|
2085
2094
|
}
|
|
2086
|
-
), stopSyncConfirmation && /* @__PURE__ */
|
|
2095
|
+
), stopSyncConfirmation && /* @__PURE__ */ React14.createElement(
|
|
2087
2096
|
StopSyncConfirmationDialog,
|
|
2088
2097
|
{
|
|
2089
2098
|
open: true,
|
|
2090
|
-
|
|
2099
|
+
onClose: () => setStopSyncConfirmation(null),
|
|
2091
2100
|
onConfirm: () => handleStopSyncWithConfirmation(stopSyncConfirmation)
|
|
2092
2101
|
}
|
|
2093
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
2102
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React14.createElement(SaveChangesDialog, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __10("You have unsaved changes", "elementor")), /* @__PURE__ */ React14.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React14.createElement(SaveChangesDialog.ContentText, null, __10("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React14.createElement(
|
|
2094
2103
|
SaveChangesDialog.Actions,
|
|
2095
2104
|
{
|
|
2096
2105
|
actions: {
|
|
@@ -2128,6 +2137,19 @@ var usePreventUnload = (isDirty) => {
|
|
|
2128
2137
|
};
|
|
2129
2138
|
}, [isDirty]);
|
|
2130
2139
|
};
|
|
2140
|
+
var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => /* @__PURE__ */ React14.createElement(ConfirmationDialog2, { open, onClose }, /* @__PURE__ */ React14.createElement(ConfirmationDialog2.Title, { icon: ColorFilterIcon, iconColor: "secondary" }, __10("Stop syncing variable color", "elementor")), /* @__PURE__ */ React14.createElement(ConfirmationDialog2.Content, null, /* @__PURE__ */ React14.createElement(ConfirmationDialog2.ContentText, null, __10(
|
|
2141
|
+
"This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
|
|
2142
|
+
"elementor"
|
|
2143
|
+
))), /* @__PURE__ */ React14.createElement(
|
|
2144
|
+
ConfirmationDialog2.Actions,
|
|
2145
|
+
{
|
|
2146
|
+
onClose,
|
|
2147
|
+
onConfirm,
|
|
2148
|
+
cancelLabel: __10("Cancel", "elementor"),
|
|
2149
|
+
confirmLabel: __10("Got it", "elementor"),
|
|
2150
|
+
color: "secondary"
|
|
2151
|
+
}
|
|
2152
|
+
));
|
|
2131
2153
|
|
|
2132
2154
|
// src/components/open-panel-from-url.tsx
|
|
2133
2155
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
@@ -2135,7 +2157,7 @@ var PANEL_ID = "variables-manager";
|
|
|
2135
2157
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
2136
2158
|
function OpenPanelFromUrl() {
|
|
2137
2159
|
const { open } = usePanelActions();
|
|
2138
|
-
const hasOpened =
|
|
2160
|
+
const hasOpened = useRef7(false);
|
|
2139
2161
|
useEffect4(() => {
|
|
2140
2162
|
const urlParams = new URLSearchParams(window.location.search);
|
|
2141
2163
|
const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
|
|
@@ -2157,15 +2179,15 @@ function OpenPanelFromUrl() {
|
|
|
2157
2179
|
}
|
|
2158
2180
|
|
|
2159
2181
|
// src/controls/variable-control.tsx
|
|
2160
|
-
import * as
|
|
2182
|
+
import * as React33 from "react";
|
|
2161
2183
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
|
|
2162
2184
|
|
|
2163
2185
|
// src/components/ui/variable/assigned-variable.tsx
|
|
2164
|
-
import { useId, useRef as
|
|
2165
|
-
import * as
|
|
2186
|
+
import { useId, useRef as useRef8 } from "react";
|
|
2187
|
+
import * as React24 from "react";
|
|
2166
2188
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
2167
2189
|
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
2168
|
-
import { bindPopover, bindTrigger as bindTrigger3, Box as
|
|
2190
|
+
import { bindPopover, bindTrigger as bindTrigger3, Box as Box5, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
2169
2191
|
|
|
2170
2192
|
// src/utils/unlink-variable.ts
|
|
2171
2193
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -2184,30 +2206,30 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
2184
2206
|
}
|
|
2185
2207
|
|
|
2186
2208
|
// src/components/variable-selection-popover.tsx
|
|
2187
|
-
import * as
|
|
2188
|
-
import { useState as
|
|
2209
|
+
import * as React22 from "react";
|
|
2210
|
+
import { useState as useState12 } from "react";
|
|
2189
2211
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
2190
2212
|
|
|
2191
2213
|
// src/context/variable-selection-popover.context.tsx
|
|
2192
|
-
import * as
|
|
2193
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
2194
|
-
import { Box } from "@elementor/ui";
|
|
2214
|
+
import * as React15 from "react";
|
|
2215
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState7 } from "react";
|
|
2216
|
+
import { Box as Box2 } from "@elementor/ui";
|
|
2195
2217
|
var PopoverContentRefContext = createContext2(null);
|
|
2196
2218
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
2197
|
-
const [anchorRef, setAnchorRef] =
|
|
2198
|
-
return /* @__PURE__ */
|
|
2219
|
+
const [anchorRef, setAnchorRef] = useState7(null);
|
|
2220
|
+
return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(Box2, { ref: setAnchorRef }, children));
|
|
2199
2221
|
};
|
|
2200
2222
|
var usePopoverContentRef = () => {
|
|
2201
2223
|
return useContext2(PopoverContentRefContext);
|
|
2202
2224
|
};
|
|
2203
2225
|
|
|
2204
2226
|
// src/components/variable-creation.tsx
|
|
2205
|
-
import * as
|
|
2206
|
-
import { useState as
|
|
2227
|
+
import * as React17 from "react";
|
|
2228
|
+
import { useState as useState8 } from "react";
|
|
2207
2229
|
import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
2208
2230
|
import { PopoverHeader, SectionPopoverBody } from "@elementor/editor-ui";
|
|
2209
2231
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
2210
|
-
import { Button as
|
|
2232
|
+
import { Button as Button3, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography6 } from "@elementor/ui";
|
|
2211
2233
|
import { __ as __11 } from "@wordpress/i18n";
|
|
2212
2234
|
|
|
2213
2235
|
// src/hooks/use-initial-value.ts
|
|
@@ -2251,10 +2273,10 @@ var unwrapValue = (input) => {
|
|
|
2251
2273
|
};
|
|
2252
2274
|
|
|
2253
2275
|
// src/components/ui/form-field.tsx
|
|
2254
|
-
import * as
|
|
2276
|
+
import * as React16 from "react";
|
|
2255
2277
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
2256
2278
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
2257
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ React16.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React16.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React16.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React16.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React16.createElement(FormHelperText, null, noticeMsg)));
|
|
2258
2280
|
};
|
|
2259
2281
|
|
|
2260
2282
|
// src/components/variable-creation.tsx
|
|
@@ -2264,11 +2286,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2264
2286
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
2265
2287
|
const { propType } = useBoundProp4();
|
|
2266
2288
|
const initialValue = useInitialValue();
|
|
2267
|
-
const [value, setValue] =
|
|
2268
|
-
const [label, setLabel] =
|
|
2269
|
-
const [errorMessage, setErrorMessage] =
|
|
2270
|
-
const [valueFieldError, setValueFieldError] =
|
|
2271
|
-
const [propTypeKey, setPropTypeKey] =
|
|
2289
|
+
const [value, setValue] = useState8(initialValue);
|
|
2290
|
+
const [label, setLabel] = useState8("");
|
|
2291
|
+
const [errorMessage, setErrorMessage] = useState8("");
|
|
2292
|
+
const [valueFieldError, setValueFieldError] = useState8("");
|
|
2293
|
+
const [propTypeKey, setPropTypeKey] = useState8(propTypeUtil.key);
|
|
2272
2294
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2273
2295
|
const resetFields = () => {
|
|
2274
2296
|
setValue("");
|
|
@@ -2325,14 +2347,14 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2325
2347
|
handleCreateAndTrack();
|
|
2326
2348
|
}
|
|
2327
2349
|
};
|
|
2328
|
-
return /* @__PURE__ */
|
|
2350
|
+
return /* @__PURE__ */ React17.createElement(SectionPopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2329
2351
|
PopoverHeader,
|
|
2330
2352
|
{
|
|
2331
|
-
icon: /* @__PURE__ */
|
|
2353
|
+
icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(IconButton4, { size: SIZE2, "aria-label": __11("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React17.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
2332
2354
|
title: __11("Create variable", "elementor"),
|
|
2333
2355
|
onClose: closePopover
|
|
2334
2356
|
}
|
|
2335
|
-
), /* @__PURE__ */
|
|
2357
|
+
), /* @__PURE__ */ React17.createElement(Divider2, null), /* @__PURE__ */ React17.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2336
2358
|
FormField,
|
|
2337
2359
|
{
|
|
2338
2360
|
id: "variable-label",
|
|
@@ -2340,7 +2362,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2340
2362
|
errorMsg: labelFieldError?.message,
|
|
2341
2363
|
noticeMsg: labelHint(label)
|
|
2342
2364
|
},
|
|
2343
|
-
/* @__PURE__ */
|
|
2365
|
+
/* @__PURE__ */ React17.createElement(
|
|
2344
2366
|
LabelField,
|
|
2345
2367
|
{
|
|
2346
2368
|
id: "variable-label",
|
|
@@ -2359,7 +2381,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2359
2381
|
onKeyDown: handleKeyDown
|
|
2360
2382
|
}
|
|
2361
2383
|
)
|
|
2362
|
-
), ValueField && /* @__PURE__ */
|
|
2384
|
+
), ValueField && /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: __11("Value", "elementor") }, /* @__PURE__ */ React17.createElement(Typography6, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React17.createElement(
|
|
2363
2385
|
ValueField,
|
|
2364
2386
|
{
|
|
2365
2387
|
value,
|
|
@@ -2373,8 +2395,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2373
2395
|
propType,
|
|
2374
2396
|
onKeyDown: handleKeyDown
|
|
2375
2397
|
}
|
|
2376
|
-
))), errorMessage && /* @__PURE__ */
|
|
2377
|
-
|
|
2398
|
+
))), errorMessage && /* @__PURE__ */ React17.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React17.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React17.createElement(
|
|
2399
|
+
Button3,
|
|
2378
2400
|
{
|
|
2379
2401
|
id: "create-variable-button",
|
|
2380
2402
|
size: "small",
|
|
@@ -2387,29 +2409,29 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2387
2409
|
};
|
|
2388
2410
|
|
|
2389
2411
|
// src/components/variable-edit.tsx
|
|
2390
|
-
import * as
|
|
2391
|
-
import { useEffect as useEffect5, useState as
|
|
2412
|
+
import * as React19 from "react";
|
|
2413
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
2392
2414
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
2393
2415
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
2394
2416
|
import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
|
|
2395
2417
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
2396
|
-
import { Button as
|
|
2418
|
+
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Tooltip, Typography as Typography8 } from "@elementor/ui";
|
|
2397
2419
|
import { __ as __13 } from "@wordpress/i18n";
|
|
2398
2420
|
|
|
2399
2421
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
2400
|
-
import * as
|
|
2401
|
-
import { useState as
|
|
2422
|
+
import * as React18 from "react";
|
|
2423
|
+
import { useState as useState9 } from "react";
|
|
2402
2424
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2403
2425
|
import {
|
|
2404
|
-
Button as
|
|
2405
|
-
Checkbox
|
|
2406
|
-
Dialog
|
|
2407
|
-
DialogActions
|
|
2408
|
-
DialogContent
|
|
2409
|
-
DialogContentText
|
|
2410
|
-
DialogTitle
|
|
2411
|
-
FormControlLabel
|
|
2412
|
-
Typography as
|
|
2426
|
+
Button as Button4,
|
|
2427
|
+
Checkbox,
|
|
2428
|
+
Dialog,
|
|
2429
|
+
DialogActions,
|
|
2430
|
+
DialogContent,
|
|
2431
|
+
DialogContentText,
|
|
2432
|
+
DialogTitle,
|
|
2433
|
+
FormControlLabel,
|
|
2434
|
+
Typography as Typography7
|
|
2413
2435
|
} from "@elementor/ui";
|
|
2414
2436
|
import { __ as __12 } from "@wordpress/i18n";
|
|
2415
2437
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
@@ -2418,30 +2440,30 @@ var EditConfirmationDialog = ({
|
|
|
2418
2440
|
onConfirm,
|
|
2419
2441
|
onSuppressMessage
|
|
2420
2442
|
}) => {
|
|
2421
|
-
const [dontShowAgain, setDontShowAgain] =
|
|
2443
|
+
const [dontShowAgain, setDontShowAgain] = useState9(false);
|
|
2422
2444
|
const handleSave = () => {
|
|
2423
2445
|
if (dontShowAgain) {
|
|
2424
2446
|
onSuppressMessage?.();
|
|
2425
2447
|
}
|
|
2426
2448
|
onConfirm?.();
|
|
2427
2449
|
};
|
|
2428
|
-
return /* @__PURE__ */
|
|
2450
|
+
return /* @__PURE__ */ React18.createElement(Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React18.createElement(DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React18.createElement(AlertTriangleFilledIcon3, { color: "secondary" }), __12("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React18.createElement(DialogContent, null, /* @__PURE__ */ React18.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __12(
|
|
2429
2451
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
2430
2452
|
"elementor"
|
|
2431
|
-
))), /* @__PURE__ */
|
|
2432
|
-
|
|
2453
|
+
))), /* @__PURE__ */ React18.createElement(DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React18.createElement(
|
|
2454
|
+
FormControlLabel,
|
|
2433
2455
|
{
|
|
2434
|
-
control: /* @__PURE__ */
|
|
2435
|
-
|
|
2456
|
+
control: /* @__PURE__ */ React18.createElement(
|
|
2457
|
+
Checkbox,
|
|
2436
2458
|
{
|
|
2437
2459
|
checked: dontShowAgain,
|
|
2438
2460
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2439
2461
|
size: "small"
|
|
2440
2462
|
}
|
|
2441
2463
|
),
|
|
2442
|
-
label: /* @__PURE__ */
|
|
2464
|
+
label: /* @__PURE__ */ React18.createElement(Typography7, { variant: "body2" }, __12("Don't show me again", "elementor"))
|
|
2443
2465
|
}
|
|
2444
|
-
), /* @__PURE__ */
|
|
2466
|
+
), /* @__PURE__ */ React18.createElement("div", null, /* @__PURE__ */ React18.createElement(Button4, { color: "secondary", onClick: closeDialog }, __12("Keep editing", "elementor")), /* @__PURE__ */ React18.createElement(Button4, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __12("Save", "elementor")))));
|
|
2445
2467
|
};
|
|
2446
2468
|
|
|
2447
2469
|
// src/components/variable-edit.tsx
|
|
@@ -2452,19 +2474,19 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2452
2474
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
2453
2475
|
const { propType } = useBoundProp5();
|
|
2454
2476
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(EDIT_CONFIRMATION_DIALOG_ID);
|
|
2455
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
2456
|
-
const [editConfirmation, setEditConfirmation] =
|
|
2457
|
-
const [errorMessage, setErrorMessage] =
|
|
2458
|
-
const [valueFieldError, setValueFieldError] =
|
|
2477
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState10(false);
|
|
2478
|
+
const [editConfirmation, setEditConfirmation] = useState10(false);
|
|
2479
|
+
const [errorMessage, setErrorMessage] = useState10("");
|
|
2480
|
+
const [valueFieldError, setValueFieldError] = useState10("");
|
|
2459
2481
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
2460
2482
|
const variable = useVariable(editId);
|
|
2461
|
-
const [propTypeKey, setPropTypeKey] =
|
|
2483
|
+
const [propTypeKey, setPropTypeKey] = useState10(variable?.type ?? propTypeUtil.key);
|
|
2462
2484
|
if (!variable) {
|
|
2463
2485
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2464
2486
|
}
|
|
2465
2487
|
const userPermissions = usePermissions();
|
|
2466
|
-
const [value, setValue] =
|
|
2467
|
-
const [label, setLabel] =
|
|
2488
|
+
const [value, setValue] = useState10(() => variable.value);
|
|
2489
|
+
const [label, setLabel] = useState10(() => variable.label);
|
|
2468
2490
|
useEffect5(() => {
|
|
2469
2491
|
styleVariablesRepository.update({
|
|
2470
2492
|
[editId]: {
|
|
@@ -2527,7 +2549,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2527
2549
|
const actions = [];
|
|
2528
2550
|
if (userPermissions.canDelete()) {
|
|
2529
2551
|
actions.push(
|
|
2530
|
-
/* @__PURE__ */
|
|
2552
|
+
/* @__PURE__ */ React19.createElement(Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React19.createElement(IconButton5, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React19.createElement(TrashIcon2, { fontSize: SIZE3 })))
|
|
2531
2553
|
);
|
|
2532
2554
|
}
|
|
2533
2555
|
const hasEmptyFields = () => {
|
|
@@ -2552,23 +2574,23 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2552
2574
|
handleUpdate();
|
|
2553
2575
|
}
|
|
2554
2576
|
};
|
|
2555
|
-
return /* @__PURE__ */
|
|
2577
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(SectionPopoverBody2, { height: "auto" }, /* @__PURE__ */ React19.createElement(
|
|
2556
2578
|
PopoverHeader2,
|
|
2557
2579
|
{
|
|
2558
2580
|
title: __13("Edit variable", "elementor"),
|
|
2559
2581
|
onClose,
|
|
2560
|
-
icon: /* @__PURE__ */
|
|
2582
|
+
icon: /* @__PURE__ */ React19.createElement(React19.Fragment, null, onGoBack && /* @__PURE__ */ React19.createElement(
|
|
2561
2583
|
IconButton5,
|
|
2562
2584
|
{
|
|
2563
2585
|
size: SIZE3,
|
|
2564
2586
|
"aria-label": __13("Go Back", "elementor"),
|
|
2565
2587
|
onClick: onGoBack
|
|
2566
2588
|
},
|
|
2567
|
-
/* @__PURE__ */
|
|
2568
|
-
), /* @__PURE__ */
|
|
2589
|
+
/* @__PURE__ */ React19.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
2590
|
+
), /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2569
2591
|
actions
|
|
2570
2592
|
}
|
|
2571
|
-
), /* @__PURE__ */
|
|
2593
|
+
), /* @__PURE__ */ React19.createElement(Divider3, null), /* @__PURE__ */ React19.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React19.createElement(
|
|
2572
2594
|
FormField,
|
|
2573
2595
|
{
|
|
2574
2596
|
id: "variable-label",
|
|
@@ -2576,7 +2598,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2576
2598
|
errorMsg: labelFieldError?.message,
|
|
2577
2599
|
noticeMsg: labelHint(label)
|
|
2578
2600
|
},
|
|
2579
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ React19.createElement(
|
|
2580
2602
|
LabelField,
|
|
2581
2603
|
{
|
|
2582
2604
|
id: "variable-label",
|
|
@@ -2595,7 +2617,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2595
2617
|
onKeyDown: handleKeyDown
|
|
2596
2618
|
}
|
|
2597
2619
|
)
|
|
2598
|
-
), ValueField && /* @__PURE__ */
|
|
2620
|
+
), ValueField && /* @__PURE__ */ React19.createElement(FormField, { errorMsg: valueFieldError, label: __13("Value", "elementor") }, /* @__PURE__ */ React19.createElement(Typography8, { variant: "h5" }, /* @__PURE__ */ React19.createElement(
|
|
2599
2621
|
ValueField,
|
|
2600
2622
|
{
|
|
2601
2623
|
propTypeKey: variable.type,
|
|
@@ -2610,7 +2632,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2610
2632
|
onValidationChange: setValueFieldError,
|
|
2611
2633
|
propType
|
|
2612
2634
|
}
|
|
2613
|
-
))), errorMessage && /* @__PURE__ */
|
|
2635
|
+
))), errorMessage && /* @__PURE__ */ React19.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React19.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React19.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __13("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2614
2636
|
DeleteConfirmationDialog,
|
|
2615
2637
|
{
|
|
2616
2638
|
open: true,
|
|
@@ -2618,7 +2640,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2618
2640
|
onConfirm: handleDelete,
|
|
2619
2641
|
closeDialog: closeDeleteDialog()
|
|
2620
2642
|
}
|
|
2621
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2643
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React19.createElement(
|
|
2622
2644
|
EditConfirmationDialog,
|
|
2623
2645
|
{
|
|
2624
2646
|
closeDialog: closeEditDialog(),
|
|
@@ -2629,8 +2651,8 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2629
2651
|
};
|
|
2630
2652
|
|
|
2631
2653
|
// src/components/variables-selection.tsx
|
|
2632
|
-
import { useState as
|
|
2633
|
-
import * as
|
|
2654
|
+
import { useState as useState11 } from "react";
|
|
2655
|
+
import * as React21 from "react";
|
|
2634
2656
|
import {
|
|
2635
2657
|
PopoverHeader as PopoverHeader3,
|
|
2636
2658
|
PopoverMenuList,
|
|
@@ -2643,17 +2665,17 @@ import { Divider as Divider4, IconButton as IconButton7, Tooltip as Tooltip3 } f
|
|
|
2643
2665
|
import { __ as __15, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
2644
2666
|
|
|
2645
2667
|
// src/components/ui/menu-item-content.tsx
|
|
2646
|
-
import * as
|
|
2668
|
+
import * as React20 from "react";
|
|
2647
2669
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2648
2670
|
import { EditIcon } from "@elementor/icons";
|
|
2649
|
-
import { Box as
|
|
2671
|
+
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography9 } from "@elementor/ui";
|
|
2650
2672
|
import { __ as __14 } from "@wordpress/i18n";
|
|
2651
2673
|
var SIZE4 = "tiny";
|
|
2652
2674
|
var EDIT_LABEL = __14("Edit variable", "elementor");
|
|
2653
2675
|
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2654
2676
|
const onEdit = item.onEdit;
|
|
2655
|
-
return /* @__PURE__ */
|
|
2656
|
-
|
|
2677
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React20.createElement(
|
|
2678
|
+
Box3,
|
|
2657
2679
|
{
|
|
2658
2680
|
sx: {
|
|
2659
2681
|
flex: 1,
|
|
@@ -2663,29 +2685,29 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2663
2685
|
gap: 1
|
|
2664
2686
|
}
|
|
2665
2687
|
},
|
|
2666
|
-
/* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ React20.createElement(
|
|
2667
2689
|
EllipsisWithTooltip2,
|
|
2668
2690
|
{
|
|
2669
2691
|
title: item.label || item.value,
|
|
2670
|
-
as:
|
|
2692
|
+
as: Typography9,
|
|
2671
2693
|
variant: "caption",
|
|
2672
2694
|
color: disabled ? "text.disabled" : "text.primary",
|
|
2673
2695
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2674
2696
|
maxWidth: "50%"
|
|
2675
2697
|
}
|
|
2676
2698
|
),
|
|
2677
|
-
item.secondaryText && /* @__PURE__ */
|
|
2699
|
+
item.secondaryText && /* @__PURE__ */ React20.createElement(
|
|
2678
2700
|
EllipsisWithTooltip2,
|
|
2679
2701
|
{
|
|
2680
2702
|
title: item.secondaryText,
|
|
2681
|
-
as:
|
|
2703
|
+
as: Typography9,
|
|
2682
2704
|
variant: "caption",
|
|
2683
2705
|
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2684
2706
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2685
2707
|
maxWidth: "50%"
|
|
2686
2708
|
}
|
|
2687
2709
|
)
|
|
2688
|
-
), !!onEdit && !disabled && /* @__PURE__ */
|
|
2710
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React20.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React20.createElement(
|
|
2689
2711
|
IconButton6,
|
|
2690
2712
|
{
|
|
2691
2713
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2695,7 +2717,7 @@ var MenuItemContent = ({ item, disabled = false }) => {
|
|
|
2695
2717
|
},
|
|
2696
2718
|
"aria-label": EDIT_LABEL
|
|
2697
2719
|
},
|
|
2698
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ React20.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2699
2721
|
)));
|
|
2700
2722
|
};
|
|
2701
2723
|
|
|
@@ -2741,7 +2763,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
|
|
|
2741
2763
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2742
2764
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2743
2765
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
2744
|
-
const [searchValue, setSearchValue] =
|
|
2766
|
+
const [searchValue, setSearchValue] = useState11("");
|
|
2745
2767
|
const {
|
|
2746
2768
|
list: variables,
|
|
2747
2769
|
hasMatches: hasSearchResults,
|
|
@@ -2768,7 +2790,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2768
2790
|
const actions = [];
|
|
2769
2791
|
if (onAdd) {
|
|
2770
2792
|
actions.push(
|
|
2771
|
-
/* @__PURE__ */
|
|
2793
|
+
/* @__PURE__ */ React21.createElement(Tooltip3, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React21.createElement("span", null, /* @__PURE__ */ React21.createElement(
|
|
2772
2794
|
IconButton7,
|
|
2773
2795
|
{
|
|
2774
2796
|
id: "add-variable-button",
|
|
@@ -2777,7 +2799,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2777
2799
|
"aria-label": CREATE_LABEL,
|
|
2778
2800
|
disabled
|
|
2779
2801
|
},
|
|
2780
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ React21.createElement(PlusIcon2, { fontSize: SIZE5 })
|
|
2781
2803
|
)))
|
|
2782
2804
|
);
|
|
2783
2805
|
}
|
|
@@ -2791,7 +2813,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2791
2813
|
});
|
|
2792
2814
|
};
|
|
2793
2815
|
actions.push(
|
|
2794
|
-
/* @__PURE__ */
|
|
2816
|
+
/* @__PURE__ */ React21.createElement(Tooltip3, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React21.createElement(
|
|
2795
2817
|
IconButton7,
|
|
2796
2818
|
{
|
|
2797
2819
|
id: "variables-manager-button",
|
|
@@ -2799,16 +2821,16 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2799
2821
|
onClick: handleOpenManager,
|
|
2800
2822
|
"aria-label": MANAGER_LABEL
|
|
2801
2823
|
},
|
|
2802
|
-
/* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ React21.createElement(SettingsIcon, { fontSize: SIZE5 })
|
|
2803
2825
|
))
|
|
2804
2826
|
);
|
|
2805
2827
|
}
|
|
2806
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2828
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
2807
2829
|
const items = variables.map(({ value, label, key }) => ({
|
|
2808
2830
|
type: "item",
|
|
2809
2831
|
value: key,
|
|
2810
2832
|
label,
|
|
2811
|
-
icon: /* @__PURE__ */
|
|
2833
|
+
icon: /* @__PURE__ */ React21.createElement(StartIcon, { value }),
|
|
2812
2834
|
secondaryText: value,
|
|
2813
2835
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
2814
2836
|
}));
|
|
@@ -2818,22 +2840,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2818
2840
|
const handleClearSearch = () => {
|
|
2819
2841
|
setSearchValue("");
|
|
2820
2842
|
};
|
|
2821
|
-
return /* @__PURE__ */
|
|
2843
|
+
return /* @__PURE__ */ React21.createElement(SectionPopoverBody3, null, /* @__PURE__ */ React21.createElement(
|
|
2822
2844
|
PopoverHeader3,
|
|
2823
2845
|
{
|
|
2824
2846
|
title: __15("Variables", "elementor"),
|
|
2825
|
-
icon: /* @__PURE__ */
|
|
2847
|
+
icon: /* @__PURE__ */ React21.createElement(ColorFilterIcon2, { fontSize: SIZE5 }),
|
|
2826
2848
|
onClose: closePopover,
|
|
2827
2849
|
actions
|
|
2828
2850
|
}
|
|
2829
|
-
), hasVariables && /* @__PURE__ */
|
|
2851
|
+
), hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2830
2852
|
SearchField2,
|
|
2831
2853
|
{
|
|
2832
2854
|
value: searchValue,
|
|
2833
2855
|
onSearch: handleSearch,
|
|
2834
2856
|
placeholder: __15("Search", "elementor")
|
|
2835
2857
|
}
|
|
2836
|
-
), /* @__PURE__ */
|
|
2858
|
+
), /* @__PURE__ */ React21.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
2837
2859
|
PopoverMenuList,
|
|
2838
2860
|
{
|
|
2839
2861
|
items,
|
|
@@ -2843,10 +2865,10 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2843
2865
|
},
|
|
2844
2866
|
selectedValue: variable,
|
|
2845
2867
|
"data-testid": `${variableType}-variables-list`,
|
|
2846
|
-
menuListTemplate: (props) => /* @__PURE__ */
|
|
2847
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2868
|
+
menuListTemplate: (props) => /* @__PURE__ */ React21.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2869
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React21.createElement(MenuItemContent, { item, disabled })
|
|
2848
2870
|
}
|
|
2849
|
-
), disabled && /* @__PURE__ */
|
|
2871
|
+
), disabled && /* @__PURE__ */ React21.createElement(
|
|
2850
2872
|
PromotionAlert,
|
|
2851
2873
|
{
|
|
2852
2874
|
message: sprintf3(
|
|
@@ -2856,14 +2878,14 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2856
2878
|
),
|
|
2857
2879
|
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2858
2880
|
}
|
|
2859
|
-
)), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2881
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2860
2882
|
NoSearchResults,
|
|
2861
2883
|
{
|
|
2862
2884
|
searchValue,
|
|
2863
2885
|
onClear: handleClearSearch,
|
|
2864
|
-
icon: /* @__PURE__ */
|
|
2886
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2865
2887
|
}
|
|
2866
|
-
), disabled && !hasVariables && /* @__PURE__ */
|
|
2888
|
+
), disabled && !hasVariables && /* @__PURE__ */ React21.createElement(
|
|
2867
2889
|
EmptyState,
|
|
2868
2890
|
{
|
|
2869
2891
|
title: sprintf3(
|
|
@@ -2876,10 +2898,10 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2876
2898
|
__15("Upgrade to create %s variables and maintain consistent element sizing.", "elementor"),
|
|
2877
2899
|
variableType
|
|
2878
2900
|
),
|
|
2879
|
-
icon: /* @__PURE__ */
|
|
2901
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" })
|
|
2880
2902
|
},
|
|
2881
2903
|
emptyState
|
|
2882
|
-
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2904
|
+
), !hasVariables && !hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2883
2905
|
EmptyState,
|
|
2884
2906
|
{
|
|
2885
2907
|
title: sprintf3(
|
|
@@ -2891,10 +2913,10 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2891
2913
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
2892
2914
|
"elementor"
|
|
2893
2915
|
),
|
|
2894
|
-
icon: /* @__PURE__ */
|
|
2916
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2895
2917
|
onAdd
|
|
2896
2918
|
}
|
|
2897
|
-
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */
|
|
2919
|
+
), hasNoCompatibleVariables && !disabled && /* @__PURE__ */ React21.createElement(
|
|
2898
2920
|
EmptyState,
|
|
2899
2921
|
{
|
|
2900
2922
|
title: __15("No compatible variables", "elementor"),
|
|
@@ -2902,7 +2924,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2902
2924
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
2903
2925
|
"elementor"
|
|
2904
2926
|
),
|
|
2905
|
-
icon: /* @__PURE__ */
|
|
2927
|
+
icon: /* @__PURE__ */ React21.createElement(VariableIcon, { fontSize: "large" }),
|
|
2906
2928
|
onAdd
|
|
2907
2929
|
}
|
|
2908
2930
|
));
|
|
@@ -2913,13 +2935,13 @@ var VIEW_LIST = "list";
|
|
|
2913
2935
|
var VIEW_ADD = "add";
|
|
2914
2936
|
var VIEW_EDIT = "edit";
|
|
2915
2937
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2916
|
-
const [currentView, setCurrentView] =
|
|
2917
|
-
const [editId, setEditId] =
|
|
2938
|
+
const [currentView, setCurrentView] = useState12(VIEW_LIST);
|
|
2939
|
+
const [editId, setEditId] = useState12("");
|
|
2918
2940
|
const { open } = usePanelActions();
|
|
2919
2941
|
const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
|
|
2920
2942
|
open();
|
|
2921
2943
|
} : void 0;
|
|
2922
|
-
return /* @__PURE__ */
|
|
2944
|
+
return /* @__PURE__ */ React22.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React22.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2923
2945
|
propTypeKey,
|
|
2924
2946
|
currentView,
|
|
2925
2947
|
selectedVariable,
|
|
@@ -2966,7 +2988,7 @@ function RenderView(props) {
|
|
|
2966
2988
|
}
|
|
2967
2989
|
};
|
|
2968
2990
|
if (VIEW_LIST === props.currentView) {
|
|
2969
|
-
return /* @__PURE__ */
|
|
2991
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2970
2992
|
VariablesSelection,
|
|
2971
2993
|
{
|
|
2972
2994
|
closePopover: handlers.onClose,
|
|
@@ -2978,10 +3000,10 @@ function RenderView(props) {
|
|
|
2978
3000
|
);
|
|
2979
3001
|
}
|
|
2980
3002
|
if (VIEW_ADD === props.currentView) {
|
|
2981
|
-
return /* @__PURE__ */
|
|
3003
|
+
return /* @__PURE__ */ React22.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2982
3004
|
}
|
|
2983
3005
|
if (VIEW_EDIT === props.currentView) {
|
|
2984
|
-
return /* @__PURE__ */
|
|
3006
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2985
3007
|
VariableEdit,
|
|
2986
3008
|
{
|
|
2987
3009
|
editId: props.editId,
|
|
@@ -2995,9 +3017,9 @@ function RenderView(props) {
|
|
|
2995
3017
|
}
|
|
2996
3018
|
|
|
2997
3019
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2998
|
-
import * as
|
|
3020
|
+
import * as React23 from "react";
|
|
2999
3021
|
import { DetachIcon } from "@elementor/icons";
|
|
3000
|
-
import { Box as
|
|
3022
|
+
import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography10, UnstableTag as Tag } from "@elementor/ui";
|
|
3001
3023
|
import { __ as __16 } from "@wordpress/i18n";
|
|
3002
3024
|
var SIZE6 = "tiny";
|
|
3003
3025
|
var UNLINK_LABEL = __16("Unlink variable", "elementor");
|
|
@@ -3005,16 +3027,16 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3005
3027
|
const actions = [];
|
|
3006
3028
|
if (onUnlink) {
|
|
3007
3029
|
actions.push(
|
|
3008
|
-
/* @__PURE__ */
|
|
3030
|
+
/* @__PURE__ */ React23.createElement(Tooltip4, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React23.createElement(IconButton8, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React23.createElement(DetachIcon, { fontSize: SIZE6 })))
|
|
3009
3031
|
);
|
|
3010
3032
|
}
|
|
3011
|
-
return /* @__PURE__ */
|
|
3033
|
+
return /* @__PURE__ */ React23.createElement(Tooltip4, { title: label, placement: "top" }, /* @__PURE__ */ React23.createElement(
|
|
3012
3034
|
Tag,
|
|
3013
3035
|
{
|
|
3014
3036
|
fullWidth: true,
|
|
3015
3037
|
showActionsOnHover: true,
|
|
3016
|
-
startIcon: /* @__PURE__ */
|
|
3017
|
-
label: /* @__PURE__ */
|
|
3038
|
+
startIcon: /* @__PURE__ */ React23.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
3039
|
+
label: /* @__PURE__ */ React23.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React23.createElement(Typography10, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
3018
3040
|
actions,
|
|
3019
3041
|
...props
|
|
3020
3042
|
}
|
|
@@ -3025,7 +3047,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
3025
3047
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
3026
3048
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
3027
3049
|
const { setValue } = useBoundProp6();
|
|
3028
|
-
const anchorRef =
|
|
3050
|
+
const anchorRef = useRef8(null);
|
|
3029
3051
|
const popupId = useId();
|
|
3030
3052
|
const popupState = usePopupState3({
|
|
3031
3053
|
variant: "popover",
|
|
@@ -3033,15 +3055,15 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3033
3055
|
});
|
|
3034
3056
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
3035
3057
|
const StartIcon = startIcon || (() => null);
|
|
3036
|
-
return /* @__PURE__ */
|
|
3058
|
+
return /* @__PURE__ */ React24.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React24.createElement(
|
|
3037
3059
|
AssignedTag,
|
|
3038
3060
|
{
|
|
3039
3061
|
label: variable.label,
|
|
3040
|
-
startIcon: /* @__PURE__ */
|
|
3062
|
+
startIcon: /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(ColorFilterIcon3, { fontSize: SIZE6 }), /* @__PURE__ */ React24.createElement(StartIcon, { value: variable.value })),
|
|
3041
3063
|
onUnlink: unlinkVariable,
|
|
3042
3064
|
...bindTrigger3(popupState)
|
|
3043
3065
|
}
|
|
3044
|
-
), /* @__PURE__ */
|
|
3066
|
+
), /* @__PURE__ */ React24.createElement(
|
|
3045
3067
|
Popover,
|
|
3046
3068
|
{
|
|
3047
3069
|
disableScrollLock: true,
|
|
@@ -3053,7 +3075,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3053
3075
|
},
|
|
3054
3076
|
...bindPopover(popupState)
|
|
3055
3077
|
},
|
|
3056
|
-
/* @__PURE__ */
|
|
3078
|
+
/* @__PURE__ */ React24.createElement(
|
|
3057
3079
|
VariableSelectionPopover,
|
|
3058
3080
|
{
|
|
3059
3081
|
selectedVariable: variable,
|
|
@@ -3065,18 +3087,18 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
3065
3087
|
};
|
|
3066
3088
|
|
|
3067
3089
|
// src/components/ui/variable/deleted-variable.tsx
|
|
3068
|
-
import * as
|
|
3069
|
-
import { useId as useId2, useRef as
|
|
3090
|
+
import * as React28 from "react";
|
|
3091
|
+
import { useId as useId2, useRef as useRef9, useState as useState14 } from "react";
|
|
3070
3092
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
3071
|
-
import { Backdrop, bindPopover as bindPopover2, Box as
|
|
3093
|
+
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
3072
3094
|
import { __ as __19 } from "@wordpress/i18n";
|
|
3073
3095
|
|
|
3074
3096
|
// src/components/variable-restore.tsx
|
|
3075
|
-
import * as
|
|
3076
|
-
import { useState as
|
|
3097
|
+
import * as React25 from "react";
|
|
3098
|
+
import { useState as useState13 } from "react";
|
|
3077
3099
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
3078
3100
|
import { PopoverHeader as PopoverHeader4, SectionPopoverBody as SectionPopoverBody4 } from "@elementor/editor-ui";
|
|
3079
|
-
import { Button as
|
|
3101
|
+
import { Button as Button6, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
|
|
3080
3102
|
import { __ as __17 } from "@wordpress/i18n";
|
|
3081
3103
|
var SIZE7 = "tiny";
|
|
3082
3104
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
@@ -3087,11 +3109,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3087
3109
|
if (!variable) {
|
|
3088
3110
|
throw new Error(`Global ${variableType} variable not found`);
|
|
3089
3111
|
}
|
|
3090
|
-
const [errorMessage, setErrorMessage] =
|
|
3091
|
-
const [valueFieldError, setValueFieldError] =
|
|
3092
|
-
const [label, setLabel] =
|
|
3093
|
-
const [value, setValue] =
|
|
3094
|
-
const [propTypeKey, setPropTypeKey] =
|
|
3112
|
+
const [errorMessage, setErrorMessage] = useState13("");
|
|
3113
|
+
const [valueFieldError, setValueFieldError] = useState13("");
|
|
3114
|
+
const [label, setLabel] = useState13(variable.label);
|
|
3115
|
+
const [value, setValue] = useState13(variable.value);
|
|
3116
|
+
const [propTypeKey, setPropTypeKey] = useState13(variable?.type ?? propTypeUtil.key);
|
|
3095
3117
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
3096
3118
|
value: variable.label,
|
|
3097
3119
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -3137,14 +3159,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3137
3159
|
handleRestore();
|
|
3138
3160
|
}
|
|
3139
3161
|
};
|
|
3140
|
-
return /* @__PURE__ */
|
|
3162
|
+
return /* @__PURE__ */ React25.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React25.createElement(SectionPopoverBody4, { height: "auto" }, /* @__PURE__ */ React25.createElement(
|
|
3141
3163
|
PopoverHeader4,
|
|
3142
3164
|
{
|
|
3143
|
-
icon: /* @__PURE__ */
|
|
3165
|
+
icon: /* @__PURE__ */ React25.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
3144
3166
|
title: __17("Restore variable", "elementor"),
|
|
3145
3167
|
onClose
|
|
3146
3168
|
}
|
|
3147
|
-
), /* @__PURE__ */
|
|
3169
|
+
), /* @__PURE__ */ React25.createElement(Divider5, null), /* @__PURE__ */ React25.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React25.createElement(
|
|
3148
3170
|
FormField,
|
|
3149
3171
|
{
|
|
3150
3172
|
id: "variable-label",
|
|
@@ -3152,7 +3174,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3152
3174
|
errorMsg: labelFieldError?.message,
|
|
3153
3175
|
noticeMsg: labelHint(label)
|
|
3154
3176
|
},
|
|
3155
|
-
/* @__PURE__ */
|
|
3177
|
+
/* @__PURE__ */ React25.createElement(
|
|
3156
3178
|
LabelField,
|
|
3157
3179
|
{
|
|
3158
3180
|
id: "variable-label",
|
|
@@ -3171,7 +3193,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3171
3193
|
onKeyDown: handleKeyDown
|
|
3172
3194
|
}
|
|
3173
3195
|
)
|
|
3174
|
-
), ValueField && /* @__PURE__ */
|
|
3196
|
+
), ValueField && /* @__PURE__ */ React25.createElement(FormField, { errorMsg: valueFieldError, label: __17("Value", "elementor") }, /* @__PURE__ */ React25.createElement(Typography11, { variant: "h5" }, /* @__PURE__ */ React25.createElement(
|
|
3175
3197
|
ValueField,
|
|
3176
3198
|
{
|
|
3177
3199
|
propTypeKey,
|
|
@@ -3186,25 +3208,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
3186
3208
|
propType,
|
|
3187
3209
|
onKeyDown: handleKeyDown
|
|
3188
3210
|
}
|
|
3189
|
-
))), errorMessage && /* @__PURE__ */
|
|
3211
|
+
))), errorMessage && /* @__PURE__ */ React25.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React25.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React25.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __17("Restore", "elementor")))));
|
|
3190
3212
|
};
|
|
3191
3213
|
|
|
3192
3214
|
// src/components/ui/deleted-variable-alert.tsx
|
|
3193
|
-
import * as
|
|
3194
|
-
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as
|
|
3215
|
+
import * as React26 from "react";
|
|
3216
|
+
import { Alert as Alert2, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener2, Typography as Typography12 } from "@elementor/ui";
|
|
3195
3217
|
import { __ as __18 } from "@wordpress/i18n";
|
|
3196
3218
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
3197
|
-
return /* @__PURE__ */
|
|
3219
|
+
return /* @__PURE__ */ React26.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React26.createElement(
|
|
3198
3220
|
Alert2,
|
|
3199
3221
|
{
|
|
3200
3222
|
variant: "standard",
|
|
3201
3223
|
severity: "warning",
|
|
3202
3224
|
onClose,
|
|
3203
|
-
action: /* @__PURE__ */
|
|
3225
|
+
action: /* @__PURE__ */ React26.createElement(React26.Fragment, null, onUnlink && /* @__PURE__ */ React26.createElement(AlertAction2, { variant: "contained", onClick: onUnlink }, __18("Unlink", "elementor")), onRestore && /* @__PURE__ */ React26.createElement(AlertAction2, { variant: "outlined", onClick: onRestore }, __18("Restore", "elementor"))),
|
|
3204
3226
|
sx: { maxWidth: 300 }
|
|
3205
3227
|
},
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ React26.createElement(AlertTitle2, null, __18("Deleted variable", "elementor")),
|
|
3229
|
+
/* @__PURE__ */ React26.createElement(Typography12, { variant: "body2", color: "textPrimary" }, __18("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React26.createElement(Typography12, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", __18(
|
|
3208
3230
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
3209
3231
|
"elementor"
|
|
3210
3232
|
))
|
|
@@ -3212,13 +3234,13 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
3212
3234
|
};
|
|
3213
3235
|
|
|
3214
3236
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
3215
|
-
import * as
|
|
3237
|
+
import * as React27 from "react";
|
|
3216
3238
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon4 } from "@elementor/icons";
|
|
3217
|
-
import { Box as
|
|
3218
|
-
var WarningVariableTag =
|
|
3239
|
+
import { Box as Box6, Chip, Tooltip as Tooltip5, Typography as Typography13 } from "@elementor/ui";
|
|
3240
|
+
var WarningVariableTag = React27.forwardRef(
|
|
3219
3241
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
3220
3242
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
3221
|
-
return /* @__PURE__ */
|
|
3243
|
+
return /* @__PURE__ */ React27.createElement(
|
|
3222
3244
|
Chip,
|
|
3223
3245
|
{
|
|
3224
3246
|
ref,
|
|
@@ -3227,8 +3249,8 @@ var WarningVariableTag = React26.forwardRef(
|
|
|
3227
3249
|
shape: "rounded",
|
|
3228
3250
|
variant: "standard",
|
|
3229
3251
|
onClick,
|
|
3230
|
-
icon: /* @__PURE__ */
|
|
3231
|
-
label: /* @__PURE__ */
|
|
3252
|
+
icon: /* @__PURE__ */ React27.createElement(AlertTriangleFilledIcon4, null),
|
|
3253
|
+
label: /* @__PURE__ */ React27.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React27.createElement(Box6, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React27.createElement(Typography13, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
3232
3254
|
sx: {
|
|
3233
3255
|
height: (theme) => theme.spacing(3.5),
|
|
3234
3256
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -3247,10 +3269,10 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3247
3269
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
3248
3270
|
const boundProp = useBoundProp8();
|
|
3249
3271
|
const userPermissions = usePermissions();
|
|
3250
|
-
const [showInfotip, setShowInfotip] =
|
|
3272
|
+
const [showInfotip, setShowInfotip] = useState14(false);
|
|
3251
3273
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
3252
3274
|
const closeInfotip = () => setShowInfotip(false);
|
|
3253
|
-
const deletedChipAnchorRef =
|
|
3275
|
+
const deletedChipAnchorRef = useRef9(null);
|
|
3254
3276
|
const popupId = useId2();
|
|
3255
3277
|
const popupState = usePopupState4({
|
|
3256
3278
|
variant: "popover",
|
|
@@ -3278,7 +3300,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3278
3300
|
const handleRestoreWithOverrides = () => {
|
|
3279
3301
|
popupState.close();
|
|
3280
3302
|
};
|
|
3281
|
-
return /* @__PURE__ */
|
|
3303
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Box7, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React28.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
|
|
3282
3304
|
Infotip2,
|
|
3283
3305
|
{
|
|
3284
3306
|
color: "warning",
|
|
@@ -3286,7 +3308,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3286
3308
|
open: showInfotip,
|
|
3287
3309
|
disableHoverListener: true,
|
|
3288
3310
|
onClose: closeInfotip,
|
|
3289
|
-
content: /* @__PURE__ */
|
|
3311
|
+
content: /* @__PURE__ */ React28.createElement(
|
|
3290
3312
|
DeletedVariableAlert,
|
|
3291
3313
|
{
|
|
3292
3314
|
onClose: closeInfotip,
|
|
@@ -3306,7 +3328,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3306
3328
|
}
|
|
3307
3329
|
}
|
|
3308
3330
|
},
|
|
3309
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ React28.createElement(
|
|
3310
3332
|
WarningVariableTag,
|
|
3311
3333
|
{
|
|
3312
3334
|
label: variable.label,
|
|
@@ -3314,7 +3336,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3314
3336
|
suffix: __19("deleted", "elementor")
|
|
3315
3337
|
}
|
|
3316
3338
|
)
|
|
3317
|
-
), /* @__PURE__ */
|
|
3339
|
+
), /* @__PURE__ */ React28.createElement(
|
|
3318
3340
|
Popover2,
|
|
3319
3341
|
{
|
|
3320
3342
|
disableScrollLock: true,
|
|
@@ -3325,7 +3347,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3325
3347
|
},
|
|
3326
3348
|
...bindPopover2(popupState)
|
|
3327
3349
|
},
|
|
3328
|
-
/* @__PURE__ */
|
|
3350
|
+
/* @__PURE__ */ React28.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React28.createElement(
|
|
3329
3351
|
VariableRestore,
|
|
3330
3352
|
{
|
|
3331
3353
|
variableId: variable.key ?? "",
|
|
@@ -3337,15 +3359,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
3337
3359
|
};
|
|
3338
3360
|
|
|
3339
3361
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3340
|
-
import * as
|
|
3341
|
-
import { useId as useId3, useRef as
|
|
3362
|
+
import * as React30 from "react";
|
|
3363
|
+
import { useId as useId3, useRef as useRef10, useState as useState15 } from "react";
|
|
3342
3364
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
3343
|
-
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as
|
|
3365
|
+
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box8, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
3344
3366
|
import { __ as __21 } from "@wordpress/i18n";
|
|
3345
3367
|
|
|
3346
3368
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
3347
|
-
import * as
|
|
3348
|
-
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as
|
|
3369
|
+
import * as React29 from "react";
|
|
3370
|
+
import { Alert as Alert3, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener3, Typography as Typography14 } from "@elementor/ui";
|
|
3349
3371
|
import { __ as __20 } from "@wordpress/i18n";
|
|
3350
3372
|
var i18n = {
|
|
3351
3373
|
title: __20("Variable has changed", "elementor"),
|
|
@@ -3359,30 +3381,30 @@ var i18n = {
|
|
|
3359
3381
|
}
|
|
3360
3382
|
};
|
|
3361
3383
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
3362
|
-
return /* @__PURE__ */
|
|
3384
|
+
return /* @__PURE__ */ React29.createElement(ClickAwayListener3, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
3363
3385
|
Alert3,
|
|
3364
3386
|
{
|
|
3365
3387
|
variant: "standard",
|
|
3366
3388
|
severity: "warning",
|
|
3367
3389
|
onClose,
|
|
3368
|
-
action: /* @__PURE__ */
|
|
3390
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
3369
3391
|
sx: { maxWidth: 300 }
|
|
3370
3392
|
},
|
|
3371
|
-
/* @__PURE__ */
|
|
3372
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ React29.createElement(AlertTitle3, null, i18n.title),
|
|
3394
|
+
/* @__PURE__ */ React29.createElement(Typography14, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
3373
3395
|
));
|
|
3374
3396
|
};
|
|
3375
3397
|
|
|
3376
3398
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
3377
3399
|
var MismatchVariable = ({ variable }) => {
|
|
3378
3400
|
const { setValue, value } = useBoundProp9();
|
|
3379
|
-
const anchorRef =
|
|
3401
|
+
const anchorRef = useRef10(null);
|
|
3380
3402
|
const popupId = useId3();
|
|
3381
3403
|
const popupState = usePopupState5({
|
|
3382
3404
|
variant: "popover",
|
|
3383
3405
|
popupId: `elementor-variables-list-${popupId}`
|
|
3384
3406
|
});
|
|
3385
|
-
const [infotipVisible, setInfotipVisible] =
|
|
3407
|
+
const [infotipVisible, setInfotipVisible] = useState15(false);
|
|
3386
3408
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3387
3409
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3388
3410
|
const triggerSelect = () => {
|
|
@@ -3395,7 +3417,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3395
3417
|
setValue(null);
|
|
3396
3418
|
};
|
|
3397
3419
|
const showClearButton = !!value;
|
|
3398
|
-
return /* @__PURE__ */
|
|
3420
|
+
return /* @__PURE__ */ React30.createElement(Box8, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React30.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React30.createElement(
|
|
3399
3421
|
Infotip3,
|
|
3400
3422
|
{
|
|
3401
3423
|
color: "warning",
|
|
@@ -3403,7 +3425,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3403
3425
|
open: infotipVisible,
|
|
3404
3426
|
disableHoverListener: true,
|
|
3405
3427
|
onClose: closeInfotip,
|
|
3406
|
-
content: /* @__PURE__ */
|
|
3428
|
+
content: /* @__PURE__ */ React30.createElement(
|
|
3407
3429
|
MismatchVariableAlert,
|
|
3408
3430
|
{
|
|
3409
3431
|
onClose: closeInfotip,
|
|
@@ -3422,7 +3444,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3422
3444
|
}
|
|
3423
3445
|
}
|
|
3424
3446
|
},
|
|
3425
|
-
/* @__PURE__ */
|
|
3447
|
+
/* @__PURE__ */ React30.createElement(
|
|
3426
3448
|
WarningVariableTag,
|
|
3427
3449
|
{
|
|
3428
3450
|
label: variable.label,
|
|
@@ -3430,7 +3452,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3430
3452
|
suffix: __21("changed", "elementor")
|
|
3431
3453
|
}
|
|
3432
3454
|
)
|
|
3433
|
-
), /* @__PURE__ */
|
|
3455
|
+
), /* @__PURE__ */ React30.createElement(
|
|
3434
3456
|
Popover3,
|
|
3435
3457
|
{
|
|
3436
3458
|
disableScrollLock: true,
|
|
@@ -3442,7 +3464,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3442
3464
|
},
|
|
3443
3465
|
...bindPopover3(popupState)
|
|
3444
3466
|
},
|
|
3445
|
-
/* @__PURE__ */
|
|
3467
|
+
/* @__PURE__ */ React30.createElement(
|
|
3446
3468
|
VariableSelectionPopover,
|
|
3447
3469
|
{
|
|
3448
3470
|
selectedVariable: variable,
|
|
@@ -3454,28 +3476,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
3454
3476
|
};
|
|
3455
3477
|
|
|
3456
3478
|
// src/components/ui/variable/missing-variable.tsx
|
|
3457
|
-
import * as
|
|
3458
|
-
import { useState as
|
|
3479
|
+
import * as React32 from "react";
|
|
3480
|
+
import { useState as useState16 } from "react";
|
|
3459
3481
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
3460
3482
|
import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
|
|
3461
3483
|
import { __ as __23 } from "@wordpress/i18n";
|
|
3462
3484
|
|
|
3463
3485
|
// src/components/ui/missing-variable-alert.tsx
|
|
3464
|
-
import * as
|
|
3465
|
-
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as
|
|
3486
|
+
import * as React31 from "react";
|
|
3487
|
+
import { Alert as Alert4, AlertAction as AlertAction4, AlertTitle as AlertTitle4, ClickAwayListener as ClickAwayListener4, Typography as Typography15 } from "@elementor/ui";
|
|
3466
3488
|
import { __ as __22 } from "@wordpress/i18n";
|
|
3467
3489
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
3468
|
-
return /* @__PURE__ */
|
|
3490
|
+
return /* @__PURE__ */ React31.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React31.createElement(
|
|
3469
3491
|
Alert4,
|
|
3470
3492
|
{
|
|
3471
3493
|
variant: "standard",
|
|
3472
3494
|
severity: "warning",
|
|
3473
3495
|
onClose,
|
|
3474
|
-
action: /* @__PURE__ */
|
|
3496
|
+
action: /* @__PURE__ */ React31.createElement(React31.Fragment, null, onClear && /* @__PURE__ */ React31.createElement(AlertAction4, { variant: "contained", onClick: onClear }, __22("Clear", "elementor"))),
|
|
3475
3497
|
sx: { maxWidth: 300 }
|
|
3476
3498
|
},
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
3499
|
+
/* @__PURE__ */ React31.createElement(AlertTitle4, null, __22("This variable is missing", "elementor")),
|
|
3500
|
+
/* @__PURE__ */ React31.createElement(Typography15, { variant: "body2", color: "textPrimary" }, __22(
|
|
3479
3501
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
3480
3502
|
"elementor"
|
|
3481
3503
|
))
|
|
@@ -3485,11 +3507,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
3485
3507
|
// src/components/ui/variable/missing-variable.tsx
|
|
3486
3508
|
var MissingVariable = () => {
|
|
3487
3509
|
const { setValue } = useBoundProp10();
|
|
3488
|
-
const [infotipVisible, setInfotipVisible] =
|
|
3510
|
+
const [infotipVisible, setInfotipVisible] = useState16(false);
|
|
3489
3511
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
3490
3512
|
const closeInfotip = () => setInfotipVisible(false);
|
|
3491
3513
|
const clearValue = () => setValue(null);
|
|
3492
|
-
return /* @__PURE__ */
|
|
3514
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, infotipVisible && /* @__PURE__ */ React32.createElement(Backdrop3, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React32.createElement(
|
|
3493
3515
|
Infotip4,
|
|
3494
3516
|
{
|
|
3495
3517
|
color: "warning",
|
|
@@ -3497,7 +3519,7 @@ var MissingVariable = () => {
|
|
|
3497
3519
|
open: infotipVisible,
|
|
3498
3520
|
disableHoverListener: true,
|
|
3499
3521
|
onClose: closeInfotip,
|
|
3500
|
-
content: /* @__PURE__ */
|
|
3522
|
+
content: /* @__PURE__ */ React32.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
3501
3523
|
slotProps: {
|
|
3502
3524
|
popper: {
|
|
3503
3525
|
modifiers: [
|
|
@@ -3509,7 +3531,7 @@ var MissingVariable = () => {
|
|
|
3509
3531
|
}
|
|
3510
3532
|
}
|
|
3511
3533
|
},
|
|
3512
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ React32.createElement(WarningVariableTag, { label: __23("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
3513
3535
|
));
|
|
3514
3536
|
};
|
|
3515
3537
|
|
|
@@ -3519,21 +3541,21 @@ var VariableControl = () => {
|
|
|
3519
3541
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
3520
3542
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
3521
3543
|
if (!assignedVariable) {
|
|
3522
|
-
return /* @__PURE__ */
|
|
3544
|
+
return /* @__PURE__ */ React33.createElement(MissingVariable, null);
|
|
3523
3545
|
}
|
|
3524
3546
|
const { $$type: propTypeKey } = boundPropValue;
|
|
3525
3547
|
if (assignedVariable?.deleted) {
|
|
3526
|
-
return /* @__PURE__ */
|
|
3548
|
+
return /* @__PURE__ */ React33.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
3527
3549
|
}
|
|
3528
3550
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
3529
3551
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
3530
|
-
return /* @__PURE__ */
|
|
3552
|
+
return /* @__PURE__ */ React33.createElement(MismatchVariable, { variable: assignedVariable });
|
|
3531
3553
|
}
|
|
3532
|
-
return /* @__PURE__ */
|
|
3554
|
+
return /* @__PURE__ */ React33.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
3533
3555
|
};
|
|
3534
3556
|
|
|
3535
3557
|
// src/hooks/use-prop-variable-action.tsx
|
|
3536
|
-
import * as
|
|
3558
|
+
import * as React34 from "react";
|
|
3537
3559
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-controls";
|
|
3538
3560
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
3539
3561
|
import { __ as __24 } from "@wordpress/i18n";
|
|
@@ -3549,7 +3571,7 @@ var usePropVariableAction = () => {
|
|
|
3549
3571
|
return null;
|
|
3550
3572
|
}
|
|
3551
3573
|
trackOpenVariablePopover(path, variable.variableType);
|
|
3552
|
-
return /* @__PURE__ */
|
|
3574
|
+
return /* @__PURE__ */ React34.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
3553
3575
|
}
|
|
3554
3576
|
};
|
|
3555
3577
|
};
|
|
@@ -3696,21 +3718,21 @@ function initMcp() {
|
|
|
3696
3718
|
}
|
|
3697
3719
|
|
|
3698
3720
|
// src/register-variable-types.tsx
|
|
3699
|
-
import * as
|
|
3721
|
+
import * as React37 from "react";
|
|
3700
3722
|
import { colorPropTypeUtil, sizePropTypeUtil, stringPropTypeUtil } from "@elementor/editor-props";
|
|
3701
3723
|
import { CtaButton } from "@elementor/editor-ui";
|
|
3702
3724
|
import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
|
|
3703
|
-
import { BrushIcon
|
|
3725
|
+
import { BrushIcon, ExpandDiagonalIcon, ResetIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
3704
3726
|
import { __ as __26 } from "@wordpress/i18n";
|
|
3705
3727
|
|
|
3706
3728
|
// src/components/fields/color-field.tsx
|
|
3707
|
-
import * as
|
|
3708
|
-
import { useRef as
|
|
3729
|
+
import * as React35 from "react";
|
|
3730
|
+
import { useRef as useRef11, useState as useState17 } from "react";
|
|
3709
3731
|
import { UnstableColorField } from "@elementor/ui";
|
|
3710
3732
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
3711
|
-
const [color, setColor] =
|
|
3712
|
-
const [errorMessage, setErrorMessage] =
|
|
3713
|
-
const defaultRef =
|
|
3733
|
+
const [color, setColor] = useState17(value);
|
|
3734
|
+
const [errorMessage, setErrorMessage] = useState17("");
|
|
3735
|
+
const defaultRef = useRef11(null);
|
|
3714
3736
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3715
3737
|
const handleChange = (newValue) => {
|
|
3716
3738
|
setColor(newValue);
|
|
@@ -3719,7 +3741,7 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3719
3741
|
onValidationChange?.(errorMsg);
|
|
3720
3742
|
onChange(errorMsg ? "" : newValue);
|
|
3721
3743
|
};
|
|
3722
|
-
return /* @__PURE__ */
|
|
3744
|
+
return /* @__PURE__ */ React35.createElement(
|
|
3723
3745
|
UnstableColorField,
|
|
3724
3746
|
{
|
|
3725
3747
|
id: "color-variable-field",
|
|
@@ -3748,21 +3770,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
3748
3770
|
};
|
|
3749
3771
|
|
|
3750
3772
|
// src/components/fields/font-field.tsx
|
|
3751
|
-
import * as
|
|
3752
|
-
import { useId as useId4, useRef as
|
|
3773
|
+
import * as React36 from "react";
|
|
3774
|
+
import { useId as useId4, useRef as useRef12, useState as useState18 } from "react";
|
|
3753
3775
|
import { enqueueFont as enqueueFont2, ItemSelector, useFontFamilies } from "@elementor/editor-controls";
|
|
3754
3776
|
import { useSectionWidth } from "@elementor/editor-ui";
|
|
3755
3777
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
3756
3778
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
3757
3779
|
import { __ as __25 } from "@wordpress/i18n";
|
|
3758
3780
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
3759
|
-
const [fontFamily, setFontFamily] =
|
|
3760
|
-
const defaultRef =
|
|
3781
|
+
const [fontFamily, setFontFamily] = useState18(value);
|
|
3782
|
+
const defaultRef = useRef12(null);
|
|
3761
3783
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
3762
3784
|
const fontPopoverState = usePopupState6({ variant: "popover" });
|
|
3763
3785
|
const fontFamilies = useFontFamilies();
|
|
3764
3786
|
const sectionWidth = useSectionWidth();
|
|
3765
|
-
const mapFontSubs =
|
|
3787
|
+
const mapFontSubs = React36.useMemo(() => {
|
|
3766
3788
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3767
3789
|
label,
|
|
3768
3790
|
items: fonts
|
|
@@ -3779,17 +3801,17 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3779
3801
|
fontPopoverState.close();
|
|
3780
3802
|
};
|
|
3781
3803
|
const id2 = useId4();
|
|
3782
|
-
return /* @__PURE__ */
|
|
3804
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
3783
3805
|
UnstableTag,
|
|
3784
3806
|
{
|
|
3785
3807
|
id: id2,
|
|
3786
3808
|
variant: "outlined",
|
|
3787
3809
|
label: fontFamily,
|
|
3788
|
-
endIcon: /* @__PURE__ */
|
|
3810
|
+
endIcon: /* @__PURE__ */ React36.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
3789
3811
|
...bindTrigger4(fontPopoverState),
|
|
3790
3812
|
fullWidth: true
|
|
3791
3813
|
}
|
|
3792
|
-
), /* @__PURE__ */
|
|
3814
|
+
), /* @__PURE__ */ React36.createElement(
|
|
3793
3815
|
Popover4,
|
|
3794
3816
|
{
|
|
3795
3817
|
disablePortal: true,
|
|
@@ -3799,7 +3821,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
3799
3821
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
3800
3822
|
...bindPopover4(fontPopoverState)
|
|
3801
3823
|
},
|
|
3802
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ React36.createElement(
|
|
3803
3825
|
ItemSelector,
|
|
3804
3826
|
{
|
|
3805
3827
|
id: "font-family-variables-selector",
|
|
@@ -3833,11 +3855,11 @@ function registerVariableTypes() {
|
|
|
3833
3855
|
registerVariableType({
|
|
3834
3856
|
key: colorVariablePropTypeUtil.key,
|
|
3835
3857
|
valueField: ColorField,
|
|
3836
|
-
icon:
|
|
3858
|
+
icon: BrushIcon,
|
|
3837
3859
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
3838
3860
|
fallbackPropTypeUtil: colorPropTypeUtil,
|
|
3839
3861
|
variableType: "color",
|
|
3840
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
3862
|
+
startIcon: ({ value }) => /* @__PURE__ */ React37.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
3841
3863
|
defaultValue: "#ffffff",
|
|
3842
3864
|
menuActionsFactory: ({ variable, variableId, handlers }) => {
|
|
3843
3865
|
const actions = [];
|
|
@@ -3879,7 +3901,7 @@ function registerVariableTypes() {
|
|
|
3879
3901
|
styleTransformer: EmptyTransformer,
|
|
3880
3902
|
variableType: "size",
|
|
3881
3903
|
selectionFilter: () => [],
|
|
3882
|
-
emptyState: /* @__PURE__ */
|
|
3904
|
+
emptyState: /* @__PURE__ */ React37.createElement(CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
|
|
3883
3905
|
};
|
|
3884
3906
|
registerVariableType({
|
|
3885
3907
|
...sizePromotions,
|
|
@@ -3893,8 +3915,8 @@ function registerVariableTypes() {
|
|
|
3893
3915
|
}
|
|
3894
3916
|
|
|
3895
3917
|
// src/renderers/style-variables-renderer.tsx
|
|
3896
|
-
import * as
|
|
3897
|
-
import { useEffect as useEffect6, useState as
|
|
3918
|
+
import * as React38 from "react";
|
|
3919
|
+
import { useEffect as useEffect6, useState as useState19 } from "react";
|
|
3898
3920
|
import {
|
|
3899
3921
|
__privateUseListenTo as useListenTo,
|
|
3900
3922
|
commandEndEvent,
|
|
@@ -3911,13 +3933,13 @@ function StyleVariablesRenderer() {
|
|
|
3911
3933
|
}
|
|
3912
3934
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
3913
3935
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
3914
|
-
return /* @__PURE__ */
|
|
3936
|
+
return /* @__PURE__ */ React38.createElement(Portal, { container }, /* @__PURE__ */ React38.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
3915
3937
|
}
|
|
3916
3938
|
function usePortalContainer() {
|
|
3917
3939
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
3918
3940
|
}
|
|
3919
3941
|
function useStyleVariables() {
|
|
3920
|
-
const [variables, setVariables] =
|
|
3942
|
+
const [variables, setVariables] = useState19({});
|
|
3921
3943
|
useEffect6(() => {
|
|
3922
3944
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
3923
3945
|
return () => {
|
|
@@ -3941,22 +3963,22 @@ import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elemen
|
|
|
3941
3963
|
import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
3942
3964
|
|
|
3943
3965
|
// src/components/variables-repeater-item-slot.tsx
|
|
3944
|
-
import * as
|
|
3966
|
+
import * as React39 from "react";
|
|
3945
3967
|
var useColorVariable = (value) => {
|
|
3946
3968
|
const variableId = value?.value?.color?.value;
|
|
3947
3969
|
return useVariable(variableId || "");
|
|
3948
3970
|
};
|
|
3949
3971
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
3950
3972
|
const colorVariable = useColorVariable(value);
|
|
3951
|
-
return /* @__PURE__ */
|
|
3973
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3952
3974
|
};
|
|
3953
3975
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
3954
3976
|
const colorVariable = useColorVariable(value);
|
|
3955
|
-
return /* @__PURE__ */
|
|
3977
|
+
return /* @__PURE__ */ React39.createElement("span", null, colorVariable?.label);
|
|
3956
3978
|
};
|
|
3957
3979
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
3958
3980
|
const colorVariable = useColorVariable(value);
|
|
3959
|
-
return /* @__PURE__ */
|
|
3981
|
+
return /* @__PURE__ */ React39.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
3960
3982
|
};
|
|
3961
3983
|
|
|
3962
3984
|
// src/repeater-injections.ts
|