@elementor/editor-variables 3.32.0-66 → 3.32.0-68
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 +330 -257
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +333 -261
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/fields/color-field.tsx +8 -0
- package/src/components/fields/label-field.tsx +28 -25
- package/src/components/variable-creation.tsx +33 -17
- package/src/components/variable-edit.tsx +33 -17
- package/src/components/variable-restore.tsx +33 -17
- package/src/components/variables-manager/variable-editable-cell.tsx +0 -3
- package/src/components/variables-manager/variable-table-cell.tsx +1 -0
- package/src/components/variables-manager/variables-manager-panel.tsx +15 -13
- package/src/components/variables-manager/variables-manager-table.tsx +14 -9
package/dist/index.js
CHANGED
|
@@ -41,14 +41,14 @@ var import_editor_editing_panel11 = require("@elementor/editor-editing-panel");
|
|
|
41
41
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
42
42
|
|
|
43
43
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
44
|
-
var
|
|
45
|
-
var
|
|
44
|
+
var React8 = __toESM(require("react"));
|
|
45
|
+
var import_react7 = require("react");
|
|
46
46
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
47
47
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
48
48
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
49
49
|
var import_icons3 = require("@elementor/icons");
|
|
50
|
-
var
|
|
51
|
-
var
|
|
50
|
+
var import_ui8 = require("@elementor/ui");
|
|
51
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
52
52
|
|
|
53
53
|
// src/hooks/use-prop-variables.ts
|
|
54
54
|
var import_react2 = require("react");
|
|
@@ -550,24 +550,129 @@ var restoreVariable = (restoreId, label, value) => {
|
|
|
550
550
|
};
|
|
551
551
|
|
|
552
552
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
553
|
-
var
|
|
554
|
-
var
|
|
553
|
+
var React7 = __toESM(require("react"));
|
|
554
|
+
var import_react6 = require("react");
|
|
555
555
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
556
556
|
var import_icons2 = require("@elementor/icons");
|
|
557
|
-
var
|
|
558
|
-
var
|
|
557
|
+
var import_ui7 = require("@elementor/ui");
|
|
558
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
559
559
|
|
|
560
|
-
// src/components/
|
|
560
|
+
// src/components/fields/label-field.tsx
|
|
561
561
|
var React3 = __toESM(require("react"));
|
|
562
562
|
var import_react3 = require("react");
|
|
563
|
-
var import_icons = require("@elementor/icons");
|
|
564
563
|
var import_ui3 = require("@elementor/ui");
|
|
564
|
+
|
|
565
|
+
// src/utils/validations.ts
|
|
566
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
567
|
+
var ERROR_MESSAGES = {
|
|
568
|
+
MISSING_VARIABLE_NAME: (0, import_i18n3.__)("Give your variable a name.", "elementor"),
|
|
569
|
+
MISSING_VARIABLE_VALUE: (0, import_i18n3.__)("Add a value to complete your variable.", "elementor"),
|
|
570
|
+
INVALID_CHARACTERS: (0, import_i18n3.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
571
|
+
NO_NON_SPECIAL_CHARACTER: (0, import_i18n3.__)("Names have to include at least one non-special character.", "elementor"),
|
|
572
|
+
VARIABLE_LABEL_MAX_LENGTH: (0, import_i18n3.__)("Keep names up to 50 characters.", "elementor"),
|
|
573
|
+
DUPLICATED_LABEL: (0, import_i18n3.__)("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
574
|
+
UNEXPECTED_ERROR: (0, import_i18n3.__)("There was a glitch. Try saving your variable again.", "elementor")
|
|
575
|
+
};
|
|
576
|
+
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
577
|
+
var mapServerError = (error) => {
|
|
578
|
+
if (error?.response?.data?.code === "duplicated_label") {
|
|
579
|
+
return {
|
|
580
|
+
field: "label",
|
|
581
|
+
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
return void 0;
|
|
585
|
+
};
|
|
586
|
+
var validateLabel = (name) => {
|
|
587
|
+
if (!name.trim()) {
|
|
588
|
+
return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
|
|
589
|
+
}
|
|
590
|
+
const allowedChars = /^[a-zA-Z0-9_-]+$/;
|
|
591
|
+
if (!allowedChars.test(name)) {
|
|
592
|
+
return ERROR_MESSAGES.INVALID_CHARACTERS;
|
|
593
|
+
}
|
|
594
|
+
const hasAlphanumeric = /[a-zA-Z0-9]/;
|
|
595
|
+
if (!hasAlphanumeric.test(name)) {
|
|
596
|
+
return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
|
|
597
|
+
}
|
|
598
|
+
if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
|
|
599
|
+
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
600
|
+
}
|
|
601
|
+
return "";
|
|
602
|
+
};
|
|
603
|
+
var labelHint = (name) => {
|
|
604
|
+
const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
|
|
605
|
+
if (hintThreshold < name.length) {
|
|
606
|
+
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
607
|
+
}
|
|
608
|
+
return "";
|
|
609
|
+
};
|
|
610
|
+
var validateValue = (value) => {
|
|
611
|
+
if (!value.trim()) {
|
|
612
|
+
return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
|
|
613
|
+
}
|
|
614
|
+
return "";
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// src/components/fields/label-field.tsx
|
|
618
|
+
function isLabelEqual(a, b) {
|
|
619
|
+
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
620
|
+
}
|
|
621
|
+
var useLabelError = (initialError) => {
|
|
622
|
+
const [error, setError] = (0, import_react3.useState)(initialError ?? { value: "", message: "" });
|
|
623
|
+
return {
|
|
624
|
+
labelFieldError: error,
|
|
625
|
+
setLabelFieldError: setError
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
var LabelField = ({
|
|
629
|
+
value,
|
|
630
|
+
error,
|
|
631
|
+
onChange,
|
|
632
|
+
id: id2,
|
|
633
|
+
onErrorChange,
|
|
634
|
+
size = "tiny",
|
|
635
|
+
focusOnShow = false
|
|
636
|
+
}) => {
|
|
637
|
+
const [label, setLabel] = (0, import_react3.useState)(value);
|
|
638
|
+
const [errorMessage, setErrorMessage] = (0, import_react3.useState)("");
|
|
639
|
+
const handleChange = (newValue) => {
|
|
640
|
+
setLabel(newValue);
|
|
641
|
+
const errorMsg2 = validateLabel(newValue);
|
|
642
|
+
setErrorMessage(errorMsg2);
|
|
643
|
+
onErrorChange?.(errorMsg2);
|
|
644
|
+
onChange(isLabelEqual(newValue, error?.value ?? "") || errorMsg2 ? "" : newValue);
|
|
645
|
+
};
|
|
646
|
+
let errorMsg = errorMessage;
|
|
647
|
+
if (isLabelEqual(label, error?.value ?? "") && error?.message) {
|
|
648
|
+
errorMsg = error.message;
|
|
649
|
+
}
|
|
650
|
+
return /* @__PURE__ */ React3.createElement(
|
|
651
|
+
import_ui3.TextField,
|
|
652
|
+
{
|
|
653
|
+
id: id2,
|
|
654
|
+
size,
|
|
655
|
+
fullWidth: true,
|
|
656
|
+
value: label,
|
|
657
|
+
error: !!errorMsg,
|
|
658
|
+
onChange: (e) => handleChange(e.target.value),
|
|
659
|
+
inputProps: { maxLength: VARIABLE_LABEL_MAX_LENGTH },
|
|
660
|
+
autoFocus: focusOnShow
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
// src/components/variables-manager/variable-edit-menu.tsx
|
|
666
|
+
var React4 = __toESM(require("react"));
|
|
667
|
+
var import_react4 = require("react");
|
|
668
|
+
var import_icons = require("@elementor/icons");
|
|
669
|
+
var import_ui4 = require("@elementor/ui");
|
|
565
670
|
var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
566
|
-
const menuState = (0,
|
|
671
|
+
const menuState = (0, import_ui4.usePopupState)({
|
|
567
672
|
variant: "popover"
|
|
568
673
|
});
|
|
569
|
-
return /* @__PURE__ */
|
|
570
|
-
|
|
674
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(import_ui4.IconButton, { ...(0, import_ui4.bindTrigger)(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React4.createElement(import_icons.DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React4.createElement(
|
|
675
|
+
import_ui4.Menu,
|
|
571
676
|
{
|
|
572
677
|
disablePortal: true,
|
|
573
678
|
MenuListProps: {
|
|
@@ -576,7 +681,7 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
576
681
|
PaperProps: {
|
|
577
682
|
elevation: 6
|
|
578
683
|
},
|
|
579
|
-
...(0,
|
|
684
|
+
...(0, import_ui4.bindMenu)(menuState),
|
|
580
685
|
anchorEl: menuState.anchorEl,
|
|
581
686
|
anchorOrigin: {
|
|
582
687
|
vertical: "bottom",
|
|
@@ -589,8 +694,8 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
589
694
|
open: menuState.isOpen,
|
|
590
695
|
onClose: menuState.close
|
|
591
696
|
},
|
|
592
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
593
|
-
|
|
697
|
+
menuActions.map((action) => /* @__PURE__ */ React4.createElement(
|
|
698
|
+
import_ui4.MenuItem,
|
|
594
699
|
{
|
|
595
700
|
key: action.name,
|
|
596
701
|
onClick: () => {
|
|
@@ -602,7 +707,7 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
602
707
|
gap: 1
|
|
603
708
|
}
|
|
604
709
|
},
|
|
605
|
-
action.icon && (0,
|
|
710
|
+
action.icon && (0, import_react4.createElement)(action.icon, {
|
|
606
711
|
fontSize: "inherit"
|
|
607
712
|
}),
|
|
608
713
|
" ",
|
|
@@ -612,19 +717,18 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
612
717
|
};
|
|
613
718
|
|
|
614
719
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
615
|
-
var
|
|
616
|
-
var
|
|
617
|
-
var
|
|
720
|
+
var React5 = __toESM(require("react"));
|
|
721
|
+
var import_react5 = require("react");
|
|
722
|
+
var import_ui5 = require("@elementor/ui");
|
|
618
723
|
var VariableEditableCell = ({
|
|
619
724
|
initialValue,
|
|
620
725
|
children,
|
|
621
726
|
editableElement,
|
|
622
727
|
onSave,
|
|
623
|
-
prefixElement
|
|
624
|
-
disableCloseOnBlur
|
|
728
|
+
prefixElement
|
|
625
729
|
}) => {
|
|
626
|
-
const [value, setValue] = (0,
|
|
627
|
-
const [isEditing, setIsEditing] = (0,
|
|
730
|
+
const [value, setValue] = (0, import_react5.useState)(initialValue);
|
|
731
|
+
const [isEditing, setIsEditing] = (0, import_react5.useState)(false);
|
|
628
732
|
const handleDoubleClick = () => {
|
|
629
733
|
setIsEditing(true);
|
|
630
734
|
};
|
|
@@ -647,14 +751,13 @@ var VariableEditableCell = ({
|
|
|
647
751
|
setValue(newValue);
|
|
648
752
|
};
|
|
649
753
|
const editableContent = editableElement({ value, onChange: handleChange });
|
|
650
|
-
return /* @__PURE__ */
|
|
651
|
-
|
|
754
|
+
return /* @__PURE__ */ React5.createElement(import_ui5.ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React5.createElement(
|
|
755
|
+
import_ui5.Stack,
|
|
652
756
|
{
|
|
653
757
|
direction: "row",
|
|
654
758
|
alignItems: "center",
|
|
655
759
|
gap: 1,
|
|
656
760
|
onDoubleClick: handleDoubleClick,
|
|
657
|
-
onBlur: disableCloseOnBlur ? void 0 : handleSave,
|
|
658
761
|
onKeyDown: handleKeyDown,
|
|
659
762
|
tabIndex: 0,
|
|
660
763
|
role: "button",
|
|
@@ -666,8 +769,8 @@ var VariableEditableCell = ({
|
|
|
666
769
|
};
|
|
667
770
|
|
|
668
771
|
// src/components/variables-manager/variable-table-cell.tsx
|
|
669
|
-
var
|
|
670
|
-
var
|
|
772
|
+
var React6 = __toESM(require("react"));
|
|
773
|
+
var import_ui6 = require("@elementor/ui");
|
|
671
774
|
var VariableTableCell = ({
|
|
672
775
|
children,
|
|
673
776
|
isHeader,
|
|
@@ -682,15 +785,16 @@ var VariableTableCell = ({
|
|
|
682
785
|
cursor: "initial",
|
|
683
786
|
typography: "caption",
|
|
684
787
|
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
788
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
685
789
|
...width && { width },
|
|
686
790
|
...sx
|
|
687
791
|
};
|
|
688
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ React6.createElement(import_ui6.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
689
793
|
};
|
|
690
794
|
|
|
691
795
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
692
796
|
var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
693
|
-
const [ids, setIds] = (0,
|
|
797
|
+
const [ids, setIds] = (0, import_react6.useState)(Object.keys(variables));
|
|
694
798
|
const rows = ids.map((id2) => {
|
|
695
799
|
const variable = variables[id2];
|
|
696
800
|
const variableType = getVariableType(variable.type);
|
|
@@ -706,17 +810,17 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
706
810
|
minWidth: 250,
|
|
707
811
|
tableLayout: "fixed"
|
|
708
812
|
};
|
|
709
|
-
return /* @__PURE__ */
|
|
710
|
-
|
|
813
|
+
return /* @__PURE__ */ React7.createElement(import_ui7.TableContainer, { sx: { overflow: "initial" } }, /* @__PURE__ */ React7.createElement(import_ui7.Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React7.createElement(import_ui7.TableHead, null, /* @__PURE__ */ React7.createElement(import_ui7.TableRow, null, /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n4.__)("Name", "elementor")), /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n4.__)("Value", "elementor")), /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React7.createElement(import_ui7.TableBody, null, /* @__PURE__ */ React7.createElement(
|
|
814
|
+
import_ui7.UnstableSortableProvider,
|
|
711
815
|
{
|
|
712
816
|
value: ids,
|
|
713
817
|
onChange: setIds,
|
|
714
818
|
variant: "static",
|
|
715
819
|
restrictAxis: true,
|
|
716
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
820
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React7.createElement(import_ui7.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React7.createElement(import_ui7.TableBody, null, dragOverlayChildren))
|
|
717
821
|
},
|
|
718
|
-
rows.map((row) => /* @__PURE__ */
|
|
719
|
-
|
|
822
|
+
rows.map((row) => /* @__PURE__ */ React7.createElement(
|
|
823
|
+
import_ui7.UnstableSortableItem,
|
|
720
824
|
{
|
|
721
825
|
key: row.id,
|
|
722
826
|
id: row.id,
|
|
@@ -735,8 +839,8 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
735
839
|
}) => {
|
|
736
840
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
737
841
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
738
|
-
return /* @__PURE__ */
|
|
739
|
-
|
|
842
|
+
return /* @__PURE__ */ React7.createElement(
|
|
843
|
+
import_ui7.TableRow,
|
|
740
844
|
{
|
|
741
845
|
...itemProps,
|
|
742
846
|
selected: isDragged,
|
|
@@ -766,8 +870,8 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
766
870
|
style: { ...itemStyle, ...triggerStyle },
|
|
767
871
|
disableDivider: isDragOverlay || index === rows.length - 1
|
|
768
872
|
},
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
|
|
873
|
+
/* @__PURE__ */ React7.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React7.createElement(
|
|
874
|
+
import_ui7.IconButton,
|
|
771
875
|
{
|
|
772
876
|
size: "small",
|
|
773
877
|
ref: setTriggerRef,
|
|
@@ -775,39 +879,54 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
775
879
|
disabled: isSorting,
|
|
776
880
|
draggable: true
|
|
777
881
|
},
|
|
778
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ React7.createElement(import_icons2.GripVerticalIcon, { fontSize: "inherit" })
|
|
779
883
|
)),
|
|
780
|
-
/* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ React7.createElement(VariableTableCell, null, /* @__PURE__ */ React7.createElement(
|
|
781
885
|
VariableEditableCell,
|
|
782
886
|
{
|
|
783
887
|
initialValue: row.name,
|
|
784
888
|
onSave: () => {
|
|
785
889
|
},
|
|
786
|
-
prefixElement: (0,
|
|
787
|
-
editableElement: ({ value, onChange }) => /* @__PURE__ */
|
|
788
|
-
|
|
890
|
+
prefixElement: (0, import_react6.createElement)(row.icon, { fontSize: "inherit" }),
|
|
891
|
+
editableElement: ({ value, onChange }) => /* @__PURE__ */ React7.createElement(
|
|
892
|
+
LabelField,
|
|
789
893
|
{
|
|
894
|
+
id: "variable-label-" + row.id,
|
|
790
895
|
size: "tiny",
|
|
791
896
|
value,
|
|
792
|
-
onChange
|
|
897
|
+
onChange,
|
|
898
|
+
focusOnShow: true
|
|
793
899
|
}
|
|
794
900
|
)
|
|
795
901
|
},
|
|
796
|
-
/* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ React7.createElement(
|
|
903
|
+
import_editor_ui.EllipsisWithTooltip,
|
|
904
|
+
{
|
|
905
|
+
title: row.name,
|
|
906
|
+
sx: { border: "4px solid transparent" }
|
|
907
|
+
},
|
|
908
|
+
row.name
|
|
909
|
+
)
|
|
797
910
|
)),
|
|
798
|
-
/* @__PURE__ */
|
|
911
|
+
/* @__PURE__ */ React7.createElement(VariableTableCell, null, /* @__PURE__ */ React7.createElement(
|
|
799
912
|
VariableEditableCell,
|
|
800
913
|
{
|
|
801
914
|
initialValue: row.value,
|
|
802
915
|
onSave: () => {
|
|
803
916
|
},
|
|
804
|
-
editableElement: row.valueField
|
|
805
|
-
disableCloseOnBlur: true
|
|
917
|
+
editableElement: row.valueField
|
|
806
918
|
},
|
|
807
919
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
808
|
-
/* @__PURE__ */
|
|
920
|
+
/* @__PURE__ */ React7.createElement(
|
|
921
|
+
import_editor_ui.EllipsisWithTooltip,
|
|
922
|
+
{
|
|
923
|
+
title: row.value,
|
|
924
|
+
sx: { border: "4px solid transparent" }
|
|
925
|
+
},
|
|
926
|
+
row.value
|
|
927
|
+
)
|
|
809
928
|
)),
|
|
810
|
-
/* @__PURE__ */
|
|
929
|
+
/* @__PURE__ */ React7.createElement(
|
|
811
930
|
VariableTableCell,
|
|
812
931
|
{
|
|
813
932
|
align: "right",
|
|
@@ -816,7 +935,7 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
816
935
|
maxWidth: 16,
|
|
817
936
|
sx: { paddingInlineEnd: 1 }
|
|
818
937
|
},
|
|
819
|
-
/* @__PURE__ */
|
|
938
|
+
/* @__PURE__ */ React7.createElement(import_ui7.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React7.createElement(
|
|
820
939
|
VariableEditMenu,
|
|
821
940
|
{
|
|
822
941
|
menuActions,
|
|
@@ -851,14 +970,14 @@ function VariablesManagerPanel() {
|
|
|
851
970
|
usePreventUnload(isDirty);
|
|
852
971
|
const menuActions = [
|
|
853
972
|
{
|
|
854
|
-
name: (0,
|
|
973
|
+
name: (0, import_i18n5.__)("Delete", "elementor"),
|
|
855
974
|
icon: import_icons3.TrashIcon,
|
|
856
975
|
color: "error.main",
|
|
857
976
|
onClick: () => {
|
|
858
977
|
}
|
|
859
978
|
}
|
|
860
979
|
];
|
|
861
|
-
return /* @__PURE__ */
|
|
980
|
+
return /* @__PURE__ */ React8.createElement(import_editor_ui2.ThemeProvider, null, /* @__PURE__ */ React8.createElement(import_ui8.ErrorBoundary, { fallback: /* @__PURE__ */ React8.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React8.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React8.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React8.createElement(import_ui8.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React8.createElement(import_ui8.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React8.createElement(import_ui8.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React8.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React8.createElement(import_icons3.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n5.__)("Variable Manager", "elementor"))), /* @__PURE__ */ React8.createElement(
|
|
862
981
|
CloseButton,
|
|
863
982
|
{
|
|
864
983
|
sx: { marginLeft: "auto" },
|
|
@@ -866,7 +985,7 @@ function VariablesManagerPanel() {
|
|
|
866
985
|
closePanel();
|
|
867
986
|
}
|
|
868
987
|
}
|
|
869
|
-
))), /* @__PURE__ */
|
|
988
|
+
)), /* @__PURE__ */ React8.createElement(import_ui8.Divider, { sx: { width: "100%" } }))), /* @__PURE__ */ React8.createElement(
|
|
870
989
|
import_editor_panels.PanelBody,
|
|
871
990
|
{
|
|
872
991
|
sx: {
|
|
@@ -875,14 +994,13 @@ function VariablesManagerPanel() {
|
|
|
875
994
|
height: "100%"
|
|
876
995
|
}
|
|
877
996
|
},
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
|
|
880
|
-
), /* @__PURE__ */ React7.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React7.createElement(import_ui7.Button, { fullWidth: true, size: "small", color: "global", variant: "contained", disabled: !isDirty }, (0, import_i18n4.__)("Save changes", "elementor"))))));
|
|
997
|
+
/* @__PURE__ */ React8.createElement(VariablesManagerTable, { menuActions, variables })
|
|
998
|
+
), /* @__PURE__ */ React8.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React8.createElement(import_ui8.Button, { fullWidth: true, size: "small", color: "global", variant: "contained", disabled: !isDirty }, (0, import_i18n5.__)("Save changes", "elementor"))))));
|
|
881
999
|
}
|
|
882
|
-
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */
|
|
883
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
1000
|
+
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React8.createElement(import_ui8.IconButton, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React8.createElement(import_icons3.XIcon, { fontSize: "small" }));
|
|
1001
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React8.createElement(import_ui8.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React8.createElement(import_ui8.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React8.createElement("strong", null, (0, import_i18n5.__)("Something went wrong", "elementor"))));
|
|
884
1002
|
var usePreventUnload = (isDirty) => {
|
|
885
|
-
(0,
|
|
1003
|
+
(0, import_react7.useEffect)(() => {
|
|
886
1004
|
const handleBeforeUnload = (event) => {
|
|
887
1005
|
if (isDirty) {
|
|
888
1006
|
event.preventDefault();
|
|
@@ -928,16 +1046,16 @@ var import_react13 = require("react");
|
|
|
928
1046
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
929
1047
|
|
|
930
1048
|
// src/context/variable-selection-popover.context.tsx
|
|
931
|
-
var
|
|
932
|
-
var
|
|
933
|
-
var
|
|
934
|
-
var PopoverContentRefContext = (0,
|
|
1049
|
+
var React9 = __toESM(require("react"));
|
|
1050
|
+
var import_react8 = require("react");
|
|
1051
|
+
var import_ui9 = require("@elementor/ui");
|
|
1052
|
+
var PopoverContentRefContext = (0, import_react8.createContext)(null);
|
|
935
1053
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
936
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
937
|
-
return /* @__PURE__ */
|
|
1054
|
+
const [anchorRef, setAnchorRef] = (0, import_react8.useState)(null);
|
|
1055
|
+
return /* @__PURE__ */ React9.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React9.createElement(import_ui9.Box, { ref: setAnchorRef }, children));
|
|
938
1056
|
};
|
|
939
1057
|
var usePopoverContentRef = () => {
|
|
940
|
-
return (0,
|
|
1058
|
+
return (0, import_react8.useContext)(PopoverContentRefContext);
|
|
941
1059
|
};
|
|
942
1060
|
|
|
943
1061
|
// src/hooks/use-permissions.ts
|
|
@@ -963,7 +1081,7 @@ var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
|
963
1081
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
964
1082
|
var import_icons4 = require("@elementor/icons");
|
|
965
1083
|
var import_ui11 = require("@elementor/ui");
|
|
966
|
-
var
|
|
1084
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
967
1085
|
|
|
968
1086
|
// src/hooks/use-initial-value.ts
|
|
969
1087
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -995,112 +1113,11 @@ var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
|
995
1113
|
});
|
|
996
1114
|
};
|
|
997
1115
|
|
|
998
|
-
// src/
|
|
999
|
-
var import_i18n5 = require("@wordpress/i18n");
|
|
1000
|
-
var ERROR_MESSAGES = {
|
|
1001
|
-
MISSING_VARIABLE_NAME: (0, import_i18n5.__)("Give your variable a name.", "elementor"),
|
|
1002
|
-
MISSING_VARIABLE_VALUE: (0, import_i18n5.__)("Add a value to complete your variable.", "elementor"),
|
|
1003
|
-
INVALID_CHARACTERS: (0, import_i18n5.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
1004
|
-
NO_NON_SPECIAL_CHARACTER: (0, import_i18n5.__)("Names have to include at least one non-special character.", "elementor"),
|
|
1005
|
-
VARIABLE_LABEL_MAX_LENGTH: (0, import_i18n5.__)("Keep names up to 50 characters.", "elementor"),
|
|
1006
|
-
DUPLICATED_LABEL: (0, import_i18n5.__)("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
1007
|
-
UNEXPECTED_ERROR: (0, import_i18n5.__)("There was a glitch. Try saving your variable again.", "elementor")
|
|
1008
|
-
};
|
|
1009
|
-
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
1010
|
-
var mapServerError = (error) => {
|
|
1011
|
-
if (error?.response?.data?.code === "duplicated_label") {
|
|
1012
|
-
return {
|
|
1013
|
-
field: "label",
|
|
1014
|
-
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
return void 0;
|
|
1018
|
-
};
|
|
1019
|
-
var validateLabel = (name) => {
|
|
1020
|
-
if (!name.trim()) {
|
|
1021
|
-
return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
|
|
1022
|
-
}
|
|
1023
|
-
const allowedChars = /^[a-zA-Z0-9_-]+$/;
|
|
1024
|
-
if (!allowedChars.test(name)) {
|
|
1025
|
-
return ERROR_MESSAGES.INVALID_CHARACTERS;
|
|
1026
|
-
}
|
|
1027
|
-
const hasAlphanumeric = /[a-zA-Z0-9]/;
|
|
1028
|
-
if (!hasAlphanumeric.test(name)) {
|
|
1029
|
-
return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
|
|
1030
|
-
}
|
|
1031
|
-
if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
|
|
1032
|
-
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
1033
|
-
}
|
|
1034
|
-
return "";
|
|
1035
|
-
};
|
|
1036
|
-
var labelHint = (name) => {
|
|
1037
|
-
const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
|
|
1038
|
-
if (hintThreshold < name.length) {
|
|
1039
|
-
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
1040
|
-
}
|
|
1041
|
-
return "";
|
|
1042
|
-
};
|
|
1043
|
-
var validateValue = (value) => {
|
|
1044
|
-
if (!value.trim()) {
|
|
1045
|
-
return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
|
|
1046
|
-
}
|
|
1047
|
-
return "";
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
// src/components/fields/label-field.tsx
|
|
1116
|
+
// src/components/ui/form-field.tsx
|
|
1051
1117
|
var React10 = __toESM(require("react"));
|
|
1052
|
-
var import_react8 = require("react");
|
|
1053
1118
|
var import_ui10 = require("@elementor/ui");
|
|
1054
|
-
var import_i18n6 = require("@wordpress/i18n");
|
|
1055
|
-
|
|
1056
|
-
// src/components/ui/form-field.tsx
|
|
1057
|
-
var React9 = __toESM(require("react"));
|
|
1058
|
-
var import_ui9 = require("@elementor/ui");
|
|
1059
1119
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
1060
|
-
return /* @__PURE__ */
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
// src/components/fields/label-field.tsx
|
|
1064
|
-
function isLabelEqual(a, b) {
|
|
1065
|
-
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1066
|
-
}
|
|
1067
|
-
var useLabelError = (initialError) => {
|
|
1068
|
-
const [error, setError] = (0, import_react8.useState)(initialError ?? { value: "", message: "" });
|
|
1069
|
-
return {
|
|
1070
|
-
labelFieldError: error,
|
|
1071
|
-
setLabelFieldError: setError
|
|
1072
|
-
};
|
|
1073
|
-
};
|
|
1074
|
-
var LabelField = ({ value, error, onChange }) => {
|
|
1075
|
-
const [label, setLabel] = (0, import_react8.useState)(value);
|
|
1076
|
-
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
|
1077
|
-
const [noticeMessage, setNoticeMessage] = (0, import_react8.useState)(() => labelHint(value));
|
|
1078
|
-
const handleChange = (newValue) => {
|
|
1079
|
-
setLabel(newValue);
|
|
1080
|
-
const errorMsg2 = validateLabel(newValue);
|
|
1081
|
-
const hintMsg = labelHint(newValue);
|
|
1082
|
-
setErrorMessage(errorMsg2);
|
|
1083
|
-
setNoticeMessage(errorMsg2 ? "" : hintMsg);
|
|
1084
|
-
onChange(isLabelEqual(newValue, error?.value ?? "") || errorMsg2 ? "" : newValue);
|
|
1085
|
-
};
|
|
1086
|
-
const id2 = (0, import_react8.useId)();
|
|
1087
|
-
let errorMsg = errorMessage;
|
|
1088
|
-
if (isLabelEqual(label, error?.value ?? "") && error?.message) {
|
|
1089
|
-
errorMsg = error.message;
|
|
1090
|
-
}
|
|
1091
|
-
const noticeMsg = errorMsg ? "" : noticeMessage;
|
|
1092
|
-
return /* @__PURE__ */ React10.createElement(FormField, { id: id2, label: (0, import_i18n6.__)("Name", "elementor"), errorMsg, noticeMsg }, /* @__PURE__ */ React10.createElement(
|
|
1093
|
-
import_ui10.TextField,
|
|
1094
|
-
{
|
|
1095
|
-
id: id2,
|
|
1096
|
-
size: "tiny",
|
|
1097
|
-
fullWidth: true,
|
|
1098
|
-
value: label,
|
|
1099
|
-
error: !!errorMsg,
|
|
1100
|
-
onChange: (e) => handleChange(e.target.value),
|
|
1101
|
-
inputProps: { maxLength: VARIABLE_LABEL_MAX_LENGTH }
|
|
1102
|
-
}
|
|
1103
|
-
));
|
|
1120
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui10.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(import_ui10.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React10.createElement(import_ui10.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React10.createElement(import_ui10.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React10.createElement(import_ui10.FormHelperText, null, noticeMsg)));
|
|
1104
1121
|
};
|
|
1105
1122
|
|
|
1106
1123
|
// src/components/variable-creation.tsx
|
|
@@ -1167,21 +1184,37 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1167
1184
|
return /* @__PURE__ */ React11.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React11.createElement(
|
|
1168
1185
|
import_editor_ui3.PopoverHeader,
|
|
1169
1186
|
{
|
|
1170
|
-
icon: /* @__PURE__ */ React11.createElement(React11.Fragment, null, onGoBack && /* @__PURE__ */ React11.createElement(import_ui11.IconButton, { size: SIZE, "aria-label": (0,
|
|
1171
|
-
title: (0,
|
|
1187
|
+
icon: /* @__PURE__ */ React11.createElement(React11.Fragment, null, onGoBack && /* @__PURE__ */ React11.createElement(import_ui11.IconButton, { size: SIZE, "aria-label": (0, import_i18n6.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React11.createElement(import_icons4.ArrowLeftIcon, { fontSize: SIZE })), /* @__PURE__ */ React11.createElement(VariableIcon, { fontSize: SIZE })),
|
|
1188
|
+
title: (0, import_i18n6.__)("Create variable", "elementor"),
|
|
1172
1189
|
onClose: closePopover
|
|
1173
1190
|
}
|
|
1174
1191
|
), /* @__PURE__ */ React11.createElement(import_ui11.Divider, null), /* @__PURE__ */ React11.createElement(import_editor_controls3.PopoverContent, { p: 2 }, /* @__PURE__ */ React11.createElement(
|
|
1175
|
-
|
|
1192
|
+
FormField,
|
|
1176
1193
|
{
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1194
|
+
id: "variable-label",
|
|
1195
|
+
label: (0, import_i18n6.__)("Name", "elementor"),
|
|
1196
|
+
errorMsg: labelFieldError?.message,
|
|
1197
|
+
noticeMsg: labelHint(label)
|
|
1198
|
+
},
|
|
1199
|
+
/* @__PURE__ */ React11.createElement(
|
|
1200
|
+
LabelField,
|
|
1201
|
+
{
|
|
1202
|
+
id: "variable-label",
|
|
1203
|
+
value: label,
|
|
1204
|
+
error: labelFieldError,
|
|
1205
|
+
onChange: (newValue) => {
|
|
1206
|
+
setLabel(newValue);
|
|
1207
|
+
setErrorMessage("");
|
|
1208
|
+
},
|
|
1209
|
+
onErrorChange: (errorMsg) => {
|
|
1210
|
+
setLabelFieldError({
|
|
1211
|
+
value: label,
|
|
1212
|
+
message: errorMsg
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1182
1215
|
}
|
|
1183
|
-
|
|
1184
|
-
), /* @__PURE__ */ React11.createElement(FormField, { errorMsg: valueFieldError, label: (0,
|
|
1216
|
+
)
|
|
1217
|
+
), /* @__PURE__ */ React11.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n6.__)("Value", "elementor") }, /* @__PURE__ */ React11.createElement(import_ui11.Typography, { variant: "h5" }, /* @__PURE__ */ React11.createElement(
|
|
1185
1218
|
ValueField,
|
|
1186
1219
|
{
|
|
1187
1220
|
value,
|
|
@@ -1193,7 +1226,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1193
1226
|
onValidationChange: setValueFieldError,
|
|
1194
1227
|
propType
|
|
1195
1228
|
}
|
|
1196
|
-
)), errorMessage && /* @__PURE__ */ React11.createElement(import_ui11.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React11.createElement(import_ui11.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React11.createElement(import_ui11.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreateAndTrack }, (0,
|
|
1229
|
+
))), errorMessage && /* @__PURE__ */ React11.createElement(import_ui11.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React11.createElement(import_ui11.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React11.createElement(import_ui11.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreateAndTrack }, (0, import_i18n6.__)("Create", "elementor"))));
|
|
1197
1230
|
};
|
|
1198
1231
|
|
|
1199
1232
|
// src/components/variable-edit.tsx
|
|
@@ -1205,13 +1238,13 @@ var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
|
1205
1238
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1206
1239
|
var import_icons7 = require("@elementor/icons");
|
|
1207
1240
|
var import_ui14 = require("@elementor/ui");
|
|
1208
|
-
var
|
|
1241
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1209
1242
|
|
|
1210
1243
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
1211
1244
|
var React12 = __toESM(require("react"));
|
|
1212
1245
|
var import_icons5 = require("@elementor/icons");
|
|
1213
1246
|
var import_ui12 = require("@elementor/ui");
|
|
1214
|
-
var
|
|
1247
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
1215
1248
|
var TITLE_ID = "delete-variable-dialog";
|
|
1216
1249
|
var DeleteConfirmationDialog = ({
|
|
1217
1250
|
open,
|
|
@@ -1219,7 +1252,7 @@ var DeleteConfirmationDialog = ({
|
|
|
1219
1252
|
closeDialog,
|
|
1220
1253
|
onConfirm
|
|
1221
1254
|
}) => {
|
|
1222
|
-
return /* @__PURE__ */ React12.createElement(import_ui12.Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React12.createElement(import_ui12.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React12.createElement(import_icons5.AlertOctagonFilledIcon, { color: "error" }), (0,
|
|
1255
|
+
return /* @__PURE__ */ React12.createElement(import_ui12.Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React12.createElement(import_ui12.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React12.createElement(import_icons5.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n7.__)("Delete this variable?", "elementor")), /* @__PURE__ */ React12.createElement(import_ui12.DialogContent, null, /* @__PURE__ */ React12.createElement(import_ui12.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n7.__)("All elements using", "elementor"), /* @__PURE__ */ React12.createElement(import_ui12.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__ */ React12.createElement(import_ui12.DialogActions, null, /* @__PURE__ */ React12.createElement(import_ui12.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n7.__)("Not now", "elementor")), /* @__PURE__ */ React12.createElement(import_ui12.Button, { variant: "contained", color: "error", onClick: onConfirm }, (0, import_i18n7.__)("Delete", "elementor"))));
|
|
1223
1256
|
};
|
|
1224
1257
|
|
|
1225
1258
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
@@ -1227,7 +1260,7 @@ var React13 = __toESM(require("react"));
|
|
|
1227
1260
|
var import_react10 = require("react");
|
|
1228
1261
|
var import_icons6 = require("@elementor/icons");
|
|
1229
1262
|
var import_ui13 = require("@elementor/ui");
|
|
1230
|
-
var
|
|
1263
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1231
1264
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
1232
1265
|
var EditConfirmationDialog = ({
|
|
1233
1266
|
closeDialog,
|
|
@@ -1241,7 +1274,7 @@ var EditConfirmationDialog = ({
|
|
|
1241
1274
|
}
|
|
1242
1275
|
onConfirm?.();
|
|
1243
1276
|
};
|
|
1244
|
-
return /* @__PURE__ */ React13.createElement(import_ui13.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React13.createElement(import_ui13.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React13.createElement(import_icons6.AlertTriangleFilledIcon, { color: "secondary" }), (0,
|
|
1277
|
+
return /* @__PURE__ */ React13.createElement(import_ui13.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React13.createElement(import_ui13.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React13.createElement(import_icons6.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n8.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React13.createElement(import_ui13.DialogContent, null, /* @__PURE__ */ React13.createElement(import_ui13.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n8.__)(
|
|
1245
1278
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
1246
1279
|
"elementor"
|
|
1247
1280
|
))), /* @__PURE__ */ React13.createElement(import_ui13.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React13.createElement(
|
|
@@ -1255,9 +1288,9 @@ var EditConfirmationDialog = ({
|
|
|
1255
1288
|
size: "small"
|
|
1256
1289
|
}
|
|
1257
1290
|
),
|
|
1258
|
-
label: /* @__PURE__ */ React13.createElement(import_ui13.Typography, { variant: "body2" }, (0,
|
|
1291
|
+
label: /* @__PURE__ */ React13.createElement(import_ui13.Typography, { variant: "body2" }, (0, import_i18n8.__)("Don't show me again", "elementor"))
|
|
1259
1292
|
}
|
|
1260
|
-
), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(import_ui13.Button, { color: "secondary", onClick: closeDialog }, (0,
|
|
1293
|
+
), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(import_ui13.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n8.__)("Keep editing", "elementor")), /* @__PURE__ */ React13.createElement(import_ui13.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n8.__)("Save", "elementor")))));
|
|
1261
1294
|
};
|
|
1262
1295
|
|
|
1263
1296
|
// src/components/variable-edit.tsx
|
|
@@ -1347,7 +1380,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1347
1380
|
{
|
|
1348
1381
|
key: "delete",
|
|
1349
1382
|
size: SIZE2,
|
|
1350
|
-
"aria-label": (0,
|
|
1383
|
+
"aria-label": (0, import_i18n9.__)("Delete", "elementor"),
|
|
1351
1384
|
onClick: handleDeleteConfirmation
|
|
1352
1385
|
},
|
|
1353
1386
|
/* @__PURE__ */ React14.createElement(import_icons7.TrashIcon, { fontSize: SIZE2 })
|
|
@@ -1373,13 +1406,13 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1373
1406
|
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React14.createElement(
|
|
1374
1407
|
import_editor_ui4.PopoverHeader,
|
|
1375
1408
|
{
|
|
1376
|
-
title: (0,
|
|
1409
|
+
title: (0, import_i18n9.__)("Edit variable", "elementor"),
|
|
1377
1410
|
onClose,
|
|
1378
1411
|
icon: /* @__PURE__ */ React14.createElement(React14.Fragment, null, onGoBack && /* @__PURE__ */ React14.createElement(
|
|
1379
1412
|
import_ui14.IconButton,
|
|
1380
1413
|
{
|
|
1381
1414
|
size: SIZE2,
|
|
1382
|
-
"aria-label": (0,
|
|
1415
|
+
"aria-label": (0, import_i18n9.__)("Go Back", "elementor"),
|
|
1383
1416
|
onClick: onGoBack
|
|
1384
1417
|
},
|
|
1385
1418
|
/* @__PURE__ */ React14.createElement(import_icons7.ArrowLeftIcon, { fontSize: SIZE2 })
|
|
@@ -1387,16 +1420,32 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1387
1420
|
actions
|
|
1388
1421
|
}
|
|
1389
1422
|
), /* @__PURE__ */ React14.createElement(import_ui14.Divider, null), /* @__PURE__ */ React14.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React14.createElement(
|
|
1390
|
-
|
|
1423
|
+
FormField,
|
|
1391
1424
|
{
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1425
|
+
id: "variable-label",
|
|
1426
|
+
label: (0, import_i18n9.__)("Name", "elementor"),
|
|
1427
|
+
errorMsg: labelFieldError?.message,
|
|
1428
|
+
noticeMsg: labelHint(label)
|
|
1429
|
+
},
|
|
1430
|
+
/* @__PURE__ */ React14.createElement(
|
|
1431
|
+
LabelField,
|
|
1432
|
+
{
|
|
1433
|
+
id: "variable-label",
|
|
1434
|
+
value: label,
|
|
1435
|
+
error: labelFieldError,
|
|
1436
|
+
onChange: (newValue) => {
|
|
1437
|
+
setLabel(newValue);
|
|
1438
|
+
setErrorMessage("");
|
|
1439
|
+
},
|
|
1440
|
+
onErrorChange: (errorMsg) => {
|
|
1441
|
+
setLabelFieldError({
|
|
1442
|
+
value: label,
|
|
1443
|
+
message: errorMsg
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1397
1446
|
}
|
|
1398
|
-
|
|
1399
|
-
), /* @__PURE__ */ React14.createElement(FormField, { errorMsg: valueFieldError, label: (0,
|
|
1447
|
+
)
|
|
1448
|
+
), /* @__PURE__ */ React14.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n9.__)("Value", "elementor") }, /* @__PURE__ */ React14.createElement(import_ui14.Typography, { variant: "h5" }, /* @__PURE__ */ React14.createElement(
|
|
1400
1449
|
ValueField,
|
|
1401
1450
|
{
|
|
1402
1451
|
value,
|
|
@@ -1408,7 +1457,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1408
1457
|
onValidationChange: setValueFieldError,
|
|
1409
1458
|
propType
|
|
1410
1459
|
}
|
|
1411
|
-
)), errorMessage && /* @__PURE__ */ React14.createElement(import_ui14.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React14.createElement(import_ui14.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React14.createElement(import_ui14.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0,
|
|
1460
|
+
))), errorMessage && /* @__PURE__ */ React14.createElement(import_ui14.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React14.createElement(import_ui14.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React14.createElement(import_ui14.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n9.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
1412
1461
|
DeleteConfirmationDialog,
|
|
1413
1462
|
{
|
|
1414
1463
|
open: true,
|
|
@@ -1434,14 +1483,14 @@ var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
|
1434
1483
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1435
1484
|
var import_icons9 = require("@elementor/icons");
|
|
1436
1485
|
var import_ui19 = require("@elementor/ui");
|
|
1437
|
-
var
|
|
1486
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
1438
1487
|
|
|
1439
1488
|
// src/components/ui/menu-item-content.tsx
|
|
1440
1489
|
var React15 = __toESM(require("react"));
|
|
1441
1490
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1442
1491
|
var import_icons8 = require("@elementor/icons");
|
|
1443
1492
|
var import_ui15 = require("@elementor/ui");
|
|
1444
|
-
var
|
|
1493
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1445
1494
|
var SIZE3 = "tiny";
|
|
1446
1495
|
var MenuItemContent = ({ item }) => {
|
|
1447
1496
|
const onEdit = item.onEdit;
|
|
@@ -1486,7 +1535,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
1486
1535
|
e.stopPropagation();
|
|
1487
1536
|
onEdit(item.value);
|
|
1488
1537
|
},
|
|
1489
|
-
"aria-label": (0,
|
|
1538
|
+
"aria-label": (0, import_i18n10.__)("Edit", "elementor")
|
|
1490
1539
|
},
|
|
1491
1540
|
/* @__PURE__ */ React15.createElement(import_icons8.EditIcon, { color: "action", fontSize: SIZE3 })
|
|
1492
1541
|
));
|
|
@@ -1495,7 +1544,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
1495
1544
|
// src/components/ui/no-search-results.tsx
|
|
1496
1545
|
var React16 = __toESM(require("react"));
|
|
1497
1546
|
var import_ui16 = require("@elementor/ui");
|
|
1498
|
-
var
|
|
1547
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1499
1548
|
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
1500
1549
|
return /* @__PURE__ */ React16.createElement(
|
|
1501
1550
|
import_ui16.Stack,
|
|
@@ -1509,15 +1558,15 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
1509
1558
|
sx: { pb: 3.5 }
|
|
1510
1559
|
},
|
|
1511
1560
|
icon,
|
|
1512
|
-
/* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "subtitle2" }, (0,
|
|
1513
|
-
/* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0,
|
|
1561
|
+
/* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n11.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React16.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1562
|
+
/* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n11.__)("Try something else.", "elementor"), /* @__PURE__ */ React16.createElement(import_ui16.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n11.__)("Clear & try again", "elementor")))
|
|
1514
1563
|
);
|
|
1515
1564
|
};
|
|
1516
1565
|
|
|
1517
1566
|
// src/components/ui/no-variables.tsx
|
|
1518
1567
|
var React17 = __toESM(require("react"));
|
|
1519
1568
|
var import_ui17 = require("@elementor/ui");
|
|
1520
|
-
var
|
|
1569
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1521
1570
|
var NoVariables = ({ icon, title, onAdd }) => {
|
|
1522
1571
|
const canAdd = usePermissions().canAdd();
|
|
1523
1572
|
return /* @__PURE__ */ React17.createElement(
|
|
@@ -1534,17 +1583,17 @@ var NoVariables = ({ icon, title, onAdd }) => {
|
|
|
1534
1583
|
canAdd ? /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1535
1584
|
NoVariablesContent,
|
|
1536
1585
|
{
|
|
1537
|
-
title: title || (0,
|
|
1538
|
-
message: (0,
|
|
1586
|
+
title: title || (0, import_i18n12.__)("Create your first variable", "elementor"),
|
|
1587
|
+
message: (0, import_i18n12.__)(
|
|
1539
1588
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1540
1589
|
"elementor"
|
|
1541
1590
|
)
|
|
1542
1591
|
}
|
|
1543
|
-
), onAdd && /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0,
|
|
1592
|
+
), onAdd && /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n12.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React17.createElement(
|
|
1544
1593
|
NoVariablesContent,
|
|
1545
1594
|
{
|
|
1546
|
-
title: (0,
|
|
1547
|
-
message: (0,
|
|
1595
|
+
title: (0, import_i18n12.__)("There are no variables", "elementor"),
|
|
1596
|
+
message: (0, import_i18n12.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
1548
1597
|
}
|
|
1549
1598
|
)
|
|
1550
1599
|
);
|
|
@@ -1639,15 +1688,15 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1639
1688
|
const handleClearSearch = () => {
|
|
1640
1689
|
setSearchValue("");
|
|
1641
1690
|
};
|
|
1642
|
-
const noVariableTitle = (0,
|
|
1691
|
+
const noVariableTitle = (0, import_i18n13.sprintf)(
|
|
1643
1692
|
/* translators: %s: Variable Type. */
|
|
1644
|
-
(0,
|
|
1693
|
+
(0, import_i18n13.__)("Create your first %s variable", "elementor"),
|
|
1645
1694
|
variableType
|
|
1646
1695
|
);
|
|
1647
1696
|
return /* @__PURE__ */ React18.createElement(import_editor_editing_panel4.PopoverBody, null, /* @__PURE__ */ React18.createElement(
|
|
1648
1697
|
import_editor_ui6.PopoverHeader,
|
|
1649
1698
|
{
|
|
1650
|
-
title: (0,
|
|
1699
|
+
title: (0, import_i18n13.__)("Variables", "elementor"),
|
|
1651
1700
|
icon: /* @__PURE__ */ React18.createElement(import_icons9.ColorFilterIcon, { fontSize: SIZE4 }),
|
|
1652
1701
|
onClose: closePopover,
|
|
1653
1702
|
actions
|
|
@@ -1657,7 +1706,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1657
1706
|
{
|
|
1658
1707
|
value: searchValue,
|
|
1659
1708
|
onSearch: handleSearch,
|
|
1660
|
-
placeholder: (0,
|
|
1709
|
+
placeholder: (0, import_i18n13.__)("Search", "elementor")
|
|
1661
1710
|
}
|
|
1662
1711
|
), /* @__PURE__ */ React18.createElement(import_ui19.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React18.createElement(
|
|
1663
1712
|
import_editor_ui6.PopoverMenuList,
|
|
@@ -1769,13 +1818,13 @@ function RenderView(props) {
|
|
|
1769
1818
|
var React20 = __toESM(require("react"));
|
|
1770
1819
|
var import_icons10 = require("@elementor/icons");
|
|
1771
1820
|
var import_ui20 = require("@elementor/ui");
|
|
1772
|
-
var
|
|
1821
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
1773
1822
|
var SIZE5 = "tiny";
|
|
1774
1823
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
1775
1824
|
const actions = [];
|
|
1776
1825
|
if (onUnlink) {
|
|
1777
1826
|
actions.push(
|
|
1778
|
-
/* @__PURE__ */ React20.createElement(import_ui20.IconButton, { key: "unlink", size: SIZE5, onClick: onUnlink, "aria-label": (0,
|
|
1827
|
+
/* @__PURE__ */ React20.createElement(import_ui20.IconButton, { key: "unlink", size: SIZE5, onClick: onUnlink, "aria-label": (0, import_i18n14.__)("Unlink", "elementor") }, /* @__PURE__ */ React20.createElement(import_icons10.DetachIcon, { fontSize: SIZE5 }))
|
|
1779
1828
|
);
|
|
1780
1829
|
}
|
|
1781
1830
|
return /* @__PURE__ */ React20.createElement(import_ui20.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React20.createElement(
|
|
@@ -1847,7 +1896,7 @@ var import_editor_controls7 = require("@elementor/editor-controls");
|
|
|
1847
1896
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
1848
1897
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
1849
1898
|
var import_ui22 = require("@elementor/ui");
|
|
1850
|
-
var
|
|
1899
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
1851
1900
|
var SIZE6 = "tiny";
|
|
1852
1901
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
1853
1902
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -1902,20 +1951,36 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1902
1951
|
import_editor_ui7.PopoverHeader,
|
|
1903
1952
|
{
|
|
1904
1953
|
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: SIZE6 }),
|
|
1905
|
-
title: (0,
|
|
1954
|
+
title: (0, import_i18n15.__)("Restore variable", "elementor"),
|
|
1906
1955
|
onClose
|
|
1907
1956
|
}
|
|
1908
1957
|
), /* @__PURE__ */ React22.createElement(import_ui22.Divider, null), /* @__PURE__ */ React22.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React22.createElement(
|
|
1909
|
-
|
|
1958
|
+
FormField,
|
|
1910
1959
|
{
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1960
|
+
id: "variable-label",
|
|
1961
|
+
label: (0, import_i18n15.__)("Name", "elementor"),
|
|
1962
|
+
errorMsg: labelFieldError?.message,
|
|
1963
|
+
noticeMsg: labelHint(label)
|
|
1964
|
+
},
|
|
1965
|
+
/* @__PURE__ */ React22.createElement(
|
|
1966
|
+
LabelField,
|
|
1967
|
+
{
|
|
1968
|
+
id: "variable-label",
|
|
1969
|
+
value: label,
|
|
1970
|
+
error: labelFieldError,
|
|
1971
|
+
onChange: (newValue) => {
|
|
1972
|
+
setLabel(newValue);
|
|
1973
|
+
setErrorMessage("");
|
|
1974
|
+
},
|
|
1975
|
+
onErrorChange: (errorMsg) => {
|
|
1976
|
+
setLabelFieldError({
|
|
1977
|
+
value: label,
|
|
1978
|
+
message: errorMsg
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1916
1981
|
}
|
|
1917
|
-
|
|
1918
|
-
), /* @__PURE__ */ React22.createElement(FormField, { errorMsg: valueFieldError, label: (0,
|
|
1982
|
+
)
|
|
1983
|
+
), /* @__PURE__ */ React22.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n15.__)("Value", "elementor") }, /* @__PURE__ */ React22.createElement(import_ui22.Typography, { variant: "h5" }, /* @__PURE__ */ React22.createElement(
|
|
1919
1984
|
ValueField,
|
|
1920
1985
|
{
|
|
1921
1986
|
value,
|
|
@@ -1927,14 +1992,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1927
1992
|
onValidationChange: setValueFieldError,
|
|
1928
1993
|
propType
|
|
1929
1994
|
}
|
|
1930
|
-
)), errorMessage && /* @__PURE__ */ React22.createElement(import_ui22.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React22.createElement(import_ui22.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React22.createElement(import_ui22.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0,
|
|
1995
|
+
))), errorMessage && /* @__PURE__ */ React22.createElement(import_ui22.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React22.createElement(import_ui22.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React22.createElement(import_ui22.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n15.__)("Restore", "elementor")))));
|
|
1931
1996
|
};
|
|
1932
1997
|
|
|
1933
1998
|
// src/components/ui/deleted-variable-alert.tsx
|
|
1934
1999
|
var React23 = __toESM(require("react"));
|
|
1935
2000
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
1936
2001
|
var import_ui23 = require("@elementor/ui");
|
|
1937
|
-
var
|
|
2002
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
1938
2003
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
1939
2004
|
const sectionWidth = (0, import_editor_editing_panel6.useSectionWidth)();
|
|
1940
2005
|
return /* @__PURE__ */ React23.createElement(import_ui23.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React23.createElement(
|
|
@@ -1943,16 +2008,16 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
1943
2008
|
variant: "standard",
|
|
1944
2009
|
severity: "warning",
|
|
1945
2010
|
onClose,
|
|
1946
|
-
action: /* @__PURE__ */ React23.createElement(React23.Fragment, null, onUnlink && /* @__PURE__ */ React23.createElement(import_ui23.AlertAction, { variant: "contained", onClick: onUnlink }, (0,
|
|
2011
|
+
action: /* @__PURE__ */ React23.createElement(React23.Fragment, null, onUnlink && /* @__PURE__ */ React23.createElement(import_ui23.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n16.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React23.createElement(import_ui23.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n16.__)("Restore", "elementor"))),
|
|
1947
2012
|
sx: { width: sectionWidth }
|
|
1948
2013
|
},
|
|
1949
|
-
/* @__PURE__ */ React23.createElement(import_ui23.AlertTitle, null, (0,
|
|
1950
|
-
(0,
|
|
2014
|
+
/* @__PURE__ */ React23.createElement(import_ui23.AlertTitle, null, (0, import_i18n16.__)("Deleted variable", "elementor")),
|
|
2015
|
+
(0, import_i18n16.__)("The variable", "elementor"),
|
|
1951
2016
|
" '",
|
|
1952
2017
|
label,
|
|
1953
2018
|
"'",
|
|
1954
2019
|
" ",
|
|
1955
|
-
(0,
|
|
2020
|
+
(0, import_i18n16.__)(
|
|
1956
2021
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
1957
2022
|
"elementor"
|
|
1958
2023
|
)
|
|
@@ -1963,7 +2028,7 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
1963
2028
|
var React24 = __toESM(require("react"));
|
|
1964
2029
|
var import_icons12 = require("@elementor/icons");
|
|
1965
2030
|
var import_ui24 = require("@elementor/ui");
|
|
1966
|
-
var
|
|
2031
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
1967
2032
|
var DeletedTag = React24.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
1968
2033
|
return /* @__PURE__ */ React24.createElement(
|
|
1969
2034
|
import_ui24.Chip,
|
|
@@ -1975,7 +2040,7 @@ var DeletedTag = React24.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
1975
2040
|
variant: "standard",
|
|
1976
2041
|
onClick,
|
|
1977
2042
|
icon: /* @__PURE__ */ React24.createElement(import_icons12.AlertTriangleFilledIcon, null),
|
|
1978
|
-
label: /* @__PURE__ */ React24.createElement(import_ui24.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React24.createElement(import_ui24.Box, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", (0,
|
|
2043
|
+
label: /* @__PURE__ */ React24.createElement(import_ui24.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React24.createElement(import_ui24.Box, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", (0, import_i18n17.__)("deleted", "elementor"), ")"))),
|
|
1979
2044
|
sx: {
|
|
1980
2045
|
height: (theme) => theme.spacing(3.5),
|
|
1981
2046
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -2084,16 +2149,16 @@ var import_ui28 = require("@elementor/ui");
|
|
|
2084
2149
|
var React26 = __toESM(require("react"));
|
|
2085
2150
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
2086
2151
|
var import_ui26 = require("@elementor/ui");
|
|
2087
|
-
var
|
|
2152
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
2088
2153
|
var i18n = {
|
|
2089
|
-
title: (0,
|
|
2090
|
-
message: (0,
|
|
2154
|
+
title: (0, import_i18n18.__)("Variable has changed", "elementor"),
|
|
2155
|
+
message: (0, import_i18n18.__)(
|
|
2091
2156
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
2092
2157
|
"elementor"
|
|
2093
2158
|
),
|
|
2094
2159
|
buttons: {
|
|
2095
|
-
clear: (0,
|
|
2096
|
-
select: (0,
|
|
2160
|
+
clear: (0, import_i18n18.__)("Clear", "elementor"),
|
|
2161
|
+
select: (0, import_i18n18.__)("Select variable", "elementor")
|
|
2097
2162
|
}
|
|
2098
2163
|
};
|
|
2099
2164
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
@@ -2119,7 +2184,7 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
2119
2184
|
var React27 = __toESM(require("react"));
|
|
2120
2185
|
var import_icons13 = require("@elementor/icons");
|
|
2121
2186
|
var import_ui27 = require("@elementor/ui");
|
|
2122
|
-
var
|
|
2187
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2123
2188
|
var MismatchTag = React27.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
2124
2189
|
return /* @__PURE__ */ React27.createElement(
|
|
2125
2190
|
import_ui27.Chip,
|
|
@@ -2131,7 +2196,7 @@ var MismatchTag = React27.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
2131
2196
|
variant: "standard",
|
|
2132
2197
|
onClick,
|
|
2133
2198
|
icon: /* @__PURE__ */ React27.createElement(import_icons13.AlertTriangleFilledIcon, null),
|
|
2134
|
-
label: /* @__PURE__ */ React27.createElement(import_ui27.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React27.createElement(import_ui27.Box, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", (0,
|
|
2199
|
+
label: /* @__PURE__ */ React27.createElement(import_ui27.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React27.createElement(import_ui27.Box, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", (0, import_i18n19.__)("changed", "elementor"), ")"))),
|
|
2135
2200
|
sx: {
|
|
2136
2201
|
height: (theme) => theme.spacing(3.5),
|
|
2137
2202
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -2220,13 +2285,13 @@ var React31 = __toESM(require("react"));
|
|
|
2220
2285
|
var import_react18 = require("react");
|
|
2221
2286
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
2222
2287
|
var import_ui31 = require("@elementor/ui");
|
|
2223
|
-
var
|
|
2288
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
2224
2289
|
|
|
2225
2290
|
// src/components/ui/missing-variable-alert.tsx
|
|
2226
2291
|
var React29 = __toESM(require("react"));
|
|
2227
2292
|
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
2228
2293
|
var import_ui29 = require("@elementor/ui");
|
|
2229
|
-
var
|
|
2294
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
2230
2295
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
2231
2296
|
const sectionWidth = (0, import_editor_editing_panel8.useSectionWidth)();
|
|
2232
2297
|
return /* @__PURE__ */ React29.createElement(import_ui29.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
@@ -2235,11 +2300,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
2235
2300
|
variant: "standard",
|
|
2236
2301
|
severity: "warning",
|
|
2237
2302
|
onClose,
|
|
2238
|
-
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(import_ui29.AlertAction, { variant: "contained", onClick: onClear }, (0,
|
|
2303
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(import_ui29.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n20.__)("Clear", "elementor"))),
|
|
2239
2304
|
sx: { width: sectionWidth }
|
|
2240
2305
|
},
|
|
2241
|
-
/* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, (0,
|
|
2242
|
-
(0,
|
|
2306
|
+
/* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, (0, import_i18n20.__)("This variable is missing", "elementor")),
|
|
2307
|
+
(0, import_i18n20.__)(
|
|
2243
2308
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
2244
2309
|
"elementor"
|
|
2245
2310
|
)
|
|
@@ -2300,7 +2365,7 @@ var MissingVariable = () => {
|
|
|
2300
2365
|
}
|
|
2301
2366
|
}
|
|
2302
2367
|
},
|
|
2303
|
-
/* @__PURE__ */ React31.createElement(MissingTag, { label: (0,
|
|
2368
|
+
/* @__PURE__ */ React31.createElement(MissingTag, { label: (0, import_i18n21.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
2304
2369
|
));
|
|
2305
2370
|
};
|
|
2306
2371
|
|
|
@@ -2327,14 +2392,14 @@ var VariableControl = () => {
|
|
|
2327
2392
|
var React33 = __toESM(require("react"));
|
|
2328
2393
|
var import_editor_editing_panel9 = require("@elementor/editor-editing-panel");
|
|
2329
2394
|
var import_icons15 = require("@elementor/icons");
|
|
2330
|
-
var
|
|
2395
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
2331
2396
|
var usePropVariableAction = () => {
|
|
2332
2397
|
const { propType, path } = (0, import_editor_editing_panel9.useBoundProp)();
|
|
2333
2398
|
const variable = resolveVariableFromPropType(propType);
|
|
2334
2399
|
return {
|
|
2335
2400
|
visible: Boolean(variable),
|
|
2336
2401
|
icon: import_icons15.ColorFilterIcon,
|
|
2337
|
-
title: (0,
|
|
2402
|
+
title: (0, import_i18n22.__)("Variables", "elementor"),
|
|
2338
2403
|
content: ({ close: closePopover }) => {
|
|
2339
2404
|
if (!variable) {
|
|
2340
2405
|
return null;
|
|
@@ -2397,7 +2462,15 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
2397
2462
|
colorPicker: {
|
|
2398
2463
|
anchorEl: anchorRef,
|
|
2399
2464
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
2400
|
-
transformOrigin: { vertical: "top", horizontal: -10 }
|
|
2465
|
+
transformOrigin: { vertical: "top", horizontal: -10 },
|
|
2466
|
+
slotProps: {
|
|
2467
|
+
colorIndicator: {
|
|
2468
|
+
size: "inherit",
|
|
2469
|
+
sx: {
|
|
2470
|
+
borderRadius: 0.5
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2401
2474
|
}
|
|
2402
2475
|
}
|
|
2403
2476
|
}
|
|
@@ -2411,7 +2484,7 @@ var import_editor_controls12 = require("@elementor/editor-controls");
|
|
|
2411
2484
|
var import_editor_editing_panel10 = require("@elementor/editor-editing-panel");
|
|
2412
2485
|
var import_icons16 = require("@elementor/icons");
|
|
2413
2486
|
var import_ui33 = require("@elementor/ui");
|
|
2414
|
-
var
|
|
2487
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
2415
2488
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
2416
2489
|
const [fontFamily, setFontFamily] = (0, import_react20.useState)(value);
|
|
2417
2490
|
const defaultRef = (0, import_react20.useRef)(null);
|
|
@@ -2464,7 +2537,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
2464
2537
|
onItemChange: handleFontFamilyChange,
|
|
2465
2538
|
onClose: fontPopoverState.close,
|
|
2466
2539
|
sectionWidth,
|
|
2467
|
-
title: (0,
|
|
2540
|
+
title: (0, import_i18n23.__)("Font Family", "elementor"),
|
|
2468
2541
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
2469
2542
|
onDebounce: import_editor_controls12.enqueueFont,
|
|
2470
2543
|
icon: import_icons16.TextIcon
|