@elementor/editor-variables 3.32.0-28 → 3.32.0-29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +213 -193
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +163 -152
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/fields/color-field.tsx +18 -25
- package/src/components/fields/font-field.tsx +36 -48
- package/src/components/fields/label-field.tsx +13 -21
- package/src/components/ui/form-field.tsx +28 -0
- package/src/components/variable-creation.tsx +14 -7
- package/src/components/variable-edit.tsx +13 -7
- package/src/components/variable-restore.tsx +13 -7
- package/src/variables-registry/create-variable-type-registry.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -113,15 +113,15 @@ var usePreventUnload = (isDirty) => {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
// src/controls/variable-control.tsx
|
|
116
|
-
var
|
|
116
|
+
var React25 = __toESM(require("react"));
|
|
117
117
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
118
118
|
|
|
119
119
|
// src/components/ui/variable/assigned-variable.tsx
|
|
120
120
|
var import_react11 = require("react");
|
|
121
|
-
var
|
|
121
|
+
var React17 = __toESM(require("react"));
|
|
122
122
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
123
123
|
var import_icons9 = require("@elementor/icons");
|
|
124
|
-
var
|
|
124
|
+
var import_ui17 = require("@elementor/ui");
|
|
125
125
|
|
|
126
126
|
// src/variables-registry/create-variable-type-registry.ts
|
|
127
127
|
var import_editor_canvas3 = require("@elementor/editor-canvas");
|
|
@@ -526,7 +526,7 @@ function createVariableTypeRegistry() {
|
|
|
526
526
|
var { registerVariableType, getVariableType, hasVariableType } = createVariableTypeRegistry();
|
|
527
527
|
|
|
528
528
|
// src/components/variable-selection-popover.tsx
|
|
529
|
-
var
|
|
529
|
+
var React15 = __toESM(require("react"));
|
|
530
530
|
var import_react10 = require("react");
|
|
531
531
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
532
532
|
|
|
@@ -574,13 +574,13 @@ var usePermissions = () => {
|
|
|
574
574
|
};
|
|
575
575
|
|
|
576
576
|
// src/components/variable-creation.tsx
|
|
577
|
-
var
|
|
577
|
+
var React7 = __toESM(require("react"));
|
|
578
578
|
var import_react6 = require("react");
|
|
579
579
|
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
580
580
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
581
581
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
582
582
|
var import_icons2 = require("@elementor/icons");
|
|
583
|
-
var
|
|
583
|
+
var import_ui7 = require("@elementor/ui");
|
|
584
584
|
var import_i18n6 = require("@wordpress/i18n");
|
|
585
585
|
|
|
586
586
|
// src/hooks/use-initial-value.ts
|
|
@@ -726,10 +726,19 @@ var validateValue = (value) => {
|
|
|
726
726
|
};
|
|
727
727
|
|
|
728
728
|
// src/components/fields/label-field.tsx
|
|
729
|
-
var
|
|
729
|
+
var React6 = __toESM(require("react"));
|
|
730
730
|
var import_react5 = require("react");
|
|
731
|
-
var
|
|
731
|
+
var import_ui6 = require("@elementor/ui");
|
|
732
732
|
var import_i18n5 = require("@wordpress/i18n");
|
|
733
|
+
|
|
734
|
+
// src/components/ui/form-field.tsx
|
|
735
|
+
var React5 = __toESM(require("react"));
|
|
736
|
+
var import_ui5 = require("@elementor/ui");
|
|
737
|
+
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
738
|
+
return /* @__PURE__ */ React5.createElement(import_ui5.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React5.createElement(import_ui5.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React5.createElement(import_ui5.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React5.createElement(import_ui5.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React5.createElement(import_ui5.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React5.createElement(import_ui5.FormHelperText, null, noticeMsg)));
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
// src/components/fields/label-field.tsx
|
|
733
742
|
function isLabelEqual(a, b) {
|
|
734
743
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
735
744
|
}
|
|
@@ -758,8 +767,8 @@ var LabelField = ({ value, error, onChange }) => {
|
|
|
758
767
|
errorMsg = error.message;
|
|
759
768
|
}
|
|
760
769
|
const noticeMsg = errorMsg ? "" : noticeMessage;
|
|
761
|
-
return /* @__PURE__ */
|
|
762
|
-
|
|
770
|
+
return /* @__PURE__ */ React6.createElement(FormField, { id: id2, label: (0, import_i18n5.__)("Name", "elementor"), errorMsg, noticeMsg }, /* @__PURE__ */ React6.createElement(
|
|
771
|
+
import_ui6.TextField,
|
|
763
772
|
{
|
|
764
773
|
id: id2,
|
|
765
774
|
size: "tiny",
|
|
@@ -769,7 +778,7 @@ var LabelField = ({ value, error, onChange }) => {
|
|
|
769
778
|
onChange: (e) => handleChange(e.target.value),
|
|
770
779
|
inputProps: { maxLength: VARIABLE_LABEL_MAX_LENGTH }
|
|
771
780
|
}
|
|
772
|
-
)
|
|
781
|
+
));
|
|
773
782
|
};
|
|
774
783
|
|
|
775
784
|
// src/components/variable-creation.tsx
|
|
@@ -781,11 +790,13 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
781
790
|
const [value, setValue] = (0, import_react6.useState)(initialValue);
|
|
782
791
|
const [label, setLabel] = (0, import_react6.useState)("");
|
|
783
792
|
const [errorMessage, setErrorMessage] = (0, import_react6.useState)("");
|
|
793
|
+
const [valueFieldError, setValueFieldError] = (0, import_react6.useState)("");
|
|
784
794
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
785
795
|
const resetFields = () => {
|
|
786
796
|
setValue("");
|
|
787
797
|
setLabel("");
|
|
788
798
|
setErrorMessage("");
|
|
799
|
+
setValueFieldError("");
|
|
789
800
|
};
|
|
790
801
|
const closePopover = () => {
|
|
791
802
|
resetFields();
|
|
@@ -824,14 +835,14 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
824
835
|
return !!errorMessage;
|
|
825
836
|
};
|
|
826
837
|
const isSubmitDisabled = hasEmptyValue() || hasErrors();
|
|
827
|
-
return /* @__PURE__ */
|
|
838
|
+
return /* @__PURE__ */ React7.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React7.createElement(
|
|
828
839
|
import_editor_ui2.PopoverHeader,
|
|
829
840
|
{
|
|
830
|
-
icon: /* @__PURE__ */
|
|
841
|
+
icon: /* @__PURE__ */ React7.createElement(React7.Fragment, null, onGoBack && /* @__PURE__ */ React7.createElement(import_ui7.IconButton, { size: SIZE, "aria-label": (0, import_i18n6.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React7.createElement(import_icons2.ArrowLeftIcon, { fontSize: SIZE })), /* @__PURE__ */ React7.createElement(VariableIcon, { fontSize: SIZE })),
|
|
831
842
|
title: (0, import_i18n6.__)("Create variable", "elementor"),
|
|
832
843
|
onClose: closePopover
|
|
833
844
|
}
|
|
834
|
-
), /* @__PURE__ */
|
|
845
|
+
), /* @__PURE__ */ React7.createElement(import_ui7.Divider, null), /* @__PURE__ */ React7.createElement(import_editor_controls3.PopoverContent, { p: 2 }, /* @__PURE__ */ React7.createElement(
|
|
835
846
|
LabelField,
|
|
836
847
|
{
|
|
837
848
|
value: label,
|
|
@@ -841,33 +852,35 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
841
852
|
setErrorMessage("");
|
|
842
853
|
}
|
|
843
854
|
}
|
|
844
|
-
), /* @__PURE__ */
|
|
855
|
+
), /* @__PURE__ */ React7.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n6.__)("Value", "elementor") }, /* @__PURE__ */ React7.createElement(
|
|
845
856
|
ValueField,
|
|
846
857
|
{
|
|
847
858
|
value,
|
|
848
859
|
onChange: (newValue) => {
|
|
849
860
|
setValue(newValue);
|
|
850
861
|
setErrorMessage("");
|
|
851
|
-
|
|
862
|
+
setValueFieldError("");
|
|
863
|
+
},
|
|
864
|
+
onValidationChange: setValueFieldError
|
|
852
865
|
}
|
|
853
|
-
), errorMessage && /* @__PURE__ */
|
|
866
|
+
)), errorMessage && /* @__PURE__ */ React7.createElement(import_ui7.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React7.createElement(import_ui7.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React7.createElement(import_ui7.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreateAndTrack }, (0, import_i18n6.__)("Create", "elementor"))));
|
|
854
867
|
};
|
|
855
868
|
|
|
856
869
|
// src/components/variable-edit.tsx
|
|
857
|
-
var
|
|
870
|
+
var React10 = __toESM(require("react"));
|
|
858
871
|
var import_react8 = require("react");
|
|
859
872
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
860
873
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
861
874
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
862
875
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
863
876
|
var import_icons5 = require("@elementor/icons");
|
|
864
|
-
var
|
|
877
|
+
var import_ui10 = require("@elementor/ui");
|
|
865
878
|
var import_i18n9 = require("@wordpress/i18n");
|
|
866
879
|
|
|
867
880
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
868
|
-
var
|
|
881
|
+
var React8 = __toESM(require("react"));
|
|
869
882
|
var import_icons3 = require("@elementor/icons");
|
|
870
|
-
var
|
|
883
|
+
var import_ui8 = require("@elementor/ui");
|
|
871
884
|
var import_i18n7 = require("@wordpress/i18n");
|
|
872
885
|
var TITLE_ID = "delete-variable-dialog";
|
|
873
886
|
var DeleteConfirmationDialog = ({
|
|
@@ -876,14 +889,14 @@ var DeleteConfirmationDialog = ({
|
|
|
876
889
|
closeDialog,
|
|
877
890
|
onConfirm
|
|
878
891
|
}) => {
|
|
879
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ React8.createElement(import_ui8.Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React8.createElement(import_ui8.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React8.createElement(import_icons3.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n7.__)("Delete this variable?", "elementor")), /* @__PURE__ */ React8.createElement(import_ui8.DialogContent, null, /* @__PURE__ */ React8.createElement(import_ui8.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n7.__)("All elements using", "elementor"), /* @__PURE__ */ React8.createElement(import_ui8.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), (0, import_i18n7.__)("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React8.createElement(import_ui8.DialogActions, null, /* @__PURE__ */ React8.createElement(import_ui8.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n7.__)("Not now", "elementor")), /* @__PURE__ */ React8.createElement(import_ui8.Button, { variant: "contained", color: "error", onClick: onConfirm }, (0, import_i18n7.__)("Delete", "elementor"))));
|
|
880
893
|
};
|
|
881
894
|
|
|
882
895
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
883
|
-
var
|
|
896
|
+
var React9 = __toESM(require("react"));
|
|
884
897
|
var import_react7 = require("react");
|
|
885
898
|
var import_icons4 = require("@elementor/icons");
|
|
886
|
-
var
|
|
899
|
+
var import_ui9 = require("@elementor/ui");
|
|
887
900
|
var import_i18n8 = require("@wordpress/i18n");
|
|
888
901
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
889
902
|
var EditConfirmationDialog = ({
|
|
@@ -898,23 +911,23 @@ var EditConfirmationDialog = ({
|
|
|
898
911
|
}
|
|
899
912
|
onConfirm?.();
|
|
900
913
|
};
|
|
901
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ React9.createElement(import_ui9.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React9.createElement(import_ui9.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React9.createElement(import_icons4.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n8.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React9.createElement(import_ui9.DialogContent, null, /* @__PURE__ */ React9.createElement(import_ui9.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n8.__)(
|
|
902
915
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
903
916
|
"elementor"
|
|
904
|
-
))), /* @__PURE__ */
|
|
905
|
-
|
|
917
|
+
))), /* @__PURE__ */ React9.createElement(import_ui9.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React9.createElement(
|
|
918
|
+
import_ui9.FormControlLabel,
|
|
906
919
|
{
|
|
907
|
-
control: /* @__PURE__ */
|
|
908
|
-
|
|
920
|
+
control: /* @__PURE__ */ React9.createElement(
|
|
921
|
+
import_ui9.Checkbox,
|
|
909
922
|
{
|
|
910
923
|
checked: dontShowAgain,
|
|
911
924
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
912
925
|
size: "small"
|
|
913
926
|
}
|
|
914
927
|
),
|
|
915
|
-
label: /* @__PURE__ */
|
|
928
|
+
label: /* @__PURE__ */ React9.createElement(import_ui9.Typography, { variant: "body2" }, (0, import_i18n8.__)("Don't show me again", "elementor"))
|
|
916
929
|
}
|
|
917
|
-
), /* @__PURE__ */
|
|
930
|
+
), /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(import_ui9.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n8.__)("Keep editing", "elementor")), /* @__PURE__ */ React9.createElement(import_ui9.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n8.__)("Save", "elementor")))));
|
|
918
931
|
};
|
|
919
932
|
|
|
920
933
|
// src/components/variable-edit.tsx
|
|
@@ -926,6 +939,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
926
939
|
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react8.useState)(false);
|
|
927
940
|
const [editConfirmation, setEditConfirmation] = (0, import_react8.useState)(false);
|
|
928
941
|
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
|
942
|
+
const [valueFieldError, setValueFieldError] = (0, import_react8.useState)("");
|
|
929
943
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
930
944
|
const variable = useVariable(editId);
|
|
931
945
|
if (!variable) {
|
|
@@ -997,15 +1011,15 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
997
1011
|
const actions = [];
|
|
998
1012
|
if (userPermissions.canDelete()) {
|
|
999
1013
|
actions.push(
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
|
|
1014
|
+
/* @__PURE__ */ React10.createElement(
|
|
1015
|
+
import_ui10.IconButton,
|
|
1002
1016
|
{
|
|
1003
1017
|
key: "delete",
|
|
1004
1018
|
size: SIZE2,
|
|
1005
1019
|
"aria-label": (0, import_i18n9.__)("Delete", "elementor"),
|
|
1006
1020
|
onClick: handleDeleteConfirmation
|
|
1007
1021
|
},
|
|
1008
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ React10.createElement(import_icons5.TrashIcon, { fontSize: SIZE2 })
|
|
1009
1023
|
)
|
|
1010
1024
|
);
|
|
1011
1025
|
}
|
|
@@ -1019,23 +1033,23 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1019
1033
|
return !!errorMessage;
|
|
1020
1034
|
};
|
|
1021
1035
|
const isSubmitDisabled = noValueChanged() || hasEmptyValues() || hasErrors();
|
|
1022
|
-
return /* @__PURE__ */
|
|
1036
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React10.createElement(
|
|
1023
1037
|
import_editor_ui3.PopoverHeader,
|
|
1024
1038
|
{
|
|
1025
1039
|
title: (0, import_i18n9.__)("Edit variable", "elementor"),
|
|
1026
1040
|
onClose,
|
|
1027
|
-
icon: /* @__PURE__ */
|
|
1028
|
-
|
|
1041
|
+
icon: /* @__PURE__ */ React10.createElement(React10.Fragment, null, onGoBack && /* @__PURE__ */ React10.createElement(
|
|
1042
|
+
import_ui10.IconButton,
|
|
1029
1043
|
{
|
|
1030
1044
|
size: SIZE2,
|
|
1031
1045
|
"aria-label": (0, import_i18n9.__)("Go Back", "elementor"),
|
|
1032
1046
|
onClick: onGoBack
|
|
1033
1047
|
},
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
), /* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ React10.createElement(import_icons5.ArrowLeftIcon, { fontSize: SIZE2 })
|
|
1049
|
+
), /* @__PURE__ */ React10.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
1036
1050
|
actions
|
|
1037
1051
|
}
|
|
1038
|
-
), /* @__PURE__ */
|
|
1052
|
+
), /* @__PURE__ */ React10.createElement(import_ui10.Divider, null), /* @__PURE__ */ React10.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React10.createElement(
|
|
1039
1053
|
LabelField,
|
|
1040
1054
|
{
|
|
1041
1055
|
value: label,
|
|
@@ -1045,16 +1059,18 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1045
1059
|
setErrorMessage("");
|
|
1046
1060
|
}
|
|
1047
1061
|
}
|
|
1048
|
-
), /* @__PURE__ */
|
|
1062
|
+
), /* @__PURE__ */ React10.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n9.__)("Value", "elementor") }, /* @__PURE__ */ React10.createElement(
|
|
1049
1063
|
ValueField,
|
|
1050
1064
|
{
|
|
1051
1065
|
value,
|
|
1052
1066
|
onChange: (newValue) => {
|
|
1053
1067
|
setValue(newValue);
|
|
1054
1068
|
setErrorMessage("");
|
|
1055
|
-
|
|
1069
|
+
setValueFieldError("");
|
|
1070
|
+
},
|
|
1071
|
+
onValidationChange: setValueFieldError
|
|
1056
1072
|
}
|
|
1057
|
-
), errorMessage && /* @__PURE__ */
|
|
1073
|
+
)), errorMessage && /* @__PURE__ */ React10.createElement(import_ui10.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React10.createElement(import_ui10.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React10.createElement(import_ui10.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n9.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React10.createElement(
|
|
1058
1074
|
DeleteConfirmationDialog,
|
|
1059
1075
|
{
|
|
1060
1076
|
open: true,
|
|
@@ -1062,7 +1078,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1062
1078
|
onConfirm: handleDelete,
|
|
1063
1079
|
closeDialog: closeDeleteDialog()
|
|
1064
1080
|
}
|
|
1065
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
1081
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React10.createElement(
|
|
1066
1082
|
EditConfirmationDialog,
|
|
1067
1083
|
{
|
|
1068
1084
|
closeDialog: closeEditDialog(),
|
|
@@ -1073,26 +1089,26 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1073
1089
|
};
|
|
1074
1090
|
|
|
1075
1091
|
// src/components/variables-selection.tsx
|
|
1076
|
-
var
|
|
1092
|
+
var React14 = __toESM(require("react"));
|
|
1077
1093
|
var import_react9 = require("react");
|
|
1078
1094
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
1079
1095
|
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
1080
1096
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1081
1097
|
var import_icons7 = require("@elementor/icons");
|
|
1082
|
-
var
|
|
1098
|
+
var import_ui15 = require("@elementor/ui");
|
|
1083
1099
|
var import_i18n13 = require("@wordpress/i18n");
|
|
1084
1100
|
|
|
1085
1101
|
// src/components/ui/menu-item-content.tsx
|
|
1086
|
-
var
|
|
1102
|
+
var React11 = __toESM(require("react"));
|
|
1087
1103
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1088
1104
|
var import_icons6 = require("@elementor/icons");
|
|
1089
|
-
var
|
|
1105
|
+
var import_ui11 = require("@elementor/ui");
|
|
1090
1106
|
var import_i18n10 = require("@wordpress/i18n");
|
|
1091
1107
|
var SIZE3 = "tiny";
|
|
1092
1108
|
var MenuItemContent = ({ item }) => {
|
|
1093
1109
|
const onEdit = item.onEdit;
|
|
1094
|
-
return /* @__PURE__ */
|
|
1095
|
-
|
|
1110
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(import_ui11.ListItemIcon, null, item.icon), /* @__PURE__ */ React11.createElement(
|
|
1111
|
+
import_ui11.Box,
|
|
1096
1112
|
{
|
|
1097
1113
|
sx: {
|
|
1098
1114
|
flex: 1,
|
|
@@ -1102,30 +1118,30 @@ var MenuItemContent = ({ item }) => {
|
|
|
1102
1118
|
gap: 1
|
|
1103
1119
|
}
|
|
1104
1120
|
},
|
|
1105
|
-
/* @__PURE__ */
|
|
1121
|
+
/* @__PURE__ */ React11.createElement(
|
|
1106
1122
|
import_editor_ui4.EllipsisWithTooltip,
|
|
1107
1123
|
{
|
|
1108
1124
|
title: item.label || item.value,
|
|
1109
|
-
as:
|
|
1125
|
+
as: import_ui11.Typography,
|
|
1110
1126
|
variant: "caption",
|
|
1111
1127
|
color: "text.primary",
|
|
1112
1128
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
1113
1129
|
maxWidth: "50%"
|
|
1114
1130
|
}
|
|
1115
1131
|
),
|
|
1116
|
-
item.secondaryText && /* @__PURE__ */
|
|
1132
|
+
item.secondaryText && /* @__PURE__ */ React11.createElement(
|
|
1117
1133
|
import_editor_ui4.EllipsisWithTooltip,
|
|
1118
1134
|
{
|
|
1119
1135
|
title: item.secondaryText,
|
|
1120
|
-
as:
|
|
1136
|
+
as: import_ui11.Typography,
|
|
1121
1137
|
variant: "caption",
|
|
1122
1138
|
color: "text.tertiary",
|
|
1123
1139
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
1124
1140
|
maxWidth: "50%"
|
|
1125
1141
|
}
|
|
1126
1142
|
)
|
|
1127
|
-
), !!onEdit && /* @__PURE__ */
|
|
1128
|
-
|
|
1143
|
+
), !!onEdit && /* @__PURE__ */ React11.createElement(
|
|
1144
|
+
import_ui11.IconButton,
|
|
1129
1145
|
{
|
|
1130
1146
|
sx: { mx: 1, opacity: "0" },
|
|
1131
1147
|
onClick: (e) => {
|
|
@@ -1134,17 +1150,17 @@ var MenuItemContent = ({ item }) => {
|
|
|
1134
1150
|
},
|
|
1135
1151
|
"aria-label": (0, import_i18n10.__)("Edit", "elementor")
|
|
1136
1152
|
},
|
|
1137
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ React11.createElement(import_icons6.EditIcon, { color: "action", fontSize: SIZE3 })
|
|
1138
1154
|
));
|
|
1139
1155
|
};
|
|
1140
1156
|
|
|
1141
1157
|
// src/components/ui/no-search-results.tsx
|
|
1142
|
-
var
|
|
1143
|
-
var
|
|
1158
|
+
var React12 = __toESM(require("react"));
|
|
1159
|
+
var import_ui12 = require("@elementor/ui");
|
|
1144
1160
|
var import_i18n11 = require("@wordpress/i18n");
|
|
1145
1161
|
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
1146
|
-
return /* @__PURE__ */
|
|
1147
|
-
|
|
1162
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1163
|
+
import_ui12.Stack,
|
|
1148
1164
|
{
|
|
1149
1165
|
gap: 1,
|
|
1150
1166
|
alignItems: "center",
|
|
@@ -1155,19 +1171,19 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
1155
1171
|
sx: { pb: 3.5 }
|
|
1156
1172
|
},
|
|
1157
1173
|
icon,
|
|
1158
|
-
/* @__PURE__ */
|
|
1159
|
-
/* @__PURE__ */
|
|
1174
|
+
/* @__PURE__ */ React12.createElement(import_ui12.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n11.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React12.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1175
|
+
/* @__PURE__ */ React12.createElement(import_ui12.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n11.__)("Try something else.", "elementor"), /* @__PURE__ */ React12.createElement(import_ui12.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n11.__)("Clear & try again", "elementor")))
|
|
1160
1176
|
);
|
|
1161
1177
|
};
|
|
1162
1178
|
|
|
1163
1179
|
// src/components/ui/no-variables.tsx
|
|
1164
|
-
var
|
|
1165
|
-
var
|
|
1180
|
+
var React13 = __toESM(require("react"));
|
|
1181
|
+
var import_ui13 = require("@elementor/ui");
|
|
1166
1182
|
var import_i18n12 = require("@wordpress/i18n");
|
|
1167
1183
|
var NoVariables = ({ icon, title, onAdd }) => {
|
|
1168
1184
|
const canAdd = usePermissions().canAdd();
|
|
1169
|
-
return /* @__PURE__ */
|
|
1170
|
-
|
|
1185
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1186
|
+
import_ui13.Stack,
|
|
1171
1187
|
{
|
|
1172
1188
|
gap: 1,
|
|
1173
1189
|
alignItems: "center",
|
|
@@ -1177,7 +1193,7 @@ var NoVariables = ({ icon, title, onAdd }) => {
|
|
|
1177
1193
|
sx: { p: 2.5, pb: 5.5 }
|
|
1178
1194
|
},
|
|
1179
1195
|
icon,
|
|
1180
|
-
canAdd ? /* @__PURE__ */
|
|
1196
|
+
canAdd ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
|
1181
1197
|
NoVariablesContent,
|
|
1182
1198
|
{
|
|
1183
1199
|
title: title || (0, import_i18n12.__)("Create your first variable", "elementor"),
|
|
@@ -1186,7 +1202,7 @@ var NoVariables = ({ icon, title, onAdd }) => {
|
|
|
1186
1202
|
"elementor"
|
|
1187
1203
|
)
|
|
1188
1204
|
}
|
|
1189
|
-
), onAdd && /* @__PURE__ */
|
|
1205
|
+
), onAdd && /* @__PURE__ */ React13.createElement(import_ui13.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n12.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React13.createElement(
|
|
1190
1206
|
NoVariablesContent,
|
|
1191
1207
|
{
|
|
1192
1208
|
title: (0, import_i18n12.__)("There are no variables", "elementor"),
|
|
@@ -1196,12 +1212,12 @@ var NoVariables = ({ icon, title, onAdd }) => {
|
|
|
1196
1212
|
);
|
|
1197
1213
|
};
|
|
1198
1214
|
function NoVariablesContent({ title, message }) {
|
|
1199
|
-
return /* @__PURE__ */
|
|
1215
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(import_ui13.Typography, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React13.createElement(import_ui13.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
1200
1216
|
}
|
|
1201
1217
|
|
|
1202
1218
|
// src/components/ui/styled-menu-list.tsx
|
|
1203
|
-
var
|
|
1204
|
-
var VariablesStyledMenuList = (0,
|
|
1219
|
+
var import_ui14 = require("@elementor/ui");
|
|
1220
|
+
var VariablesStyledMenuList = (0, import_ui14.styled)(import_ui14.MenuList)(({ theme }) => ({
|
|
1205
1221
|
"& > li": {
|
|
1206
1222
|
height: 32,
|
|
1207
1223
|
width: "100%",
|
|
@@ -1262,20 +1278,20 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1262
1278
|
const actions = [];
|
|
1263
1279
|
if (onAdd) {
|
|
1264
1280
|
actions.push(
|
|
1265
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ React14.createElement(import_ui15.IconButton, { key: "add", size: SIZE4, onClick: onAddAndTrack }, /* @__PURE__ */ React14.createElement(import_icons7.PlusIcon, { fontSize: SIZE4 }))
|
|
1266
1282
|
);
|
|
1267
1283
|
}
|
|
1268
1284
|
if (onSettings) {
|
|
1269
1285
|
actions.push(
|
|
1270
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ React14.createElement(import_ui15.IconButton, { key: "settings", size: SIZE4, onClick: onSettings }, /* @__PURE__ */ React14.createElement(import_icons7.SettingsIcon, { fontSize: SIZE4 }))
|
|
1271
1287
|
);
|
|
1272
1288
|
}
|
|
1273
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
1289
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React14.createElement(VariableIcon, { fontSize: SIZE4 }));
|
|
1274
1290
|
const items = variables.map(({ value, label, key }) => ({
|
|
1275
1291
|
type: "item",
|
|
1276
1292
|
value: key,
|
|
1277
1293
|
label,
|
|
1278
|
-
icon: /* @__PURE__ */
|
|
1294
|
+
icon: /* @__PURE__ */ React14.createElement(StartIcon, { value }),
|
|
1279
1295
|
secondaryText: value,
|
|
1280
1296
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
1281
1297
|
}));
|
|
@@ -1290,22 +1306,22 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1290
1306
|
(0, import_i18n13.__)("Create your first %s variable", "elementor"),
|
|
1291
1307
|
variableType
|
|
1292
1308
|
);
|
|
1293
|
-
return /* @__PURE__ */
|
|
1309
|
+
return /* @__PURE__ */ React14.createElement(import_editor_editing_panel4.PopoverBody, null, /* @__PURE__ */ React14.createElement(
|
|
1294
1310
|
import_editor_ui5.PopoverHeader,
|
|
1295
1311
|
{
|
|
1296
1312
|
title: (0, import_i18n13.__)("Variables", "elementor"),
|
|
1297
|
-
icon: /* @__PURE__ */
|
|
1313
|
+
icon: /* @__PURE__ */ React14.createElement(import_icons7.ColorFilterIcon, { fontSize: SIZE4 }),
|
|
1298
1314
|
onClose: closePopover,
|
|
1299
1315
|
actions
|
|
1300
1316
|
}
|
|
1301
|
-
), hasVariables && /* @__PURE__ */
|
|
1317
|
+
), hasVariables && /* @__PURE__ */ React14.createElement(
|
|
1302
1318
|
import_editor_ui5.PopoverSearch,
|
|
1303
1319
|
{
|
|
1304
1320
|
value: searchValue,
|
|
1305
1321
|
onSearch: handleSearch,
|
|
1306
1322
|
placeholder: (0, import_i18n13.__)("Search", "elementor")
|
|
1307
1323
|
}
|
|
1308
|
-
), /* @__PURE__ */
|
|
1324
|
+
), /* @__PURE__ */ React14.createElement(import_ui15.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React14.createElement(
|
|
1309
1325
|
import_editor_ui5.PopoverMenuList,
|
|
1310
1326
|
{
|
|
1311
1327
|
items,
|
|
@@ -1315,16 +1331,16 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1315
1331
|
selectedValue: variable,
|
|
1316
1332
|
"data-testid": `${variableType}-variables-list`,
|
|
1317
1333
|
menuListTemplate: VariablesStyledMenuList,
|
|
1318
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
1334
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React14.createElement(MenuItemContent, { item })
|
|
1319
1335
|
}
|
|
1320
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
1336
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React14.createElement(
|
|
1321
1337
|
NoSearchResults,
|
|
1322
1338
|
{
|
|
1323
1339
|
searchValue,
|
|
1324
1340
|
onClear: handleClearSearch,
|
|
1325
|
-
icon: /* @__PURE__ */
|
|
1341
|
+
icon: /* @__PURE__ */ React14.createElement(VariableIcon, { fontSize: "large" })
|
|
1326
1342
|
}
|
|
1327
|
-
), !hasVariables && /* @__PURE__ */
|
|
1343
|
+
), !hasVariables && /* @__PURE__ */ React14.createElement(NoVariables, { title: noVariableTitle, icon: /* @__PURE__ */ React14.createElement(VariableIcon, { fontSize: "large" }), onAdd }));
|
|
1328
1344
|
};
|
|
1329
1345
|
|
|
1330
1346
|
// src/components/variable-selection-popover.tsx
|
|
@@ -1338,7 +1354,7 @@ var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable })
|
|
|
1338
1354
|
const onSettingsAvailable = (0, import_editor_v1_adapters2.isExperimentActive)("e_variables_settings") ? () => {
|
|
1339
1355
|
open();
|
|
1340
1356
|
} : void 0;
|
|
1341
|
-
return /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ React15.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React15.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
1342
1358
|
propTypeKey,
|
|
1343
1359
|
currentView,
|
|
1344
1360
|
selectedVariable,
|
|
@@ -1384,7 +1400,7 @@ function RenderView(props) {
|
|
|
1384
1400
|
}
|
|
1385
1401
|
};
|
|
1386
1402
|
if (VIEW_LIST === props.currentView) {
|
|
1387
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1388
1404
|
VariablesSelection,
|
|
1389
1405
|
{
|
|
1390
1406
|
closePopover: handlers.onClose,
|
|
@@ -1395,10 +1411,10 @@ function RenderView(props) {
|
|
|
1395
1411
|
);
|
|
1396
1412
|
}
|
|
1397
1413
|
if (VIEW_ADD === props.currentView) {
|
|
1398
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ React15.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
1399
1415
|
}
|
|
1400
1416
|
if (VIEW_EDIT === props.currentView) {
|
|
1401
|
-
return /* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1402
1418
|
VariableEdit,
|
|
1403
1419
|
{
|
|
1404
1420
|
editId: props.editId,
|
|
@@ -1412,25 +1428,25 @@ function RenderView(props) {
|
|
|
1412
1428
|
}
|
|
1413
1429
|
|
|
1414
1430
|
// src/components/ui/tags/assigned-tag.tsx
|
|
1415
|
-
var
|
|
1431
|
+
var React16 = __toESM(require("react"));
|
|
1416
1432
|
var import_icons8 = require("@elementor/icons");
|
|
1417
|
-
var
|
|
1433
|
+
var import_ui16 = require("@elementor/ui");
|
|
1418
1434
|
var import_i18n14 = require("@wordpress/i18n");
|
|
1419
1435
|
var SIZE5 = "tiny";
|
|
1420
1436
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
1421
1437
|
const actions = [];
|
|
1422
1438
|
if (onUnlink) {
|
|
1423
1439
|
actions.push(
|
|
1424
|
-
/* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ React16.createElement(import_ui16.IconButton, { key: "unlink", size: SIZE5, onClick: onUnlink, "aria-label": (0, import_i18n14.__)("Unlink", "elementor") }, /* @__PURE__ */ React16.createElement(import_icons8.DetachIcon, { fontSize: SIZE5 }))
|
|
1425
1441
|
);
|
|
1426
1442
|
}
|
|
1427
|
-
return /* @__PURE__ */
|
|
1428
|
-
|
|
1443
|
+
return /* @__PURE__ */ React16.createElement(import_ui16.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React16.createElement(
|
|
1444
|
+
import_ui16.UnstableTag,
|
|
1429
1445
|
{
|
|
1430
1446
|
fullWidth: true,
|
|
1431
1447
|
showActionsOnHover: true,
|
|
1432
|
-
startIcon: /* @__PURE__ */
|
|
1433
|
-
label: /* @__PURE__ */
|
|
1448
|
+
startIcon: /* @__PURE__ */ React16.createElement(import_ui16.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
1449
|
+
label: /* @__PURE__ */ React16.createElement(import_ui16.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React16.createElement(import_ui16.Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
1434
1450
|
actions,
|
|
1435
1451
|
...props
|
|
1436
1452
|
}
|
|
@@ -1443,7 +1459,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1443
1459
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
1444
1460
|
const anchorRef = (0, import_react11.useRef)(null);
|
|
1445
1461
|
const popupId = (0, import_react11.useId)();
|
|
1446
|
-
const popupState = (0,
|
|
1462
|
+
const popupState = (0, import_ui17.usePopupState)({
|
|
1447
1463
|
variant: "popover",
|
|
1448
1464
|
popupId: `elementor-variables-list-${popupId}`
|
|
1449
1465
|
});
|
|
@@ -1452,16 +1468,16 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1452
1468
|
setValue(fallbackValue);
|
|
1453
1469
|
};
|
|
1454
1470
|
const StartIcon = startIcon || (() => null);
|
|
1455
|
-
return /* @__PURE__ */
|
|
1471
|
+
return /* @__PURE__ */ React17.createElement(import_ui17.Box, { ref: anchorRef }, /* @__PURE__ */ React17.createElement(
|
|
1456
1472
|
AssignedTag,
|
|
1457
1473
|
{
|
|
1458
1474
|
label: variable.label,
|
|
1459
|
-
startIcon: /* @__PURE__ */
|
|
1475
|
+
startIcon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(import_icons9.ColorFilterIcon, { fontSize: SIZE5 }), /* @__PURE__ */ React17.createElement(StartIcon, { value: variable.value })),
|
|
1460
1476
|
onUnlink: unlinkVariable,
|
|
1461
|
-
...(0,
|
|
1477
|
+
...(0, import_ui17.bindTrigger)(popupState)
|
|
1462
1478
|
}
|
|
1463
|
-
), /* @__PURE__ */
|
|
1464
|
-
|
|
1479
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1480
|
+
import_ui17.Popover,
|
|
1465
1481
|
{
|
|
1466
1482
|
disableScrollLock: true,
|
|
1467
1483
|
anchorEl: anchorRef.current,
|
|
@@ -1470,9 +1486,9 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1470
1486
|
PaperProps: {
|
|
1471
1487
|
sx: { my: 1 }
|
|
1472
1488
|
},
|
|
1473
|
-
...(0,
|
|
1489
|
+
...(0, import_ui17.bindPopover)(popupState)
|
|
1474
1490
|
},
|
|
1475
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ React17.createElement(
|
|
1476
1492
|
VariableSelectionPopover,
|
|
1477
1493
|
{
|
|
1478
1494
|
selectedVariable: variable,
|
|
@@ -1484,18 +1500,18 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1484
1500
|
};
|
|
1485
1501
|
|
|
1486
1502
|
// src/components/ui/variable/deleted-variable.tsx
|
|
1487
|
-
var
|
|
1503
|
+
var React21 = __toESM(require("react"));
|
|
1488
1504
|
var import_react13 = require("react");
|
|
1489
1505
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
1490
|
-
var
|
|
1506
|
+
var import_ui21 = require("@elementor/ui");
|
|
1491
1507
|
|
|
1492
1508
|
// src/components/variable-restore.tsx
|
|
1493
|
-
var
|
|
1509
|
+
var React18 = __toESM(require("react"));
|
|
1494
1510
|
var import_react12 = require("react");
|
|
1495
1511
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
1496
1512
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
1497
1513
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1498
|
-
var
|
|
1514
|
+
var import_ui18 = require("@elementor/ui");
|
|
1499
1515
|
var import_i18n15 = require("@wordpress/i18n");
|
|
1500
1516
|
var SIZE6 = "tiny";
|
|
1501
1517
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
@@ -1506,6 +1522,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1506
1522
|
throw new Error(`Global ${variableType} variable not found`);
|
|
1507
1523
|
}
|
|
1508
1524
|
const [errorMessage, setErrorMessage] = (0, import_react12.useState)("");
|
|
1525
|
+
const [valueFieldError, setValueFieldError] = (0, import_react12.useState)("");
|
|
1509
1526
|
const [label, setLabel] = (0, import_react12.useState)(variable.label);
|
|
1510
1527
|
const [value, setValue] = (0, import_react12.useState)(variable.value);
|
|
1511
1528
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
@@ -1539,14 +1556,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1539
1556
|
return !!errorMessage;
|
|
1540
1557
|
};
|
|
1541
1558
|
const isSubmitDisabled = noValueChanged() || hasEmptyValues() || hasErrors();
|
|
1542
|
-
return /* @__PURE__ */
|
|
1559
|
+
return /* @__PURE__ */ React18.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React18.createElement(import_editor_editing_panel5.PopoverBody, { height: "auto" }, /* @__PURE__ */ React18.createElement(
|
|
1543
1560
|
import_editor_ui6.PopoverHeader,
|
|
1544
1561
|
{
|
|
1545
|
-
icon: /* @__PURE__ */
|
|
1562
|
+
icon: /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: SIZE6 }),
|
|
1546
1563
|
title: (0, import_i18n15.__)("Restore variable", "elementor"),
|
|
1547
1564
|
onClose
|
|
1548
1565
|
}
|
|
1549
|
-
), /* @__PURE__ */
|
|
1566
|
+
), /* @__PURE__ */ React18.createElement(import_ui18.Divider, null), /* @__PURE__ */ React18.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React18.createElement(
|
|
1550
1567
|
LabelField,
|
|
1551
1568
|
{
|
|
1552
1569
|
value: label,
|
|
@@ -1556,35 +1573,37 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1556
1573
|
setErrorMessage("");
|
|
1557
1574
|
}
|
|
1558
1575
|
}
|
|
1559
|
-
), /* @__PURE__ */
|
|
1576
|
+
), /* @__PURE__ */ React18.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n15.__)("Value", "elementor") }, /* @__PURE__ */ React18.createElement(
|
|
1560
1577
|
ValueField,
|
|
1561
1578
|
{
|
|
1562
1579
|
value,
|
|
1563
1580
|
onChange: (newValue) => {
|
|
1564
1581
|
setValue(newValue);
|
|
1565
1582
|
setErrorMessage("");
|
|
1566
|
-
|
|
1583
|
+
setValueFieldError("");
|
|
1584
|
+
},
|
|
1585
|
+
onValidationChange: setValueFieldError
|
|
1567
1586
|
}
|
|
1568
|
-
), errorMessage && /* @__PURE__ */
|
|
1587
|
+
)), errorMessage && /* @__PURE__ */ React18.createElement(import_ui18.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React18.createElement(import_ui18.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React18.createElement(import_ui18.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n15.__)("Restore", "elementor")))));
|
|
1569
1588
|
};
|
|
1570
1589
|
|
|
1571
1590
|
// src/components/ui/deleted-variable-alert.tsx
|
|
1572
|
-
var
|
|
1591
|
+
var React19 = __toESM(require("react"));
|
|
1573
1592
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
1574
|
-
var
|
|
1593
|
+
var import_ui19 = require("@elementor/ui");
|
|
1575
1594
|
var import_i18n16 = require("@wordpress/i18n");
|
|
1576
1595
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
1577
1596
|
const sectionWidth = (0, import_editor_editing_panel6.useSectionWidth)();
|
|
1578
|
-
return /* @__PURE__ */
|
|
1579
|
-
|
|
1597
|
+
return /* @__PURE__ */ React19.createElement(import_ui19.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React19.createElement(
|
|
1598
|
+
import_ui19.Alert,
|
|
1580
1599
|
{
|
|
1581
1600
|
variant: "standard",
|
|
1582
1601
|
severity: "warning",
|
|
1583
1602
|
onClose,
|
|
1584
|
-
action: /* @__PURE__ */
|
|
1603
|
+
action: /* @__PURE__ */ React19.createElement(React19.Fragment, null, onUnlink && /* @__PURE__ */ React19.createElement(import_ui19.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n16.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React19.createElement(import_ui19.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n16.__)("Restore", "elementor"))),
|
|
1585
1604
|
sx: { width: sectionWidth }
|
|
1586
1605
|
},
|
|
1587
|
-
/* @__PURE__ */
|
|
1606
|
+
/* @__PURE__ */ React19.createElement(import_ui19.AlertTitle, null, (0, import_i18n16.__)("Deleted variable", "elementor")),
|
|
1588
1607
|
(0, import_i18n16.__)("The variable", "elementor"),
|
|
1589
1608
|
" '",
|
|
1590
1609
|
label,
|
|
@@ -1598,13 +1617,13 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
1598
1617
|
};
|
|
1599
1618
|
|
|
1600
1619
|
// src/components/ui/tags/deleted-tag.tsx
|
|
1601
|
-
var
|
|
1620
|
+
var React20 = __toESM(require("react"));
|
|
1602
1621
|
var import_icons10 = require("@elementor/icons");
|
|
1603
|
-
var
|
|
1622
|
+
var import_ui20 = require("@elementor/ui");
|
|
1604
1623
|
var import_i18n17 = require("@wordpress/i18n");
|
|
1605
|
-
var DeletedTag =
|
|
1606
|
-
return /* @__PURE__ */
|
|
1607
|
-
|
|
1624
|
+
var DeletedTag = React20.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
1625
|
+
return /* @__PURE__ */ React20.createElement(
|
|
1626
|
+
import_ui20.Chip,
|
|
1608
1627
|
{
|
|
1609
1628
|
ref,
|
|
1610
1629
|
size: "tiny",
|
|
@@ -1612,8 +1631,8 @@ var DeletedTag = React19.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
1612
1631
|
shape: "rounded",
|
|
1613
1632
|
variant: "standard",
|
|
1614
1633
|
onClick,
|
|
1615
|
-
icon: /* @__PURE__ */
|
|
1616
|
-
label: /* @__PURE__ */
|
|
1634
|
+
icon: /* @__PURE__ */ React20.createElement(import_icons10.AlertTriangleFilledIcon, null),
|
|
1635
|
+
label: /* @__PURE__ */ React20.createElement(import_ui20.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React20.createElement(import_ui20.Box, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React20.createElement(import_ui20.Typography, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React20.createElement(import_ui20.Typography, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", (0, import_i18n17.__)("deleted", "elementor"), ")"))),
|
|
1617
1636
|
sx: {
|
|
1618
1637
|
height: (theme) => theme.spacing(3.5),
|
|
1619
1638
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -1635,7 +1654,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1635
1654
|
const closeInfotip = () => setShowInfotip(false);
|
|
1636
1655
|
const deletedChipAnchorRef = (0, import_react13.useRef)(null);
|
|
1637
1656
|
const popupId = (0, import_react13.useId)();
|
|
1638
|
-
const popupState = (0,
|
|
1657
|
+
const popupState = (0, import_ui21.usePopupState)({
|
|
1639
1658
|
variant: "popover",
|
|
1640
1659
|
popupId: `elementor-variables-restore-${popupId}`
|
|
1641
1660
|
});
|
|
@@ -1663,15 +1682,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1663
1682
|
const handleRestoreWithOverrides = () => {
|
|
1664
1683
|
popupState.close();
|
|
1665
1684
|
};
|
|
1666
|
-
return /* @__PURE__ */
|
|
1667
|
-
|
|
1685
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(import_ui21.Box, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React21.createElement(import_ui21.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React21.createElement(
|
|
1686
|
+
import_ui21.Infotip,
|
|
1668
1687
|
{
|
|
1669
1688
|
color: "warning",
|
|
1670
1689
|
placement: "right-start",
|
|
1671
1690
|
open: showInfotip,
|
|
1672
1691
|
disableHoverListener: true,
|
|
1673
1692
|
onClose: closeInfotip,
|
|
1674
|
-
content: /* @__PURE__ */
|
|
1693
|
+
content: /* @__PURE__ */ React21.createElement(
|
|
1675
1694
|
DeletedVariableAlert,
|
|
1676
1695
|
{
|
|
1677
1696
|
onClose: closeInfotip,
|
|
@@ -1691,9 +1710,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1691
1710
|
}
|
|
1692
1711
|
}
|
|
1693
1712
|
},
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
), /* @__PURE__ */
|
|
1696
|
-
|
|
1713
|
+
/* @__PURE__ */ React21.createElement(DeletedTag, { label: variable.label, onClick: toggleInfotip })
|
|
1714
|
+
), /* @__PURE__ */ React21.createElement(
|
|
1715
|
+
import_ui21.Popover,
|
|
1697
1716
|
{
|
|
1698
1717
|
disableScrollLock: true,
|
|
1699
1718
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -1701,9 +1720,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1701
1720
|
PaperProps: {
|
|
1702
1721
|
sx: { my: 1 }
|
|
1703
1722
|
},
|
|
1704
|
-
...(0,
|
|
1723
|
+
...(0, import_ui21.bindPopover)(popupState)
|
|
1705
1724
|
},
|
|
1706
|
-
/* @__PURE__ */
|
|
1725
|
+
/* @__PURE__ */ React21.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React21.createElement(
|
|
1707
1726
|
VariableRestore,
|
|
1708
1727
|
{
|
|
1709
1728
|
variableId: variable.key ?? "",
|
|
@@ -1715,29 +1734,29 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1715
1734
|
};
|
|
1716
1735
|
|
|
1717
1736
|
// src/components/ui/variable/missing-variable.tsx
|
|
1718
|
-
var
|
|
1737
|
+
var React24 = __toESM(require("react"));
|
|
1719
1738
|
var import_react14 = require("react");
|
|
1720
1739
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
1721
|
-
var
|
|
1740
|
+
var import_ui24 = require("@elementor/ui");
|
|
1722
1741
|
var import_i18n19 = require("@wordpress/i18n");
|
|
1723
1742
|
|
|
1724
1743
|
// src/components/ui/missing-variable-alert.tsx
|
|
1725
|
-
var
|
|
1744
|
+
var React22 = __toESM(require("react"));
|
|
1726
1745
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
1727
|
-
var
|
|
1746
|
+
var import_ui22 = require("@elementor/ui");
|
|
1728
1747
|
var import_i18n18 = require("@wordpress/i18n");
|
|
1729
1748
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
1730
1749
|
const sectionWidth = (0, import_editor_editing_panel7.useSectionWidth)();
|
|
1731
|
-
return /* @__PURE__ */
|
|
1732
|
-
|
|
1750
|
+
return /* @__PURE__ */ React22.createElement(import_ui22.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React22.createElement(
|
|
1751
|
+
import_ui22.Alert,
|
|
1733
1752
|
{
|
|
1734
1753
|
variant: "standard",
|
|
1735
1754
|
severity: "warning",
|
|
1736
1755
|
onClose,
|
|
1737
|
-
action: /* @__PURE__ */
|
|
1756
|
+
action: /* @__PURE__ */ React22.createElement(React22.Fragment, null, onClear && /* @__PURE__ */ React22.createElement(import_ui22.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n18.__)("Clear", "elementor"))),
|
|
1738
1757
|
sx: { width: sectionWidth }
|
|
1739
1758
|
},
|
|
1740
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ React22.createElement(import_ui22.AlertTitle, null, (0, import_i18n18.__)("This variable is missing", "elementor")),
|
|
1741
1760
|
(0, import_i18n18.__)(
|
|
1742
1761
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
1743
1762
|
"elementor"
|
|
@@ -1746,12 +1765,12 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
1746
1765
|
};
|
|
1747
1766
|
|
|
1748
1767
|
// src/components/ui/tags/missing-tag.tsx
|
|
1749
|
-
var
|
|
1768
|
+
var React23 = __toESM(require("react"));
|
|
1750
1769
|
var import_icons11 = require("@elementor/icons");
|
|
1751
|
-
var
|
|
1752
|
-
var MissingTag =
|
|
1753
|
-
return /* @__PURE__ */
|
|
1754
|
-
|
|
1770
|
+
var import_ui23 = require("@elementor/ui");
|
|
1771
|
+
var MissingTag = React23.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
1772
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1773
|
+
import_ui23.Chip,
|
|
1755
1774
|
{
|
|
1756
1775
|
ref,
|
|
1757
1776
|
size: "tiny",
|
|
@@ -1759,7 +1778,7 @@ var MissingTag = React22.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
1759
1778
|
shape: "rounded",
|
|
1760
1779
|
variant: "standard",
|
|
1761
1780
|
onClick,
|
|
1762
|
-
icon: /* @__PURE__ */
|
|
1781
|
+
icon: /* @__PURE__ */ React23.createElement(import_icons11.AlertTriangleFilledIcon, null),
|
|
1763
1782
|
label,
|
|
1764
1783
|
sx: {
|
|
1765
1784
|
height: (theme) => theme.spacing(3.5),
|
|
@@ -1779,15 +1798,15 @@ var MissingVariable = () => {
|
|
|
1779
1798
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
1780
1799
|
const closeInfotip = () => setInfotipVisible(false);
|
|
1781
1800
|
const clearValue = () => setValue(null);
|
|
1782
|
-
return /* @__PURE__ */
|
|
1783
|
-
|
|
1801
|
+
return /* @__PURE__ */ React24.createElement(React24.Fragment, null, infotipVisible && /* @__PURE__ */ React24.createElement(import_ui24.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React24.createElement(
|
|
1802
|
+
import_ui24.Infotip,
|
|
1784
1803
|
{
|
|
1785
1804
|
color: "warning",
|
|
1786
1805
|
placement: "right-start",
|
|
1787
1806
|
open: infotipVisible,
|
|
1788
1807
|
disableHoverListener: true,
|
|
1789
1808
|
onClose: closeInfotip,
|
|
1790
|
-
content: /* @__PURE__ */
|
|
1809
|
+
content: /* @__PURE__ */ React24.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
1791
1810
|
slotProps: {
|
|
1792
1811
|
popper: {
|
|
1793
1812
|
modifiers: [
|
|
@@ -1799,7 +1818,7 @@ var MissingVariable = () => {
|
|
|
1799
1818
|
}
|
|
1800
1819
|
}
|
|
1801
1820
|
},
|
|
1802
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ React24.createElement(MissingTag, { label: (0, import_i18n19.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
1803
1822
|
));
|
|
1804
1823
|
};
|
|
1805
1824
|
|
|
@@ -1808,17 +1827,17 @@ var VariableControl = () => {
|
|
|
1808
1827
|
const boundProp = (0, import_editor_controls10.useBoundProp)().value;
|
|
1809
1828
|
const assignedVariable = useVariable(boundProp?.value);
|
|
1810
1829
|
if (!assignedVariable) {
|
|
1811
|
-
return /* @__PURE__ */
|
|
1830
|
+
return /* @__PURE__ */ React25.createElement(MissingVariable, null);
|
|
1812
1831
|
}
|
|
1813
1832
|
const { $$type: propTypeKey } = boundProp;
|
|
1814
1833
|
if (assignedVariable?.deleted) {
|
|
1815
|
-
return /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ React25.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
1816
1835
|
}
|
|
1817
|
-
return /* @__PURE__ */
|
|
1836
|
+
return /* @__PURE__ */ React25.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
1818
1837
|
};
|
|
1819
1838
|
|
|
1820
1839
|
// src/hooks/use-prop-variable-action.tsx
|
|
1821
|
-
var
|
|
1840
|
+
var React26 = __toESM(require("react"));
|
|
1822
1841
|
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
1823
1842
|
var import_icons12 = require("@elementor/icons");
|
|
1824
1843
|
var import_i18n20 = require("@wordpress/i18n");
|
|
@@ -1834,7 +1853,7 @@ var usePropVariableAction = () => {
|
|
|
1834
1853
|
return null;
|
|
1835
1854
|
}
|
|
1836
1855
|
trackOpenVariablePopover(path, variable.variableType);
|
|
1837
|
-
return /* @__PURE__ */
|
|
1856
|
+
return /* @__PURE__ */ React26.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
1838
1857
|
}
|
|
1839
1858
|
};
|
|
1840
1859
|
};
|
|
@@ -1859,16 +1878,15 @@ var trackOpenVariablePopover = (path, variableType) => {
|
|
|
1859
1878
|
};
|
|
1860
1879
|
|
|
1861
1880
|
// src/register-variable-types.tsx
|
|
1862
|
-
var
|
|
1881
|
+
var React29 = __toESM(require("react"));
|
|
1863
1882
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
1864
1883
|
var import_icons14 = require("@elementor/icons");
|
|
1865
1884
|
|
|
1866
1885
|
// src/components/fields/color-field.tsx
|
|
1867
|
-
var
|
|
1886
|
+
var React27 = __toESM(require("react"));
|
|
1868
1887
|
var import_react15 = require("react");
|
|
1869
|
-
var
|
|
1870
|
-
var
|
|
1871
|
-
var ColorField = ({ value, onChange }) => {
|
|
1888
|
+
var import_ui25 = require("@elementor/ui");
|
|
1889
|
+
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
1872
1890
|
const [color, setColor] = (0, import_react15.useState)(value);
|
|
1873
1891
|
const [errorMessage, setErrorMessage] = (0, import_react15.useState)("");
|
|
1874
1892
|
const defaultRef = (0, import_react15.useRef)(null);
|
|
@@ -1877,16 +1895,17 @@ var ColorField = ({ value, onChange }) => {
|
|
|
1877
1895
|
setColor(newValue);
|
|
1878
1896
|
const errorMsg = validateValue(newValue);
|
|
1879
1897
|
setErrorMessage(errorMsg);
|
|
1898
|
+
onValidationChange?.(errorMsg);
|
|
1880
1899
|
onChange(errorMsg ? "" : newValue);
|
|
1881
1900
|
};
|
|
1882
|
-
return /* @__PURE__ */
|
|
1883
|
-
|
|
1901
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1902
|
+
import_ui25.UnstableColorField,
|
|
1884
1903
|
{
|
|
1885
1904
|
size: "tiny",
|
|
1886
1905
|
fullWidth: true,
|
|
1887
1906
|
value: color,
|
|
1888
1907
|
onChange: handleChange,
|
|
1889
|
-
error: errorMessage
|
|
1908
|
+
error: errorMessage || void 0,
|
|
1890
1909
|
slotProps: {
|
|
1891
1910
|
colorPicker: {
|
|
1892
1911
|
anchorEl: anchorRef,
|
|
@@ -1895,26 +1914,25 @@ var ColorField = ({ value, onChange }) => {
|
|
|
1895
1914
|
}
|
|
1896
1915
|
}
|
|
1897
1916
|
}
|
|
1898
|
-
)
|
|
1917
|
+
);
|
|
1899
1918
|
};
|
|
1900
1919
|
|
|
1901
1920
|
// src/components/fields/font-field.tsx
|
|
1902
|
-
var
|
|
1921
|
+
var React28 = __toESM(require("react"));
|
|
1903
1922
|
var import_react16 = require("react");
|
|
1904
1923
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
1905
1924
|
var import_editor_editing_panel9 = require("@elementor/editor-editing-panel");
|
|
1906
1925
|
var import_icons13 = require("@elementor/icons");
|
|
1907
|
-
var
|
|
1908
|
-
var
|
|
1909
|
-
var FontField = ({ value, onChange }) => {
|
|
1926
|
+
var import_ui26 = require("@elementor/ui");
|
|
1927
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
1928
|
+
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
1910
1929
|
const [fontFamily, setFontFamily] = (0, import_react16.useState)(value);
|
|
1911
|
-
const [errorMessage, setErrorMessage] = (0, import_react16.useState)("");
|
|
1912
1930
|
const defaultRef = (0, import_react16.useRef)(null);
|
|
1913
1931
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
1914
|
-
const fontPopoverState = (0,
|
|
1932
|
+
const fontPopoverState = (0, import_ui26.usePopupState)({ variant: "popover" });
|
|
1915
1933
|
const fontFamilies = (0, import_editor_editing_panel9.useFontFamilies)();
|
|
1916
1934
|
const sectionWidth = (0, import_editor_editing_panel9.useSectionWidth)();
|
|
1917
|
-
const mapFontSubs =
|
|
1935
|
+
const mapFontSubs = React28.useMemo(() => {
|
|
1918
1936
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
1919
1937
|
label,
|
|
1920
1938
|
items: fonts
|
|
@@ -1923,33 +1941,35 @@ var FontField = ({ value, onChange }) => {
|
|
|
1923
1941
|
const handleChange = (newValue) => {
|
|
1924
1942
|
setFontFamily(newValue);
|
|
1925
1943
|
const errorMsg = validateValue(newValue);
|
|
1926
|
-
|
|
1944
|
+
onValidationChange?.(errorMsg);
|
|
1927
1945
|
onChange(errorMsg ? "" : newValue);
|
|
1928
1946
|
};
|
|
1929
1947
|
const handleFontFamilyChange = (newFontFamily) => {
|
|
1930
1948
|
handleChange(newFontFamily);
|
|
1931
1949
|
fontPopoverState.close();
|
|
1932
1950
|
};
|
|
1933
|
-
|
|
1934
|
-
|
|
1951
|
+
const id2 = (0, import_react16.useId)();
|
|
1952
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(
|
|
1953
|
+
import_ui26.UnstableTag,
|
|
1935
1954
|
{
|
|
1955
|
+
id: id2,
|
|
1936
1956
|
variant: "outlined",
|
|
1937
1957
|
label: fontFamily,
|
|
1938
|
-
endIcon: /* @__PURE__ */
|
|
1939
|
-
...(0,
|
|
1958
|
+
endIcon: /* @__PURE__ */ React28.createElement(import_icons13.ChevronDownIcon, { fontSize: "tiny" }),
|
|
1959
|
+
...(0, import_ui26.bindTrigger)(fontPopoverState),
|
|
1940
1960
|
fullWidth: true
|
|
1941
1961
|
}
|
|
1942
|
-
), /* @__PURE__ */
|
|
1943
|
-
|
|
1962
|
+
), /* @__PURE__ */ React28.createElement(
|
|
1963
|
+
import_ui26.Popover,
|
|
1944
1964
|
{
|
|
1945
1965
|
disablePortal: true,
|
|
1946
1966
|
disableScrollLock: true,
|
|
1947
1967
|
anchorEl: anchorRef,
|
|
1948
1968
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
1949
1969
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
1950
|
-
...(0,
|
|
1970
|
+
...(0, import_ui26.bindPopover)(fontPopoverState)
|
|
1951
1971
|
},
|
|
1952
|
-
/* @__PURE__ */
|
|
1972
|
+
/* @__PURE__ */ React28.createElement(
|
|
1953
1973
|
import_editor_controls11.ItemSelector,
|
|
1954
1974
|
{
|
|
1955
1975
|
itemsList: mapFontSubs,
|
|
@@ -1957,13 +1977,13 @@ var FontField = ({ value, onChange }) => {
|
|
|
1957
1977
|
onItemChange: handleFontFamilyChange,
|
|
1958
1978
|
onClose: fontPopoverState.close,
|
|
1959
1979
|
sectionWidth,
|
|
1960
|
-
title: (0,
|
|
1980
|
+
title: (0, import_i18n21.__)("Font Family", "elementor"),
|
|
1961
1981
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
1962
1982
|
onDebounce: import_editor_controls11.enqueueFont,
|
|
1963
1983
|
icon: import_icons13.TextIcon
|
|
1964
1984
|
}
|
|
1965
1985
|
)
|
|
1966
|
-
)
|
|
1986
|
+
));
|
|
1967
1987
|
};
|
|
1968
1988
|
|
|
1969
1989
|
// src/register-variable-types.tsx
|
|
@@ -1974,7 +1994,7 @@ function registerVariableTypes() {
|
|
|
1974
1994
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
1975
1995
|
fallbackPropTypeUtil: import_editor_props3.colorPropTypeUtil,
|
|
1976
1996
|
variableType: "color",
|
|
1977
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
1997
|
+
startIcon: ({ value }) => /* @__PURE__ */ React29.createElement(ColorIndicator, { size: "inherit", component: "span", value })
|
|
1978
1998
|
});
|
|
1979
1999
|
registerVariableType({
|
|
1980
2000
|
valueField: FontField,
|
|
@@ -1986,10 +2006,10 @@ function registerVariableTypes() {
|
|
|
1986
2006
|
}
|
|
1987
2007
|
|
|
1988
2008
|
// src/renderers/style-variables-renderer.tsx
|
|
1989
|
-
var
|
|
2009
|
+
var React30 = __toESM(require("react"));
|
|
1990
2010
|
var import_react17 = require("react");
|
|
1991
2011
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
1992
|
-
var
|
|
2012
|
+
var import_ui27 = require("@elementor/ui");
|
|
1993
2013
|
|
|
1994
2014
|
// src/sync/get-canvas-iframe-document.ts
|
|
1995
2015
|
function getCanvasIframeDocument() {
|
|
@@ -2008,7 +2028,7 @@ function StyleVariablesRenderer() {
|
|
|
2008
2028
|
}
|
|
2009
2029
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
2010
2030
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
2011
|
-
return /* @__PURE__ */
|
|
2031
|
+
return /* @__PURE__ */ React30.createElement(import_ui27.Portal, { container }, /* @__PURE__ */ React30.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
2012
2032
|
}
|
|
2013
2033
|
function usePortalContainer() {
|
|
2014
2034
|
return (0, import_editor_v1_adapters3.__privateUseListenTo)((0, import_editor_v1_adapters3.commandEndEvent)("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
@@ -2038,22 +2058,22 @@ var import_editor_controls12 = require("@elementor/editor-controls");
|
|
|
2038
2058
|
var import_editor_props4 = require("@elementor/editor-props");
|
|
2039
2059
|
|
|
2040
2060
|
// src/components/variables-repeater-item-slot.tsx
|
|
2041
|
-
var
|
|
2061
|
+
var React31 = __toESM(require("react"));
|
|
2042
2062
|
var useColorVariable = (value) => {
|
|
2043
2063
|
const variableId = value?.value?.color?.value;
|
|
2044
2064
|
return useVariable(variableId || "");
|
|
2045
2065
|
};
|
|
2046
2066
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
2047
2067
|
const colorVariable = useColorVariable(value);
|
|
2048
|
-
return /* @__PURE__ */
|
|
2068
|
+
return /* @__PURE__ */ React31.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
2049
2069
|
};
|
|
2050
2070
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
2051
2071
|
const colorVariable = useColorVariable(value);
|
|
2052
|
-
return /* @__PURE__ */
|
|
2072
|
+
return /* @__PURE__ */ React31.createElement("span", null, colorVariable?.label);
|
|
2053
2073
|
};
|
|
2054
2074
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
2055
2075
|
const colorVariable = useColorVariable(value);
|
|
2056
|
-
return /* @__PURE__ */
|
|
2076
|
+
return /* @__PURE__ */ React31.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
2057
2077
|
};
|
|
2058
2078
|
|
|
2059
2079
|
// src/repeater-injections.ts
|