@elementor/editor-variables 3.32.0-81 → 3.32.0-82
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 +61 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/variables-manager/variable-edit-menu.tsx +4 -3
- package/src/components/variables-manager/variable-editable-cell.tsx +36 -18
- package/src/components/variables-manager/variables-manager-panel.tsx +20 -5
- package/src/components/variables-manager/variables-manager-table.tsx +32 -14
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
|
5
5
|
|
|
6
6
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
7
7
|
import * as React8 from "react";
|
|
8
|
-
import { useEffect } from "react";
|
|
8
|
+
import { useEffect, useState as useState4 } from "react";
|
|
9
9
|
import {
|
|
10
10
|
__createPanel as createPanel,
|
|
11
11
|
Panel,
|
|
@@ -647,7 +647,7 @@ import * as React4 from "react";
|
|
|
647
647
|
import { createElement as createElement5 } from "react";
|
|
648
648
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
649
649
|
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, usePopupState } from "@elementor/ui";
|
|
650
|
-
var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
650
|
+
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
651
651
|
const menuState = usePopupState({
|
|
652
652
|
variant: "popover"
|
|
653
653
|
});
|
|
@@ -679,7 +679,7 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
679
679
|
{
|
|
680
680
|
key: action.name,
|
|
681
681
|
onClick: () => {
|
|
682
|
-
action.onClick?.();
|
|
682
|
+
action.onClick?.(itemId);
|
|
683
683
|
menuState.close();
|
|
684
684
|
},
|
|
685
685
|
sx: {
|
|
@@ -704,7 +704,7 @@ var VariableEditableCell = ({
|
|
|
704
704
|
initialValue,
|
|
705
705
|
children,
|
|
706
706
|
editableElement,
|
|
707
|
-
|
|
707
|
+
onChange,
|
|
708
708
|
prefixElement
|
|
709
709
|
}) => {
|
|
710
710
|
const [value, setValue] = useState2(initialValue);
|
|
@@ -713,7 +713,7 @@ var VariableEditableCell = ({
|
|
|
713
713
|
setIsEditing(true);
|
|
714
714
|
};
|
|
715
715
|
const handleSave = () => {
|
|
716
|
-
|
|
716
|
+
onChange(value);
|
|
717
717
|
setIsEditing(false);
|
|
718
718
|
};
|
|
719
719
|
const handleKeyDown = (event) => {
|
|
@@ -731,7 +731,24 @@ var VariableEditableCell = ({
|
|
|
731
731
|
setValue(newValue);
|
|
732
732
|
};
|
|
733
733
|
const editableContent = editableElement({ value, onChange: handleChange });
|
|
734
|
-
|
|
734
|
+
if (isEditing) {
|
|
735
|
+
return /* @__PURE__ */ React5.createElement(ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React5.createElement(
|
|
736
|
+
Stack2,
|
|
737
|
+
{
|
|
738
|
+
direction: "row",
|
|
739
|
+
alignItems: "center",
|
|
740
|
+
gap: 1,
|
|
741
|
+
onDoubleClick: handleDoubleClick,
|
|
742
|
+
onKeyDown: handleKeyDown,
|
|
743
|
+
tabIndex: 0,
|
|
744
|
+
role: "button",
|
|
745
|
+
"aria-label": "Double click or press Space to edit"
|
|
746
|
+
},
|
|
747
|
+
prefixElement,
|
|
748
|
+
editableContent
|
|
749
|
+
));
|
|
750
|
+
}
|
|
751
|
+
return /* @__PURE__ */ React5.createElement(
|
|
735
752
|
Stack2,
|
|
736
753
|
{
|
|
737
754
|
direction: "row",
|
|
@@ -744,8 +761,8 @@ var VariableEditableCell = ({
|
|
|
744
761
|
"aria-label": "Double click or press Space to edit"
|
|
745
762
|
},
|
|
746
763
|
prefixElement,
|
|
747
|
-
|
|
748
|
-
)
|
|
764
|
+
children
|
|
765
|
+
);
|
|
749
766
|
};
|
|
750
767
|
|
|
751
768
|
// src/components/variables-manager/variable-table-cell.tsx
|
|
@@ -773,9 +790,9 @@ var VariableTableCell = ({
|
|
|
773
790
|
};
|
|
774
791
|
|
|
775
792
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
776
|
-
var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
793
|
+
var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange }) => {
|
|
777
794
|
const [ids, setIds] = useState3(Object.keys(variables));
|
|
778
|
-
const rows = ids.map((id2) => {
|
|
795
|
+
const rows = ids.filter((id2) => !variables[id2].deleted).map((id2) => {
|
|
779
796
|
const variable = variables[id2];
|
|
780
797
|
const variableType = getVariableType(variable.type);
|
|
781
798
|
return {
|
|
@@ -865,7 +882,13 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
865
882
|
VariableEditableCell,
|
|
866
883
|
{
|
|
867
884
|
initialValue: row.name,
|
|
868
|
-
|
|
885
|
+
onChange: (value) => {
|
|
886
|
+
if (value !== row.name) {
|
|
887
|
+
handleOnChange({
|
|
888
|
+
...variables,
|
|
889
|
+
[row.id]: { ...variables[row.id], label: value }
|
|
890
|
+
});
|
|
891
|
+
}
|
|
869
892
|
},
|
|
870
893
|
prefixElement: createElement9(row.icon, { fontSize: "inherit" }),
|
|
871
894
|
editableElement: ({ value, onChange }) => /* @__PURE__ */ React7.createElement(
|
|
@@ -892,7 +915,13 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
892
915
|
VariableEditableCell,
|
|
893
916
|
{
|
|
894
917
|
initialValue: row.value,
|
|
895
|
-
|
|
918
|
+
onChange: (value) => {
|
|
919
|
+
if (value !== row.value) {
|
|
920
|
+
handleOnChange({
|
|
921
|
+
...variables,
|
|
922
|
+
[row.id]: { ...variables[row.id], value }
|
|
923
|
+
});
|
|
924
|
+
}
|
|
896
925
|
},
|
|
897
926
|
editableElement: row.valueField
|
|
898
927
|
},
|
|
@@ -919,7 +948,8 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
919
948
|
VariableEditMenu,
|
|
920
949
|
{
|
|
921
950
|
menuActions,
|
|
922
|
-
disabled: isSorting
|
|
951
|
+
disabled: isSorting,
|
|
952
|
+
itemId: row.id
|
|
923
953
|
}
|
|
924
954
|
))
|
|
925
955
|
)
|
|
@@ -945,18 +975,26 @@ var { panel, usePanelActions } = createPanel({
|
|
|
945
975
|
});
|
|
946
976
|
function VariablesManagerPanel() {
|
|
947
977
|
const { close: closePanel } = usePanelActions();
|
|
948
|
-
const isDirty = false;
|
|
949
|
-
const variables = getVariables(false);
|
|
978
|
+
const [isDirty, setIsDirty] = useState4(false);
|
|
979
|
+
const [variables, setVariables] = useState4(getVariables(false));
|
|
980
|
+
const [deletedVariables, setDeletedVariables] = useState4([]);
|
|
950
981
|
usePreventUnload(isDirty);
|
|
951
982
|
const menuActions = [
|
|
952
983
|
{
|
|
953
984
|
name: __5("Delete", "elementor"),
|
|
954
985
|
icon: TrashIcon,
|
|
955
986
|
color: "error.main",
|
|
956
|
-
onClick: () => {
|
|
987
|
+
onClick: (itemId) => {
|
|
988
|
+
setDeletedVariables([...deletedVariables, itemId]);
|
|
989
|
+
setVariables({ ...variables, [itemId]: { ...variables[itemId], deleted: true } });
|
|
990
|
+
setIsDirty(true);
|
|
957
991
|
}
|
|
958
992
|
}
|
|
959
993
|
];
|
|
994
|
+
const handleOnChange = (newVariables) => {
|
|
995
|
+
setVariables(newVariables);
|
|
996
|
+
setIsDirty(true);
|
|
997
|
+
};
|
|
960
998
|
return /* @__PURE__ */ React8.createElement(ThemeProvider, null, /* @__PURE__ */ React8.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React8.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React8.createElement(Panel, null, /* @__PURE__ */ React8.createElement(PanelHeader, null, /* @__PURE__ */ React8.createElement(Stack4, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React8.createElement(Stack4, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React8.createElement(Stack4, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React8.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React8.createElement(ColorFilterIcon, { fontSize: "inherit" }), __5("Variable Manager", "elementor"))), /* @__PURE__ */ React8.createElement(
|
|
961
999
|
CloseButton,
|
|
962
1000
|
{
|
|
@@ -974,7 +1012,14 @@ function VariablesManagerPanel() {
|
|
|
974
1012
|
height: "100%"
|
|
975
1013
|
}
|
|
976
1014
|
},
|
|
977
|
-
/* @__PURE__ */ React8.createElement(
|
|
1015
|
+
/* @__PURE__ */ React8.createElement(
|
|
1016
|
+
VariablesManagerTable,
|
|
1017
|
+
{
|
|
1018
|
+
menuActions,
|
|
1019
|
+
variables,
|
|
1020
|
+
onChange: handleOnChange
|
|
1021
|
+
}
|
|
1022
|
+
)
|
|
978
1023
|
), /* @__PURE__ */ React8.createElement(PanelFooter, null, /* @__PURE__ */ React8.createElement(Button, { fullWidth: true, size: "small", color: "global", variant: "contained", disabled: !isDirty }, __5("Save changes", "elementor"))))));
|
|
979
1024
|
}
|
|
980
1025
|
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React8.createElement(IconButton3, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React8.createElement(XIcon, { fontSize: "small" }));
|
|
@@ -1022,16 +1067,16 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
1022
1067
|
|
|
1023
1068
|
// src/components/variable-selection-popover.tsx
|
|
1024
1069
|
import * as React19 from "react";
|
|
1025
|
-
import { useState as
|
|
1070
|
+
import { useState as useState10 } from "react";
|
|
1026
1071
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
1027
1072
|
|
|
1028
1073
|
// src/context/variable-selection-popover.context.tsx
|
|
1029
1074
|
import * as React9 from "react";
|
|
1030
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
1075
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState5 } from "react";
|
|
1031
1076
|
import { Box as Box2 } from "@elementor/ui";
|
|
1032
1077
|
var PopoverContentRefContext = createContext2(null);
|
|
1033
1078
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
1034
|
-
const [anchorRef, setAnchorRef] =
|
|
1079
|
+
const [anchorRef, setAnchorRef] = useState5(null);
|
|
1035
1080
|
return /* @__PURE__ */ React9.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React9.createElement(Box2, { ref: setAnchorRef }, children));
|
|
1036
1081
|
};
|
|
1037
1082
|
var usePopoverContentRef = () => {
|
|
@@ -1055,7 +1100,7 @@ var usePermissions = () => {
|
|
|
1055
1100
|
|
|
1056
1101
|
// src/components/variable-creation.tsx
|
|
1057
1102
|
import * as React11 from "react";
|
|
1058
|
-
import { useState as
|
|
1103
|
+
import { useState as useState6 } from "react";
|
|
1059
1104
|
import { PopoverContent, useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
1060
1105
|
import { PopoverBody } from "@elementor/editor-editing-panel";
|
|
1061
1106
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
@@ -1107,10 +1152,10 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1107
1152
|
const { setValue: setVariable, path } = useBoundProp3(propTypeUtil);
|
|
1108
1153
|
const { propType } = useBoundProp3();
|
|
1109
1154
|
const initialValue = useInitialValue();
|
|
1110
|
-
const [value, setValue] =
|
|
1111
|
-
const [label, setLabel] =
|
|
1112
|
-
const [errorMessage, setErrorMessage] =
|
|
1113
|
-
const [valueFieldError, setValueFieldError] =
|
|
1155
|
+
const [value, setValue] = useState6(initialValue);
|
|
1156
|
+
const [label, setLabel] = useState6("");
|
|
1157
|
+
const [errorMessage, setErrorMessage] = useState6("");
|
|
1158
|
+
const [valueFieldError, setValueFieldError] = useState6("");
|
|
1114
1159
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1115
1160
|
const resetFields = () => {
|
|
1116
1161
|
setValue("");
|
|
@@ -1211,7 +1256,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1211
1256
|
|
|
1212
1257
|
// src/components/variable-edit.tsx
|
|
1213
1258
|
import * as React14 from "react";
|
|
1214
|
-
import { useEffect as useEffect2, useState as
|
|
1259
|
+
import { useEffect as useEffect2, useState as useState8 } from "react";
|
|
1215
1260
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
1216
1261
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
1217
1262
|
import { PopoverBody as PopoverBody2 } from "@elementor/editor-editing-panel";
|
|
@@ -1245,7 +1290,7 @@ var DeleteConfirmationDialog = ({
|
|
|
1245
1290
|
|
|
1246
1291
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
1247
1292
|
import * as React13 from "react";
|
|
1248
|
-
import { useState as
|
|
1293
|
+
import { useState as useState7 } from "react";
|
|
1249
1294
|
import { AlertTriangleFilledIcon } from "@elementor/icons";
|
|
1250
1295
|
import {
|
|
1251
1296
|
Button as Button4,
|
|
@@ -1265,7 +1310,7 @@ var EditConfirmationDialog = ({
|
|
|
1265
1310
|
onConfirm,
|
|
1266
1311
|
onSuppressMessage
|
|
1267
1312
|
}) => {
|
|
1268
|
-
const [dontShowAgain, setDontShowAgain] =
|
|
1313
|
+
const [dontShowAgain, setDontShowAgain] = useState7(false);
|
|
1269
1314
|
const handleSave = () => {
|
|
1270
1315
|
if (dontShowAgain) {
|
|
1271
1316
|
onSuppressMessage?.();
|
|
@@ -1298,18 +1343,18 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1298
1343
|
const { setValue: notifyBoundPropChange, value: assignedValue } = useBoundProp4(propTypeUtil);
|
|
1299
1344
|
const { propType } = useBoundProp4();
|
|
1300
1345
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(EDIT_CONFIRMATION_DIALOG_ID);
|
|
1301
|
-
const [deleteConfirmation, setDeleteConfirmation] =
|
|
1302
|
-
const [editConfirmation, setEditConfirmation] =
|
|
1303
|
-
const [errorMessage, setErrorMessage] =
|
|
1304
|
-
const [valueFieldError, setValueFieldError] =
|
|
1346
|
+
const [deleteConfirmation, setDeleteConfirmation] = useState8(false);
|
|
1347
|
+
const [editConfirmation, setEditConfirmation] = useState8(false);
|
|
1348
|
+
const [errorMessage, setErrorMessage] = useState8("");
|
|
1349
|
+
const [valueFieldError, setValueFieldError] = useState8("");
|
|
1305
1350
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1306
1351
|
const variable = useVariable(editId);
|
|
1307
1352
|
if (!variable) {
|
|
1308
1353
|
throw new Error(`Global ${variableType} variable not found`);
|
|
1309
1354
|
}
|
|
1310
1355
|
const userPermissions = usePermissions();
|
|
1311
|
-
const [value, setValue] =
|
|
1312
|
-
const [label, setLabel] =
|
|
1356
|
+
const [value, setValue] = useState8(() => variable.value);
|
|
1357
|
+
const [label, setLabel] = useState8(() => variable.label);
|
|
1313
1358
|
useEffect2(() => {
|
|
1314
1359
|
styleVariablesRepository.update({
|
|
1315
1360
|
[editId]: {
|
|
@@ -1475,7 +1520,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1475
1520
|
|
|
1476
1521
|
// src/components/variables-selection.tsx
|
|
1477
1522
|
import * as React18 from "react";
|
|
1478
|
-
import { useState as
|
|
1523
|
+
import { useState as useState9 } from "react";
|
|
1479
1524
|
import { useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
1480
1525
|
import { PopoverBody as PopoverBody3 } from "@elementor/editor-editing-panel";
|
|
1481
1526
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, PopoverSearch } from "@elementor/editor-ui";
|
|
@@ -1637,7 +1682,7 @@ var SIZE4 = "tiny";
|
|
|
1637
1682
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
1638
1683
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil } = useVariableType();
|
|
1639
1684
|
const { value: variable, setValue: setVariable, path } = useBoundProp5(propTypeUtil);
|
|
1640
|
-
const [searchValue, setSearchValue] =
|
|
1685
|
+
const [searchValue, setSearchValue] = useState9("");
|
|
1641
1686
|
const {
|
|
1642
1687
|
list: variables,
|
|
1643
1688
|
hasMatches: hasSearchResults,
|
|
@@ -1733,8 +1778,8 @@ var VIEW_LIST = "list";
|
|
|
1733
1778
|
var VIEW_ADD = "add";
|
|
1734
1779
|
var VIEW_EDIT = "edit";
|
|
1735
1780
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
1736
|
-
const [currentView, setCurrentView] =
|
|
1737
|
-
const [editId, setEditId] =
|
|
1781
|
+
const [currentView, setCurrentView] = useState10(VIEW_LIST);
|
|
1782
|
+
const [editId, setEditId] = useState10("");
|
|
1738
1783
|
const { open } = usePanelActions();
|
|
1739
1784
|
const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
|
|
1740
1785
|
open();
|
|
@@ -1883,13 +1928,13 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1883
1928
|
|
|
1884
1929
|
// src/components/ui/variable/deleted-variable.tsx
|
|
1885
1930
|
import * as React25 from "react";
|
|
1886
|
-
import { useId as useId2, useRef as useRef2, useState as
|
|
1931
|
+
import { useId as useId2, useRef as useRef2, useState as useState12 } from "react";
|
|
1887
1932
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
1888
1933
|
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip, Popover as Popover2, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1889
1934
|
|
|
1890
1935
|
// src/components/variable-restore.tsx
|
|
1891
1936
|
import * as React22 from "react";
|
|
1892
|
-
import { useState as
|
|
1937
|
+
import { useState as useState11 } from "react";
|
|
1893
1938
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
1894
1939
|
import { PopoverBody as PopoverBody4 } from "@elementor/editor-editing-panel";
|
|
1895
1940
|
import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
|
|
@@ -1904,10 +1949,10 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1904
1949
|
if (!variable) {
|
|
1905
1950
|
throw new Error(`Global ${variableType} variable not found`);
|
|
1906
1951
|
}
|
|
1907
|
-
const [errorMessage, setErrorMessage] =
|
|
1908
|
-
const [valueFieldError, setValueFieldError] =
|
|
1909
|
-
const [label, setLabel] =
|
|
1910
|
-
const [value, setValue] =
|
|
1952
|
+
const [errorMessage, setErrorMessage] = useState11("");
|
|
1953
|
+
const [valueFieldError, setValueFieldError] = useState11("");
|
|
1954
|
+
const [label, setLabel] = useState11(variable.label);
|
|
1955
|
+
const [value, setValue] = useState11(variable.value);
|
|
1911
1956
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
1912
1957
|
value: variable.label,
|
|
1913
1958
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -2055,7 +2100,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2055
2100
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
2056
2101
|
const { setValue } = useBoundProp8();
|
|
2057
2102
|
const userPermissions = usePermissions();
|
|
2058
|
-
const [showInfotip, setShowInfotip] =
|
|
2103
|
+
const [showInfotip, setShowInfotip] = useState12(false);
|
|
2059
2104
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
2060
2105
|
const closeInfotip = () => setShowInfotip(false);
|
|
2061
2106
|
const deletedChipAnchorRef = useRef2(null);
|
|
@@ -2139,7 +2184,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2139
2184
|
|
|
2140
2185
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2141
2186
|
import * as React28 from "react";
|
|
2142
|
-
import { useId as useId3, useRef as useRef3, useState as
|
|
2187
|
+
import { useId as useId3, useRef as useRef3, useState as useState13 } from "react";
|
|
2143
2188
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
2144
2189
|
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box9, Infotip as Infotip2, Popover as Popover3, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2145
2190
|
|
|
@@ -2215,7 +2260,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2215
2260
|
variant: "popover",
|
|
2216
2261
|
popupId: `elementor-variables-list-${popupId}`
|
|
2217
2262
|
});
|
|
2218
|
-
const [infotipVisible, setInfotipVisible] =
|
|
2263
|
+
const [infotipVisible, setInfotipVisible] = useState13(false);
|
|
2219
2264
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
2220
2265
|
const closeInfotip = () => setInfotipVisible(false);
|
|
2221
2266
|
const triggerSelect = () => {
|
|
@@ -2280,7 +2325,7 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2280
2325
|
|
|
2281
2326
|
// src/components/ui/variable/missing-variable.tsx
|
|
2282
2327
|
import * as React31 from "react";
|
|
2283
|
-
import { useState as
|
|
2328
|
+
import { useState as useState14 } from "react";
|
|
2284
2329
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
2285
2330
|
import { Backdrop as Backdrop3, Infotip as Infotip3 } from "@elementor/ui";
|
|
2286
2331
|
import { __ as __21 } from "@wordpress/i18n";
|
|
@@ -2339,7 +2384,7 @@ var MissingTag = React30.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
2339
2384
|
// src/components/ui/variable/missing-variable.tsx
|
|
2340
2385
|
var MissingVariable = () => {
|
|
2341
2386
|
const { setValue } = useBoundProp10();
|
|
2342
|
-
const [infotipVisible, setInfotipVisible] =
|
|
2387
|
+
const [infotipVisible, setInfotipVisible] = useState14(false);
|
|
2343
2388
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
2344
2389
|
const closeInfotip = () => setInfotipVisible(false);
|
|
2345
2390
|
const clearValue = () => setValue(null);
|
|
@@ -2434,11 +2479,11 @@ import { BrushIcon, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
|
2434
2479
|
|
|
2435
2480
|
// src/components/fields/color-field.tsx
|
|
2436
2481
|
import * as React34 from "react";
|
|
2437
|
-
import { useRef as useRef4, useState as
|
|
2482
|
+
import { useRef as useRef4, useState as useState15 } from "react";
|
|
2438
2483
|
import { UnstableColorField } from "@elementor/ui";
|
|
2439
2484
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
2440
|
-
const [color, setColor] =
|
|
2441
|
-
const [errorMessage, setErrorMessage] =
|
|
2485
|
+
const [color, setColor] = useState15(value);
|
|
2486
|
+
const [errorMessage, setErrorMessage] = useState15("");
|
|
2442
2487
|
const defaultRef = useRef4(null);
|
|
2443
2488
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
2444
2489
|
const handleChange = (newValue) => {
|
|
@@ -2477,14 +2522,14 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
2477
2522
|
|
|
2478
2523
|
// src/components/fields/font-field.tsx
|
|
2479
2524
|
import * as React35 from "react";
|
|
2480
|
-
import { useId as useId4, useRef as useRef5, useState as
|
|
2525
|
+
import { useId as useId4, useRef as useRef5, useState as useState16 } from "react";
|
|
2481
2526
|
import { enqueueFont as enqueueFont2, ItemSelector } from "@elementor/editor-controls";
|
|
2482
2527
|
import { useFontFamilies, useSectionWidth as useSectionWidth4 } from "@elementor/editor-editing-panel";
|
|
2483
2528
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
2484
2529
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger3, Popover as Popover4, UnstableTag, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
2485
2530
|
import { __ as __23 } from "@wordpress/i18n";
|
|
2486
2531
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
2487
|
-
const [fontFamily, setFontFamily] =
|
|
2532
|
+
const [fontFamily, setFontFamily] = useState16(value);
|
|
2488
2533
|
const defaultRef = useRef5(null);
|
|
2489
2534
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
2490
2535
|
const fontPopoverState = usePopupState5({ variant: "popover" });
|
|
@@ -2565,7 +2610,7 @@ function registerVariableTypes() {
|
|
|
2565
2610
|
|
|
2566
2611
|
// src/renderers/style-variables-renderer.tsx
|
|
2567
2612
|
import * as React37 from "react";
|
|
2568
|
-
import { useEffect as useEffect3, useState as
|
|
2613
|
+
import { useEffect as useEffect3, useState as useState17 } from "react";
|
|
2569
2614
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
2570
2615
|
import { Portal } from "@elementor/ui";
|
|
2571
2616
|
|
|
@@ -2592,7 +2637,7 @@ function usePortalContainer() {
|
|
|
2592
2637
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
2593
2638
|
}
|
|
2594
2639
|
function useStyleVariables() {
|
|
2595
|
-
const [variables, setVariables] =
|
|
2640
|
+
const [variables, setVariables] = useState17({});
|
|
2596
2641
|
useEffect3(() => {
|
|
2597
2642
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
2598
2643
|
return () => {
|