@elementor/editor-variables 3.32.0-66 → 3.32.0-67
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.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { controlActionsMenu, registerControlReplacement } from "@elementor/edito
|
|
|
4
4
|
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
5
5
|
|
|
6
6
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
7
|
-
import * as
|
|
7
|
+
import * as React8 from "react";
|
|
8
8
|
import { useEffect } from "react";
|
|
9
9
|
import {
|
|
10
10
|
__createPanel as createPanel,
|
|
@@ -18,7 +18,7 @@ import { ThemeProvider } from "@elementor/editor-ui";
|
|
|
18
18
|
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
19
19
|
import { ColorFilterIcon, TrashIcon, XIcon } from "@elementor/icons";
|
|
20
20
|
import { Alert, Box, Button, Divider, ErrorBoundary, IconButton as IconButton3, Stack as Stack4 } from "@elementor/ui";
|
|
21
|
-
import { __ as
|
|
21
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
22
22
|
|
|
23
23
|
// src/hooks/use-prop-variables.ts
|
|
24
24
|
import { useMemo } from "react";
|
|
@@ -520,8 +520,8 @@ var restoreVariable = (restoreId, label, value) => {
|
|
|
520
520
|
};
|
|
521
521
|
|
|
522
522
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
523
|
-
import * as
|
|
524
|
-
import { createElement as
|
|
523
|
+
import * as React7 from "react";
|
|
524
|
+
import { createElement as createElement9, useState as useState3 } from "react";
|
|
525
525
|
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
526
526
|
import { GripVerticalIcon } from "@elementor/icons";
|
|
527
527
|
import {
|
|
@@ -532,22 +532,126 @@ import {
|
|
|
532
532
|
TableContainer,
|
|
533
533
|
TableHead,
|
|
534
534
|
TableRow,
|
|
535
|
-
TextField,
|
|
536
535
|
UnstableSortableItem,
|
|
537
536
|
UnstableSortableProvider
|
|
538
537
|
} from "@elementor/ui";
|
|
538
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
539
|
+
|
|
540
|
+
// src/components/fields/label-field.tsx
|
|
541
|
+
import * as React3 from "react";
|
|
542
|
+
import { useState } from "react";
|
|
543
|
+
import { TextField } from "@elementor/ui";
|
|
544
|
+
|
|
545
|
+
// src/utils/validations.ts
|
|
539
546
|
import { __ as __3 } from "@wordpress/i18n";
|
|
547
|
+
var ERROR_MESSAGES = {
|
|
548
|
+
MISSING_VARIABLE_NAME: __3("Give your variable a name.", "elementor"),
|
|
549
|
+
MISSING_VARIABLE_VALUE: __3("Add a value to complete your variable.", "elementor"),
|
|
550
|
+
INVALID_CHARACTERS: __3("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
551
|
+
NO_NON_SPECIAL_CHARACTER: __3("Names have to include at least one non-special character.", "elementor"),
|
|
552
|
+
VARIABLE_LABEL_MAX_LENGTH: __3("Keep names up to 50 characters.", "elementor"),
|
|
553
|
+
DUPLICATED_LABEL: __3("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
554
|
+
UNEXPECTED_ERROR: __3("There was a glitch. Try saving your variable again.", "elementor")
|
|
555
|
+
};
|
|
556
|
+
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
557
|
+
var mapServerError = (error) => {
|
|
558
|
+
if (error?.response?.data?.code === "duplicated_label") {
|
|
559
|
+
return {
|
|
560
|
+
field: "label",
|
|
561
|
+
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
return void 0;
|
|
565
|
+
};
|
|
566
|
+
var validateLabel = (name) => {
|
|
567
|
+
if (!name.trim()) {
|
|
568
|
+
return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
|
|
569
|
+
}
|
|
570
|
+
const allowedChars = /^[a-zA-Z0-9_-]+$/;
|
|
571
|
+
if (!allowedChars.test(name)) {
|
|
572
|
+
return ERROR_MESSAGES.INVALID_CHARACTERS;
|
|
573
|
+
}
|
|
574
|
+
const hasAlphanumeric = /[a-zA-Z0-9]/;
|
|
575
|
+
if (!hasAlphanumeric.test(name)) {
|
|
576
|
+
return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
|
|
577
|
+
}
|
|
578
|
+
if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
|
|
579
|
+
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
580
|
+
}
|
|
581
|
+
return "";
|
|
582
|
+
};
|
|
583
|
+
var labelHint = (name) => {
|
|
584
|
+
const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
|
|
585
|
+
if (hintThreshold < name.length) {
|
|
586
|
+
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
587
|
+
}
|
|
588
|
+
return "";
|
|
589
|
+
};
|
|
590
|
+
var validateValue = (value) => {
|
|
591
|
+
if (!value.trim()) {
|
|
592
|
+
return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
|
|
593
|
+
}
|
|
594
|
+
return "";
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
// src/components/fields/label-field.tsx
|
|
598
|
+
function isLabelEqual(a, b) {
|
|
599
|
+
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
600
|
+
}
|
|
601
|
+
var useLabelError = (initialError) => {
|
|
602
|
+
const [error, setError] = useState(initialError ?? { value: "", message: "" });
|
|
603
|
+
return {
|
|
604
|
+
labelFieldError: error,
|
|
605
|
+
setLabelFieldError: setError
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
var LabelField = ({
|
|
609
|
+
value,
|
|
610
|
+
error,
|
|
611
|
+
onChange,
|
|
612
|
+
id: id2,
|
|
613
|
+
onErrorChange,
|
|
614
|
+
size = "tiny",
|
|
615
|
+
focusOnShow = false
|
|
616
|
+
}) => {
|
|
617
|
+
const [label, setLabel] = useState(value);
|
|
618
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
619
|
+
const handleChange = (newValue) => {
|
|
620
|
+
setLabel(newValue);
|
|
621
|
+
const errorMsg2 = validateLabel(newValue);
|
|
622
|
+
setErrorMessage(errorMsg2);
|
|
623
|
+
onErrorChange?.(errorMsg2);
|
|
624
|
+
onChange(isLabelEqual(newValue, error?.value ?? "") || errorMsg2 ? "" : newValue);
|
|
625
|
+
};
|
|
626
|
+
let errorMsg = errorMessage;
|
|
627
|
+
if (isLabelEqual(label, error?.value ?? "") && error?.message) {
|
|
628
|
+
errorMsg = error.message;
|
|
629
|
+
}
|
|
630
|
+
return /* @__PURE__ */ React3.createElement(
|
|
631
|
+
TextField,
|
|
632
|
+
{
|
|
633
|
+
id: id2,
|
|
634
|
+
size,
|
|
635
|
+
fullWidth: true,
|
|
636
|
+
value: label,
|
|
637
|
+
error: !!errorMsg,
|
|
638
|
+
onChange: (e) => handleChange(e.target.value),
|
|
639
|
+
inputProps: { maxLength: VARIABLE_LABEL_MAX_LENGTH },
|
|
640
|
+
autoFocus: focusOnShow
|
|
641
|
+
}
|
|
642
|
+
);
|
|
643
|
+
};
|
|
540
644
|
|
|
541
645
|
// src/components/variables-manager/variable-edit-menu.tsx
|
|
542
|
-
import * as
|
|
543
|
-
import { createElement as
|
|
646
|
+
import * as React4 from "react";
|
|
647
|
+
import { createElement as createElement5 } from "react";
|
|
544
648
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
545
649
|
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, usePopupState } from "@elementor/ui";
|
|
546
650
|
var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
547
651
|
const menuState = usePopupState({
|
|
548
652
|
variant: "popover"
|
|
549
653
|
});
|
|
550
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(IconButton, { ...bindTrigger(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React4.createElement(DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React4.createElement(
|
|
551
655
|
Menu,
|
|
552
656
|
{
|
|
553
657
|
disablePortal: true,
|
|
@@ -570,7 +674,7 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
570
674
|
open: menuState.isOpen,
|
|
571
675
|
onClose: menuState.close
|
|
572
676
|
},
|
|
573
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
677
|
+
menuActions.map((action) => /* @__PURE__ */ React4.createElement(
|
|
574
678
|
MenuItem,
|
|
575
679
|
{
|
|
576
680
|
key: action.name,
|
|
@@ -583,7 +687,7 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
583
687
|
gap: 1
|
|
584
688
|
}
|
|
585
689
|
},
|
|
586
|
-
action.icon &&
|
|
690
|
+
action.icon && createElement5(action.icon, {
|
|
587
691
|
fontSize: "inherit"
|
|
588
692
|
}),
|
|
589
693
|
" ",
|
|
@@ -593,19 +697,18 @@ var VariableEditMenu = ({ menuActions, disabled }) => {
|
|
|
593
697
|
};
|
|
594
698
|
|
|
595
699
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
596
|
-
import * as
|
|
597
|
-
import { useState } from "react";
|
|
700
|
+
import * as React5 from "react";
|
|
701
|
+
import { useState as useState2 } from "react";
|
|
598
702
|
import { ClickAwayListener, Stack as Stack2 } from "@elementor/ui";
|
|
599
703
|
var VariableEditableCell = ({
|
|
600
704
|
initialValue,
|
|
601
705
|
children,
|
|
602
706
|
editableElement,
|
|
603
707
|
onSave,
|
|
604
|
-
prefixElement
|
|
605
|
-
disableCloseOnBlur
|
|
708
|
+
prefixElement
|
|
606
709
|
}) => {
|
|
607
|
-
const [value, setValue] =
|
|
608
|
-
const [isEditing, setIsEditing] =
|
|
710
|
+
const [value, setValue] = useState2(initialValue);
|
|
711
|
+
const [isEditing, setIsEditing] = useState2(false);
|
|
609
712
|
const handleDoubleClick = () => {
|
|
610
713
|
setIsEditing(true);
|
|
611
714
|
};
|
|
@@ -628,14 +731,13 @@ var VariableEditableCell = ({
|
|
|
628
731
|
setValue(newValue);
|
|
629
732
|
};
|
|
630
733
|
const editableContent = editableElement({ value, onChange: handleChange });
|
|
631
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ React5.createElement(ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React5.createElement(
|
|
632
735
|
Stack2,
|
|
633
736
|
{
|
|
634
737
|
direction: "row",
|
|
635
738
|
alignItems: "center",
|
|
636
739
|
gap: 1,
|
|
637
740
|
onDoubleClick: handleDoubleClick,
|
|
638
|
-
onBlur: disableCloseOnBlur ? void 0 : handleSave,
|
|
639
741
|
onKeyDown: handleKeyDown,
|
|
640
742
|
tabIndex: 0,
|
|
641
743
|
role: "button",
|
|
@@ -647,7 +749,7 @@ var VariableEditableCell = ({
|
|
|
647
749
|
};
|
|
648
750
|
|
|
649
751
|
// src/components/variables-manager/variable-table-cell.tsx
|
|
650
|
-
import * as
|
|
752
|
+
import * as React6 from "react";
|
|
651
753
|
import { TableCell } from "@elementor/ui";
|
|
652
754
|
var VariableTableCell = ({
|
|
653
755
|
children,
|
|
@@ -663,15 +765,16 @@ var VariableTableCell = ({
|
|
|
663
765
|
cursor: "initial",
|
|
664
766
|
typography: "caption",
|
|
665
767
|
...isHeader && { color: "text.primary", fontWeight: "bold" },
|
|
768
|
+
...isHeader && !noPadding && { padding: "10px 16px" },
|
|
666
769
|
...width && { width },
|
|
667
770
|
...sx
|
|
668
771
|
};
|
|
669
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ React6.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
670
773
|
};
|
|
671
774
|
|
|
672
775
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
673
776
|
var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
674
|
-
const [ids, setIds] =
|
|
777
|
+
const [ids, setIds] = useState3(Object.keys(variables));
|
|
675
778
|
const rows = ids.map((id2) => {
|
|
676
779
|
const variable = variables[id2];
|
|
677
780
|
const variableType = getVariableType(variable.type);
|
|
@@ -687,16 +790,16 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
687
790
|
minWidth: 250,
|
|
688
791
|
tableLayout: "fixed"
|
|
689
792
|
};
|
|
690
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ React7.createElement(TableContainer, { sx: { overflow: "initial" } }, /* @__PURE__ */ React7.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React7.createElement(TableHead, null, /* @__PURE__ */ React7.createElement(TableRow, null, /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true }, __4("Name", "elementor")), /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true }, __4("Value", "elementor")), /* @__PURE__ */ React7.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React7.createElement(TableBody, null, /* @__PURE__ */ React7.createElement(
|
|
691
794
|
UnstableSortableProvider,
|
|
692
795
|
{
|
|
693
796
|
value: ids,
|
|
694
797
|
onChange: setIds,
|
|
695
798
|
variant: "static",
|
|
696
799
|
restrictAxis: true,
|
|
697
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
800
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React7.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React7.createElement(TableBody, null, dragOverlayChildren))
|
|
698
801
|
},
|
|
699
|
-
rows.map((row) => /* @__PURE__ */
|
|
802
|
+
rows.map((row) => /* @__PURE__ */ React7.createElement(
|
|
700
803
|
UnstableSortableItem,
|
|
701
804
|
{
|
|
702
805
|
key: row.id,
|
|
@@ -716,7 +819,7 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
716
819
|
}) => {
|
|
717
820
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
718
821
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
719
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ React7.createElement(
|
|
720
823
|
TableRow,
|
|
721
824
|
{
|
|
722
825
|
...itemProps,
|
|
@@ -747,7 +850,7 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
747
850
|
style: { ...itemStyle, ...triggerStyle },
|
|
748
851
|
disableDivider: isDragOverlay || index === rows.length - 1
|
|
749
852
|
},
|
|
750
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ React7.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React7.createElement(
|
|
751
854
|
IconButton2,
|
|
752
855
|
{
|
|
753
856
|
size: "small",
|
|
@@ -756,39 +859,54 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
756
859
|
disabled: isSorting,
|
|
757
860
|
draggable: true
|
|
758
861
|
},
|
|
759
|
-
/* @__PURE__ */
|
|
862
|
+
/* @__PURE__ */ React7.createElement(GripVerticalIcon, { fontSize: "inherit" })
|
|
760
863
|
)),
|
|
761
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ React7.createElement(VariableTableCell, null, /* @__PURE__ */ React7.createElement(
|
|
762
865
|
VariableEditableCell,
|
|
763
866
|
{
|
|
764
867
|
initialValue: row.name,
|
|
765
868
|
onSave: () => {
|
|
766
869
|
},
|
|
767
|
-
prefixElement:
|
|
768
|
-
editableElement: ({ value, onChange }) => /* @__PURE__ */
|
|
769
|
-
|
|
870
|
+
prefixElement: createElement9(row.icon, { fontSize: "inherit" }),
|
|
871
|
+
editableElement: ({ value, onChange }) => /* @__PURE__ */ React7.createElement(
|
|
872
|
+
LabelField,
|
|
770
873
|
{
|
|
874
|
+
id: "variable-label-" + row.id,
|
|
771
875
|
size: "tiny",
|
|
772
876
|
value,
|
|
773
|
-
onChange
|
|
877
|
+
onChange,
|
|
878
|
+
focusOnShow: true
|
|
774
879
|
}
|
|
775
880
|
)
|
|
776
881
|
},
|
|
777
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ React7.createElement(
|
|
883
|
+
EllipsisWithTooltip,
|
|
884
|
+
{
|
|
885
|
+
title: row.name,
|
|
886
|
+
sx: { border: "4px solid transparent" }
|
|
887
|
+
},
|
|
888
|
+
row.name
|
|
889
|
+
)
|
|
778
890
|
)),
|
|
779
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ React7.createElement(VariableTableCell, null, /* @__PURE__ */ React7.createElement(
|
|
780
892
|
VariableEditableCell,
|
|
781
893
|
{
|
|
782
894
|
initialValue: row.value,
|
|
783
895
|
onSave: () => {
|
|
784
896
|
},
|
|
785
|
-
editableElement: row.valueField
|
|
786
|
-
disableCloseOnBlur: true
|
|
897
|
+
editableElement: row.valueField
|
|
787
898
|
},
|
|
788
899
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
789
|
-
/* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ React7.createElement(
|
|
901
|
+
EllipsisWithTooltip,
|
|
902
|
+
{
|
|
903
|
+
title: row.value,
|
|
904
|
+
sx: { border: "4px solid transparent" }
|
|
905
|
+
},
|
|
906
|
+
row.value
|
|
907
|
+
)
|
|
790
908
|
)),
|
|
791
|
-
/* @__PURE__ */
|
|
909
|
+
/* @__PURE__ */ React7.createElement(
|
|
792
910
|
VariableTableCell,
|
|
793
911
|
{
|
|
794
912
|
align: "right",
|
|
@@ -797,7 +915,7 @@ var VariablesManagerTable = ({ menuActions, variables }) => {
|
|
|
797
915
|
maxWidth: 16,
|
|
798
916
|
sx: { paddingInlineEnd: 1 }
|
|
799
917
|
},
|
|
800
|
-
/* @__PURE__ */
|
|
918
|
+
/* @__PURE__ */ React7.createElement(Stack3, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React7.createElement(
|
|
801
919
|
VariableEditMenu,
|
|
802
920
|
{
|
|
803
921
|
menuActions,
|
|
@@ -832,14 +950,14 @@ function VariablesManagerPanel() {
|
|
|
832
950
|
usePreventUnload(isDirty);
|
|
833
951
|
const menuActions = [
|
|
834
952
|
{
|
|
835
|
-
name:
|
|
953
|
+
name: __5("Delete", "elementor"),
|
|
836
954
|
icon: TrashIcon,
|
|
837
955
|
color: "error.main",
|
|
838
956
|
onClick: () => {
|
|
839
957
|
}
|
|
840
958
|
}
|
|
841
959
|
];
|
|
842
|
-
return /* @__PURE__ */
|
|
960
|
+
return /* @__PURE__ */ React8.createElement(ThemeProvider, null, /* @__PURE__ */ React8.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React8.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React8.createElement(Panel, null, /* @__PURE__ */ React8.createElement(PanelHeader, null, /* @__PURE__ */ React8.createElement(Stack4, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React8.createElement(Stack4, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React8.createElement(Stack4, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React8.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React8.createElement(ColorFilterIcon, { fontSize: "inherit" }), __5("Variable Manager", "elementor"))), /* @__PURE__ */ React8.createElement(
|
|
843
961
|
CloseButton,
|
|
844
962
|
{
|
|
845
963
|
sx: { marginLeft: "auto" },
|
|
@@ -847,7 +965,7 @@ function VariablesManagerPanel() {
|
|
|
847
965
|
closePanel();
|
|
848
966
|
}
|
|
849
967
|
}
|
|
850
|
-
))), /* @__PURE__ */
|
|
968
|
+
)), /* @__PURE__ */ React8.createElement(Divider, { sx: { width: "100%" } }))), /* @__PURE__ */ React8.createElement(
|
|
851
969
|
PanelBody,
|
|
852
970
|
{
|
|
853
971
|
sx: {
|
|
@@ -856,12 +974,11 @@ function VariablesManagerPanel() {
|
|
|
856
974
|
height: "100%"
|
|
857
975
|
}
|
|
858
976
|
},
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
|
|
861
|
-
), /* @__PURE__ */ React7.createElement(PanelFooter, null, /* @__PURE__ */ React7.createElement(Button, { fullWidth: true, size: "small", color: "global", variant: "contained", disabled: !isDirty }, __4("Save changes", "elementor"))))));
|
|
977
|
+
/* @__PURE__ */ React8.createElement(VariablesManagerTable, { menuActions, variables })
|
|
978
|
+
), /* @__PURE__ */ React8.createElement(PanelFooter, null, /* @__PURE__ */ React8.createElement(Button, { fullWidth: true, size: "small", color: "global", variant: "contained", disabled: !isDirty }, __5("Save changes", "elementor"))))));
|
|
862
979
|
}
|
|
863
|
-
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */
|
|
864
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
980
|
+
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React8.createElement(IconButton3, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React8.createElement(XIcon, { fontSize: "small" }));
|
|
981
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React8.createElement(Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React8.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React8.createElement("strong", null, __5("Something went wrong", "elementor"))));
|
|
865
982
|
var usePreventUnload = (isDirty) => {
|
|
866
983
|
useEffect(() => {
|
|
867
984
|
const handleBeforeUnload = (event) => {
|
|
@@ -881,7 +998,7 @@ import * as React32 from "react";
|
|
|
881
998
|
import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
|
|
882
999
|
|
|
883
1000
|
// src/components/ui/variable/assigned-variable.tsx
|
|
884
|
-
import { useId
|
|
1001
|
+
import { useId, useRef } from "react";
|
|
885
1002
|
import * as React21 from "react";
|
|
886
1003
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
|
|
887
1004
|
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
@@ -909,13 +1026,13 @@ import { useState as useState9 } from "react";
|
|
|
909
1026
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
910
1027
|
|
|
911
1028
|
// src/context/variable-selection-popover.context.tsx
|
|
912
|
-
import * as
|
|
913
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
1029
|
+
import * as React9 from "react";
|
|
1030
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState4 } from "react";
|
|
914
1031
|
import { Box as Box2 } from "@elementor/ui";
|
|
915
1032
|
var PopoverContentRefContext = createContext2(null);
|
|
916
1033
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
917
|
-
const [anchorRef, setAnchorRef] =
|
|
918
|
-
return /* @__PURE__ */
|
|
1034
|
+
const [anchorRef, setAnchorRef] = useState4(null);
|
|
1035
|
+
return /* @__PURE__ */ React9.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React9.createElement(Box2, { ref: setAnchorRef }, children));
|
|
919
1036
|
};
|
|
920
1037
|
var usePopoverContentRef = () => {
|
|
921
1038
|
return useContext2(PopoverContentRefContext);
|
|
@@ -943,8 +1060,8 @@ import { PopoverContent, useBoundProp as useBoundProp3 } from "@elementor/editor
|
|
|
943
1060
|
import { PopoverBody } from "@elementor/editor-editing-panel";
|
|
944
1061
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
945
1062
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
946
|
-
import { Button as Button2, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4 } from "@elementor/ui";
|
|
947
|
-
import { __ as
|
|
1063
|
+
import { Button as Button2, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography2 } from "@elementor/ui";
|
|
1064
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
948
1065
|
|
|
949
1066
|
// src/hooks/use-initial-value.ts
|
|
950
1067
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
@@ -976,112 +1093,11 @@ var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
|
976
1093
|
});
|
|
977
1094
|
};
|
|
978
1095
|
|
|
979
|
-
// src/utils/validations.ts
|
|
980
|
-
import { __ as __5 } from "@wordpress/i18n";
|
|
981
|
-
var ERROR_MESSAGES = {
|
|
982
|
-
MISSING_VARIABLE_NAME: __5("Give your variable a name.", "elementor"),
|
|
983
|
-
MISSING_VARIABLE_VALUE: __5("Add a value to complete your variable.", "elementor"),
|
|
984
|
-
INVALID_CHARACTERS: __5("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
985
|
-
NO_NON_SPECIAL_CHARACTER: __5("Names have to include at least one non-special character.", "elementor"),
|
|
986
|
-
VARIABLE_LABEL_MAX_LENGTH: __5("Keep names up to 50 characters.", "elementor"),
|
|
987
|
-
DUPLICATED_LABEL: __5("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
988
|
-
UNEXPECTED_ERROR: __5("There was a glitch. Try saving your variable again.", "elementor")
|
|
989
|
-
};
|
|
990
|
-
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
991
|
-
var mapServerError = (error) => {
|
|
992
|
-
if (error?.response?.data?.code === "duplicated_label") {
|
|
993
|
-
return {
|
|
994
|
-
field: "label",
|
|
995
|
-
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
996
|
-
};
|
|
997
|
-
}
|
|
998
|
-
return void 0;
|
|
999
|
-
};
|
|
1000
|
-
var validateLabel = (name) => {
|
|
1001
|
-
if (!name.trim()) {
|
|
1002
|
-
return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
|
|
1003
|
-
}
|
|
1004
|
-
const allowedChars = /^[a-zA-Z0-9_-]+$/;
|
|
1005
|
-
if (!allowedChars.test(name)) {
|
|
1006
|
-
return ERROR_MESSAGES.INVALID_CHARACTERS;
|
|
1007
|
-
}
|
|
1008
|
-
const hasAlphanumeric = /[a-zA-Z0-9]/;
|
|
1009
|
-
if (!hasAlphanumeric.test(name)) {
|
|
1010
|
-
return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
|
|
1011
|
-
}
|
|
1012
|
-
if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
|
|
1013
|
-
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
1014
|
-
}
|
|
1015
|
-
return "";
|
|
1016
|
-
};
|
|
1017
|
-
var labelHint = (name) => {
|
|
1018
|
-
const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
|
|
1019
|
-
if (hintThreshold < name.length) {
|
|
1020
|
-
return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
|
|
1021
|
-
}
|
|
1022
|
-
return "";
|
|
1023
|
-
};
|
|
1024
|
-
var validateValue = (value) => {
|
|
1025
|
-
if (!value.trim()) {
|
|
1026
|
-
return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
|
|
1027
|
-
}
|
|
1028
|
-
return "";
|
|
1029
|
-
};
|
|
1030
|
-
|
|
1031
|
-
// src/components/fields/label-field.tsx
|
|
1032
|
-
import * as React10 from "react";
|
|
1033
|
-
import { useId, useState as useState4 } from "react";
|
|
1034
|
-
import { TextField as TextField2 } from "@elementor/ui";
|
|
1035
|
-
import { __ as __6 } from "@wordpress/i18n";
|
|
1036
|
-
|
|
1037
1096
|
// src/components/ui/form-field.tsx
|
|
1038
|
-
import * as
|
|
1097
|
+
import * as React10 from "react";
|
|
1039
1098
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
1040
1099
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
1041
|
-
return /* @__PURE__ */
|
|
1042
|
-
};
|
|
1043
|
-
|
|
1044
|
-
// src/components/fields/label-field.tsx
|
|
1045
|
-
function isLabelEqual(a, b) {
|
|
1046
|
-
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
1047
|
-
}
|
|
1048
|
-
var useLabelError = (initialError) => {
|
|
1049
|
-
const [error, setError] = useState4(initialError ?? { value: "", message: "" });
|
|
1050
|
-
return {
|
|
1051
|
-
labelFieldError: error,
|
|
1052
|
-
setLabelFieldError: setError
|
|
1053
|
-
};
|
|
1054
|
-
};
|
|
1055
|
-
var LabelField = ({ value, error, onChange }) => {
|
|
1056
|
-
const [label, setLabel] = useState4(value);
|
|
1057
|
-
const [errorMessage, setErrorMessage] = useState4("");
|
|
1058
|
-
const [noticeMessage, setNoticeMessage] = useState4(() => labelHint(value));
|
|
1059
|
-
const handleChange = (newValue) => {
|
|
1060
|
-
setLabel(newValue);
|
|
1061
|
-
const errorMsg2 = validateLabel(newValue);
|
|
1062
|
-
const hintMsg = labelHint(newValue);
|
|
1063
|
-
setErrorMessage(errorMsg2);
|
|
1064
|
-
setNoticeMessage(errorMsg2 ? "" : hintMsg);
|
|
1065
|
-
onChange(isLabelEqual(newValue, error?.value ?? "") || errorMsg2 ? "" : newValue);
|
|
1066
|
-
};
|
|
1067
|
-
const id2 = useId();
|
|
1068
|
-
let errorMsg = errorMessage;
|
|
1069
|
-
if (isLabelEqual(label, error?.value ?? "") && error?.message) {
|
|
1070
|
-
errorMsg = error.message;
|
|
1071
|
-
}
|
|
1072
|
-
const noticeMsg = errorMsg ? "" : noticeMessage;
|
|
1073
|
-
return /* @__PURE__ */ React10.createElement(FormField, { id: id2, label: __6("Name", "elementor"), errorMsg, noticeMsg }, /* @__PURE__ */ React10.createElement(
|
|
1074
|
-
TextField2,
|
|
1075
|
-
{
|
|
1076
|
-
id: id2,
|
|
1077
|
-
size: "tiny",
|
|
1078
|
-
fullWidth: true,
|
|
1079
|
-
value: label,
|
|
1080
|
-
error: !!errorMsg,
|
|
1081
|
-
onChange: (e) => handleChange(e.target.value),
|
|
1082
|
-
inputProps: { maxLength: VARIABLE_LABEL_MAX_LENGTH }
|
|
1083
|
-
}
|
|
1084
|
-
));
|
|
1100
|
+
return /* @__PURE__ */ React10.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React10.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React10.createElement(FormHelperText, null, noticeMsg)));
|
|
1085
1101
|
};
|
|
1086
1102
|
|
|
1087
1103
|
// src/components/variable-creation.tsx
|
|
@@ -1148,21 +1164,37 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1148
1164
|
return /* @__PURE__ */ React11.createElement(PopoverBody, { height: "auto" }, /* @__PURE__ */ React11.createElement(
|
|
1149
1165
|
PopoverHeader,
|
|
1150
1166
|
{
|
|
1151
|
-
icon: /* @__PURE__ */ React11.createElement(React11.Fragment, null, onGoBack && /* @__PURE__ */ React11.createElement(IconButton4, { size: SIZE, "aria-label":
|
|
1152
|
-
title:
|
|
1167
|
+
icon: /* @__PURE__ */ React11.createElement(React11.Fragment, null, onGoBack && /* @__PURE__ */ React11.createElement(IconButton4, { size: SIZE, "aria-label": __6("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React11.createElement(ArrowLeftIcon, { fontSize: SIZE })), /* @__PURE__ */ React11.createElement(VariableIcon, { fontSize: SIZE })),
|
|
1168
|
+
title: __6("Create variable", "elementor"),
|
|
1153
1169
|
onClose: closePopover
|
|
1154
1170
|
}
|
|
1155
1171
|
), /* @__PURE__ */ React11.createElement(Divider2, null), /* @__PURE__ */ React11.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React11.createElement(
|
|
1156
|
-
|
|
1172
|
+
FormField,
|
|
1157
1173
|
{
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1174
|
+
id: "variable-label",
|
|
1175
|
+
label: __6("Name", "elementor"),
|
|
1176
|
+
errorMsg: labelFieldError?.message,
|
|
1177
|
+
noticeMsg: labelHint(label)
|
|
1178
|
+
},
|
|
1179
|
+
/* @__PURE__ */ React11.createElement(
|
|
1180
|
+
LabelField,
|
|
1181
|
+
{
|
|
1182
|
+
id: "variable-label",
|
|
1183
|
+
value: label,
|
|
1184
|
+
error: labelFieldError,
|
|
1185
|
+
onChange: (newValue) => {
|
|
1186
|
+
setLabel(newValue);
|
|
1187
|
+
setErrorMessage("");
|
|
1188
|
+
},
|
|
1189
|
+
onErrorChange: (errorMsg) => {
|
|
1190
|
+
setLabelFieldError({
|
|
1191
|
+
value: label,
|
|
1192
|
+
message: errorMsg
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1163
1195
|
}
|
|
1164
|
-
|
|
1165
|
-
), /* @__PURE__ */ React11.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
1196
|
+
)
|
|
1197
|
+
), /* @__PURE__ */ React11.createElement(FormField, { errorMsg: valueFieldError, label: __6("Value", "elementor") }, /* @__PURE__ */ React11.createElement(Typography2, { variant: "h5" }, /* @__PURE__ */ React11.createElement(
|
|
1166
1198
|
ValueField,
|
|
1167
1199
|
{
|
|
1168
1200
|
value,
|
|
@@ -1174,7 +1206,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1174
1206
|
onValidationChange: setValueFieldError,
|
|
1175
1207
|
propType
|
|
1176
1208
|
}
|
|
1177
|
-
)), errorMessage && /* @__PURE__ */ React11.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React11.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React11.createElement(Button2, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreateAndTrack },
|
|
1209
|
+
))), errorMessage && /* @__PURE__ */ React11.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React11.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React11.createElement(Button2, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreateAndTrack }, __6("Create", "elementor"))));
|
|
1178
1210
|
};
|
|
1179
1211
|
|
|
1180
1212
|
// src/components/variable-edit.tsx
|
|
@@ -1185,8 +1217,8 @@ import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
|
1185
1217
|
import { PopoverBody as PopoverBody2 } from "@elementor/editor-editing-panel";
|
|
1186
1218
|
import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
1187
1219
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
1188
|
-
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5 } from "@elementor/ui";
|
|
1189
|
-
import { __ as
|
|
1220
|
+
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Typography as Typography5 } from "@elementor/ui";
|
|
1221
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
1190
1222
|
|
|
1191
1223
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
1192
1224
|
import * as React12 from "react";
|
|
@@ -1198,9 +1230,9 @@ import {
|
|
|
1198
1230
|
DialogContent,
|
|
1199
1231
|
DialogContentText,
|
|
1200
1232
|
DialogTitle,
|
|
1201
|
-
Typography as
|
|
1233
|
+
Typography as Typography3
|
|
1202
1234
|
} from "@elementor/ui";
|
|
1203
|
-
import { __ as
|
|
1235
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
1204
1236
|
var TITLE_ID = "delete-variable-dialog";
|
|
1205
1237
|
var DeleteConfirmationDialog = ({
|
|
1206
1238
|
open,
|
|
@@ -1208,7 +1240,7 @@ var DeleteConfirmationDialog = ({
|
|
|
1208
1240
|
closeDialog,
|
|
1209
1241
|
onConfirm
|
|
1210
1242
|
}) => {
|
|
1211
|
-
return /* @__PURE__ */ React12.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React12.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React12.createElement(AlertOctagonFilledIcon, { color: "error" }),
|
|
1243
|
+
return /* @__PURE__ */ React12.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React12.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React12.createElement(AlertOctagonFilledIcon, { color: "error" }), __7("Delete this variable?", "elementor")), /* @__PURE__ */ React12.createElement(DialogContent, null, /* @__PURE__ */ React12.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __7("All elements using", "elementor"), /* @__PURE__ */ React12.createElement(Typography3, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), __7("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React12.createElement(DialogActions, null, /* @__PURE__ */ React12.createElement(Button3, { color: "secondary", onClick: closeDialog }, __7("Not now", "elementor")), /* @__PURE__ */ React12.createElement(Button3, { variant: "contained", color: "error", onClick: onConfirm }, __7("Delete", "elementor"))));
|
|
1212
1244
|
};
|
|
1213
1245
|
|
|
1214
1246
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
@@ -1224,9 +1256,9 @@ import {
|
|
|
1224
1256
|
DialogContentText as DialogContentText2,
|
|
1225
1257
|
DialogTitle as DialogTitle2,
|
|
1226
1258
|
FormControlLabel,
|
|
1227
|
-
Typography as
|
|
1259
|
+
Typography as Typography4
|
|
1228
1260
|
} from "@elementor/ui";
|
|
1229
|
-
import { __ as
|
|
1261
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
1230
1262
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
1231
1263
|
var EditConfirmationDialog = ({
|
|
1232
1264
|
closeDialog,
|
|
@@ -1240,7 +1272,7 @@ var EditConfirmationDialog = ({
|
|
|
1240
1272
|
}
|
|
1241
1273
|
onConfirm?.();
|
|
1242
1274
|
};
|
|
1243
|
-
return /* @__PURE__ */ React13.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React13.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React13.createElement(AlertTriangleFilledIcon, { color: "secondary" }),
|
|
1275
|
+
return /* @__PURE__ */ React13.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React13.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React13.createElement(AlertTriangleFilledIcon, { color: "secondary" }), __8("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React13.createElement(DialogContent2, null, /* @__PURE__ */ React13.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __8(
|
|
1244
1276
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
1245
1277
|
"elementor"
|
|
1246
1278
|
))), /* @__PURE__ */ React13.createElement(DialogActions2, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React13.createElement(
|
|
@@ -1254,9 +1286,9 @@ var EditConfirmationDialog = ({
|
|
|
1254
1286
|
size: "small"
|
|
1255
1287
|
}
|
|
1256
1288
|
),
|
|
1257
|
-
label: /* @__PURE__ */ React13.createElement(
|
|
1289
|
+
label: /* @__PURE__ */ React13.createElement(Typography4, { variant: "body2" }, __8("Don't show me again", "elementor"))
|
|
1258
1290
|
}
|
|
1259
|
-
), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(Button4, { color: "secondary", onClick: closeDialog },
|
|
1291
|
+
), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(Button4, { color: "secondary", onClick: closeDialog }, __8("Keep editing", "elementor")), /* @__PURE__ */ React13.createElement(Button4, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __8("Save", "elementor")))));
|
|
1260
1292
|
};
|
|
1261
1293
|
|
|
1262
1294
|
// src/components/variable-edit.tsx
|
|
@@ -1346,7 +1378,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1346
1378
|
{
|
|
1347
1379
|
key: "delete",
|
|
1348
1380
|
size: SIZE2,
|
|
1349
|
-
"aria-label":
|
|
1381
|
+
"aria-label": __9("Delete", "elementor"),
|
|
1350
1382
|
onClick: handleDeleteConfirmation
|
|
1351
1383
|
},
|
|
1352
1384
|
/* @__PURE__ */ React14.createElement(TrashIcon2, { fontSize: SIZE2 })
|
|
@@ -1372,13 +1404,13 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1372
1404
|
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(PopoverBody2, { height: "auto" }, /* @__PURE__ */ React14.createElement(
|
|
1373
1405
|
PopoverHeader2,
|
|
1374
1406
|
{
|
|
1375
|
-
title:
|
|
1407
|
+
title: __9("Edit variable", "elementor"),
|
|
1376
1408
|
onClose,
|
|
1377
1409
|
icon: /* @__PURE__ */ React14.createElement(React14.Fragment, null, onGoBack && /* @__PURE__ */ React14.createElement(
|
|
1378
1410
|
IconButton5,
|
|
1379
1411
|
{
|
|
1380
1412
|
size: SIZE2,
|
|
1381
|
-
"aria-label":
|
|
1413
|
+
"aria-label": __9("Go Back", "elementor"),
|
|
1382
1414
|
onClick: onGoBack
|
|
1383
1415
|
},
|
|
1384
1416
|
/* @__PURE__ */ React14.createElement(ArrowLeftIcon2, { fontSize: SIZE2 })
|
|
@@ -1386,16 +1418,32 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1386
1418
|
actions
|
|
1387
1419
|
}
|
|
1388
1420
|
), /* @__PURE__ */ React14.createElement(Divider3, null), /* @__PURE__ */ React14.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React14.createElement(
|
|
1389
|
-
|
|
1421
|
+
FormField,
|
|
1390
1422
|
{
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1423
|
+
id: "variable-label",
|
|
1424
|
+
label: __9("Name", "elementor"),
|
|
1425
|
+
errorMsg: labelFieldError?.message,
|
|
1426
|
+
noticeMsg: labelHint(label)
|
|
1427
|
+
},
|
|
1428
|
+
/* @__PURE__ */ React14.createElement(
|
|
1429
|
+
LabelField,
|
|
1430
|
+
{
|
|
1431
|
+
id: "variable-label",
|
|
1432
|
+
value: label,
|
|
1433
|
+
error: labelFieldError,
|
|
1434
|
+
onChange: (newValue) => {
|
|
1435
|
+
setLabel(newValue);
|
|
1436
|
+
setErrorMessage("");
|
|
1437
|
+
},
|
|
1438
|
+
onErrorChange: (errorMsg) => {
|
|
1439
|
+
setLabelFieldError({
|
|
1440
|
+
value: label,
|
|
1441
|
+
message: errorMsg
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1396
1444
|
}
|
|
1397
|
-
|
|
1398
|
-
), /* @__PURE__ */ React14.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
1445
|
+
)
|
|
1446
|
+
), /* @__PURE__ */ React14.createElement(FormField, { errorMsg: valueFieldError, label: __9("Value", "elementor") }, /* @__PURE__ */ React14.createElement(Typography5, { variant: "h5" }, /* @__PURE__ */ React14.createElement(
|
|
1399
1447
|
ValueField,
|
|
1400
1448
|
{
|
|
1401
1449
|
value,
|
|
@@ -1407,7 +1455,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1407
1455
|
onValidationChange: setValueFieldError,
|
|
1408
1456
|
propType
|
|
1409
1457
|
}
|
|
1410
|
-
)), errorMessage && /* @__PURE__ */ React14.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React14.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React14.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate },
|
|
1458
|
+
))), errorMessage && /* @__PURE__ */ React14.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React14.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React14.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __9("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React14.createElement(
|
|
1411
1459
|
DeleteConfirmationDialog,
|
|
1412
1460
|
{
|
|
1413
1461
|
open: true,
|
|
@@ -1433,14 +1481,14 @@ import { PopoverBody as PopoverBody3 } from "@elementor/editor-editing-panel";
|
|
|
1433
1481
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, PopoverSearch } from "@elementor/editor-ui";
|
|
1434
1482
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon, SettingsIcon } from "@elementor/icons";
|
|
1435
1483
|
import { Divider as Divider4, IconButton as IconButton7 } from "@elementor/ui";
|
|
1436
|
-
import { __ as
|
|
1484
|
+
import { __ as __13, sprintf } from "@wordpress/i18n";
|
|
1437
1485
|
|
|
1438
1486
|
// src/components/ui/menu-item-content.tsx
|
|
1439
1487
|
import * as React15 from "react";
|
|
1440
1488
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
1441
1489
|
import { EditIcon } from "@elementor/icons";
|
|
1442
|
-
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Typography as
|
|
1443
|
-
import { __ as
|
|
1490
|
+
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Typography as Typography6 } from "@elementor/ui";
|
|
1491
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1444
1492
|
var SIZE3 = "tiny";
|
|
1445
1493
|
var MenuItemContent = ({ item }) => {
|
|
1446
1494
|
const onEdit = item.onEdit;
|
|
@@ -1459,7 +1507,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
1459
1507
|
EllipsisWithTooltip2,
|
|
1460
1508
|
{
|
|
1461
1509
|
title: item.label || item.value,
|
|
1462
|
-
as:
|
|
1510
|
+
as: Typography6,
|
|
1463
1511
|
variant: "caption",
|
|
1464
1512
|
color: "text.primary",
|
|
1465
1513
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
@@ -1470,7 +1518,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
1470
1518
|
EllipsisWithTooltip2,
|
|
1471
1519
|
{
|
|
1472
1520
|
title: item.secondaryText,
|
|
1473
|
-
as:
|
|
1521
|
+
as: Typography6,
|
|
1474
1522
|
variant: "caption",
|
|
1475
1523
|
color: "text.tertiary",
|
|
1476
1524
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
@@ -1485,7 +1533,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
1485
1533
|
e.stopPropagation();
|
|
1486
1534
|
onEdit(item.value);
|
|
1487
1535
|
},
|
|
1488
|
-
"aria-label":
|
|
1536
|
+
"aria-label": __10("Edit", "elementor")
|
|
1489
1537
|
},
|
|
1490
1538
|
/* @__PURE__ */ React15.createElement(EditIcon, { color: "action", fontSize: SIZE3 })
|
|
1491
1539
|
));
|
|
@@ -1493,8 +1541,8 @@ var MenuItemContent = ({ item }) => {
|
|
|
1493
1541
|
|
|
1494
1542
|
// src/components/ui/no-search-results.tsx
|
|
1495
1543
|
import * as React16 from "react";
|
|
1496
|
-
import { Link, Stack as Stack5, Typography as
|
|
1497
|
-
import { __ as
|
|
1544
|
+
import { Link, Stack as Stack5, Typography as Typography7 } from "@elementor/ui";
|
|
1545
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
1498
1546
|
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
1499
1547
|
return /* @__PURE__ */ React16.createElement(
|
|
1500
1548
|
Stack5,
|
|
@@ -1508,15 +1556,15 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
1508
1556
|
sx: { pb: 3.5 }
|
|
1509
1557
|
},
|
|
1510
1558
|
icon,
|
|
1511
|
-
/* @__PURE__ */ React16.createElement(
|
|
1512
|
-
/* @__PURE__ */ React16.createElement(
|
|
1559
|
+
/* @__PURE__ */ React16.createElement(Typography7, { align: "center", variant: "subtitle2" }, __11("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React16.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1560
|
+
/* @__PURE__ */ React16.createElement(Typography7, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __11("Try something else.", "elementor"), /* @__PURE__ */ React16.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __11("Clear & try again", "elementor")))
|
|
1513
1561
|
);
|
|
1514
1562
|
};
|
|
1515
1563
|
|
|
1516
1564
|
// src/components/ui/no-variables.tsx
|
|
1517
1565
|
import * as React17 from "react";
|
|
1518
|
-
import { Button as Button6, Stack as Stack6, Typography as
|
|
1519
|
-
import { __ as
|
|
1566
|
+
import { Button as Button6, Stack as Stack6, Typography as Typography8 } from "@elementor/ui";
|
|
1567
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1520
1568
|
var NoVariables = ({ icon, title, onAdd }) => {
|
|
1521
1569
|
const canAdd = usePermissions().canAdd();
|
|
1522
1570
|
return /* @__PURE__ */ React17.createElement(
|
|
@@ -1533,23 +1581,23 @@ var NoVariables = ({ icon, title, onAdd }) => {
|
|
|
1533
1581
|
canAdd ? /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1534
1582
|
NoVariablesContent,
|
|
1535
1583
|
{
|
|
1536
|
-
title: title ||
|
|
1537
|
-
message:
|
|
1584
|
+
title: title || __12("Create your first variable", "elementor"),
|
|
1585
|
+
message: __12(
|
|
1538
1586
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1539
1587
|
"elementor"
|
|
1540
1588
|
)
|
|
1541
1589
|
}
|
|
1542
|
-
), onAdd && /* @__PURE__ */ React17.createElement(Button6, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd },
|
|
1590
|
+
), onAdd && /* @__PURE__ */ React17.createElement(Button6, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __12("Create a variable", "elementor"))) : /* @__PURE__ */ React17.createElement(
|
|
1543
1591
|
NoVariablesContent,
|
|
1544
1592
|
{
|
|
1545
|
-
title:
|
|
1546
|
-
message:
|
|
1593
|
+
title: __12("There are no variables", "elementor"),
|
|
1594
|
+
message: __12("With your current role, you can only connect and detach variables.", "elementor")
|
|
1547
1595
|
}
|
|
1548
1596
|
)
|
|
1549
1597
|
);
|
|
1550
1598
|
};
|
|
1551
1599
|
function NoVariablesContent({ title, message }) {
|
|
1552
|
-
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1600
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(Typography8, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React17.createElement(Typography8, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
1553
1601
|
}
|
|
1554
1602
|
|
|
1555
1603
|
// src/components/ui/styled-menu-list.tsx
|
|
@@ -1640,13 +1688,13 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1640
1688
|
};
|
|
1641
1689
|
const noVariableTitle = sprintf(
|
|
1642
1690
|
/* translators: %s: Variable Type. */
|
|
1643
|
-
|
|
1691
|
+
__13("Create your first %s variable", "elementor"),
|
|
1644
1692
|
variableType
|
|
1645
1693
|
);
|
|
1646
1694
|
return /* @__PURE__ */ React18.createElement(PopoverBody3, null, /* @__PURE__ */ React18.createElement(
|
|
1647
1695
|
PopoverHeader3,
|
|
1648
1696
|
{
|
|
1649
|
-
title:
|
|
1697
|
+
title: __13("Variables", "elementor"),
|
|
1650
1698
|
icon: /* @__PURE__ */ React18.createElement(ColorFilterIcon2, { fontSize: SIZE4 }),
|
|
1651
1699
|
onClose: closePopover,
|
|
1652
1700
|
actions
|
|
@@ -1656,7 +1704,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1656
1704
|
{
|
|
1657
1705
|
value: searchValue,
|
|
1658
1706
|
onSearch: handleSearch,
|
|
1659
|
-
placeholder:
|
|
1707
|
+
placeholder: __13("Search", "elementor")
|
|
1660
1708
|
}
|
|
1661
1709
|
), /* @__PURE__ */ React18.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React18.createElement(
|
|
1662
1710
|
PopoverMenuList,
|
|
@@ -1767,14 +1815,14 @@ function RenderView(props) {
|
|
|
1767
1815
|
// src/components/ui/tags/assigned-tag.tsx
|
|
1768
1816
|
import * as React20 from "react";
|
|
1769
1817
|
import { DetachIcon } from "@elementor/icons";
|
|
1770
|
-
import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip, Typography as
|
|
1771
|
-
import { __ as
|
|
1818
|
+
import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip, Typography as Typography9, UnstableTag as Tag } from "@elementor/ui";
|
|
1819
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
1772
1820
|
var SIZE5 = "tiny";
|
|
1773
1821
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
1774
1822
|
const actions = [];
|
|
1775
1823
|
if (onUnlink) {
|
|
1776
1824
|
actions.push(
|
|
1777
|
-
/* @__PURE__ */ React20.createElement(IconButton8, { key: "unlink", size: SIZE5, onClick: onUnlink, "aria-label":
|
|
1825
|
+
/* @__PURE__ */ React20.createElement(IconButton8, { key: "unlink", size: SIZE5, onClick: onUnlink, "aria-label": __14("Unlink", "elementor") }, /* @__PURE__ */ React20.createElement(DetachIcon, { fontSize: SIZE5 }))
|
|
1778
1826
|
);
|
|
1779
1827
|
}
|
|
1780
1828
|
return /* @__PURE__ */ React20.createElement(Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React20.createElement(
|
|
@@ -1783,7 +1831,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
1783
1831
|
fullWidth: true,
|
|
1784
1832
|
showActionsOnHover: true,
|
|
1785
1833
|
startIcon: /* @__PURE__ */ React20.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
1786
|
-
label: /* @__PURE__ */ React20.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React20.createElement(
|
|
1834
|
+
label: /* @__PURE__ */ React20.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React20.createElement(Typography9, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
1787
1835
|
actions,
|
|
1788
1836
|
...props
|
|
1789
1837
|
}
|
|
@@ -1795,7 +1843,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1795
1843
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
1796
1844
|
const { setValue } = useBoundProp6();
|
|
1797
1845
|
const anchorRef = useRef(null);
|
|
1798
|
-
const popupId =
|
|
1846
|
+
const popupId = useId();
|
|
1799
1847
|
const popupState = usePopupState2({
|
|
1800
1848
|
variant: "popover",
|
|
1801
1849
|
popupId: `elementor-variables-list-${popupId}`
|
|
@@ -1835,7 +1883,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
1835
1883
|
|
|
1836
1884
|
// src/components/ui/variable/deleted-variable.tsx
|
|
1837
1885
|
import * as React25 from "react";
|
|
1838
|
-
import { useId as
|
|
1886
|
+
import { useId as useId2, useRef as useRef2, useState as useState11 } from "react";
|
|
1839
1887
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
|
|
1840
1888
|
import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip, Popover as Popover2, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1841
1889
|
|
|
@@ -1845,8 +1893,8 @@ import { useState as useState10 } from "react";
|
|
|
1845
1893
|
import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
1846
1894
|
import { PopoverBody as PopoverBody4 } from "@elementor/editor-editing-panel";
|
|
1847
1895
|
import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
|
|
1848
|
-
import { Button as Button7, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4 } from "@elementor/ui";
|
|
1849
|
-
import { __ as
|
|
1896
|
+
import { Button as Button7, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography10 } from "@elementor/ui";
|
|
1897
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
1850
1898
|
var SIZE6 = "tiny";
|
|
1851
1899
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
1852
1900
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
@@ -1901,20 +1949,36 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1901
1949
|
PopoverHeader4,
|
|
1902
1950
|
{
|
|
1903
1951
|
icon: /* @__PURE__ */ React22.createElement(VariableIcon, { fontSize: SIZE6 }),
|
|
1904
|
-
title:
|
|
1952
|
+
title: __15("Restore variable", "elementor"),
|
|
1905
1953
|
onClose
|
|
1906
1954
|
}
|
|
1907
1955
|
), /* @__PURE__ */ React22.createElement(Divider5, null), /* @__PURE__ */ React22.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React22.createElement(
|
|
1908
|
-
|
|
1956
|
+
FormField,
|
|
1909
1957
|
{
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1958
|
+
id: "variable-label",
|
|
1959
|
+
label: __15("Name", "elementor"),
|
|
1960
|
+
errorMsg: labelFieldError?.message,
|
|
1961
|
+
noticeMsg: labelHint(label)
|
|
1962
|
+
},
|
|
1963
|
+
/* @__PURE__ */ React22.createElement(
|
|
1964
|
+
LabelField,
|
|
1965
|
+
{
|
|
1966
|
+
id: "variable-label",
|
|
1967
|
+
value: label,
|
|
1968
|
+
error: labelFieldError,
|
|
1969
|
+
onChange: (newValue) => {
|
|
1970
|
+
setLabel(newValue);
|
|
1971
|
+
setErrorMessage("");
|
|
1972
|
+
},
|
|
1973
|
+
onErrorChange: (errorMsg) => {
|
|
1974
|
+
setLabelFieldError({
|
|
1975
|
+
value: label,
|
|
1976
|
+
message: errorMsg
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1915
1979
|
}
|
|
1916
|
-
|
|
1917
|
-
), /* @__PURE__ */ React22.createElement(FormField, { errorMsg: valueFieldError, label:
|
|
1980
|
+
)
|
|
1981
|
+
), /* @__PURE__ */ React22.createElement(FormField, { errorMsg: valueFieldError, label: __15("Value", "elementor") }, /* @__PURE__ */ React22.createElement(Typography10, { variant: "h5" }, /* @__PURE__ */ React22.createElement(
|
|
1918
1982
|
ValueField,
|
|
1919
1983
|
{
|
|
1920
1984
|
value,
|
|
@@ -1926,14 +1990,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
1926
1990
|
onValidationChange: setValueFieldError,
|
|
1927
1991
|
propType
|
|
1928
1992
|
}
|
|
1929
|
-
)), errorMessage && /* @__PURE__ */ React22.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React22.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React22.createElement(Button7, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore },
|
|
1993
|
+
))), errorMessage && /* @__PURE__ */ React22.createElement(FormHelperText4, { error: true }, errorMessage)), /* @__PURE__ */ React22.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React22.createElement(Button7, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, __15("Restore", "elementor")))));
|
|
1930
1994
|
};
|
|
1931
1995
|
|
|
1932
1996
|
// src/components/ui/deleted-variable-alert.tsx
|
|
1933
1997
|
import * as React23 from "react";
|
|
1934
1998
|
import { useSectionWidth } from "@elementor/editor-editing-panel";
|
|
1935
1999
|
import { Alert as Alert2, AlertAction, AlertTitle, ClickAwayListener as ClickAwayListener2 } from "@elementor/ui";
|
|
1936
|
-
import { __ as
|
|
2000
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
1937
2001
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
1938
2002
|
const sectionWidth = useSectionWidth();
|
|
1939
2003
|
return /* @__PURE__ */ React23.createElement(ClickAwayListener2, { onClickAway: onClose }, /* @__PURE__ */ React23.createElement(
|
|
@@ -1942,16 +2006,16 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
1942
2006
|
variant: "standard",
|
|
1943
2007
|
severity: "warning",
|
|
1944
2008
|
onClose,
|
|
1945
|
-
action: /* @__PURE__ */ React23.createElement(React23.Fragment, null, onUnlink && /* @__PURE__ */ React23.createElement(AlertAction, { variant: "contained", onClick: onUnlink },
|
|
2009
|
+
action: /* @__PURE__ */ React23.createElement(React23.Fragment, null, onUnlink && /* @__PURE__ */ React23.createElement(AlertAction, { variant: "contained", onClick: onUnlink }, __16("Unlink", "elementor")), onRestore && /* @__PURE__ */ React23.createElement(AlertAction, { variant: "outlined", onClick: onRestore }, __16("Restore", "elementor"))),
|
|
1946
2010
|
sx: { width: sectionWidth }
|
|
1947
2011
|
},
|
|
1948
|
-
/* @__PURE__ */ React23.createElement(AlertTitle, null,
|
|
1949
|
-
|
|
2012
|
+
/* @__PURE__ */ React23.createElement(AlertTitle, null, __16("Deleted variable", "elementor")),
|
|
2013
|
+
__16("The variable", "elementor"),
|
|
1950
2014
|
" '",
|
|
1951
2015
|
label,
|
|
1952
2016
|
"'",
|
|
1953
2017
|
" ",
|
|
1954
|
-
|
|
2018
|
+
__16(
|
|
1955
2019
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
1956
2020
|
"elementor"
|
|
1957
2021
|
)
|
|
@@ -1961,8 +2025,8 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
1961
2025
|
// src/components/ui/tags/deleted-tag.tsx
|
|
1962
2026
|
import * as React24 from "react";
|
|
1963
2027
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon2 } from "@elementor/icons";
|
|
1964
|
-
import { Box as Box6, Chip, Tooltip as Tooltip2, Typography as
|
|
1965
|
-
import { __ as
|
|
2028
|
+
import { Box as Box6, Chip, Tooltip as Tooltip2, Typography as Typography11 } from "@elementor/ui";
|
|
2029
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
1966
2030
|
var DeletedTag = React24.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
1967
2031
|
return /* @__PURE__ */ React24.createElement(
|
|
1968
2032
|
Chip,
|
|
@@ -1974,7 +2038,7 @@ var DeletedTag = React24.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
1974
2038
|
variant: "standard",
|
|
1975
2039
|
onClick,
|
|
1976
2040
|
icon: /* @__PURE__ */ React24.createElement(AlertTriangleFilledIcon2, null),
|
|
1977
|
-
label: /* @__PURE__ */ React24.createElement(Tooltip2, { title: label, placement: "top" }, /* @__PURE__ */ React24.createElement(Box6, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React24.createElement(
|
|
2041
|
+
label: /* @__PURE__ */ React24.createElement(Tooltip2, { title: label, placement: "top" }, /* @__PURE__ */ React24.createElement(Box6, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React24.createElement(Typography11, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React24.createElement(Typography11, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", __17("deleted", "elementor"), ")"))),
|
|
1978
2042
|
sx: {
|
|
1979
2043
|
height: (theme) => theme.spacing(3.5),
|
|
1980
2044
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -1995,7 +2059,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
1995
2059
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
1996
2060
|
const closeInfotip = () => setShowInfotip(false);
|
|
1997
2061
|
const deletedChipAnchorRef = useRef2(null);
|
|
1998
|
-
const popupId =
|
|
2062
|
+
const popupId = useId2();
|
|
1999
2063
|
const popupState = usePopupState3({
|
|
2000
2064
|
variant: "popover",
|
|
2001
2065
|
popupId: `elementor-variables-restore-${popupId}`
|
|
@@ -2075,7 +2139,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2075
2139
|
|
|
2076
2140
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2077
2141
|
import * as React28 from "react";
|
|
2078
|
-
import { useId as
|
|
2142
|
+
import { useId as useId3, useRef as useRef3, useState as useState12 } from "react";
|
|
2079
2143
|
import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
|
|
2080
2144
|
import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box9, Infotip as Infotip2, Popover as Popover3, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2081
2145
|
|
|
@@ -2083,16 +2147,16 @@ import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box9, Infoti
|
|
|
2083
2147
|
import * as React26 from "react";
|
|
2084
2148
|
import { useSectionWidth as useSectionWidth2 } from "@elementor/editor-editing-panel";
|
|
2085
2149
|
import { Alert as Alert3, AlertAction as AlertAction2, AlertTitle as AlertTitle2, ClickAwayListener as ClickAwayListener3 } from "@elementor/ui";
|
|
2086
|
-
import { __ as
|
|
2150
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
2087
2151
|
var i18n = {
|
|
2088
|
-
title:
|
|
2089
|
-
message:
|
|
2152
|
+
title: __18("Variable has changed", "elementor"),
|
|
2153
|
+
message: __18(
|
|
2090
2154
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
2091
2155
|
"elementor"
|
|
2092
2156
|
),
|
|
2093
2157
|
buttons: {
|
|
2094
|
-
clear:
|
|
2095
|
-
select:
|
|
2158
|
+
clear: __18("Clear", "elementor"),
|
|
2159
|
+
select: __18("Select variable", "elementor")
|
|
2096
2160
|
}
|
|
2097
2161
|
};
|
|
2098
2162
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
@@ -2117,8 +2181,8 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
|
2117
2181
|
// src/components/ui/tags/mismatch-tag.tsx
|
|
2118
2182
|
import * as React27 from "react";
|
|
2119
2183
|
import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
|
|
2120
|
-
import { Box as Box8, Chip as Chip2, Tooltip as Tooltip3, Typography as
|
|
2121
|
-
import { __ as
|
|
2184
|
+
import { Box as Box8, Chip as Chip2, Tooltip as Tooltip3, Typography as Typography12 } from "@elementor/ui";
|
|
2185
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2122
2186
|
var MismatchTag = React27.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
2123
2187
|
return /* @__PURE__ */ React27.createElement(
|
|
2124
2188
|
Chip2,
|
|
@@ -2130,7 +2194,7 @@ var MismatchTag = React27.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
2130
2194
|
variant: "standard",
|
|
2131
2195
|
onClick,
|
|
2132
2196
|
icon: /* @__PURE__ */ React27.createElement(AlertTriangleFilledIcon3, null),
|
|
2133
|
-
label: /* @__PURE__ */ React27.createElement(Tooltip3, { title: label, placement: "top" }, /* @__PURE__ */ React27.createElement(Box8, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React27.createElement(
|
|
2197
|
+
label: /* @__PURE__ */ React27.createElement(Tooltip3, { title: label, placement: "top" }, /* @__PURE__ */ React27.createElement(Box8, { sx: { display: "flex", gap: 0.5, alignItems: "center" } }, /* @__PURE__ */ React27.createElement(Typography12, { variant: "caption", noWrap: true }, label), /* @__PURE__ */ React27.createElement(Typography12, { variant: "caption", noWrap: true, sx: { textOverflow: "initial", overflow: "visible" } }, "(", __19("changed", "elementor"), ")"))),
|
|
2134
2198
|
sx: {
|
|
2135
2199
|
height: (theme) => theme.spacing(3.5),
|
|
2136
2200
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -2146,7 +2210,7 @@ var MismatchTag = React27.forwardRef(({ label, onClick, ...props }, ref) => {
|
|
|
2146
2210
|
var MismatchVariable = ({ variable }) => {
|
|
2147
2211
|
const { setValue } = useBoundProp9();
|
|
2148
2212
|
const anchorRef = useRef3(null);
|
|
2149
|
-
const popupId =
|
|
2213
|
+
const popupId = useId3();
|
|
2150
2214
|
const popupState = usePopupState4({
|
|
2151
2215
|
variant: "popover",
|
|
2152
2216
|
popupId: `elementor-variables-list-${popupId}`
|
|
@@ -2219,13 +2283,13 @@ import * as React31 from "react";
|
|
|
2219
2283
|
import { useState as useState13 } from "react";
|
|
2220
2284
|
import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
|
|
2221
2285
|
import { Backdrop as Backdrop3, Infotip as Infotip3 } from "@elementor/ui";
|
|
2222
|
-
import { __ as
|
|
2286
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
2223
2287
|
|
|
2224
2288
|
// src/components/ui/missing-variable-alert.tsx
|
|
2225
2289
|
import * as React29 from "react";
|
|
2226
2290
|
import { useSectionWidth as useSectionWidth3 } from "@elementor/editor-editing-panel";
|
|
2227
2291
|
import { Alert as Alert4, AlertAction as AlertAction3, AlertTitle as AlertTitle3, ClickAwayListener as ClickAwayListener4 } from "@elementor/ui";
|
|
2228
|
-
import { __ as
|
|
2292
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2229
2293
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
2230
2294
|
const sectionWidth = useSectionWidth3();
|
|
2231
2295
|
return /* @__PURE__ */ React29.createElement(ClickAwayListener4, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
@@ -2234,11 +2298,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
2234
2298
|
variant: "standard",
|
|
2235
2299
|
severity: "warning",
|
|
2236
2300
|
onClose,
|
|
2237
|
-
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "contained", onClick: onClear },
|
|
2301
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(AlertAction3, { variant: "contained", onClick: onClear }, __20("Clear", "elementor"))),
|
|
2238
2302
|
sx: { width: sectionWidth }
|
|
2239
2303
|
},
|
|
2240
|
-
/* @__PURE__ */ React29.createElement(AlertTitle3, null,
|
|
2241
|
-
|
|
2304
|
+
/* @__PURE__ */ React29.createElement(AlertTitle3, null, __20("This variable is missing", "elementor")),
|
|
2305
|
+
__20(
|
|
2242
2306
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
2243
2307
|
"elementor"
|
|
2244
2308
|
)
|
|
@@ -2299,7 +2363,7 @@ var MissingVariable = () => {
|
|
|
2299
2363
|
}
|
|
2300
2364
|
}
|
|
2301
2365
|
},
|
|
2302
|
-
/* @__PURE__ */ React31.createElement(MissingTag, { label:
|
|
2366
|
+
/* @__PURE__ */ React31.createElement(MissingTag, { label: __21("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
2303
2367
|
));
|
|
2304
2368
|
};
|
|
2305
2369
|
|
|
@@ -2326,14 +2390,14 @@ var VariableControl = () => {
|
|
|
2326
2390
|
import * as React33 from "react";
|
|
2327
2391
|
import { useBoundProp as useBoundProp12 } from "@elementor/editor-editing-panel";
|
|
2328
2392
|
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
2329
|
-
import { __ as
|
|
2393
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2330
2394
|
var usePropVariableAction = () => {
|
|
2331
2395
|
const { propType, path } = useBoundProp12();
|
|
2332
2396
|
const variable = resolveVariableFromPropType(propType);
|
|
2333
2397
|
return {
|
|
2334
2398
|
visible: Boolean(variable),
|
|
2335
2399
|
icon: ColorFilterIcon4,
|
|
2336
|
-
title:
|
|
2400
|
+
title: __22("Variables", "elementor"),
|
|
2337
2401
|
content: ({ close: closePopover }) => {
|
|
2338
2402
|
if (!variable) {
|
|
2339
2403
|
return null;
|
|
@@ -2396,7 +2460,15 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
2396
2460
|
colorPicker: {
|
|
2397
2461
|
anchorEl: anchorRef,
|
|
2398
2462
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
2399
|
-
transformOrigin: { vertical: "top", horizontal: -10 }
|
|
2463
|
+
transformOrigin: { vertical: "top", horizontal: -10 },
|
|
2464
|
+
slotProps: {
|
|
2465
|
+
colorIndicator: {
|
|
2466
|
+
size: "inherit",
|
|
2467
|
+
sx: {
|
|
2468
|
+
borderRadius: 0.5
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2400
2472
|
}
|
|
2401
2473
|
}
|
|
2402
2474
|
}
|
|
@@ -2405,12 +2477,12 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
2405
2477
|
|
|
2406
2478
|
// src/components/fields/font-field.tsx
|
|
2407
2479
|
import * as React35 from "react";
|
|
2408
|
-
import { useId as
|
|
2480
|
+
import { useId as useId4, useRef as useRef5, useState as useState15 } from "react";
|
|
2409
2481
|
import { enqueueFont as enqueueFont2, ItemSelector } from "@elementor/editor-controls";
|
|
2410
2482
|
import { useFontFamilies, useSectionWidth as useSectionWidth4 } from "@elementor/editor-editing-panel";
|
|
2411
2483
|
import { ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
2412
2484
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger3, Popover as Popover4, UnstableTag, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
2413
|
-
import { __ as
|
|
2485
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
2414
2486
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
2415
2487
|
const [fontFamily, setFontFamily] = useState15(value);
|
|
2416
2488
|
const defaultRef = useRef5(null);
|
|
@@ -2434,7 +2506,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
2434
2506
|
handleChange(newFontFamily);
|
|
2435
2507
|
fontPopoverState.close();
|
|
2436
2508
|
};
|
|
2437
|
-
const id2 =
|
|
2509
|
+
const id2 = useId4();
|
|
2438
2510
|
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, /* @__PURE__ */ React35.createElement(
|
|
2439
2511
|
UnstableTag,
|
|
2440
2512
|
{
|
|
@@ -2463,7 +2535,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
2463
2535
|
onItemChange: handleFontFamilyChange,
|
|
2464
2536
|
onClose: fontPopoverState.close,
|
|
2465
2537
|
sectionWidth,
|
|
2466
|
-
title:
|
|
2538
|
+
title: __23("Font Family", "elementor"),
|
|
2467
2539
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
2468
2540
|
onDebounce: enqueueFont2,
|
|
2469
2541
|
icon: TextIcon
|