@elementor/editor-variables 3.33.0-124 → 3.33.0-126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +682 -496
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +606 -420
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -12
- package/src/components/fields/label-field.tsx +6 -1
- package/src/components/variables-manager/variable-editable-cell.tsx +31 -8
- package/src/components/variables-manager/variables-manager-create-menu.tsx +110 -0
- package/src/components/variables-manager/variables-manager-panel.tsx +64 -35
- package/src/components/variables-manager/variables-manager-table.tsx +49 -5
- package/src/register-variable-types.tsx +2 -0
- package/src/service.ts +8 -0
- package/src/utils/tracking.ts +7 -22
- package/src/variables-registry/create-variable-type-registry.ts +8 -0
- package/src/variables-registry/variable-type-registry.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -43,14 +43,73 @@ var import_editor_panels2 = require("@elementor/editor-panels");
|
|
|
43
43
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
44
44
|
|
|
45
45
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
46
|
-
var
|
|
47
|
-
var
|
|
46
|
+
var React10 = __toESM(require("react"));
|
|
47
|
+
var import_react8 = require("react");
|
|
48
48
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
49
49
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
50
50
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
51
|
+
var import_icons5 = require("@elementor/icons");
|
|
52
|
+
var import_ui10 = require("@elementor/ui");
|
|
53
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
54
|
+
|
|
55
|
+
// src/batch-operations.ts
|
|
56
|
+
var generateTempId = () => {
|
|
57
|
+
const timestamp = Date.now().toString(36);
|
|
58
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
59
|
+
return `tmp-${timestamp}-${random}`;
|
|
60
|
+
};
|
|
61
|
+
var isTempId = (id2) => {
|
|
62
|
+
return id2.startsWith("tmp-");
|
|
63
|
+
};
|
|
64
|
+
var buildOperationsArray = (originalVariables, currentVariables) => {
|
|
65
|
+
const operations = [];
|
|
66
|
+
Object.entries(currentVariables).forEach(([id2, variable]) => {
|
|
67
|
+
if (isTempId(id2)) {
|
|
68
|
+
operations.push({
|
|
69
|
+
type: "create",
|
|
70
|
+
variable: {
|
|
71
|
+
...variable,
|
|
72
|
+
id: id2
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} else if (originalVariables[id2]) {
|
|
76
|
+
const original = originalVariables[id2];
|
|
77
|
+
if (original.deleted && !variable.deleted) {
|
|
78
|
+
operations.push({
|
|
79
|
+
type: "restore",
|
|
80
|
+
id: id2,
|
|
81
|
+
...original.label !== variable.label && { label: variable.label },
|
|
82
|
+
...original.value !== variable.value && { value: variable.value }
|
|
83
|
+
});
|
|
84
|
+
} else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value)) {
|
|
85
|
+
operations.push({
|
|
86
|
+
type: "update",
|
|
87
|
+
id: id2,
|
|
88
|
+
variable: {
|
|
89
|
+
...original.label !== variable.label && { label: variable.label },
|
|
90
|
+
...original.value !== variable.value && { value: variable.value }
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.entries(originalVariables).forEach(([id2, variable]) => {
|
|
97
|
+
if (isTempId(id2) || variable.deleted) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const currentVariable = currentVariables[id2];
|
|
101
|
+
if (!currentVariable || currentVariable.deleted) {
|
|
102
|
+
operations.push({
|
|
103
|
+
type: "delete",
|
|
104
|
+
id: id2
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return operations.filter((op) => {
|
|
109
|
+
const id2 = op.id || op.variable?.id;
|
|
110
|
+
return id2 && !(isTempId(id2) && currentVariables[id2]?.deleted);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
54
113
|
|
|
55
114
|
// src/hooks/use-prop-variables.ts
|
|
56
115
|
var import_react2 = require("react");
|
|
@@ -124,60 +183,6 @@ var apiClient = {
|
|
|
124
183
|
}
|
|
125
184
|
};
|
|
126
185
|
|
|
127
|
-
// src/batch-operations.ts
|
|
128
|
-
var isTempId = (id2) => {
|
|
129
|
-
return id2.startsWith("tmp-");
|
|
130
|
-
};
|
|
131
|
-
var buildOperationsArray = (originalVariables, currentVariables) => {
|
|
132
|
-
const operations = [];
|
|
133
|
-
Object.entries(currentVariables).forEach(([id2, variable]) => {
|
|
134
|
-
if (isTempId(id2)) {
|
|
135
|
-
operations.push({
|
|
136
|
-
type: "create",
|
|
137
|
-
variable: {
|
|
138
|
-
...variable,
|
|
139
|
-
id: id2
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
} else if (originalVariables[id2]) {
|
|
143
|
-
const original = originalVariables[id2];
|
|
144
|
-
if (original.deleted && !variable.deleted) {
|
|
145
|
-
operations.push({
|
|
146
|
-
type: "restore",
|
|
147
|
-
id: id2,
|
|
148
|
-
...original.label !== variable.label && { label: variable.label },
|
|
149
|
-
...original.value !== variable.value && { value: variable.value }
|
|
150
|
-
});
|
|
151
|
-
} else if (!variable.deleted && (original.label !== variable.label || original.value !== variable.value)) {
|
|
152
|
-
operations.push({
|
|
153
|
-
type: "update",
|
|
154
|
-
id: id2,
|
|
155
|
-
variable: {
|
|
156
|
-
...original.label !== variable.label && { label: variable.label },
|
|
157
|
-
...original.value !== variable.value && { value: variable.value }
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
Object.entries(originalVariables).forEach(([id2, variable]) => {
|
|
164
|
-
if (isTempId(id2) || variable.deleted) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const currentVariable = currentVariables[id2];
|
|
168
|
-
if (!currentVariable || currentVariable.deleted) {
|
|
169
|
-
operations.push({
|
|
170
|
-
type: "delete",
|
|
171
|
-
id: id2
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
return operations.filter((op) => {
|
|
176
|
-
const id2 = op.id || op.variable?.id;
|
|
177
|
-
return id2 && !(isTempId(id2) && currentVariables[id2]?.deleted);
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
|
|
181
186
|
// src/storage.ts
|
|
182
187
|
var STORAGE_KEY = "elementor-global-variables";
|
|
183
188
|
var STORAGE_WATERMARK_KEY = "elementor-global-variables-watermark";
|
|
@@ -427,6 +432,13 @@ var service = {
|
|
|
427
432
|
batchSave: (originalVariables, currentVariables) => {
|
|
428
433
|
const operations = buildOperationsArray(originalVariables, currentVariables);
|
|
429
434
|
const batchPayload = { operations, watermark: storage.state.watermark };
|
|
435
|
+
if (operations.length === 0) {
|
|
436
|
+
return Promise.resolve({
|
|
437
|
+
success: true,
|
|
438
|
+
watermark: storage.state.watermark,
|
|
439
|
+
operations: 0
|
|
440
|
+
});
|
|
441
|
+
}
|
|
430
442
|
return apiClient.batch(batchPayload).then((response) => {
|
|
431
443
|
const { success, data: payload } = response.data;
|
|
432
444
|
if (!success) {
|
|
@@ -516,6 +528,7 @@ function createVariableTypeRegistry() {
|
|
|
516
528
|
valueField,
|
|
517
529
|
propTypeUtil,
|
|
518
530
|
variableType,
|
|
531
|
+
defaultValue,
|
|
519
532
|
selectionFilter,
|
|
520
533
|
valueTransformer,
|
|
521
534
|
fallbackPropTypeUtil,
|
|
@@ -540,6 +553,7 @@ function createVariableTypeRegistry() {
|
|
|
540
553
|
valueField,
|
|
541
554
|
propTypeUtil,
|
|
542
555
|
variableType,
|
|
556
|
+
defaultValue,
|
|
543
557
|
selectionFilter,
|
|
544
558
|
valueTransformer,
|
|
545
559
|
fallbackPropTypeUtil,
|
|
@@ -557,18 +571,22 @@ function createVariableTypeRegistry() {
|
|
|
557
571
|
const getVariableType2 = (key) => {
|
|
558
572
|
return variableTypes[key];
|
|
559
573
|
};
|
|
574
|
+
const getVariableTypes2 = () => {
|
|
575
|
+
return variableTypes;
|
|
576
|
+
};
|
|
560
577
|
const hasVariableType2 = (key) => {
|
|
561
578
|
return key in variableTypes;
|
|
562
579
|
};
|
|
563
580
|
return {
|
|
564
581
|
registerVariableType: registerVariableType2,
|
|
565
582
|
getVariableType: getVariableType2,
|
|
583
|
+
getVariableTypes: getVariableTypes2,
|
|
566
584
|
hasVariableType: hasVariableType2
|
|
567
585
|
};
|
|
568
586
|
}
|
|
569
587
|
|
|
570
588
|
// src/variables-registry/variable-type-registry.ts
|
|
571
|
-
var { registerVariableType, getVariableType, hasVariableType } = createVariableTypeRegistry();
|
|
589
|
+
var { registerVariableType, getVariableType, getVariableTypes, hasVariableType } = createVariableTypeRegistry();
|
|
572
590
|
|
|
573
591
|
// src/context/variable-type-context.tsx
|
|
574
592
|
var VariableTypeContext = (0, import_react.createContext)(null);
|
|
@@ -661,29 +679,116 @@ var DeleteConfirmationDialog = ({
|
|
|
661
679
|
return /* @__PURE__ */ React3.createElement(import_ui3.Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React3.createElement(import_ui3.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React3.createElement(import_icons.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n3.__)("Delete this variable?", "elementor")), /* @__PURE__ */ React3.createElement(import_ui3.DialogContent, null, /* @__PURE__ */ React3.createElement(import_ui3.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n3.__)("All elements using", "elementor"), "\xA0", /* @__PURE__ */ React3.createElement(import_ui3.Typography, { variant: "subtitle2", component: "span", sx: { lineBreak: "anywhere" } }, label), "\xA0", (0, import_i18n3.__)("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React3.createElement(import_ui3.DialogActions, null, /* @__PURE__ */ React3.createElement(import_ui3.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n3.__)("Not now", "elementor")), /* @__PURE__ */ React3.createElement(import_ui3.Button, { variant: "contained", color: "error", onClick: onConfirm }, (0, import_i18n3.__)("Delete", "elementor"))));
|
|
662
680
|
};
|
|
663
681
|
|
|
682
|
+
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
683
|
+
var React4 = __toESM(require("react"));
|
|
684
|
+
var import_react3 = require("react");
|
|
685
|
+
var import_icons2 = require("@elementor/icons");
|
|
686
|
+
var import_ui4 = require("@elementor/ui");
|
|
687
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
688
|
+
var SIZE = "tiny";
|
|
689
|
+
var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
690
|
+
const menuState = (0, import_ui4.usePopupState)({
|
|
691
|
+
variant: "popover"
|
|
692
|
+
});
|
|
693
|
+
const variableTypes = getVariableTypes();
|
|
694
|
+
const menuOptions = Object.entries(variableTypes).map(([key, variable]) => {
|
|
695
|
+
const displayName = variable.variableType.charAt(0).toUpperCase() + variable.variableType.slice(1);
|
|
696
|
+
return {
|
|
697
|
+
key,
|
|
698
|
+
name: displayName,
|
|
699
|
+
icon: variable.icon,
|
|
700
|
+
onClick: () => {
|
|
701
|
+
const defaultName = getDefaultName(variables, key, variable.variableType);
|
|
702
|
+
onCreate(key, defaultName, variable.defaultValue || "");
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
});
|
|
706
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
707
|
+
import_ui4.IconButton,
|
|
708
|
+
{
|
|
709
|
+
...(0, import_ui4.bindTrigger)(menuState),
|
|
710
|
+
disabled,
|
|
711
|
+
size: SIZE,
|
|
712
|
+
"aria-label": (0, import_i18n4.__)("Add variable", "elementor")
|
|
713
|
+
},
|
|
714
|
+
/* @__PURE__ */ React4.createElement(import_icons2.PlusIcon, { fontSize: SIZE })
|
|
715
|
+
), /* @__PURE__ */ React4.createElement(
|
|
716
|
+
import_ui4.Menu,
|
|
717
|
+
{
|
|
718
|
+
disablePortal: true,
|
|
719
|
+
MenuListProps: {
|
|
720
|
+
dense: true
|
|
721
|
+
},
|
|
722
|
+
PaperProps: {
|
|
723
|
+
elevation: 6
|
|
724
|
+
},
|
|
725
|
+
...(0, import_ui4.bindMenu)(menuState),
|
|
726
|
+
anchorEl: menuState.anchorEl,
|
|
727
|
+
anchorOrigin: {
|
|
728
|
+
vertical: "bottom",
|
|
729
|
+
horizontal: "right"
|
|
730
|
+
},
|
|
731
|
+
transformOrigin: {
|
|
732
|
+
vertical: "top",
|
|
733
|
+
horizontal: "right"
|
|
734
|
+
},
|
|
735
|
+
open: menuState.isOpen,
|
|
736
|
+
onClose: menuState.close
|
|
737
|
+
},
|
|
738
|
+
menuOptions.map((option) => /* @__PURE__ */ React4.createElement(
|
|
739
|
+
import_ui4.MenuItem,
|
|
740
|
+
{
|
|
741
|
+
key: option.key,
|
|
742
|
+
onClick: () => {
|
|
743
|
+
option.onClick?.();
|
|
744
|
+
menuState.close();
|
|
745
|
+
},
|
|
746
|
+
sx: {
|
|
747
|
+
gap: 1.5
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
(0, import_react3.createElement)(option.icon, {
|
|
751
|
+
fontSize: SIZE,
|
|
752
|
+
color: "action"
|
|
753
|
+
}),
|
|
754
|
+
/* @__PURE__ */ React4.createElement(import_ui4.Typography, { variant: "caption", color: "text.primary" }, option.name)
|
|
755
|
+
))
|
|
756
|
+
));
|
|
757
|
+
};
|
|
758
|
+
var getDefaultName = (variables, type, baseName) => {
|
|
759
|
+
const existingNames = Object.values(variables).filter((variable) => variable.type === type).map((variable) => variable.label);
|
|
760
|
+
let counter = 1;
|
|
761
|
+
let name = `${baseName}-${counter}`;
|
|
762
|
+
while (existingNames.includes(name)) {
|
|
763
|
+
counter++;
|
|
764
|
+
name = `${baseName}-${counter}`;
|
|
765
|
+
}
|
|
766
|
+
return name;
|
|
767
|
+
};
|
|
768
|
+
|
|
664
769
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
665
|
-
var
|
|
666
|
-
var
|
|
770
|
+
var React9 = __toESM(require("react"));
|
|
771
|
+
var import_react7 = require("react");
|
|
667
772
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
668
|
-
var
|
|
669
|
-
var
|
|
670
|
-
var
|
|
773
|
+
var import_icons4 = require("@elementor/icons");
|
|
774
|
+
var import_ui9 = require("@elementor/ui");
|
|
775
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
671
776
|
|
|
672
777
|
// src/components/fields/label-field.tsx
|
|
673
|
-
var
|
|
674
|
-
var
|
|
675
|
-
var
|
|
778
|
+
var React5 = __toESM(require("react"));
|
|
779
|
+
var import_react4 = require("react");
|
|
780
|
+
var import_ui5 = require("@elementor/ui");
|
|
676
781
|
|
|
677
782
|
// src/utils/validations.ts
|
|
678
|
-
var
|
|
783
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
679
784
|
var ERROR_MESSAGES = {
|
|
680
|
-
MISSING_VARIABLE_NAME: (0,
|
|
681
|
-
MISSING_VARIABLE_VALUE: (0,
|
|
682
|
-
INVALID_CHARACTERS: (0,
|
|
683
|
-
NO_NON_SPECIAL_CHARACTER: (0,
|
|
684
|
-
VARIABLE_LABEL_MAX_LENGTH: (0,
|
|
685
|
-
DUPLICATED_LABEL: (0,
|
|
686
|
-
UNEXPECTED_ERROR: (0,
|
|
785
|
+
MISSING_VARIABLE_NAME: (0, import_i18n5.__)("Give your variable a name.", "elementor"),
|
|
786
|
+
MISSING_VARIABLE_VALUE: (0, import_i18n5.__)("Add a value to complete your variable.", "elementor"),
|
|
787
|
+
INVALID_CHARACTERS: (0, import_i18n5.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
788
|
+
NO_NON_SPECIAL_CHARACTER: (0, import_i18n5.__)("Names have to include at least one non-special character.", "elementor"),
|
|
789
|
+
VARIABLE_LABEL_MAX_LENGTH: (0, import_i18n5.__)("Keep names up to 50 characters.", "elementor"),
|
|
790
|
+
DUPLICATED_LABEL: (0, import_i18n5.__)("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
791
|
+
UNEXPECTED_ERROR: (0, import_i18n5.__)("There was a glitch. Try saving your variable again.", "elementor")
|
|
687
792
|
};
|
|
688
793
|
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
689
794
|
var mapServerError = (error) => {
|
|
@@ -731,7 +836,7 @@ function isLabelEqual(a, b) {
|
|
|
731
836
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
732
837
|
}
|
|
733
838
|
var useLabelError = (initialError) => {
|
|
734
|
-
const [error, setError] = (0,
|
|
839
|
+
const [error, setError] = (0, import_react4.useState)(initialError ?? { value: "", message: "" });
|
|
735
840
|
return {
|
|
736
841
|
labelFieldError: error,
|
|
737
842
|
setLabelFieldError: setError
|
|
@@ -744,10 +849,11 @@ var LabelField = ({
|
|
|
744
849
|
id: id2,
|
|
745
850
|
onErrorChange,
|
|
746
851
|
size = "tiny",
|
|
747
|
-
focusOnShow = false
|
|
852
|
+
focusOnShow = false,
|
|
853
|
+
selectOnShow = false
|
|
748
854
|
}) => {
|
|
749
|
-
const [label, setLabel] = (0,
|
|
750
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
855
|
+
const [label, setLabel] = (0, import_react4.useState)(value);
|
|
856
|
+
const [errorMessage, setErrorMessage] = (0, import_react4.useState)("");
|
|
751
857
|
const handleChange = (newValue) => {
|
|
752
858
|
setLabel(newValue);
|
|
753
859
|
const errorMsg2 = validateLabel(newValue);
|
|
@@ -759,8 +865,8 @@ var LabelField = ({
|
|
|
759
865
|
if (isLabelEqual(label, error?.value ?? "") && error?.message) {
|
|
760
866
|
errorMsg = error.message;
|
|
761
867
|
}
|
|
762
|
-
return /* @__PURE__ */
|
|
763
|
-
|
|
868
|
+
return /* @__PURE__ */ React5.createElement(
|
|
869
|
+
import_ui5.TextField,
|
|
764
870
|
{
|
|
765
871
|
id: id2,
|
|
766
872
|
size,
|
|
@@ -768,23 +874,26 @@ var LabelField = ({
|
|
|
768
874
|
value: label,
|
|
769
875
|
error: !!errorMsg,
|
|
770
876
|
onChange: (e) => handleChange(e.target.value),
|
|
771
|
-
inputProps: {
|
|
877
|
+
inputProps: {
|
|
878
|
+
maxLength: VARIABLE_LABEL_MAX_LENGTH,
|
|
879
|
+
...selectOnShow && { onFocus: (e) => e.target.select() }
|
|
880
|
+
},
|
|
772
881
|
autoFocus: focusOnShow
|
|
773
882
|
}
|
|
774
883
|
);
|
|
775
884
|
};
|
|
776
885
|
|
|
777
886
|
// src/components/variables-manager/variable-edit-menu.tsx
|
|
778
|
-
var
|
|
779
|
-
var
|
|
780
|
-
var
|
|
781
|
-
var
|
|
887
|
+
var React6 = __toESM(require("react"));
|
|
888
|
+
var import_react5 = require("react");
|
|
889
|
+
var import_icons3 = require("@elementor/icons");
|
|
890
|
+
var import_ui6 = require("@elementor/ui");
|
|
782
891
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
783
|
-
const menuState = (0,
|
|
892
|
+
const menuState = (0, import_ui6.usePopupState)({
|
|
784
893
|
variant: "popover"
|
|
785
894
|
});
|
|
786
|
-
return /* @__PURE__ */
|
|
787
|
-
|
|
895
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(import_ui6.IconButton, { ...(0, import_ui6.bindTrigger)(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React6.createElement(import_icons3.DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React6.createElement(
|
|
896
|
+
import_ui6.Menu,
|
|
788
897
|
{
|
|
789
898
|
disablePortal: true,
|
|
790
899
|
MenuListProps: {
|
|
@@ -793,7 +902,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
793
902
|
PaperProps: {
|
|
794
903
|
elevation: 6
|
|
795
904
|
},
|
|
796
|
-
...(0,
|
|
905
|
+
...(0, import_ui6.bindMenu)(menuState),
|
|
797
906
|
anchorEl: menuState.anchorEl,
|
|
798
907
|
anchorOrigin: {
|
|
799
908
|
vertical: "bottom",
|
|
@@ -806,8 +915,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
806
915
|
open: menuState.isOpen,
|
|
807
916
|
onClose: menuState.close
|
|
808
917
|
},
|
|
809
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
810
|
-
|
|
918
|
+
menuActions.map((action) => /* @__PURE__ */ React6.createElement(
|
|
919
|
+
import_ui6.MenuItem,
|
|
811
920
|
{
|
|
812
921
|
key: action.name,
|
|
813
922
|
onClick: () => {
|
|
@@ -819,7 +928,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
819
928
|
gap: 1
|
|
820
929
|
}
|
|
821
930
|
},
|
|
822
|
-
action.icon && (0,
|
|
931
|
+
action.icon && (0, import_react5.createElement)(action.icon, {
|
|
823
932
|
fontSize: "inherit"
|
|
824
933
|
}),
|
|
825
934
|
" ",
|
|
@@ -829,18 +938,31 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
829
938
|
};
|
|
830
939
|
|
|
831
940
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
832
|
-
var
|
|
833
|
-
var
|
|
834
|
-
var
|
|
941
|
+
var React7 = __toESM(require("react"));
|
|
942
|
+
var import_react6 = require("react");
|
|
943
|
+
var import_ui7 = require("@elementor/ui");
|
|
835
944
|
var VariableEditableCell = ({
|
|
836
945
|
initialValue,
|
|
837
946
|
children,
|
|
838
947
|
editableElement,
|
|
839
948
|
onChange,
|
|
840
|
-
prefixElement
|
|
949
|
+
prefixElement,
|
|
950
|
+
autoEdit = false,
|
|
951
|
+
onRowRef,
|
|
952
|
+
onAutoEditComplete
|
|
841
953
|
}) => {
|
|
842
|
-
const [value, setValue] = (0,
|
|
843
|
-
const [isEditing, setIsEditing] = (0,
|
|
954
|
+
const [value, setValue] = (0, import_react6.useState)(initialValue);
|
|
955
|
+
const [isEditing, setIsEditing] = (0, import_react6.useState)(false);
|
|
956
|
+
const rowRef = (0, import_react6.useRef)(null);
|
|
957
|
+
(0, import_react6.useEffect)(() => {
|
|
958
|
+
onRowRef?.(rowRef?.current);
|
|
959
|
+
}, [onRowRef]);
|
|
960
|
+
(0, import_react6.useEffect)(() => {
|
|
961
|
+
if (autoEdit && !isEditing) {
|
|
962
|
+
setIsEditing(true);
|
|
963
|
+
onAutoEditComplete?.();
|
|
964
|
+
}
|
|
965
|
+
}, [autoEdit, isEditing, onAutoEditComplete]);
|
|
844
966
|
const handleDoubleClick = () => {
|
|
845
967
|
setIsEditing(true);
|
|
846
968
|
};
|
|
@@ -864,9 +986,10 @@ var VariableEditableCell = ({
|
|
|
864
986
|
};
|
|
865
987
|
const editableContent = editableElement({ value, onChange: handleChange });
|
|
866
988
|
if (isEditing) {
|
|
867
|
-
return /* @__PURE__ */
|
|
868
|
-
|
|
989
|
+
return /* @__PURE__ */ React7.createElement(import_ui7.ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React7.createElement(
|
|
990
|
+
import_ui7.Stack,
|
|
869
991
|
{
|
|
992
|
+
ref: rowRef,
|
|
870
993
|
direction: "row",
|
|
871
994
|
alignItems: "center",
|
|
872
995
|
gap: 1,
|
|
@@ -880,9 +1003,10 @@ var VariableEditableCell = ({
|
|
|
880
1003
|
editableContent
|
|
881
1004
|
));
|
|
882
1005
|
}
|
|
883
|
-
return /* @__PURE__ */
|
|
884
|
-
|
|
1006
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1007
|
+
import_ui7.Stack,
|
|
885
1008
|
{
|
|
1009
|
+
ref: rowRef,
|
|
886
1010
|
direction: "row",
|
|
887
1011
|
alignItems: "center",
|
|
888
1012
|
gap: 1,
|
|
@@ -898,8 +1022,8 @@ var VariableEditableCell = ({
|
|
|
898
1022
|
};
|
|
899
1023
|
|
|
900
1024
|
// src/components/variables-manager/variable-table-cell.tsx
|
|
901
|
-
var
|
|
902
|
-
var
|
|
1025
|
+
var React8 = __toESM(require("react"));
|
|
1026
|
+
var import_ui8 = require("@elementor/ui");
|
|
903
1027
|
var VariableTableCell = ({
|
|
904
1028
|
children,
|
|
905
1029
|
isHeader,
|
|
@@ -918,20 +1042,50 @@ var VariableTableCell = ({
|
|
|
918
1042
|
...width && { width },
|
|
919
1043
|
...sx
|
|
920
1044
|
};
|
|
921
|
-
return /* @__PURE__ */
|
|
1045
|
+
return /* @__PURE__ */ React8.createElement(import_ui8.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
922
1046
|
};
|
|
923
1047
|
|
|
924
1048
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
925
|
-
var VariablesManagerTable = ({
|
|
926
|
-
|
|
1049
|
+
var VariablesManagerTable = ({
|
|
1050
|
+
menuActions,
|
|
1051
|
+
variables,
|
|
1052
|
+
onChange: handleOnChange,
|
|
1053
|
+
ids,
|
|
1054
|
+
onIdsChange: setIds,
|
|
1055
|
+
autoEditVariableId,
|
|
1056
|
+
onAutoEditComplete
|
|
1057
|
+
}) => {
|
|
1058
|
+
const tableContainerRef = (0, import_react7.useRef)(null);
|
|
1059
|
+
const variableRowRefs = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
|
|
1060
|
+
(0, import_react7.useEffect)(() => {
|
|
1061
|
+
if (autoEditVariableId && tableContainerRef.current) {
|
|
1062
|
+
const rowElement = variableRowRefs.current.get(autoEditVariableId);
|
|
1063
|
+
if (rowElement) {
|
|
1064
|
+
setTimeout(() => {
|
|
1065
|
+
rowElement.scrollIntoView({
|
|
1066
|
+
behavior: "smooth",
|
|
1067
|
+
block: "center",
|
|
1068
|
+
inline: "nearest"
|
|
1069
|
+
});
|
|
1070
|
+
}, 100);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}, [autoEditVariableId]);
|
|
1074
|
+
const handleRowRef = (id2) => (ref) => {
|
|
1075
|
+
if (ref) {
|
|
1076
|
+
variableRowRefs.current.set(id2, ref);
|
|
1077
|
+
} else {
|
|
1078
|
+
variableRowRefs.current.delete(id2);
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
927
1081
|
const rows = ids.filter((id2) => !variables[id2].deleted).map((id2) => {
|
|
928
1082
|
const variable = variables[id2];
|
|
929
1083
|
const variableType = getVariableType(variable.type);
|
|
930
1084
|
return {
|
|
931
1085
|
id: id2,
|
|
1086
|
+
type: variable.type,
|
|
932
1087
|
name: variable.label,
|
|
933
1088
|
value: variable.value,
|
|
934
|
-
type: variable.type,
|
|
935
1089
|
...variableType
|
|
936
1090
|
};
|
|
937
1091
|
});
|
|
@@ -939,17 +1093,17 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
939
1093
|
minWidth: 250,
|
|
940
1094
|
tableLayout: "fixed"
|
|
941
1095
|
};
|
|
942
|
-
return /* @__PURE__ */
|
|
943
|
-
|
|
1096
|
+
return /* @__PURE__ */ React9.createElement(import_ui9.TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React9.createElement(import_ui9.Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React9.createElement(import_ui9.TableHead, null, /* @__PURE__ */ React9.createElement(import_ui9.TableRow, null, /* @__PURE__ */ React9.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React9.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n6.__)("Name", "elementor")), /* @__PURE__ */ React9.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n6.__)("Value", "elementor")), /* @__PURE__ */ React9.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React9.createElement(import_ui9.TableBody, null, /* @__PURE__ */ React9.createElement(
|
|
1097
|
+
import_ui9.UnstableSortableProvider,
|
|
944
1098
|
{
|
|
945
1099
|
value: ids,
|
|
946
1100
|
onChange: setIds,
|
|
947
1101
|
variant: "static",
|
|
948
1102
|
restrictAxis: true,
|
|
949
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1103
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React9.createElement(import_ui9.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React9.createElement(import_ui9.TableBody, null, dragOverlayChildren))
|
|
950
1104
|
},
|
|
951
|
-
rows.map((row) => /* @__PURE__ */
|
|
952
|
-
|
|
1105
|
+
rows.map((row) => /* @__PURE__ */ React9.createElement(
|
|
1106
|
+
import_ui9.UnstableSortableItem,
|
|
953
1107
|
{
|
|
954
1108
|
key: row.id,
|
|
955
1109
|
id: row.id,
|
|
@@ -968,8 +1122,8 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
968
1122
|
}) => {
|
|
969
1123
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
970
1124
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
971
|
-
return /* @__PURE__ */
|
|
972
|
-
|
|
1125
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1126
|
+
import_ui9.TableRow,
|
|
973
1127
|
{
|
|
974
1128
|
...itemProps,
|
|
975
1129
|
selected: isDragged,
|
|
@@ -999,8 +1153,8 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
999
1153
|
style: { ...itemStyle, ...triggerStyle },
|
|
1000
1154
|
disableDivider: isDragOverlay || index === rows.length - 1
|
|
1001
1155
|
},
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
|
|
1156
|
+
/* @__PURE__ */ React9.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React9.createElement(
|
|
1157
|
+
import_ui9.IconButton,
|
|
1004
1158
|
{
|
|
1005
1159
|
size: "small",
|
|
1006
1160
|
ref: setTriggerRef,
|
|
@@ -1008,9 +1162,9 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
1008
1162
|
disabled: isSorting,
|
|
1009
1163
|
draggable: true
|
|
1010
1164
|
},
|
|
1011
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ React9.createElement(import_icons4.GripVerticalIcon, { fontSize: "inherit" })
|
|
1012
1166
|
)),
|
|
1013
|
-
/* @__PURE__ */
|
|
1167
|
+
/* @__PURE__ */ React9.createElement(VariableTableCell, null, /* @__PURE__ */ React9.createElement(
|
|
1014
1168
|
VariableEditableCell,
|
|
1015
1169
|
{
|
|
1016
1170
|
initialValue: row.name,
|
|
@@ -1022,19 +1176,23 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
1022
1176
|
});
|
|
1023
1177
|
}
|
|
1024
1178
|
},
|
|
1025
|
-
prefixElement: (0,
|
|
1026
|
-
editableElement: ({ value, onChange }) => /* @__PURE__ */
|
|
1179
|
+
prefixElement: (0, import_react7.createElement)(row.icon, { fontSize: "inherit" }),
|
|
1180
|
+
editableElement: ({ value, onChange }) => /* @__PURE__ */ React9.createElement(
|
|
1027
1181
|
LabelField,
|
|
1028
1182
|
{
|
|
1029
1183
|
id: "variable-label-" + row.id,
|
|
1030
1184
|
size: "tiny",
|
|
1031
1185
|
value,
|
|
1032
1186
|
onChange,
|
|
1033
|
-
focusOnShow: true
|
|
1187
|
+
focusOnShow: true,
|
|
1188
|
+
selectOnShow: autoEditVariableId === row.id
|
|
1034
1189
|
}
|
|
1035
|
-
)
|
|
1190
|
+
),
|
|
1191
|
+
autoEdit: autoEditVariableId === row.id,
|
|
1192
|
+
onRowRef: handleRowRef(row.id),
|
|
1193
|
+
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0
|
|
1036
1194
|
},
|
|
1037
|
-
/* @__PURE__ */
|
|
1195
|
+
/* @__PURE__ */ React9.createElement(
|
|
1038
1196
|
import_editor_ui.EllipsisWithTooltip,
|
|
1039
1197
|
{
|
|
1040
1198
|
title: row.name,
|
|
@@ -1043,7 +1201,7 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
1043
1201
|
row.name
|
|
1044
1202
|
)
|
|
1045
1203
|
)),
|
|
1046
|
-
/* @__PURE__ */
|
|
1204
|
+
/* @__PURE__ */ React9.createElement(VariableTableCell, null, /* @__PURE__ */ React9.createElement(
|
|
1047
1205
|
VariableEditableCell,
|
|
1048
1206
|
{
|
|
1049
1207
|
initialValue: row.value,
|
|
@@ -1055,10 +1213,11 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
1055
1213
|
});
|
|
1056
1214
|
}
|
|
1057
1215
|
},
|
|
1058
|
-
editableElement: row.valueField
|
|
1216
|
+
editableElement: row.valueField,
|
|
1217
|
+
onRowRef: handleRowRef(row.id)
|
|
1059
1218
|
},
|
|
1060
1219
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1061
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ React9.createElement(
|
|
1062
1221
|
import_editor_ui.EllipsisWithTooltip,
|
|
1063
1222
|
{
|
|
1064
1223
|
title: row.value,
|
|
@@ -1067,7 +1226,7 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
1067
1226
|
row.value
|
|
1068
1227
|
)
|
|
1069
1228
|
)),
|
|
1070
|
-
/* @__PURE__ */
|
|
1229
|
+
/* @__PURE__ */ React9.createElement(
|
|
1071
1230
|
VariableTableCell,
|
|
1072
1231
|
{
|
|
1073
1232
|
align: "right",
|
|
@@ -1076,7 +1235,7 @@ var VariablesManagerTable = ({ menuActions, variables, onChange: handleOnChange
|
|
|
1076
1235
|
maxWidth: 16,
|
|
1077
1236
|
sx: { paddingInlineEnd: 1 }
|
|
1078
1237
|
},
|
|
1079
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ React9.createElement(import_ui9.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React9.createElement(
|
|
1080
1239
|
VariableEditMenu,
|
|
1081
1240
|
{
|
|
1082
1241
|
menuActions,
|
|
@@ -1107,12 +1266,13 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1107
1266
|
});
|
|
1108
1267
|
function VariablesManagerPanel() {
|
|
1109
1268
|
const { close: closePanel } = usePanelActions();
|
|
1110
|
-
const [variables, setVariables] = (0, import_react7.useState)(getVariables(false));
|
|
1111
|
-
const [deletedVariables, setDeletedVariables] = (0, import_react7.useState)([]);
|
|
1112
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react7.useState)(null);
|
|
1113
|
-
const [isDirty, setIsDirty] = (0, import_react7.useState)(false);
|
|
1114
|
-
const [isSaving, setIsSaving] = (0, import_react7.useState)(false);
|
|
1115
1269
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui2.useDialog)();
|
|
1270
|
+
const [variables, setVariables] = (0, import_react8.useState)(getVariables(false));
|
|
1271
|
+
const [deletedVariables, setDeletedVariables] = (0, import_react8.useState)([]);
|
|
1272
|
+
const [ids, setIds] = (0, import_react8.useState)(Object.keys(variables));
|
|
1273
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react8.useState)(null);
|
|
1274
|
+
const [autoEditVariableId, setAutoEditVariableId] = (0, import_react8.useState)(void 0);
|
|
1275
|
+
const [isDirty, setIsDirty] = (0, import_react8.useState)(false);
|
|
1116
1276
|
usePreventUnload(isDirty);
|
|
1117
1277
|
const handleClosePanel = () => {
|
|
1118
1278
|
if (isDirty) {
|
|
@@ -1121,23 +1281,52 @@ function VariablesManagerPanel() {
|
|
|
1121
1281
|
}
|
|
1122
1282
|
closePanel();
|
|
1123
1283
|
};
|
|
1124
|
-
const handleSave = (0,
|
|
1125
|
-
setIsSaving(true);
|
|
1284
|
+
const handleSave = (0, import_react8.useCallback)(async () => {
|
|
1126
1285
|
const originalVariables = getVariables(false);
|
|
1127
1286
|
const result = await service.batchSave(originalVariables, variables);
|
|
1287
|
+
setIsDirty(false);
|
|
1128
1288
|
if (result.success) {
|
|
1129
1289
|
await service.load();
|
|
1130
1290
|
const updatedVariables = service.variables();
|
|
1131
1291
|
setVariables(updatedVariables);
|
|
1132
|
-
|
|
1292
|
+
setIds(Object.keys(updatedVariables));
|
|
1133
1293
|
setDeletedVariables([]);
|
|
1294
|
+
} else {
|
|
1295
|
+
setIsDirty(true);
|
|
1134
1296
|
}
|
|
1135
|
-
setIsSaving(false);
|
|
1136
1297
|
}, [variables]);
|
|
1298
|
+
const handleOnChange = (newVariables) => {
|
|
1299
|
+
setVariables(newVariables);
|
|
1300
|
+
setIsDirty(true);
|
|
1301
|
+
};
|
|
1302
|
+
const createVariable2 = (0, import_react8.useCallback)((type, defaultName, defaultValue) => {
|
|
1303
|
+
const newId = generateTempId();
|
|
1304
|
+
const newVariable = {
|
|
1305
|
+
id: newId,
|
|
1306
|
+
label: defaultName,
|
|
1307
|
+
value: defaultValue,
|
|
1308
|
+
type
|
|
1309
|
+
};
|
|
1310
|
+
setVariables((prev) => ({ ...prev, [newId]: newVariable }));
|
|
1311
|
+
setIds((prev) => [...prev, newId]);
|
|
1312
|
+
setIsDirty(true);
|
|
1313
|
+
setAutoEditVariableId(newId);
|
|
1314
|
+
}, []);
|
|
1315
|
+
const handleDeleteVariable = (itemId) => {
|
|
1316
|
+
setDeletedVariables([...deletedVariables, itemId]);
|
|
1317
|
+
setVariables({ ...variables, [itemId]: { ...variables[itemId], deleted: true } });
|
|
1318
|
+
setIsDirty(true);
|
|
1319
|
+
setDeleteConfirmation(null);
|
|
1320
|
+
};
|
|
1321
|
+
const handleAutoEditComplete = (0, import_react8.useCallback)(() => {
|
|
1322
|
+
setTimeout(() => {
|
|
1323
|
+
setAutoEditVariableId(void 0);
|
|
1324
|
+
}, 100);
|
|
1325
|
+
}, []);
|
|
1137
1326
|
const menuActions = [
|
|
1138
1327
|
{
|
|
1139
|
-
name: (0,
|
|
1140
|
-
icon:
|
|
1328
|
+
name: (0, import_i18n7.__)("Delete", "elementor"),
|
|
1329
|
+
icon: import_icons5.TrashIcon,
|
|
1141
1330
|
color: "error.main",
|
|
1142
1331
|
onClick: (itemId) => {
|
|
1143
1332
|
if (variables[itemId]) {
|
|
@@ -1146,25 +1335,16 @@ function VariablesManagerPanel() {
|
|
|
1146
1335
|
}
|
|
1147
1336
|
}
|
|
1148
1337
|
];
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
setVariables({ ...variables, [itemId]: { ...variables[itemId], deleted: true } });
|
|
1152
|
-
setIsDirty(true);
|
|
1153
|
-
setDeleteConfirmation(null);
|
|
1154
|
-
};
|
|
1155
|
-
const handleOnChange = (newVariables) => {
|
|
1156
|
-
setVariables(newVariables);
|
|
1157
|
-
setIsDirty(true);
|
|
1158
|
-
};
|
|
1159
|
-
return /* @__PURE__ */ React9.createElement(import_editor_ui2.ThemeProvider, null, /* @__PURE__ */ React9.createElement(import_ui9.ErrorBoundary, { fallback: /* @__PURE__ */ React9.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React9.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React9.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React9.createElement(import_ui9.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React9.createElement(import_ui9.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React9.createElement(import_ui9.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React9.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React9.createElement(import_icons4.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n6.__)("Variable Manager", "elementor"))), /* @__PURE__ */ React9.createElement(
|
|
1160
|
-
CloseButton,
|
|
1338
|
+
return /* @__PURE__ */ React10.createElement(import_editor_ui2.ThemeProvider, null, /* @__PURE__ */ React10.createElement(import_ui10.ErrorBoundary, { fallback: /* @__PURE__ */ React10.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React10.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React10.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React10.createElement(import_ui10.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui10.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui10.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React10.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React10.createElement(import_icons5.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n7.__)("Variable Manager", "elementor"))), /* @__PURE__ */ React10.createElement(import_ui10.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React10.createElement(VariableManagerCreateMenu, { onCreate: createVariable2, variables }), /* @__PURE__ */ React10.createElement(
|
|
1339
|
+
import_ui10.CloseButton,
|
|
1161
1340
|
{
|
|
1162
|
-
|
|
1163
|
-
|
|
1341
|
+
"aria-label": "Close",
|
|
1342
|
+
slotProps: { icon: { fontSize: SIZE } },
|
|
1343
|
+
onClick: () => {
|
|
1164
1344
|
handleClosePanel();
|
|
1165
1345
|
}
|
|
1166
1346
|
}
|
|
1167
|
-
)), /* @__PURE__ */
|
|
1347
|
+
))), /* @__PURE__ */ React10.createElement(import_ui10.Divider, { sx: { width: "100%" } }))), /* @__PURE__ */ React10.createElement(
|
|
1168
1348
|
import_editor_panels.PanelBody,
|
|
1169
1349
|
{
|
|
1170
1350
|
sx: {
|
|
@@ -1173,26 +1353,31 @@ function VariablesManagerPanel() {
|
|
|
1173
1353
|
height: "100%"
|
|
1174
1354
|
}
|
|
1175
1355
|
},
|
|
1176
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ React10.createElement(
|
|
1177
1357
|
VariablesManagerTable,
|
|
1178
1358
|
{
|
|
1179
1359
|
menuActions,
|
|
1180
1360
|
variables,
|
|
1181
|
-
onChange: handleOnChange
|
|
1361
|
+
onChange: handleOnChange,
|
|
1362
|
+
ids,
|
|
1363
|
+
onIdsChange: setIds,
|
|
1364
|
+
autoEditVariableId,
|
|
1365
|
+
onAutoEditComplete: handleAutoEditComplete
|
|
1182
1366
|
}
|
|
1183
|
-
)
|
|
1184
|
-
|
|
1185
|
-
|
|
1367
|
+
),
|
|
1368
|
+
/* @__PURE__ */ React10.createElement(import_ui10.Divider, { sx: { width: "100%" } })
|
|
1369
|
+
), /* @__PURE__ */ React10.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React10.createElement(
|
|
1370
|
+
import_ui10.Button,
|
|
1186
1371
|
{
|
|
1187
1372
|
fullWidth: true,
|
|
1188
1373
|
size: "small",
|
|
1189
1374
|
color: "global",
|
|
1190
1375
|
variant: "contained",
|
|
1191
|
-
disabled: !isDirty
|
|
1376
|
+
disabled: !isDirty,
|
|
1192
1377
|
onClick: handleSave
|
|
1193
1378
|
},
|
|
1194
|
-
(0,
|
|
1195
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
1379
|
+
(0, import_i18n7.__)("Save changes", "elementor")
|
|
1380
|
+
))), deleteConfirmation && /* @__PURE__ */ React10.createElement(
|
|
1196
1381
|
DeleteConfirmationDialog,
|
|
1197
1382
|
{
|
|
1198
1383
|
open: true,
|
|
@@ -1200,19 +1385,19 @@ function VariablesManagerPanel() {
|
|
|
1200
1385
|
onConfirm: () => handleDeleteVariable(deleteConfirmation.id),
|
|
1201
1386
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1202
1387
|
}
|
|
1203
|
-
)), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
1388
|
+
)), isSaveChangesDialogOpen && /* @__PURE__ */ React10.createElement(import_editor_ui2.SaveChangesDialog, null, /* @__PURE__ */ React10.createElement(import_editor_ui2.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n7.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React10.createElement(import_editor_ui2.SaveChangesDialog.Content, null, /* @__PURE__ */ React10.createElement(import_editor_ui2.SaveChangesDialog.ContentText, null, (0, import_i18n7.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React10.createElement(
|
|
1204
1389
|
import_editor_ui2.SaveChangesDialog.Actions,
|
|
1205
1390
|
{
|
|
1206
1391
|
actions: {
|
|
1207
1392
|
discard: {
|
|
1208
|
-
label: (0,
|
|
1393
|
+
label: (0, import_i18n7.__)("Discard", "elementor"),
|
|
1209
1394
|
action: () => {
|
|
1210
1395
|
closeSaveChangesDialog();
|
|
1211
1396
|
closePanel();
|
|
1212
1397
|
}
|
|
1213
1398
|
},
|
|
1214
1399
|
confirm: {
|
|
1215
|
-
label: (0,
|
|
1400
|
+
label: (0, import_i18n7.__)("Save", "elementor"),
|
|
1216
1401
|
action: async () => {
|
|
1217
1402
|
await handleSave();
|
|
1218
1403
|
closeSaveChangesDialog();
|
|
@@ -1223,10 +1408,9 @@ function VariablesManagerPanel() {
|
|
|
1223
1408
|
}
|
|
1224
1409
|
)));
|
|
1225
1410
|
}
|
|
1226
|
-
var
|
|
1227
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */ React9.createElement(import_ui9.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React9.createElement(import_ui9.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React9.createElement("strong", null, (0, import_i18n6.__)("Something went wrong", "elementor"))));
|
|
1411
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React10.createElement(import_ui10.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React10.createElement(import_ui10.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React10.createElement("strong", null, (0, import_i18n7.__)("Something went wrong", "elementor"))));
|
|
1228
1412
|
var usePreventUnload = (isDirty) => {
|
|
1229
|
-
(0,
|
|
1413
|
+
(0, import_react8.useEffect)(() => {
|
|
1230
1414
|
const handleBeforeUnload = (event) => {
|
|
1231
1415
|
if (isDirty) {
|
|
1232
1416
|
event.preventDefault();
|
|
@@ -1240,15 +1424,15 @@ var usePreventUnload = (isDirty) => {
|
|
|
1240
1424
|
};
|
|
1241
1425
|
|
|
1242
1426
|
// src/controls/variable-control.tsx
|
|
1243
|
-
var
|
|
1427
|
+
var React31 = __toESM(require("react"));
|
|
1244
1428
|
var import_editor_controls11 = require("@elementor/editor-controls");
|
|
1245
1429
|
|
|
1246
1430
|
// src/components/ui/variable/assigned-variable.tsx
|
|
1247
|
-
var
|
|
1248
|
-
var
|
|
1431
|
+
var import_react15 = require("react");
|
|
1432
|
+
var React22 = __toESM(require("react"));
|
|
1249
1433
|
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
1250
|
-
var
|
|
1251
|
-
var
|
|
1434
|
+
var import_icons12 = require("@elementor/icons");
|
|
1435
|
+
var import_ui22 = require("@elementor/ui");
|
|
1252
1436
|
|
|
1253
1437
|
// src/utils/unlink-variable.ts
|
|
1254
1438
|
function transformValueBeforeUnlink(variable, propTypeKey) {
|
|
@@ -1267,21 +1451,21 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
|
|
|
1267
1451
|
}
|
|
1268
1452
|
|
|
1269
1453
|
// src/components/variable-selection-popover.tsx
|
|
1270
|
-
var
|
|
1271
|
-
var
|
|
1454
|
+
var React20 = __toESM(require("react"));
|
|
1455
|
+
var import_react14 = require("react");
|
|
1272
1456
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1273
1457
|
|
|
1274
1458
|
// src/context/variable-selection-popover.context.tsx
|
|
1275
|
-
var
|
|
1276
|
-
var
|
|
1277
|
-
var
|
|
1278
|
-
var PopoverContentRefContext = (0,
|
|
1459
|
+
var React11 = __toESM(require("react"));
|
|
1460
|
+
var import_react9 = require("react");
|
|
1461
|
+
var import_ui11 = require("@elementor/ui");
|
|
1462
|
+
var PopoverContentRefContext = (0, import_react9.createContext)(null);
|
|
1279
1463
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
1280
|
-
const [anchorRef, setAnchorRef] = (0,
|
|
1281
|
-
return /* @__PURE__ */
|
|
1464
|
+
const [anchorRef, setAnchorRef] = (0, import_react9.useState)(null);
|
|
1465
|
+
return /* @__PURE__ */ React11.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React11.createElement(import_ui11.Box, { ref: setAnchorRef }, children));
|
|
1282
1466
|
};
|
|
1283
1467
|
var usePopoverContentRef = () => {
|
|
1284
|
-
return (0,
|
|
1468
|
+
return (0, import_react9.useContext)(PopoverContentRefContext);
|
|
1285
1469
|
};
|
|
1286
1470
|
|
|
1287
1471
|
// src/hooks/use-permissions.ts
|
|
@@ -1300,14 +1484,14 @@ var usePermissions = () => {
|
|
|
1300
1484
|
};
|
|
1301
1485
|
|
|
1302
1486
|
// src/components/variable-creation.tsx
|
|
1303
|
-
var
|
|
1304
|
-
var
|
|
1487
|
+
var React13 = __toESM(require("react"));
|
|
1488
|
+
var import_react10 = require("react");
|
|
1305
1489
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
1306
1490
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
1307
1491
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1308
|
-
var
|
|
1309
|
-
var
|
|
1310
|
-
var
|
|
1492
|
+
var import_icons6 = require("@elementor/icons");
|
|
1493
|
+
var import_ui13 = require("@elementor/ui");
|
|
1494
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1311
1495
|
|
|
1312
1496
|
// src/hooks/use-initial-value.ts
|
|
1313
1497
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -1350,17 +1534,17 @@ var unwrapValue = (input) => {
|
|
|
1350
1534
|
};
|
|
1351
1535
|
|
|
1352
1536
|
// src/utils/tracking.ts
|
|
1537
|
+
var import_mixpanel = require("@elementor/mixpanel");
|
|
1353
1538
|
var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
1354
|
-
const
|
|
1355
|
-
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
1539
|
+
const { dispatchEvent, config } = (0, import_mixpanel.getMixpanel)();
|
|
1356
1540
|
if (!config?.names?.variables?.[action]) {
|
|
1357
1541
|
return;
|
|
1358
1542
|
}
|
|
1359
1543
|
const name = config.names.variables[action];
|
|
1360
|
-
|
|
1361
|
-
location: config
|
|
1362
|
-
secondaryLocation: config
|
|
1363
|
-
trigger: config
|
|
1544
|
+
dispatchEvent?.(name, {
|
|
1545
|
+
location: config?.locations?.variables || "",
|
|
1546
|
+
secondaryLocation: config?.secondaryLocations?.variablesPopover || "",
|
|
1547
|
+
trigger: config?.triggers?.click || "",
|
|
1364
1548
|
var_type: varType,
|
|
1365
1549
|
control_path: controlPath,
|
|
1366
1550
|
action_type: name
|
|
@@ -1368,23 +1552,23 @@ var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
|
1368
1552
|
};
|
|
1369
1553
|
|
|
1370
1554
|
// src/components/ui/form-field.tsx
|
|
1371
|
-
var
|
|
1372
|
-
var
|
|
1555
|
+
var React12 = __toESM(require("react"));
|
|
1556
|
+
var import_ui12 = require("@elementor/ui");
|
|
1373
1557
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
1374
|
-
return /* @__PURE__ */
|
|
1558
|
+
return /* @__PURE__ */ React12.createElement(import_ui12.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React12.createElement(import_ui12.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React12.createElement(import_ui12.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React12.createElement(import_ui12.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React12.createElement(import_ui12.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React12.createElement(import_ui12.FormHelperText, null, noticeMsg)));
|
|
1375
1559
|
};
|
|
1376
1560
|
|
|
1377
1561
|
// src/components/variable-creation.tsx
|
|
1378
|
-
var
|
|
1562
|
+
var SIZE2 = "tiny";
|
|
1379
1563
|
var VariableCreation = ({ onGoBack, onClose }) => {
|
|
1380
1564
|
const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
|
|
1381
1565
|
const { setVariableValue: setVariable, path } = useVariableBoundProp();
|
|
1382
1566
|
const { propType } = (0, import_editor_controls4.useBoundProp)();
|
|
1383
1567
|
const initialValue = useInitialValue();
|
|
1384
|
-
const [value, setValue] = (0,
|
|
1385
|
-
const [label, setLabel] = (0,
|
|
1386
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
1387
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
1568
|
+
const [value, setValue] = (0, import_react10.useState)(initialValue);
|
|
1569
|
+
const [label, setLabel] = (0, import_react10.useState)("");
|
|
1570
|
+
const [errorMessage, setErrorMessage] = (0, import_react10.useState)("");
|
|
1571
|
+
const [valueFieldError, setValueFieldError] = (0, import_react10.useState)("");
|
|
1388
1572
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1389
1573
|
const resetFields = () => {
|
|
1390
1574
|
setValue("");
|
|
@@ -1435,22 +1619,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1435
1619
|
return !!errorMessage;
|
|
1436
1620
|
};
|
|
1437
1621
|
const isSubmitDisabled = hasEmptyFields() || hasErrors();
|
|
1438
|
-
return /* @__PURE__ */
|
|
1622
|
+
return /* @__PURE__ */ React13.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React13.createElement(
|
|
1439
1623
|
import_editor_ui3.PopoverHeader,
|
|
1440
1624
|
{
|
|
1441
|
-
icon: /* @__PURE__ */
|
|
1442
|
-
title: (0,
|
|
1625
|
+
icon: /* @__PURE__ */ React13.createElement(React13.Fragment, null, onGoBack && /* @__PURE__ */ React13.createElement(import_ui13.IconButton, { size: SIZE2, "aria-label": (0, import_i18n8.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React13.createElement(import_icons6.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React13.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
1626
|
+
title: (0, import_i18n8.__)("Create variable", "elementor"),
|
|
1443
1627
|
onClose: closePopover
|
|
1444
1628
|
}
|
|
1445
|
-
), /* @__PURE__ */
|
|
1629
|
+
), /* @__PURE__ */ React13.createElement(import_ui13.Divider, null), /* @__PURE__ */ React13.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React13.createElement(
|
|
1446
1630
|
FormField,
|
|
1447
1631
|
{
|
|
1448
1632
|
id: "variable-label",
|
|
1449
|
-
label: (0,
|
|
1633
|
+
label: (0, import_i18n8.__)("Name", "elementor"),
|
|
1450
1634
|
errorMsg: labelFieldError?.message,
|
|
1451
1635
|
noticeMsg: labelHint(label)
|
|
1452
1636
|
},
|
|
1453
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ React13.createElement(
|
|
1454
1638
|
LabelField,
|
|
1455
1639
|
{
|
|
1456
1640
|
id: "variable-label",
|
|
@@ -1468,7 +1652,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1468
1652
|
}
|
|
1469
1653
|
}
|
|
1470
1654
|
)
|
|
1471
|
-
), /* @__PURE__ */
|
|
1655
|
+
), /* @__PURE__ */ React13.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n8.__)("Value", "elementor") }, /* @__PURE__ */ React13.createElement(import_ui13.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React13.createElement(
|
|
1472
1656
|
ValueField,
|
|
1473
1657
|
{
|
|
1474
1658
|
value,
|
|
@@ -1480,8 +1664,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1480
1664
|
onValidationChange: setValueFieldError,
|
|
1481
1665
|
propType
|
|
1482
1666
|
}
|
|
1483
|
-
))), errorMessage && /* @__PURE__ */
|
|
1484
|
-
|
|
1667
|
+
))), errorMessage && /* @__PURE__ */ React13.createElement(import_ui13.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React13.createElement(import_ui13.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React13.createElement(
|
|
1668
|
+
import_ui13.Button,
|
|
1485
1669
|
{
|
|
1486
1670
|
id: "create-variable-button",
|
|
1487
1671
|
size: "small",
|
|
@@ -1489,79 +1673,79 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1489
1673
|
disabled: isSubmitDisabled,
|
|
1490
1674
|
onClick: handleCreateAndTrack
|
|
1491
1675
|
},
|
|
1492
|
-
(0,
|
|
1676
|
+
(0, import_i18n8.__)("Create", "elementor")
|
|
1493
1677
|
)));
|
|
1494
1678
|
};
|
|
1495
1679
|
|
|
1496
1680
|
// src/components/variable-edit.tsx
|
|
1497
|
-
var
|
|
1498
|
-
var
|
|
1681
|
+
var React15 = __toESM(require("react"));
|
|
1682
|
+
var import_react12 = require("react");
|
|
1499
1683
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
1500
1684
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
1501
1685
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
1502
1686
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1687
|
+
var import_icons8 = require("@elementor/icons");
|
|
1688
|
+
var import_ui15 = require("@elementor/ui");
|
|
1689
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1690
|
+
|
|
1691
|
+
// src/components/ui/edit-confirmation-dialog.tsx
|
|
1692
|
+
var React14 = __toESM(require("react"));
|
|
1693
|
+
var import_react11 = require("react");
|
|
1503
1694
|
var import_icons7 = require("@elementor/icons");
|
|
1504
1695
|
var import_ui14 = require("@elementor/ui");
|
|
1505
1696
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1506
|
-
|
|
1507
|
-
// src/components/ui/edit-confirmation-dialog.tsx
|
|
1508
|
-
var React13 = __toESM(require("react"));
|
|
1509
|
-
var import_react10 = require("react");
|
|
1510
|
-
var import_icons6 = require("@elementor/icons");
|
|
1511
|
-
var import_ui13 = require("@elementor/ui");
|
|
1512
|
-
var import_i18n8 = require("@wordpress/i18n");
|
|
1513
1697
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
1514
1698
|
var EditConfirmationDialog = ({
|
|
1515
1699
|
closeDialog,
|
|
1516
1700
|
onConfirm,
|
|
1517
1701
|
onSuppressMessage
|
|
1518
1702
|
}) => {
|
|
1519
|
-
const [dontShowAgain, setDontShowAgain] = (0,
|
|
1703
|
+
const [dontShowAgain, setDontShowAgain] = (0, import_react11.useState)(false);
|
|
1520
1704
|
const handleSave = () => {
|
|
1521
1705
|
if (dontShowAgain) {
|
|
1522
1706
|
onSuppressMessage?.();
|
|
1523
1707
|
}
|
|
1524
1708
|
onConfirm?.();
|
|
1525
1709
|
};
|
|
1526
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ React14.createElement(import_ui14.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React14.createElement(import_ui14.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React14.createElement(import_icons7.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n9.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React14.createElement(import_ui14.DialogContent, null, /* @__PURE__ */ React14.createElement(import_ui14.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n9.__)(
|
|
1527
1711
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
1528
1712
|
"elementor"
|
|
1529
|
-
))), /* @__PURE__ */
|
|
1530
|
-
|
|
1713
|
+
))), /* @__PURE__ */ React14.createElement(import_ui14.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React14.createElement(
|
|
1714
|
+
import_ui14.FormControlLabel,
|
|
1531
1715
|
{
|
|
1532
|
-
control: /* @__PURE__ */
|
|
1533
|
-
|
|
1716
|
+
control: /* @__PURE__ */ React14.createElement(
|
|
1717
|
+
import_ui14.Checkbox,
|
|
1534
1718
|
{
|
|
1535
1719
|
checked: dontShowAgain,
|
|
1536
1720
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
1537
1721
|
size: "small"
|
|
1538
1722
|
}
|
|
1539
1723
|
),
|
|
1540
|
-
label: /* @__PURE__ */
|
|
1724
|
+
label: /* @__PURE__ */ React14.createElement(import_ui14.Typography, { variant: "body2" }, (0, import_i18n9.__)("Don't show me again", "elementor"))
|
|
1541
1725
|
}
|
|
1542
|
-
), /* @__PURE__ */
|
|
1726
|
+
), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(import_ui14.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n9.__)("Keep editing", "elementor")), /* @__PURE__ */ React14.createElement(import_ui14.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n9.__)("Save", "elementor")))));
|
|
1543
1727
|
};
|
|
1544
1728
|
|
|
1545
1729
|
// src/components/variable-edit.tsx
|
|
1546
|
-
var
|
|
1730
|
+
var SIZE3 = "tiny";
|
|
1547
1731
|
var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
1548
1732
|
const { icon: VariableIcon, valueField: ValueField, variableType } = useVariableType();
|
|
1549
1733
|
const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
|
|
1550
1734
|
const { propType } = (0, import_editor_controls5.useBoundProp)();
|
|
1551
1735
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
|
|
1552
|
-
const [deleteConfirmation, setDeleteConfirmation] = (0,
|
|
1553
|
-
const [editConfirmation, setEditConfirmation] = (0,
|
|
1554
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
1555
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
1736
|
+
const [deleteConfirmation, setDeleteConfirmation] = (0, import_react12.useState)(false);
|
|
1737
|
+
const [editConfirmation, setEditConfirmation] = (0, import_react12.useState)(false);
|
|
1738
|
+
const [errorMessage, setErrorMessage] = (0, import_react12.useState)("");
|
|
1739
|
+
const [valueFieldError, setValueFieldError] = (0, import_react12.useState)("");
|
|
1556
1740
|
const { labelFieldError, setLabelFieldError } = useLabelError();
|
|
1557
1741
|
const variable = useVariable(editId);
|
|
1558
1742
|
if (!variable) {
|
|
1559
1743
|
throw new Error(`Global ${variableType} variable not found`);
|
|
1560
1744
|
}
|
|
1561
1745
|
const userPermissions = usePermissions();
|
|
1562
|
-
const [value, setValue] = (0,
|
|
1563
|
-
const [label, setLabel] = (0,
|
|
1564
|
-
(0,
|
|
1746
|
+
const [value, setValue] = (0, import_react12.useState)(() => variable.value);
|
|
1747
|
+
const [label, setLabel] = (0, import_react12.useState)(() => variable.label);
|
|
1748
|
+
(0, import_react12.useEffect)(() => {
|
|
1565
1749
|
styleVariablesRepository.update({
|
|
1566
1750
|
[editId]: {
|
|
1567
1751
|
...variable,
|
|
@@ -1624,15 +1808,15 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1624
1808
|
const actions = [];
|
|
1625
1809
|
if (userPermissions.canDelete()) {
|
|
1626
1810
|
actions.push(
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
|
|
1811
|
+
/* @__PURE__ */ React15.createElement(
|
|
1812
|
+
import_ui15.IconButton,
|
|
1629
1813
|
{
|
|
1630
1814
|
key: "delete",
|
|
1631
|
-
size:
|
|
1632
|
-
"aria-label": (0,
|
|
1815
|
+
size: SIZE3,
|
|
1816
|
+
"aria-label": (0, import_i18n10.__)("Delete", "elementor"),
|
|
1633
1817
|
onClick: handleDeleteConfirmation
|
|
1634
1818
|
},
|
|
1635
|
-
/* @__PURE__ */
|
|
1819
|
+
/* @__PURE__ */ React15.createElement(import_icons8.TrashIcon, { fontSize: SIZE3 })
|
|
1636
1820
|
)
|
|
1637
1821
|
);
|
|
1638
1822
|
}
|
|
@@ -1652,31 +1836,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1652
1836
|
return !!errorMessage;
|
|
1653
1837
|
};
|
|
1654
1838
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
1655
|
-
return /* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React15.createElement(
|
|
1656
1840
|
import_editor_ui4.PopoverHeader,
|
|
1657
1841
|
{
|
|
1658
|
-
title: (0,
|
|
1842
|
+
title: (0, import_i18n10.__)("Edit variable", "elementor"),
|
|
1659
1843
|
onClose,
|
|
1660
|
-
icon: /* @__PURE__ */
|
|
1661
|
-
|
|
1844
|
+
icon: /* @__PURE__ */ React15.createElement(React15.Fragment, null, onGoBack && /* @__PURE__ */ React15.createElement(
|
|
1845
|
+
import_ui15.IconButton,
|
|
1662
1846
|
{
|
|
1663
|
-
size:
|
|
1664
|
-
"aria-label": (0,
|
|
1847
|
+
size: SIZE3,
|
|
1848
|
+
"aria-label": (0, import_i18n10.__)("Go Back", "elementor"),
|
|
1665
1849
|
onClick: onGoBack
|
|
1666
1850
|
},
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
), /* @__PURE__ */
|
|
1851
|
+
/* @__PURE__ */ React15.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
1852
|
+
), /* @__PURE__ */ React15.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
1669
1853
|
actions
|
|
1670
1854
|
}
|
|
1671
|
-
), /* @__PURE__ */
|
|
1855
|
+
), /* @__PURE__ */ React15.createElement(import_ui15.Divider, null), /* @__PURE__ */ React15.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React15.createElement(
|
|
1672
1856
|
FormField,
|
|
1673
1857
|
{
|
|
1674
1858
|
id: "variable-label",
|
|
1675
|
-
label: (0,
|
|
1859
|
+
label: (0, import_i18n10.__)("Name", "elementor"),
|
|
1676
1860
|
errorMsg: labelFieldError?.message,
|
|
1677
1861
|
noticeMsg: labelHint(label)
|
|
1678
1862
|
},
|
|
1679
|
-
/* @__PURE__ */
|
|
1863
|
+
/* @__PURE__ */ React15.createElement(
|
|
1680
1864
|
LabelField,
|
|
1681
1865
|
{
|
|
1682
1866
|
id: "variable-label",
|
|
@@ -1694,7 +1878,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1694
1878
|
}
|
|
1695
1879
|
}
|
|
1696
1880
|
)
|
|
1697
|
-
), /* @__PURE__ */
|
|
1881
|
+
), /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n10.__)("Value", "elementor") }, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "h5" }, /* @__PURE__ */ React15.createElement(
|
|
1698
1882
|
ValueField,
|
|
1699
1883
|
{
|
|
1700
1884
|
value,
|
|
@@ -1706,7 +1890,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1706
1890
|
onValidationChange: setValueFieldError,
|
|
1707
1891
|
propType
|
|
1708
1892
|
}
|
|
1709
|
-
))), errorMessage && /* @__PURE__ */
|
|
1893
|
+
))), errorMessage && /* @__PURE__ */ React15.createElement(import_ui15.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React15.createElement(import_ui15.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React15.createElement(import_ui15.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n10.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React15.createElement(
|
|
1710
1894
|
DeleteConfirmationDialog,
|
|
1711
1895
|
{
|
|
1712
1896
|
open: true,
|
|
@@ -1714,7 +1898,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1714
1898
|
onConfirm: handleDelete,
|
|
1715
1899
|
closeDialog: closeDeleteDialog()
|
|
1716
1900
|
}
|
|
1717
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
1901
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React15.createElement(
|
|
1718
1902
|
EditConfirmationDialog,
|
|
1719
1903
|
{
|
|
1720
1904
|
closeDialog: closeEditDialog(),
|
|
@@ -1725,22 +1909,22 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1725
1909
|
};
|
|
1726
1910
|
|
|
1727
1911
|
// src/components/variables-selection.tsx
|
|
1728
|
-
var
|
|
1729
|
-
var
|
|
1912
|
+
var React19 = __toESM(require("react"));
|
|
1913
|
+
var import_react13 = require("react");
|
|
1730
1914
|
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
1731
1915
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1732
|
-
var
|
|
1733
|
-
var
|
|
1734
|
-
var
|
|
1916
|
+
var import_icons10 = require("@elementor/icons");
|
|
1917
|
+
var import_ui20 = require("@elementor/ui");
|
|
1918
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
1735
1919
|
|
|
1736
1920
|
// src/components/ui/empty-state.tsx
|
|
1737
|
-
var
|
|
1738
|
-
var
|
|
1739
|
-
var
|
|
1921
|
+
var React16 = __toESM(require("react"));
|
|
1922
|
+
var import_ui16 = require("@elementor/ui");
|
|
1923
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1740
1924
|
var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
1741
1925
|
const canAdd = usePermissions().canAdd();
|
|
1742
|
-
return /* @__PURE__ */
|
|
1743
|
-
|
|
1926
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1927
|
+
import_ui16.Stack,
|
|
1744
1928
|
{
|
|
1745
1929
|
gap: 1,
|
|
1746
1930
|
alignItems: "center",
|
|
@@ -1750,30 +1934,30 @@ var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
|
1750
1934
|
sx: { p: 2.5, pb: 5.5 }
|
|
1751
1935
|
},
|
|
1752
1936
|
icon,
|
|
1753
|
-
canAdd ? /* @__PURE__ */
|
|
1937
|
+
canAdd ? /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React16.createElement(import_ui16.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n11.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React16.createElement(
|
|
1754
1938
|
Content,
|
|
1755
1939
|
{
|
|
1756
|
-
title: (0,
|
|
1757
|
-
message: (0,
|
|
1940
|
+
title: (0, import_i18n11.__)("There are no variables", "elementor"),
|
|
1941
|
+
message: (0, import_i18n11.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
1758
1942
|
}
|
|
1759
1943
|
)
|
|
1760
1944
|
);
|
|
1761
1945
|
};
|
|
1762
1946
|
function Content({ title, message }) {
|
|
1763
|
-
return /* @__PURE__ */
|
|
1947
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
1764
1948
|
}
|
|
1765
1949
|
|
|
1766
1950
|
// src/components/ui/menu-item-content.tsx
|
|
1767
|
-
var
|
|
1951
|
+
var React17 = __toESM(require("react"));
|
|
1768
1952
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1769
|
-
var
|
|
1770
|
-
var
|
|
1771
|
-
var
|
|
1772
|
-
var
|
|
1953
|
+
var import_icons9 = require("@elementor/icons");
|
|
1954
|
+
var import_ui17 = require("@elementor/ui");
|
|
1955
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1956
|
+
var SIZE4 = "tiny";
|
|
1773
1957
|
var MenuItemContent = ({ item }) => {
|
|
1774
1958
|
const onEdit = item.onEdit;
|
|
1775
|
-
return /* @__PURE__ */
|
|
1776
|
-
|
|
1959
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(import_ui17.ListItemIcon, null, item.icon), /* @__PURE__ */ React17.createElement(
|
|
1960
|
+
import_ui17.Box,
|
|
1777
1961
|
{
|
|
1778
1962
|
sx: {
|
|
1779
1963
|
flex: 1,
|
|
@@ -1783,49 +1967,49 @@ var MenuItemContent = ({ item }) => {
|
|
|
1783
1967
|
gap: 1
|
|
1784
1968
|
}
|
|
1785
1969
|
},
|
|
1786
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ React17.createElement(
|
|
1787
1971
|
import_editor_ui5.EllipsisWithTooltip,
|
|
1788
1972
|
{
|
|
1789
1973
|
title: item.label || item.value,
|
|
1790
|
-
as:
|
|
1974
|
+
as: import_ui17.Typography,
|
|
1791
1975
|
variant: "caption",
|
|
1792
1976
|
color: "text.primary",
|
|
1793
1977
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
1794
1978
|
maxWidth: "50%"
|
|
1795
1979
|
}
|
|
1796
1980
|
),
|
|
1797
|
-
item.secondaryText && /* @__PURE__ */
|
|
1981
|
+
item.secondaryText && /* @__PURE__ */ React17.createElement(
|
|
1798
1982
|
import_editor_ui5.EllipsisWithTooltip,
|
|
1799
1983
|
{
|
|
1800
1984
|
title: item.secondaryText,
|
|
1801
|
-
as:
|
|
1985
|
+
as: import_ui17.Typography,
|
|
1802
1986
|
variant: "caption",
|
|
1803
1987
|
color: "text.tertiary",
|
|
1804
1988
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
1805
1989
|
maxWidth: "50%"
|
|
1806
1990
|
}
|
|
1807
1991
|
)
|
|
1808
|
-
), !!onEdit && /* @__PURE__ */
|
|
1809
|
-
|
|
1992
|
+
), !!onEdit && /* @__PURE__ */ React17.createElement(
|
|
1993
|
+
import_ui17.IconButton,
|
|
1810
1994
|
{
|
|
1811
1995
|
sx: { mx: 1, opacity: "0" },
|
|
1812
1996
|
onClick: (e) => {
|
|
1813
1997
|
e.stopPropagation();
|
|
1814
1998
|
onEdit(item.value);
|
|
1815
1999
|
},
|
|
1816
|
-
"aria-label": (0,
|
|
2000
|
+
"aria-label": (0, import_i18n12.__)("Edit", "elementor")
|
|
1817
2001
|
},
|
|
1818
|
-
/* @__PURE__ */
|
|
2002
|
+
/* @__PURE__ */ React17.createElement(import_icons9.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
1819
2003
|
));
|
|
1820
2004
|
};
|
|
1821
2005
|
|
|
1822
2006
|
// src/components/ui/no-search-results.tsx
|
|
1823
|
-
var
|
|
1824
|
-
var
|
|
1825
|
-
var
|
|
2007
|
+
var React18 = __toESM(require("react"));
|
|
2008
|
+
var import_ui18 = require("@elementor/ui");
|
|
2009
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
1826
2010
|
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
1827
|
-
return /* @__PURE__ */
|
|
1828
|
-
|
|
2011
|
+
return /* @__PURE__ */ React18.createElement(
|
|
2012
|
+
import_ui18.Stack,
|
|
1829
2013
|
{
|
|
1830
2014
|
gap: 1,
|
|
1831
2015
|
alignItems: "center",
|
|
@@ -1836,14 +2020,14 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
|
1836
2020
|
sx: { pb: 3.5 }
|
|
1837
2021
|
},
|
|
1838
2022
|
icon,
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ React18.createElement(import_ui18.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n13.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React18.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
2024
|
+
/* @__PURE__ */ React18.createElement(import_ui18.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n13.__)("Try something else.", "elementor"), /* @__PURE__ */ React18.createElement(import_ui18.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n13.__)("Clear & try again", "elementor")))
|
|
1841
2025
|
);
|
|
1842
2026
|
};
|
|
1843
2027
|
|
|
1844
2028
|
// src/components/ui/styled-menu-list.tsx
|
|
1845
|
-
var
|
|
1846
|
-
var VariablesStyledMenuList = (0,
|
|
2029
|
+
var import_ui19 = require("@elementor/ui");
|
|
2030
|
+
var VariablesStyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ theme }) => ({
|
|
1847
2031
|
"& > li": {
|
|
1848
2032
|
height: 32,
|
|
1849
2033
|
width: "100%",
|
|
@@ -1874,11 +2058,11 @@ var VariablesStyledMenuList = (0, import_ui18.styled)(import_ui18.MenuList)(({ t
|
|
|
1874
2058
|
}));
|
|
1875
2059
|
|
|
1876
2060
|
// src/components/variables-selection.tsx
|
|
1877
|
-
var
|
|
2061
|
+
var SIZE5 = "tiny";
|
|
1878
2062
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
1879
2063
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil } = useVariableType();
|
|
1880
2064
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
1881
|
-
const [searchValue, setSearchValue] = (0,
|
|
2065
|
+
const [searchValue, setSearchValue] = (0, import_react13.useState)("");
|
|
1882
2066
|
const {
|
|
1883
2067
|
list: variables,
|
|
1884
2068
|
hasMatches: hasSearchResults,
|
|
@@ -1905,20 +2089,20 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1905
2089
|
const actions = [];
|
|
1906
2090
|
if (onAdd) {
|
|
1907
2091
|
actions.push(
|
|
1908
|
-
/* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ React19.createElement(import_ui20.IconButton, { id: "add-variable-button", key: "add", size: SIZE5, onClick: onAddAndTrack }, /* @__PURE__ */ React19.createElement(import_icons10.PlusIcon, { fontSize: SIZE5 }))
|
|
1909
2093
|
);
|
|
1910
2094
|
}
|
|
1911
2095
|
if (onSettings) {
|
|
1912
2096
|
actions.push(
|
|
1913
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ React19.createElement(import_ui20.IconButton, { id: "variables-manager-button", key: "settings", size: SIZE5, onClick: onSettings }, /* @__PURE__ */ React19.createElement(import_icons10.SettingsIcon, { fontSize: SIZE5 }))
|
|
1914
2098
|
);
|
|
1915
2099
|
}
|
|
1916
|
-
const StartIcon = startIcon || (() => /* @__PURE__ */
|
|
2100
|
+
const StartIcon = startIcon || (() => /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE5 }));
|
|
1917
2101
|
const items = variables.map(({ value, label, key }) => ({
|
|
1918
2102
|
type: "item",
|
|
1919
2103
|
value: key,
|
|
1920
2104
|
label,
|
|
1921
|
-
icon: /* @__PURE__ */
|
|
2105
|
+
icon: /* @__PURE__ */ React19.createElement(StartIcon, { value }),
|
|
1922
2106
|
secondaryText: value,
|
|
1923
2107
|
onEdit: onEdit ? () => onEdit?.(key) : void 0
|
|
1924
2108
|
}));
|
|
@@ -1928,27 +2112,27 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1928
2112
|
const handleClearSearch = () => {
|
|
1929
2113
|
setSearchValue("");
|
|
1930
2114
|
};
|
|
1931
|
-
const noVariableTitle = (0,
|
|
2115
|
+
const noVariableTitle = (0, import_i18n14.sprintf)(
|
|
1932
2116
|
/* translators: %s: Variable Type. */
|
|
1933
|
-
(0,
|
|
2117
|
+
(0, import_i18n14.__)("Create your first %s variable", "elementor"),
|
|
1934
2118
|
variableType
|
|
1935
2119
|
);
|
|
1936
|
-
return /* @__PURE__ */
|
|
2120
|
+
return /* @__PURE__ */ React19.createElement(import_editor_editing_panel4.PopoverBody, null, /* @__PURE__ */ React19.createElement(
|
|
1937
2121
|
import_editor_ui6.PopoverHeader,
|
|
1938
2122
|
{
|
|
1939
|
-
title: (0,
|
|
1940
|
-
icon: /* @__PURE__ */
|
|
2123
|
+
title: (0, import_i18n14.__)("Variables", "elementor"),
|
|
2124
|
+
icon: /* @__PURE__ */ React19.createElement(import_icons10.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
1941
2125
|
onClose: closePopover,
|
|
1942
2126
|
actions
|
|
1943
2127
|
}
|
|
1944
|
-
), hasVariables && /* @__PURE__ */
|
|
2128
|
+
), hasVariables && /* @__PURE__ */ React19.createElement(
|
|
1945
2129
|
import_editor_ui6.PopoverSearch,
|
|
1946
2130
|
{
|
|
1947
2131
|
value: searchValue,
|
|
1948
2132
|
onSearch: handleSearch,
|
|
1949
|
-
placeholder: (0,
|
|
2133
|
+
placeholder: (0, import_i18n14.__)("Search", "elementor")
|
|
1950
2134
|
}
|
|
1951
|
-
), /* @__PURE__ */
|
|
2135
|
+
), /* @__PURE__ */ React19.createElement(import_ui20.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React19.createElement(
|
|
1952
2136
|
import_editor_ui6.PopoverMenuList,
|
|
1953
2137
|
{
|
|
1954
2138
|
items,
|
|
@@ -1958,35 +2142,35 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1958
2142
|
selectedValue: variable,
|
|
1959
2143
|
"data-testid": `${variableType}-variables-list`,
|
|
1960
2144
|
menuListTemplate: VariablesStyledMenuList,
|
|
1961
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
2145
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React19.createElement(MenuItemContent, { item })
|
|
1962
2146
|
}
|
|
1963
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
2147
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React19.createElement(
|
|
1964
2148
|
NoSearchResults,
|
|
1965
2149
|
{
|
|
1966
2150
|
searchValue,
|
|
1967
2151
|
onClear: handleClearSearch,
|
|
1968
|
-
icon: /* @__PURE__ */
|
|
2152
|
+
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" })
|
|
1969
2153
|
}
|
|
1970
|
-
), !hasVariables && !hasNoCompatibleVariables && /* @__PURE__ */
|
|
2154
|
+
), !hasVariables && !hasNoCompatibleVariables && /* @__PURE__ */ React19.createElement(
|
|
1971
2155
|
EmptyState,
|
|
1972
2156
|
{
|
|
1973
2157
|
title: noVariableTitle,
|
|
1974
|
-
message: (0,
|
|
2158
|
+
message: (0, import_i18n14.__)(
|
|
1975
2159
|
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1976
2160
|
"elementor"
|
|
1977
2161
|
),
|
|
1978
|
-
icon: /* @__PURE__ */
|
|
2162
|
+
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" }),
|
|
1979
2163
|
onAdd
|
|
1980
2164
|
}
|
|
1981
|
-
), hasNoCompatibleVariables && /* @__PURE__ */
|
|
2165
|
+
), hasNoCompatibleVariables && /* @__PURE__ */ React19.createElement(
|
|
1982
2166
|
EmptyState,
|
|
1983
2167
|
{
|
|
1984
|
-
title: (0,
|
|
1985
|
-
message: (0,
|
|
2168
|
+
title: (0, import_i18n14.__)("No compatible variables", "elementor"),
|
|
2169
|
+
message: (0, import_i18n14.__)(
|
|
1986
2170
|
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
1987
2171
|
"elementor"
|
|
1988
2172
|
),
|
|
1989
|
-
icon: /* @__PURE__ */
|
|
2173
|
+
icon: /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: "large" }),
|
|
1990
2174
|
onAdd
|
|
1991
2175
|
}
|
|
1992
2176
|
));
|
|
@@ -1997,13 +2181,13 @@ var VIEW_LIST = "list";
|
|
|
1997
2181
|
var VIEW_ADD = "add";
|
|
1998
2182
|
var VIEW_EDIT = "edit";
|
|
1999
2183
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
2000
|
-
const [currentView, setCurrentView] = (0,
|
|
2001
|
-
const [editId, setEditId] = (0,
|
|
2184
|
+
const [currentView, setCurrentView] = (0, import_react14.useState)(VIEW_LIST);
|
|
2185
|
+
const [editId, setEditId] = (0, import_react14.useState)("");
|
|
2002
2186
|
const { open } = usePanelActions();
|
|
2003
2187
|
const onSettingsAvailable = (0, import_editor_v1_adapters2.isExperimentActive)("e_variables_manager") ? () => {
|
|
2004
2188
|
open();
|
|
2005
2189
|
} : void 0;
|
|
2006
|
-
return /* @__PURE__ */
|
|
2190
|
+
return /* @__PURE__ */ React20.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React20.createElement(PopoverContentRefContextProvider, null, RenderView({
|
|
2007
2191
|
propTypeKey,
|
|
2008
2192
|
currentView,
|
|
2009
2193
|
selectedVariable,
|
|
@@ -2049,7 +2233,7 @@ function RenderView(props) {
|
|
|
2049
2233
|
}
|
|
2050
2234
|
};
|
|
2051
2235
|
if (VIEW_LIST === props.currentView) {
|
|
2052
|
-
return /* @__PURE__ */
|
|
2236
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2053
2237
|
VariablesSelection,
|
|
2054
2238
|
{
|
|
2055
2239
|
closePopover: handlers.onClose,
|
|
@@ -2060,10 +2244,10 @@ function RenderView(props) {
|
|
|
2060
2244
|
);
|
|
2061
2245
|
}
|
|
2062
2246
|
if (VIEW_ADD === props.currentView) {
|
|
2063
|
-
return /* @__PURE__ */
|
|
2247
|
+
return /* @__PURE__ */ React20.createElement(VariableCreation, { onGoBack: handlers.onGoBack, onClose: handlers.onClose });
|
|
2064
2248
|
}
|
|
2065
2249
|
if (VIEW_EDIT === props.currentView) {
|
|
2066
|
-
return /* @__PURE__ */
|
|
2250
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2067
2251
|
VariableEdit,
|
|
2068
2252
|
{
|
|
2069
2253
|
editId: props.editId,
|
|
@@ -2077,25 +2261,25 @@ function RenderView(props) {
|
|
|
2077
2261
|
}
|
|
2078
2262
|
|
|
2079
2263
|
// src/components/ui/tags/assigned-tag.tsx
|
|
2080
|
-
var
|
|
2081
|
-
var
|
|
2082
|
-
var
|
|
2083
|
-
var
|
|
2084
|
-
var
|
|
2264
|
+
var React21 = __toESM(require("react"));
|
|
2265
|
+
var import_icons11 = require("@elementor/icons");
|
|
2266
|
+
var import_ui21 = require("@elementor/ui");
|
|
2267
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2268
|
+
var SIZE6 = "tiny";
|
|
2085
2269
|
var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
2086
2270
|
const actions = [];
|
|
2087
2271
|
if (onUnlink) {
|
|
2088
2272
|
actions.push(
|
|
2089
|
-
/* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ React21.createElement(import_ui21.IconButton, { key: "unlink", size: SIZE6, onClick: onUnlink, "aria-label": (0, import_i18n15.__)("Unlink", "elementor") }, /* @__PURE__ */ React21.createElement(import_icons11.DetachIcon, { fontSize: SIZE6 }))
|
|
2090
2274
|
);
|
|
2091
2275
|
}
|
|
2092
|
-
return /* @__PURE__ */
|
|
2093
|
-
|
|
2276
|
+
return /* @__PURE__ */ React21.createElement(import_ui21.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React21.createElement(
|
|
2277
|
+
import_ui21.UnstableTag,
|
|
2094
2278
|
{
|
|
2095
2279
|
fullWidth: true,
|
|
2096
2280
|
showActionsOnHover: true,
|
|
2097
|
-
startIcon: /* @__PURE__ */
|
|
2098
|
-
label: /* @__PURE__ */
|
|
2281
|
+
startIcon: /* @__PURE__ */ React21.createElement(import_ui21.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
2282
|
+
label: /* @__PURE__ */ React21.createElement(import_ui21.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React21.createElement(import_ui21.Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
2099
2283
|
actions,
|
|
2100
2284
|
...props
|
|
2101
2285
|
}
|
|
@@ -2106,24 +2290,24 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
|
2106
2290
|
var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
2107
2291
|
const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
|
|
2108
2292
|
const { setValue } = (0, import_editor_controls6.useBoundProp)();
|
|
2109
|
-
const anchorRef = (0,
|
|
2110
|
-
const popupId = (0,
|
|
2111
|
-
const popupState = (0,
|
|
2293
|
+
const anchorRef = (0, import_react15.useRef)(null);
|
|
2294
|
+
const popupId = (0, import_react15.useId)();
|
|
2295
|
+
const popupState = (0, import_ui22.usePopupState)({
|
|
2112
2296
|
variant: "popover",
|
|
2113
2297
|
popupId: `elementor-variables-list-${popupId}`
|
|
2114
2298
|
});
|
|
2115
2299
|
const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
|
|
2116
2300
|
const StartIcon = startIcon || (() => null);
|
|
2117
|
-
return /* @__PURE__ */
|
|
2301
|
+
return /* @__PURE__ */ React22.createElement(import_ui22.Box, { ref: anchorRef }, /* @__PURE__ */ React22.createElement(
|
|
2118
2302
|
AssignedTag,
|
|
2119
2303
|
{
|
|
2120
2304
|
label: variable.label,
|
|
2121
|
-
startIcon: /* @__PURE__ */
|
|
2305
|
+
startIcon: /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(import_icons12.ColorFilterIcon, { fontSize: SIZE6 }), /* @__PURE__ */ React22.createElement(StartIcon, { value: variable.value })),
|
|
2122
2306
|
onUnlink: unlinkVariable,
|
|
2123
|
-
...(0,
|
|
2307
|
+
...(0, import_ui22.bindTrigger)(popupState)
|
|
2124
2308
|
}
|
|
2125
|
-
), /* @__PURE__ */
|
|
2126
|
-
|
|
2309
|
+
), /* @__PURE__ */ React22.createElement(
|
|
2310
|
+
import_ui22.Popover,
|
|
2127
2311
|
{
|
|
2128
2312
|
disableScrollLock: true,
|
|
2129
2313
|
anchorEl: anchorRef.current,
|
|
@@ -2132,9 +2316,9 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2132
2316
|
PaperProps: {
|
|
2133
2317
|
sx: { my: 1 }
|
|
2134
2318
|
},
|
|
2135
|
-
...(0,
|
|
2319
|
+
...(0, import_ui22.bindPopover)(popupState)
|
|
2136
2320
|
},
|
|
2137
|
-
/* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ React22.createElement(
|
|
2138
2322
|
VariableSelectionPopover,
|
|
2139
2323
|
{
|
|
2140
2324
|
selectedVariable: variable,
|
|
@@ -2146,21 +2330,21 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
|
|
|
2146
2330
|
};
|
|
2147
2331
|
|
|
2148
2332
|
// src/components/ui/variable/deleted-variable.tsx
|
|
2149
|
-
var
|
|
2150
|
-
var
|
|
2333
|
+
var React26 = __toESM(require("react"));
|
|
2334
|
+
var import_react17 = require("react");
|
|
2151
2335
|
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
2152
|
-
var
|
|
2153
|
-
var
|
|
2336
|
+
var import_ui26 = require("@elementor/ui");
|
|
2337
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
2154
2338
|
|
|
2155
2339
|
// src/components/variable-restore.tsx
|
|
2156
|
-
var
|
|
2157
|
-
var
|
|
2340
|
+
var React23 = __toESM(require("react"));
|
|
2341
|
+
var import_react16 = require("react");
|
|
2158
2342
|
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
2159
2343
|
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
2160
2344
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
2161
|
-
var
|
|
2162
|
-
var
|
|
2163
|
-
var
|
|
2345
|
+
var import_ui23 = require("@elementor/ui");
|
|
2346
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2347
|
+
var SIZE7 = "tiny";
|
|
2164
2348
|
var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
2165
2349
|
const { icon: VariableIcon, valueField: ValueField, variableType } = useVariableType();
|
|
2166
2350
|
const { setVariableValue: notifyBoundPropChange } = useVariableBoundProp();
|
|
@@ -2169,10 +2353,10 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2169
2353
|
if (!variable) {
|
|
2170
2354
|
throw new Error(`Global ${variableType} variable not found`);
|
|
2171
2355
|
}
|
|
2172
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2173
|
-
const [valueFieldError, setValueFieldError] = (0,
|
|
2174
|
-
const [label, setLabel] = (0,
|
|
2175
|
-
const [value, setValue] = (0,
|
|
2356
|
+
const [errorMessage, setErrorMessage] = (0, import_react16.useState)("");
|
|
2357
|
+
const [valueFieldError, setValueFieldError] = (0, import_react16.useState)("");
|
|
2358
|
+
const [label, setLabel] = (0, import_react16.useState)(variable.label);
|
|
2359
|
+
const [value, setValue] = (0, import_react16.useState)(variable.value);
|
|
2176
2360
|
const { labelFieldError, setLabelFieldError } = useLabelError({
|
|
2177
2361
|
value: variable.label,
|
|
2178
2362
|
message: ERROR_MESSAGES.DUPLICATED_LABEL
|
|
@@ -2210,22 +2394,22 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2210
2394
|
return !!errorMessage;
|
|
2211
2395
|
};
|
|
2212
2396
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
2213
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ React23.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React23.createElement(import_editor_editing_panel5.PopoverBody, { height: "auto" }, /* @__PURE__ */ React23.createElement(
|
|
2214
2398
|
import_editor_ui7.PopoverHeader,
|
|
2215
2399
|
{
|
|
2216
|
-
icon: /* @__PURE__ */
|
|
2217
|
-
title: (0,
|
|
2400
|
+
icon: /* @__PURE__ */ React23.createElement(VariableIcon, { fontSize: SIZE7 }),
|
|
2401
|
+
title: (0, import_i18n16.__)("Restore variable", "elementor"),
|
|
2218
2402
|
onClose
|
|
2219
2403
|
}
|
|
2220
|
-
), /* @__PURE__ */
|
|
2404
|
+
), /* @__PURE__ */ React23.createElement(import_ui23.Divider, null), /* @__PURE__ */ React23.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React23.createElement(
|
|
2221
2405
|
FormField,
|
|
2222
2406
|
{
|
|
2223
2407
|
id: "variable-label",
|
|
2224
|
-
label: (0,
|
|
2408
|
+
label: (0, import_i18n16.__)("Name", "elementor"),
|
|
2225
2409
|
errorMsg: labelFieldError?.message,
|
|
2226
2410
|
noticeMsg: labelHint(label)
|
|
2227
2411
|
},
|
|
2228
|
-
/* @__PURE__ */
|
|
2412
|
+
/* @__PURE__ */ React23.createElement(
|
|
2229
2413
|
LabelField,
|
|
2230
2414
|
{
|
|
2231
2415
|
id: "variable-label",
|
|
@@ -2243,7 +2427,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2243
2427
|
}
|
|
2244
2428
|
}
|
|
2245
2429
|
)
|
|
2246
|
-
), /* @__PURE__ */
|
|
2430
|
+
), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n16.__)("Value", "elementor") }, /* @__PURE__ */ React23.createElement(import_ui23.Typography, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
|
|
2247
2431
|
ValueField,
|
|
2248
2432
|
{
|
|
2249
2433
|
value,
|
|
@@ -2255,25 +2439,25 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2255
2439
|
onValidationChange: setValueFieldError,
|
|
2256
2440
|
propType
|
|
2257
2441
|
}
|
|
2258
|
-
))), errorMessage && /* @__PURE__ */
|
|
2442
|
+
))), errorMessage && /* @__PURE__ */ React23.createElement(import_ui23.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React23.createElement(import_ui23.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React23.createElement(import_ui23.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n16.__)("Restore", "elementor")))));
|
|
2259
2443
|
};
|
|
2260
2444
|
|
|
2261
2445
|
// src/components/ui/deleted-variable-alert.tsx
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2264
|
-
var
|
|
2446
|
+
var React24 = __toESM(require("react"));
|
|
2447
|
+
var import_ui24 = require("@elementor/ui");
|
|
2448
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2265
2449
|
var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
2266
|
-
return /* @__PURE__ */
|
|
2267
|
-
|
|
2450
|
+
return /* @__PURE__ */ React24.createElement(import_ui24.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React24.createElement(
|
|
2451
|
+
import_ui24.Alert,
|
|
2268
2452
|
{
|
|
2269
2453
|
variant: "standard",
|
|
2270
2454
|
severity: "warning",
|
|
2271
2455
|
onClose,
|
|
2272
|
-
action: /* @__PURE__ */
|
|
2456
|
+
action: /* @__PURE__ */ React24.createElement(React24.Fragment, null, onUnlink && /* @__PURE__ */ React24.createElement(import_ui24.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n17.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React24.createElement(import_ui24.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n17.__)("Restore", "elementor"))),
|
|
2273
2457
|
sx: { maxWidth: 300 }
|
|
2274
2458
|
},
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ React24.createElement(import_ui24.AlertTitle, null, (0, import_i18n17.__)("Deleted variable", "elementor")),
|
|
2460
|
+
/* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n17.__)("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", (0, import_i18n17.__)(
|
|
2277
2461
|
"has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
|
|
2278
2462
|
"elementor"
|
|
2279
2463
|
))
|
|
@@ -2281,14 +2465,14 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
|
|
|
2281
2465
|
};
|
|
2282
2466
|
|
|
2283
2467
|
// src/components/ui/tags/warning-variable-tag.tsx
|
|
2284
|
-
var
|
|
2285
|
-
var
|
|
2286
|
-
var
|
|
2287
|
-
var WarningVariableTag =
|
|
2468
|
+
var React25 = __toESM(require("react"));
|
|
2469
|
+
var import_icons13 = require("@elementor/icons");
|
|
2470
|
+
var import_ui25 = require("@elementor/ui");
|
|
2471
|
+
var WarningVariableTag = React25.forwardRef(
|
|
2288
2472
|
({ label, suffix, onClick, icon, ...props }, ref) => {
|
|
2289
2473
|
const displayText = suffix ? `${label} (${suffix})` : label;
|
|
2290
|
-
return /* @__PURE__ */
|
|
2291
|
-
|
|
2474
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2475
|
+
import_ui25.Chip,
|
|
2292
2476
|
{
|
|
2293
2477
|
ref,
|
|
2294
2478
|
size: "tiny",
|
|
@@ -2296,8 +2480,8 @@ var WarningVariableTag = React24.forwardRef(
|
|
|
2296
2480
|
shape: "rounded",
|
|
2297
2481
|
variant: "standard",
|
|
2298
2482
|
onClick,
|
|
2299
|
-
icon: /* @__PURE__ */
|
|
2300
|
-
label: /* @__PURE__ */
|
|
2483
|
+
icon: /* @__PURE__ */ React25.createElement(import_icons13.AlertTriangleFilledIcon, null),
|
|
2484
|
+
label: /* @__PURE__ */ React25.createElement(import_ui25.Tooltip, { title: displayText, placement: "top" }, /* @__PURE__ */ React25.createElement(import_ui25.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React25.createElement(import_ui25.Typography, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
|
|
2301
2485
|
sx: {
|
|
2302
2486
|
height: (theme) => theme.spacing(3.5),
|
|
2303
2487
|
borderRadius: (theme) => theme.spacing(1),
|
|
@@ -2316,12 +2500,12 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2316
2500
|
const { propTypeUtil } = getVariableType(propTypeKey);
|
|
2317
2501
|
const boundProp = (0, import_editor_controls8.useBoundProp)();
|
|
2318
2502
|
const userPermissions = usePermissions();
|
|
2319
|
-
const [showInfotip, setShowInfotip] = (0,
|
|
2503
|
+
const [showInfotip, setShowInfotip] = (0, import_react17.useState)(false);
|
|
2320
2504
|
const toggleInfotip = () => setShowInfotip((prev) => !prev);
|
|
2321
2505
|
const closeInfotip = () => setShowInfotip(false);
|
|
2322
|
-
const deletedChipAnchorRef = (0,
|
|
2323
|
-
const popupId = (0,
|
|
2324
|
-
const popupState = (0,
|
|
2506
|
+
const deletedChipAnchorRef = (0, import_react17.useRef)(null);
|
|
2507
|
+
const popupId = (0, import_react17.useId)();
|
|
2508
|
+
const popupState = (0, import_ui26.usePopupState)({
|
|
2325
2509
|
variant: "popover",
|
|
2326
2510
|
popupId: `elementor-variables-restore-${popupId}`
|
|
2327
2511
|
});
|
|
@@ -2347,15 +2531,15 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2347
2531
|
const handleRestoreWithOverrides = () => {
|
|
2348
2532
|
popupState.close();
|
|
2349
2533
|
};
|
|
2350
|
-
return /* @__PURE__ */
|
|
2351
|
-
|
|
2534
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(import_ui26.Box, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React26.createElement(import_ui26.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React26.createElement(
|
|
2535
|
+
import_ui26.Infotip,
|
|
2352
2536
|
{
|
|
2353
2537
|
color: "warning",
|
|
2354
2538
|
placement: "right-start",
|
|
2355
2539
|
open: showInfotip,
|
|
2356
2540
|
disableHoverListener: true,
|
|
2357
2541
|
onClose: closeInfotip,
|
|
2358
|
-
content: /* @__PURE__ */
|
|
2542
|
+
content: /* @__PURE__ */ React26.createElement(
|
|
2359
2543
|
DeletedVariableAlert,
|
|
2360
2544
|
{
|
|
2361
2545
|
onClose: closeInfotip,
|
|
@@ -2375,16 +2559,16 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2375
2559
|
}
|
|
2376
2560
|
}
|
|
2377
2561
|
},
|
|
2378
|
-
/* @__PURE__ */
|
|
2562
|
+
/* @__PURE__ */ React26.createElement(
|
|
2379
2563
|
WarningVariableTag,
|
|
2380
2564
|
{
|
|
2381
2565
|
label: variable.label,
|
|
2382
2566
|
onClick: toggleInfotip,
|
|
2383
|
-
suffix: (0,
|
|
2567
|
+
suffix: (0, import_i18n18.__)("deleted", "elementor")
|
|
2384
2568
|
}
|
|
2385
2569
|
)
|
|
2386
|
-
), /* @__PURE__ */
|
|
2387
|
-
|
|
2570
|
+
), /* @__PURE__ */ React26.createElement(
|
|
2571
|
+
import_ui26.Popover,
|
|
2388
2572
|
{
|
|
2389
2573
|
disableScrollLock: true,
|
|
2390
2574
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
@@ -2392,9 +2576,9 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2392
2576
|
PaperProps: {
|
|
2393
2577
|
sx: { my: 1 }
|
|
2394
2578
|
},
|
|
2395
|
-
...(0,
|
|
2579
|
+
...(0, import_ui26.bindPopover)(popupState)
|
|
2396
2580
|
},
|
|
2397
|
-
/* @__PURE__ */
|
|
2581
|
+
/* @__PURE__ */ React26.createElement(VariableTypeProvider, { propTypeKey }, /* @__PURE__ */ React26.createElement(
|
|
2398
2582
|
VariableRestore,
|
|
2399
2583
|
{
|
|
2400
2584
|
variableId: variable.key ?? "",
|
|
@@ -2406,52 +2590,52 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
|
|
|
2406
2590
|
};
|
|
2407
2591
|
|
|
2408
2592
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2409
|
-
var
|
|
2410
|
-
var
|
|
2593
|
+
var React28 = __toESM(require("react"));
|
|
2594
|
+
var import_react18 = require("react");
|
|
2411
2595
|
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
2412
|
-
var
|
|
2413
|
-
var
|
|
2596
|
+
var import_ui28 = require("@elementor/ui");
|
|
2597
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
2414
2598
|
|
|
2415
2599
|
// src/components/ui/mismatch-variable-alert.tsx
|
|
2416
|
-
var
|
|
2417
|
-
var
|
|
2418
|
-
var
|
|
2600
|
+
var React27 = __toESM(require("react"));
|
|
2601
|
+
var import_ui27 = require("@elementor/ui");
|
|
2602
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2419
2603
|
var i18n = {
|
|
2420
|
-
title: (0,
|
|
2421
|
-
message: (0,
|
|
2604
|
+
title: (0, import_i18n19.__)("Variable has changed", "elementor"),
|
|
2605
|
+
message: (0, import_i18n19.__)(
|
|
2422
2606
|
`This variable is no longer compatible with this property. You can clear it or select a different one.`,
|
|
2423
2607
|
"elementor"
|
|
2424
2608
|
),
|
|
2425
2609
|
buttons: {
|
|
2426
|
-
clear: (0,
|
|
2427
|
-
select: (0,
|
|
2610
|
+
clear: (0, import_i18n19.__)("Clear", "elementor"),
|
|
2611
|
+
select: (0, import_i18n19.__)("Select variable", "elementor")
|
|
2428
2612
|
}
|
|
2429
2613
|
};
|
|
2430
2614
|
var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
|
|
2431
|
-
return /* @__PURE__ */
|
|
2432
|
-
|
|
2615
|
+
return /* @__PURE__ */ React27.createElement(import_ui27.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React27.createElement(
|
|
2616
|
+
import_ui27.Alert,
|
|
2433
2617
|
{
|
|
2434
2618
|
variant: "standard",
|
|
2435
2619
|
severity: "warning",
|
|
2436
2620
|
onClose,
|
|
2437
|
-
action: /* @__PURE__ */
|
|
2621
|
+
action: /* @__PURE__ */ React27.createElement(React27.Fragment, null, onClear && /* @__PURE__ */ React27.createElement(import_ui27.AlertAction, { variant: "contained", onClick: onClear }, i18n.buttons.clear), triggerSelect && /* @__PURE__ */ React27.createElement(import_ui27.AlertAction, { variant: "outlined", onClick: triggerSelect }, i18n.buttons.select)),
|
|
2438
2622
|
sx: { maxWidth: 300 }
|
|
2439
2623
|
},
|
|
2440
|
-
/* @__PURE__ */
|
|
2441
|
-
/* @__PURE__ */
|
|
2624
|
+
/* @__PURE__ */ React27.createElement(import_ui27.AlertTitle, null, i18n.title),
|
|
2625
|
+
/* @__PURE__ */ React27.createElement(import_ui27.Typography, { variant: "body2", color: "textPrimary" }, i18n.message)
|
|
2442
2626
|
));
|
|
2443
2627
|
};
|
|
2444
2628
|
|
|
2445
2629
|
// src/components/ui/variable/mismatch-variable.tsx
|
|
2446
2630
|
var MismatchVariable = ({ variable }) => {
|
|
2447
2631
|
const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
|
|
2448
|
-
const anchorRef = (0,
|
|
2449
|
-
const popupId = (0,
|
|
2450
|
-
const popupState = (0,
|
|
2632
|
+
const anchorRef = (0, import_react18.useRef)(null);
|
|
2633
|
+
const popupId = (0, import_react18.useId)();
|
|
2634
|
+
const popupState = (0, import_ui28.usePopupState)({
|
|
2451
2635
|
variant: "popover",
|
|
2452
2636
|
popupId: `elementor-variables-list-${popupId}`
|
|
2453
2637
|
});
|
|
2454
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
2638
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react18.useState)(false);
|
|
2455
2639
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
2456
2640
|
const closeInfotip = () => setInfotipVisible(false);
|
|
2457
2641
|
const triggerSelect = () => {
|
|
@@ -2464,15 +2648,15 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2464
2648
|
setValue(null);
|
|
2465
2649
|
};
|
|
2466
2650
|
const showClearButton = !!value;
|
|
2467
|
-
return /* @__PURE__ */
|
|
2468
|
-
|
|
2651
|
+
return /* @__PURE__ */ React28.createElement(import_ui28.Box, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React28.createElement(import_ui28.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
|
|
2652
|
+
import_ui28.Infotip,
|
|
2469
2653
|
{
|
|
2470
2654
|
color: "warning",
|
|
2471
2655
|
placement: "right-start",
|
|
2472
2656
|
open: infotipVisible,
|
|
2473
2657
|
disableHoverListener: true,
|
|
2474
2658
|
onClose: closeInfotip,
|
|
2475
|
-
content: /* @__PURE__ */
|
|
2659
|
+
content: /* @__PURE__ */ React28.createElement(
|
|
2476
2660
|
MismatchVariableAlert,
|
|
2477
2661
|
{
|
|
2478
2662
|
onClose: closeInfotip,
|
|
@@ -2491,16 +2675,16 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2491
2675
|
}
|
|
2492
2676
|
}
|
|
2493
2677
|
},
|
|
2494
|
-
/* @__PURE__ */
|
|
2678
|
+
/* @__PURE__ */ React28.createElement(
|
|
2495
2679
|
WarningVariableTag,
|
|
2496
2680
|
{
|
|
2497
2681
|
label: variable.label,
|
|
2498
2682
|
onClick: toggleInfotip,
|
|
2499
|
-
suffix: (0,
|
|
2683
|
+
suffix: (0, import_i18n20.__)("changed", "elementor")
|
|
2500
2684
|
}
|
|
2501
2685
|
)
|
|
2502
|
-
), /* @__PURE__ */
|
|
2503
|
-
|
|
2686
|
+
), /* @__PURE__ */ React28.createElement(
|
|
2687
|
+
import_ui28.Popover,
|
|
2504
2688
|
{
|
|
2505
2689
|
disableScrollLock: true,
|
|
2506
2690
|
anchorEl: anchorRef.current,
|
|
@@ -2509,9 +2693,9 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2509
2693
|
PaperProps: {
|
|
2510
2694
|
sx: { my: 1 }
|
|
2511
2695
|
},
|
|
2512
|
-
...(0,
|
|
2696
|
+
...(0, import_ui28.bindPopover)(popupState)
|
|
2513
2697
|
},
|
|
2514
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ React28.createElement(
|
|
2515
2699
|
VariableSelectionPopover,
|
|
2516
2700
|
{
|
|
2517
2701
|
selectedVariable: variable,
|
|
@@ -2523,28 +2707,28 @@ var MismatchVariable = ({ variable }) => {
|
|
|
2523
2707
|
};
|
|
2524
2708
|
|
|
2525
2709
|
// src/components/ui/variable/missing-variable.tsx
|
|
2526
|
-
var
|
|
2527
|
-
var
|
|
2710
|
+
var React30 = __toESM(require("react"));
|
|
2711
|
+
var import_react19 = require("react");
|
|
2528
2712
|
var import_editor_controls10 = require("@elementor/editor-controls");
|
|
2529
|
-
var
|
|
2530
|
-
var
|
|
2713
|
+
var import_ui30 = require("@elementor/ui");
|
|
2714
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
2531
2715
|
|
|
2532
2716
|
// src/components/ui/missing-variable-alert.tsx
|
|
2533
|
-
var
|
|
2534
|
-
var
|
|
2535
|
-
var
|
|
2717
|
+
var React29 = __toESM(require("react"));
|
|
2718
|
+
var import_ui29 = require("@elementor/ui");
|
|
2719
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
2536
2720
|
var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
2537
|
-
return /* @__PURE__ */
|
|
2538
|
-
|
|
2721
|
+
return /* @__PURE__ */ React29.createElement(import_ui29.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
|
|
2722
|
+
import_ui29.Alert,
|
|
2539
2723
|
{
|
|
2540
2724
|
variant: "standard",
|
|
2541
2725
|
severity: "warning",
|
|
2542
2726
|
onClose,
|
|
2543
|
-
action: /* @__PURE__ */
|
|
2727
|
+
action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(import_ui29.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n21.__)("Clear", "elementor"))),
|
|
2544
2728
|
sx: { maxWidth: 300 }
|
|
2545
2729
|
},
|
|
2546
|
-
/* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, (0, import_i18n21.__)("This variable is missing", "elementor")),
|
|
2731
|
+
/* @__PURE__ */ React29.createElement(import_ui29.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n21.__)(
|
|
2548
2732
|
"It may have been deleted. Try clearing this field and select a different value or variable.",
|
|
2549
2733
|
"elementor"
|
|
2550
2734
|
))
|
|
@@ -2554,19 +2738,19 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
|
|
|
2554
2738
|
// src/components/ui/variable/missing-variable.tsx
|
|
2555
2739
|
var MissingVariable = () => {
|
|
2556
2740
|
const { setValue } = (0, import_editor_controls10.useBoundProp)();
|
|
2557
|
-
const [infotipVisible, setInfotipVisible] = (0,
|
|
2741
|
+
const [infotipVisible, setInfotipVisible] = (0, import_react19.useState)(false);
|
|
2558
2742
|
const toggleInfotip = () => setInfotipVisible((prev) => !prev);
|
|
2559
2743
|
const closeInfotip = () => setInfotipVisible(false);
|
|
2560
2744
|
const clearValue = () => setValue(null);
|
|
2561
|
-
return /* @__PURE__ */
|
|
2562
|
-
|
|
2745
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, infotipVisible && /* @__PURE__ */ React30.createElement(import_ui30.Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React30.createElement(
|
|
2746
|
+
import_ui30.Infotip,
|
|
2563
2747
|
{
|
|
2564
2748
|
color: "warning",
|
|
2565
2749
|
placement: "right-start",
|
|
2566
2750
|
open: infotipVisible,
|
|
2567
2751
|
disableHoverListener: true,
|
|
2568
2752
|
onClose: closeInfotip,
|
|
2569
|
-
content: /* @__PURE__ */
|
|
2753
|
+
content: /* @__PURE__ */ React30.createElement(MissingVariableAlert, { onClose: closeInfotip, onClear: clearValue }),
|
|
2570
2754
|
slotProps: {
|
|
2571
2755
|
popper: {
|
|
2572
2756
|
modifiers: [
|
|
@@ -2578,7 +2762,7 @@ var MissingVariable = () => {
|
|
|
2578
2762
|
}
|
|
2579
2763
|
}
|
|
2580
2764
|
},
|
|
2581
|
-
/* @__PURE__ */
|
|
2765
|
+
/* @__PURE__ */ React30.createElement(WarningVariableTag, { label: (0, import_i18n22.__)("Missing variable", "elementor"), onClick: toggleInfotip })
|
|
2582
2766
|
));
|
|
2583
2767
|
};
|
|
2584
2768
|
|
|
@@ -2588,37 +2772,37 @@ var VariableControl = () => {
|
|
|
2588
2772
|
const boundPropValue = boundProp.value ?? boundProp.placeholder;
|
|
2589
2773
|
const assignedVariable = useVariable(boundPropValue?.value);
|
|
2590
2774
|
if (!assignedVariable) {
|
|
2591
|
-
return /* @__PURE__ */
|
|
2775
|
+
return /* @__PURE__ */ React31.createElement(MissingVariable, null);
|
|
2592
2776
|
}
|
|
2593
2777
|
const { $$type: propTypeKey } = boundPropValue;
|
|
2594
2778
|
if (assignedVariable?.deleted) {
|
|
2595
|
-
return /* @__PURE__ */
|
|
2779
|
+
return /* @__PURE__ */ React31.createElement(DeletedVariable, { variable: assignedVariable, propTypeKey });
|
|
2596
2780
|
}
|
|
2597
2781
|
const { isCompatible } = getVariableType(assignedVariable.type);
|
|
2598
2782
|
if (isCompatible && !isCompatible(boundProp?.propType, assignedVariable)) {
|
|
2599
|
-
return /* @__PURE__ */
|
|
2783
|
+
return /* @__PURE__ */ React31.createElement(MismatchVariable, { variable: assignedVariable });
|
|
2600
2784
|
}
|
|
2601
|
-
return /* @__PURE__ */
|
|
2785
|
+
return /* @__PURE__ */ React31.createElement(AssignedVariable, { variable: assignedVariable, propTypeKey });
|
|
2602
2786
|
};
|
|
2603
2787
|
|
|
2604
2788
|
// src/hooks/use-prop-variable-action.tsx
|
|
2605
|
-
var
|
|
2789
|
+
var React32 = __toESM(require("react"));
|
|
2606
2790
|
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
2607
|
-
var
|
|
2608
|
-
var
|
|
2791
|
+
var import_icons14 = require("@elementor/icons");
|
|
2792
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
2609
2793
|
var usePropVariableAction = () => {
|
|
2610
2794
|
const { propType, path } = (0, import_editor_editing_panel6.useBoundProp)();
|
|
2611
2795
|
const variable = resolveVariableFromPropType(propType);
|
|
2612
2796
|
return {
|
|
2613
2797
|
visible: Boolean(variable),
|
|
2614
|
-
icon:
|
|
2615
|
-
title: (0,
|
|
2798
|
+
icon: import_icons14.ColorFilterIcon,
|
|
2799
|
+
title: (0, import_i18n23.__)("Variables", "elementor"),
|
|
2616
2800
|
content: ({ close: closePopover }) => {
|
|
2617
2801
|
if (!variable) {
|
|
2618
2802
|
return null;
|
|
2619
2803
|
}
|
|
2620
2804
|
trackOpenVariablePopover(path, variable.variableType);
|
|
2621
|
-
return /* @__PURE__ */
|
|
2805
|
+
return /* @__PURE__ */ React32.createElement(VariableSelectionPopover, { closePopover, propTypeKey: variable.propTypeUtil.key });
|
|
2622
2806
|
}
|
|
2623
2807
|
};
|
|
2624
2808
|
};
|
|
@@ -2643,18 +2827,18 @@ var trackOpenVariablePopover = (path, variableType) => {
|
|
|
2643
2827
|
};
|
|
2644
2828
|
|
|
2645
2829
|
// src/register-variable-types.tsx
|
|
2646
|
-
var
|
|
2830
|
+
var React35 = __toESM(require("react"));
|
|
2647
2831
|
var import_editor_props4 = require("@elementor/editor-props");
|
|
2648
|
-
var
|
|
2832
|
+
var import_icons16 = require("@elementor/icons");
|
|
2649
2833
|
|
|
2650
2834
|
// src/components/fields/color-field.tsx
|
|
2651
|
-
var
|
|
2652
|
-
var
|
|
2653
|
-
var
|
|
2835
|
+
var React33 = __toESM(require("react"));
|
|
2836
|
+
var import_react20 = require("react");
|
|
2837
|
+
var import_ui31 = require("@elementor/ui");
|
|
2654
2838
|
var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
2655
|
-
const [color, setColor] = (0,
|
|
2656
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2657
|
-
const defaultRef = (0,
|
|
2839
|
+
const [color, setColor] = (0, import_react20.useState)(value);
|
|
2840
|
+
const [errorMessage, setErrorMessage] = (0, import_react20.useState)("");
|
|
2841
|
+
const defaultRef = (0, import_react20.useRef)(null);
|
|
2658
2842
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
2659
2843
|
const handleChange = (newValue) => {
|
|
2660
2844
|
setColor(newValue);
|
|
@@ -2663,8 +2847,8 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
2663
2847
|
onValidationChange?.(errorMsg);
|
|
2664
2848
|
onChange(errorMsg ? "" : newValue);
|
|
2665
2849
|
};
|
|
2666
|
-
return /* @__PURE__ */
|
|
2667
|
-
|
|
2850
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2851
|
+
import_ui31.UnstableColorField,
|
|
2668
2852
|
{
|
|
2669
2853
|
id: "color-variable-field",
|
|
2670
2854
|
size: "tiny",
|
|
@@ -2692,21 +2876,21 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
|
|
|
2692
2876
|
};
|
|
2693
2877
|
|
|
2694
2878
|
// src/components/fields/font-field.tsx
|
|
2695
|
-
var
|
|
2696
|
-
var
|
|
2879
|
+
var React34 = __toESM(require("react"));
|
|
2880
|
+
var import_react21 = require("react");
|
|
2697
2881
|
var import_editor_controls12 = require("@elementor/editor-controls");
|
|
2698
2882
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
2699
|
-
var
|
|
2700
|
-
var
|
|
2701
|
-
var
|
|
2883
|
+
var import_icons15 = require("@elementor/icons");
|
|
2884
|
+
var import_ui32 = require("@elementor/ui");
|
|
2885
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
2702
2886
|
var FontField = ({ value, onChange, onValidationChange }) => {
|
|
2703
|
-
const [fontFamily, setFontFamily] = (0,
|
|
2704
|
-
const defaultRef = (0,
|
|
2887
|
+
const [fontFamily, setFontFamily] = (0, import_react21.useState)(value);
|
|
2888
|
+
const defaultRef = (0, import_react21.useRef)(null);
|
|
2705
2889
|
const anchorRef = usePopoverContentRef() ?? defaultRef.current;
|
|
2706
|
-
const fontPopoverState = (0,
|
|
2890
|
+
const fontPopoverState = (0, import_ui32.usePopupState)({ variant: "popover" });
|
|
2707
2891
|
const fontFamilies = (0, import_editor_editing_panel7.useFontFamilies)();
|
|
2708
2892
|
const sectionWidth = (0, import_editor_editing_panel7.useSectionWidth)();
|
|
2709
|
-
const mapFontSubs =
|
|
2893
|
+
const mapFontSubs = React34.useMemo(() => {
|
|
2710
2894
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
2711
2895
|
label,
|
|
2712
2896
|
items: fonts
|
|
@@ -2722,28 +2906,28 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
2722
2906
|
handleChange(newFontFamily);
|
|
2723
2907
|
fontPopoverState.close();
|
|
2724
2908
|
};
|
|
2725
|
-
const id2 = (0,
|
|
2726
|
-
return /* @__PURE__ */
|
|
2727
|
-
|
|
2909
|
+
const id2 = (0, import_react21.useId)();
|
|
2910
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(
|
|
2911
|
+
import_ui32.UnstableTag,
|
|
2728
2912
|
{
|
|
2729
2913
|
id: id2,
|
|
2730
2914
|
variant: "outlined",
|
|
2731
2915
|
label: fontFamily,
|
|
2732
|
-
endIcon: /* @__PURE__ */
|
|
2733
|
-
...(0,
|
|
2916
|
+
endIcon: /* @__PURE__ */ React34.createElement(import_icons15.ChevronDownIcon, { fontSize: "tiny" }),
|
|
2917
|
+
...(0, import_ui32.bindTrigger)(fontPopoverState),
|
|
2734
2918
|
fullWidth: true
|
|
2735
2919
|
}
|
|
2736
|
-
), /* @__PURE__ */
|
|
2737
|
-
|
|
2920
|
+
), /* @__PURE__ */ React34.createElement(
|
|
2921
|
+
import_ui32.Popover,
|
|
2738
2922
|
{
|
|
2739
2923
|
disablePortal: true,
|
|
2740
2924
|
disableScrollLock: true,
|
|
2741
2925
|
anchorEl: anchorRef,
|
|
2742
2926
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
2743
2927
|
transformOrigin: { vertical: "top", horizontal: -28 },
|
|
2744
|
-
...(0,
|
|
2928
|
+
...(0, import_ui32.bindPopover)(fontPopoverState)
|
|
2745
2929
|
},
|
|
2746
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ React34.createElement(
|
|
2747
2931
|
import_editor_controls12.ItemSelector,
|
|
2748
2932
|
{
|
|
2749
2933
|
id: "font-family-variables-selector",
|
|
@@ -2752,10 +2936,10 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
2752
2936
|
onItemChange: handleFontFamilyChange,
|
|
2753
2937
|
onClose: fontPopoverState.close,
|
|
2754
2938
|
sectionWidth,
|
|
2755
|
-
title: (0,
|
|
2939
|
+
title: (0, import_i18n24.__)("Font Family", "elementor"),
|
|
2756
2940
|
itemStyle: (item) => ({ fontFamily: item.value }),
|
|
2757
2941
|
onDebounce: import_editor_controls12.enqueueFont,
|
|
2758
|
-
icon:
|
|
2942
|
+
icon: import_icons15.TextIcon
|
|
2759
2943
|
}
|
|
2760
2944
|
)
|
|
2761
2945
|
));
|
|
@@ -2765,26 +2949,28 @@ var FontField = ({ value, onChange, onValidationChange }) => {
|
|
|
2765
2949
|
function registerVariableTypes() {
|
|
2766
2950
|
registerVariableType({
|
|
2767
2951
|
valueField: ColorField,
|
|
2768
|
-
icon:
|
|
2952
|
+
icon: import_icons16.BrushIcon,
|
|
2769
2953
|
propTypeUtil: colorVariablePropTypeUtil,
|
|
2770
2954
|
fallbackPropTypeUtil: import_editor_props4.colorPropTypeUtil,
|
|
2771
2955
|
variableType: "color",
|
|
2772
|
-
startIcon: ({ value }) => /* @__PURE__ */
|
|
2956
|
+
startIcon: ({ value }) => /* @__PURE__ */ React35.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
2957
|
+
defaultValue: "#ffffff"
|
|
2773
2958
|
});
|
|
2774
2959
|
registerVariableType({
|
|
2775
2960
|
valueField: FontField,
|
|
2776
|
-
icon:
|
|
2961
|
+
icon: import_icons16.TextIcon,
|
|
2777
2962
|
propTypeUtil: fontVariablePropTypeUtil,
|
|
2778
2963
|
fallbackPropTypeUtil: import_editor_props4.stringPropTypeUtil,
|
|
2779
|
-
variableType: "font"
|
|
2964
|
+
variableType: "font",
|
|
2965
|
+
defaultValue: "Roboto"
|
|
2780
2966
|
});
|
|
2781
2967
|
}
|
|
2782
2968
|
|
|
2783
2969
|
// src/renderers/style-variables-renderer.tsx
|
|
2784
|
-
var
|
|
2785
|
-
var
|
|
2970
|
+
var React36 = __toESM(require("react"));
|
|
2971
|
+
var import_react22 = require("react");
|
|
2786
2972
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2787
|
-
var
|
|
2973
|
+
var import_ui33 = require("@elementor/ui");
|
|
2788
2974
|
|
|
2789
2975
|
// src/sync/get-canvas-iframe-document.ts
|
|
2790
2976
|
function getCanvasIframeDocument() {
|
|
@@ -2803,14 +2989,14 @@ function StyleVariablesRenderer() {
|
|
|
2803
2989
|
}
|
|
2804
2990
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
2805
2991
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
2806
|
-
return /* @__PURE__ */
|
|
2992
|
+
return /* @__PURE__ */ React36.createElement(import_ui33.Portal, { container }, /* @__PURE__ */ React36.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
2807
2993
|
}
|
|
2808
2994
|
function usePortalContainer() {
|
|
2809
2995
|
return (0, import_editor_v1_adapters3.__privateUseListenTo)((0, import_editor_v1_adapters3.commandEndEvent)("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
2810
2996
|
}
|
|
2811
2997
|
function useStyleVariables() {
|
|
2812
|
-
const [variables, setVariables] = (0,
|
|
2813
|
-
(0,
|
|
2998
|
+
const [variables, setVariables] = (0, import_react22.useState)({});
|
|
2999
|
+
(0, import_react22.useEffect)(() => {
|
|
2814
3000
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
2815
3001
|
return () => {
|
|
2816
3002
|
unsubscribe();
|
|
@@ -2833,22 +3019,22 @@ var import_editor_controls13 = require("@elementor/editor-controls");
|
|
|
2833
3019
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
2834
3020
|
|
|
2835
3021
|
// src/components/variables-repeater-item-slot.tsx
|
|
2836
|
-
var
|
|
3022
|
+
var React37 = __toESM(require("react"));
|
|
2837
3023
|
var useColorVariable = (value) => {
|
|
2838
3024
|
const variableId = value?.value?.color?.value;
|
|
2839
3025
|
return useVariable(variableId || "");
|
|
2840
3026
|
};
|
|
2841
3027
|
var BackgroundRepeaterColorIndicator = ({ value }) => {
|
|
2842
3028
|
const colorVariable = useColorVariable(value);
|
|
2843
|
-
return /* @__PURE__ */
|
|
3029
|
+
return /* @__PURE__ */ React37.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
2844
3030
|
};
|
|
2845
3031
|
var BackgroundRepeaterLabel = ({ value }) => {
|
|
2846
3032
|
const colorVariable = useColorVariable(value);
|
|
2847
|
-
return /* @__PURE__ */
|
|
3033
|
+
return /* @__PURE__ */ React37.createElement("span", null, colorVariable?.label);
|
|
2848
3034
|
};
|
|
2849
3035
|
var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
2850
3036
|
const colorVariable = useColorVariable(value);
|
|
2851
|
-
return /* @__PURE__ */
|
|
3037
|
+
return /* @__PURE__ */ React37.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
|
|
2852
3038
|
};
|
|
2853
3039
|
|
|
2854
3040
|
// src/repeater-injections.ts
|