@elementor/editor-variables 3.33.0-155 → 3.33.0-157
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +250 -232
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +227 -209
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
- package/src/components/ui/no-search-results.tsx +1 -2
- package/src/components/variables-manager/hooks/use-variables-manager-state.ts +23 -10
- package/src/components/variables-manager/variables-manager-panel.tsx +29 -13
- package/src/components/variables-manager/variables-manager-table.tsx +18 -26
- package/src/components/variables-selection.tsx +2 -2
- package/src/hooks/use-prop-variables.ts +2 -6
- package/src/utils/filter-by-search.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -43,14 +43,14 @@ 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
|
|
46
|
+
var React11 = __toESM(require("react"));
|
|
47
47
|
var import_react10 = require("react");
|
|
48
48
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
49
49
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
50
50
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
51
51
|
var import_icons5 = require("@elementor/icons");
|
|
52
|
-
var
|
|
53
|
-
var
|
|
52
|
+
var import_ui11 = require("@elementor/ui");
|
|
53
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
54
54
|
|
|
55
55
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
56
56
|
var React = __toESM(require("react"));
|
|
@@ -67,6 +67,27 @@ var DeleteConfirmationDialog = ({
|
|
|
67
67
|
return /* @__PURE__ */ React.createElement(import_ui.Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(import_ui.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React.createElement(import_icons.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n.__)("Delete this variable?", "elementor")), /* @__PURE__ */ React.createElement(import_ui.DialogContent, null, /* @__PURE__ */ React.createElement(import_ui.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n.__)("All elements using", "elementor"), "\xA0", /* @__PURE__ */ React.createElement(import_ui.Typography, { variant: "subtitle2", component: "span", sx: { lineBreak: "anywhere" } }, label), "\xA0", (0, import_i18n.__)("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React.createElement(import_ui.DialogActions, null, /* @__PURE__ */ React.createElement(import_ui.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n.__)("Not now", "elementor")), /* @__PURE__ */ React.createElement(import_ui.Button, { variant: "contained", color: "error", onClick: onConfirm }, (0, import_i18n.__)("Delete", "elementor"))));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
// src/components/ui/no-search-results.tsx
|
|
71
|
+
var React2 = __toESM(require("react"));
|
|
72
|
+
var import_ui2 = require("@elementor/ui");
|
|
73
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
74
|
+
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
75
|
+
return /* @__PURE__ */ React2.createElement(
|
|
76
|
+
import_ui2.Stack,
|
|
77
|
+
{
|
|
78
|
+
gap: 1,
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
justifyContent: "center",
|
|
81
|
+
p: 2.5,
|
|
82
|
+
color: "text.secondary",
|
|
83
|
+
sx: { pb: 3.5, pt: 5 }
|
|
84
|
+
},
|
|
85
|
+
icon,
|
|
86
|
+
/* @__PURE__ */ React2.createElement(import_ui2.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n2.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React2.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
87
|
+
/* @__PURE__ */ React2.createElement(import_ui2.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n2.__)("Try something else.", "elementor"), /* @__PURE__ */ React2.createElement(import_ui2.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n2.__)("Clear & try again", "elementor")))
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
70
91
|
// src/components/variables-manager/hooks/use-auto-edit.ts
|
|
71
92
|
var import_react = require("react");
|
|
72
93
|
var useAutoEdit = () => {
|
|
@@ -88,7 +109,7 @@ var useAutoEdit = () => {
|
|
|
88
109
|
|
|
89
110
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
90
111
|
var import_react4 = require("react");
|
|
91
|
-
var
|
|
112
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
92
113
|
|
|
93
114
|
// src/batch-operations.ts
|
|
94
115
|
var generateTempId = () => {
|
|
@@ -155,7 +176,7 @@ var import_react3 = require("react");
|
|
|
155
176
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
156
177
|
|
|
157
178
|
// src/context/variable-type-context.tsx
|
|
158
|
-
var
|
|
179
|
+
var React4 = __toESM(require("react"));
|
|
159
180
|
var import_react2 = require("react");
|
|
160
181
|
|
|
161
182
|
// src/variables-registry/create-variable-type-registry.ts
|
|
@@ -163,14 +184,14 @@ var import_editor_canvas3 = require("@elementor/editor-canvas");
|
|
|
163
184
|
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
164
185
|
|
|
165
186
|
// src/transformers/inheritance-transformer.tsx
|
|
166
|
-
var
|
|
187
|
+
var React3 = __toESM(require("react"));
|
|
167
188
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
168
|
-
var
|
|
169
|
-
var
|
|
189
|
+
var import_ui4 = require("@elementor/ui");
|
|
190
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
170
191
|
|
|
171
192
|
// src/components/ui/color-indicator.tsx
|
|
172
|
-
var
|
|
173
|
-
var ColorIndicator = (0,
|
|
193
|
+
var import_ui3 = require("@elementor/ui");
|
|
194
|
+
var ColorIndicator = (0, import_ui3.styled)(import_ui3.UnstableColorIndicator)(({ theme }) => ({
|
|
174
195
|
borderRadius: `${theme.shape.borderRadius / 2}px`,
|
|
175
196
|
marginRight: theme.spacing(0.25)
|
|
176
197
|
}));
|
|
@@ -181,7 +202,7 @@ var import_schema = require("@elementor/schema");
|
|
|
181
202
|
var colorVariablePropTypeUtil = (0, import_editor_props.createPropUtils)("global-color-variable", import_schema.z.string());
|
|
182
203
|
|
|
183
204
|
// src/service.ts
|
|
184
|
-
var
|
|
205
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
185
206
|
|
|
186
207
|
// src/api.ts
|
|
187
208
|
var import_http_client = require("@elementor/http-client");
|
|
@@ -386,7 +407,7 @@ var service = {
|
|
|
386
407
|
return apiClient.create(type, label, value).then((response) => {
|
|
387
408
|
const { success, data: payload } = response.data;
|
|
388
409
|
if (!success) {
|
|
389
|
-
const errorMessage = payload?.message || (0,
|
|
410
|
+
const errorMessage = payload?.message || (0, import_i18n3.__)("Unexpected response from server", "elementor");
|
|
390
411
|
throw new Error(errorMessage);
|
|
391
412
|
}
|
|
392
413
|
return payload;
|
|
@@ -408,7 +429,7 @@ var service = {
|
|
|
408
429
|
return apiClient.update(id2, label, value).then((response) => {
|
|
409
430
|
const { success, data: payload } = response.data;
|
|
410
431
|
if (!success) {
|
|
411
|
-
const errorMessage = payload?.message || (0,
|
|
432
|
+
const errorMessage = payload?.message || (0, import_i18n3.__)("Unexpected response from server", "elementor");
|
|
412
433
|
throw new Error(errorMessage);
|
|
413
434
|
}
|
|
414
435
|
return payload;
|
|
@@ -541,11 +562,11 @@ var inheritanceTransformer = (0, import_editor_canvas.createTransformer)((id2) =
|
|
|
541
562
|
const variables = service.variables();
|
|
542
563
|
const variable = variables[id2];
|
|
543
564
|
if (!variable) {
|
|
544
|
-
return /* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ React3.createElement("span", null, (0, import_i18n4.__)("Missing variable", "elementor"));
|
|
545
566
|
}
|
|
546
567
|
const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
|
|
547
568
|
const css = resolveCssVariable(id2, variable);
|
|
548
|
-
return /* @__PURE__ */
|
|
569
|
+
return /* @__PURE__ */ React3.createElement(import_ui4.Stack, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React3.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React3.createElement(import_ui4.Typography, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
|
|
549
570
|
});
|
|
550
571
|
|
|
551
572
|
// src/transformers/variable-transformer.ts
|
|
@@ -630,7 +651,7 @@ var { registerVariableType, getVariableType, getVariableTypes, hasVariableType }
|
|
|
630
651
|
// src/context/variable-type-context.tsx
|
|
631
652
|
var VariableTypeContext = (0, import_react2.createContext)(null);
|
|
632
653
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
633
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ React4.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
634
655
|
}
|
|
635
656
|
function useVariableType() {
|
|
636
657
|
const context = (0, import_react2.useContext)(VariableTypeContext);
|
|
@@ -640,6 +661,12 @@ function useVariableType() {
|
|
|
640
661
|
return getVariableType(context);
|
|
641
662
|
}
|
|
642
663
|
|
|
664
|
+
// src/utils/filter-by-search.ts
|
|
665
|
+
function filterBySearch(variables, searchValue) {
|
|
666
|
+
const lowerSearchValue = searchValue.toLowerCase();
|
|
667
|
+
return variables.filter((variable) => variable.label.toLowerCase().includes(lowerSearchValue));
|
|
668
|
+
}
|
|
669
|
+
|
|
643
670
|
// src/hooks/use-prop-variables.ts
|
|
644
671
|
var getVariables = (includeDeleted = true) => {
|
|
645
672
|
const variables = service.variables();
|
|
@@ -661,7 +688,7 @@ var useVariable = (key) => {
|
|
|
661
688
|
var useFilteredVariables = (searchValue, propTypeKey) => {
|
|
662
689
|
const baseVariables = usePropVariables(propTypeKey);
|
|
663
690
|
const typeFilteredVariables = useVariableSelectionFilter(baseVariables);
|
|
664
|
-
const searchFilteredVariables =
|
|
691
|
+
const searchFilteredVariables = filterBySearch(typeFilteredVariables, searchValue);
|
|
665
692
|
const sortedVariables = searchFilteredVariables.sort((a, b) => {
|
|
666
693
|
const orderA = a.order ?? Number.MAX_SAFE_INTEGER;
|
|
667
694
|
const orderB = b.order ?? Number.MAX_SAFE_INTEGER;
|
|
@@ -679,10 +706,6 @@ var useVariableSelectionFilter = (variables) => {
|
|
|
679
706
|
const { propType } = (0, import_editor_controls.useBoundProp)();
|
|
680
707
|
return selectionFilter ? selectionFilter(variables, propType) : variables;
|
|
681
708
|
};
|
|
682
|
-
var filterVariablesBySearchValue = (variables, searchValue) => {
|
|
683
|
-
const lowerSearchValue = searchValue.toLowerCase();
|
|
684
|
-
return variables.filter(({ label }) => label.toLowerCase().includes(lowerSearchValue));
|
|
685
|
-
};
|
|
686
709
|
var usePropVariables = (propKey) => {
|
|
687
710
|
return (0, import_react3.useMemo)(() => normalizeVariables(propKey), [propKey]);
|
|
688
711
|
};
|
|
@@ -710,15 +733,15 @@ var restoreVariable = (restoreId, label, value) => {
|
|
|
710
733
|
};
|
|
711
734
|
|
|
712
735
|
// src/utils/validations.ts
|
|
713
|
-
var
|
|
736
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
714
737
|
var ERROR_MESSAGES = {
|
|
715
|
-
MISSING_VARIABLE_NAME: (0,
|
|
716
|
-
MISSING_VARIABLE_VALUE: (0,
|
|
717
|
-
INVALID_CHARACTERS: (0,
|
|
718
|
-
NO_NON_SPECIAL_CHARACTER: (0,
|
|
719
|
-
VARIABLE_LABEL_MAX_LENGTH: (0,
|
|
720
|
-
DUPLICATED_LABEL: (0,
|
|
721
|
-
UNEXPECTED_ERROR: (0,
|
|
738
|
+
MISSING_VARIABLE_NAME: (0, import_i18n5.__)("Give your variable a name.", "elementor"),
|
|
739
|
+
MISSING_VARIABLE_VALUE: (0, import_i18n5.__)("Add a value to complete your variable.", "elementor"),
|
|
740
|
+
INVALID_CHARACTERS: (0, import_i18n5.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
741
|
+
NO_NON_SPECIAL_CHARACTER: (0, import_i18n5.__)("Names have to include at least one non-special character.", "elementor"),
|
|
742
|
+
VARIABLE_LABEL_MAX_LENGTH: (0, import_i18n5.__)("Keep names up to 50 characters.", "elementor"),
|
|
743
|
+
DUPLICATED_LABEL: (0, import_i18n5.__)("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
744
|
+
UNEXPECTED_ERROR: (0, import_i18n5.__)("There was a glitch. Try saving your variable again.", "elementor")
|
|
722
745
|
};
|
|
723
746
|
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
724
747
|
var mapServerError = (error) => {
|
|
@@ -765,14 +788,17 @@ var validateValue = (value) => {
|
|
|
765
788
|
var useVariablesManagerState = () => {
|
|
766
789
|
const [variables, setVariables] = (0, import_react4.useState)(() => getVariables(false));
|
|
767
790
|
const [deletedVariables, setDeletedVariables] = (0, import_react4.useState)([]);
|
|
768
|
-
const [ids, setIds] = (0, import_react4.useState)(() => Object.keys(getVariables(false)));
|
|
769
791
|
const [isDirty, setIsDirty] = (0, import_react4.useState)(false);
|
|
770
792
|
const [hasValidationErrors, setHasValidationErrors] = (0, import_react4.useState)(false);
|
|
771
793
|
const [isSaving, setIsSaving] = (0, import_react4.useState)(false);
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
794
|
+
const [searchValue, setSearchValue] = (0, import_react4.useState)("");
|
|
795
|
+
const handleOnChange = (0, import_react4.useCallback)(
|
|
796
|
+
(newVariables) => {
|
|
797
|
+
setVariables({ ...variables, ...newVariables });
|
|
798
|
+
setIsDirty(true);
|
|
799
|
+
},
|
|
800
|
+
[variables]
|
|
801
|
+
);
|
|
776
802
|
const createVariable2 = (0, import_react4.useCallback)((type, defaultName, defaultValue) => {
|
|
777
803
|
const newId = generateTempId();
|
|
778
804
|
const newVariable = {
|
|
@@ -782,7 +808,6 @@ var useVariablesManagerState = () => {
|
|
|
782
808
|
type
|
|
783
809
|
};
|
|
784
810
|
setVariables((prev) => ({ ...prev, [newId]: newVariable }));
|
|
785
|
-
setIds((prev) => [...prev, newId]);
|
|
786
811
|
setIsDirty(true);
|
|
787
812
|
return newId;
|
|
788
813
|
}, []);
|
|
@@ -791,6 +816,9 @@ var useVariablesManagerState = () => {
|
|
|
791
816
|
setVariables((prev) => ({ ...prev, [itemId]: { ...prev[itemId], deleted: true } }));
|
|
792
817
|
setIsDirty(true);
|
|
793
818
|
}, []);
|
|
819
|
+
const handleSearch = (searchTerm) => {
|
|
820
|
+
setSearchValue(searchTerm);
|
|
821
|
+
};
|
|
794
822
|
const handleSave = (0, import_react4.useCallback)(async () => {
|
|
795
823
|
try {
|
|
796
824
|
const originalVariables = getVariables(false);
|
|
@@ -800,44 +828,48 @@ var useVariablesManagerState = () => {
|
|
|
800
828
|
await service.load();
|
|
801
829
|
const updatedVariables = service.variables();
|
|
802
830
|
setVariables(updatedVariables);
|
|
803
|
-
setIds(Object.keys(updatedVariables));
|
|
804
831
|
setDeletedVariables([]);
|
|
805
832
|
setIsDirty(false);
|
|
806
833
|
setIsSaving(false);
|
|
807
834
|
return { success: true };
|
|
808
835
|
}
|
|
809
|
-
throw new Error((0,
|
|
836
|
+
throw new Error((0, import_i18n6.__)("Failed to save variables. Please try again.", "elementor"));
|
|
810
837
|
} catch (error) {
|
|
811
838
|
const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNEXPECTED_ERROR;
|
|
812
839
|
setIsSaving(false);
|
|
813
840
|
return { success: false, error: errorMessage };
|
|
814
841
|
}
|
|
815
842
|
}, [variables]);
|
|
843
|
+
const filteredVariables = () => {
|
|
844
|
+
const list = Object.entries(variables).map(([id2, value]) => ({ ...value, id: id2 }));
|
|
845
|
+
const filtered = filterBySearch(list, searchValue);
|
|
846
|
+
return Object.fromEntries(filtered.map(({ id: id2, ...rest }) => [id2, rest]));
|
|
847
|
+
};
|
|
816
848
|
return {
|
|
817
|
-
variables,
|
|
849
|
+
variables: filteredVariables(),
|
|
818
850
|
deletedVariables,
|
|
819
|
-
ids,
|
|
820
851
|
isDirty,
|
|
821
852
|
hasValidationErrors,
|
|
822
|
-
setIds,
|
|
823
853
|
handleOnChange,
|
|
824
854
|
createVariable: createVariable2,
|
|
825
855
|
handleDeleteVariable,
|
|
826
856
|
handleSave,
|
|
827
857
|
isSaving,
|
|
858
|
+
handleSearch,
|
|
859
|
+
searchValue,
|
|
828
860
|
setHasValidationErrors
|
|
829
861
|
};
|
|
830
862
|
};
|
|
831
863
|
|
|
832
864
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
833
|
-
var
|
|
865
|
+
var React5 = __toESM(require("react"));
|
|
834
866
|
var import_react5 = require("react");
|
|
835
867
|
var import_icons2 = require("@elementor/icons");
|
|
836
|
-
var
|
|
837
|
-
var
|
|
868
|
+
var import_ui5 = require("@elementor/ui");
|
|
869
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
838
870
|
var SIZE = "tiny";
|
|
839
871
|
var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
840
|
-
const menuState = (0,
|
|
872
|
+
const menuState = (0, import_ui5.usePopupState)({
|
|
841
873
|
variant: "popover"
|
|
842
874
|
});
|
|
843
875
|
const variableTypes = getVariableTypes();
|
|
@@ -853,17 +885,17 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
853
885
|
}
|
|
854
886
|
};
|
|
855
887
|
});
|
|
856
|
-
return /* @__PURE__ */
|
|
857
|
-
|
|
888
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
|
|
889
|
+
import_ui5.IconButton,
|
|
858
890
|
{
|
|
859
|
-
...(0,
|
|
891
|
+
...(0, import_ui5.bindTrigger)(menuState),
|
|
860
892
|
disabled,
|
|
861
893
|
size: SIZE,
|
|
862
|
-
"aria-label": (0,
|
|
894
|
+
"aria-label": (0, import_i18n7.__)("Add variable", "elementor")
|
|
863
895
|
},
|
|
864
|
-
/* @__PURE__ */
|
|
865
|
-
), /* @__PURE__ */
|
|
866
|
-
|
|
896
|
+
/* @__PURE__ */ React5.createElement(import_icons2.PlusIcon, { fontSize: SIZE })
|
|
897
|
+
), /* @__PURE__ */ React5.createElement(
|
|
898
|
+
import_ui5.Menu,
|
|
867
899
|
{
|
|
868
900
|
disablePortal: true,
|
|
869
901
|
MenuListProps: {
|
|
@@ -872,7 +904,7 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
872
904
|
PaperProps: {
|
|
873
905
|
elevation: 6
|
|
874
906
|
},
|
|
875
|
-
...(0,
|
|
907
|
+
...(0, import_ui5.bindMenu)(menuState),
|
|
876
908
|
anchorEl: menuState.anchorEl,
|
|
877
909
|
anchorOrigin: {
|
|
878
910
|
vertical: "bottom",
|
|
@@ -885,8 +917,8 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
885
917
|
open: menuState.isOpen,
|
|
886
918
|
onClose: menuState.close
|
|
887
919
|
},
|
|
888
|
-
menuOptions.map((option) => /* @__PURE__ */
|
|
889
|
-
|
|
920
|
+
menuOptions.map((option) => /* @__PURE__ */ React5.createElement(
|
|
921
|
+
import_ui5.MenuItem,
|
|
890
922
|
{
|
|
891
923
|
key: option.key,
|
|
892
924
|
onClick: () => {
|
|
@@ -901,7 +933,7 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
901
933
|
fontSize: SIZE,
|
|
902
934
|
color: "action"
|
|
903
935
|
}),
|
|
904
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ React5.createElement(import_ui5.Typography, { variant: "caption", color: "text.primary" }, option.name)
|
|
905
937
|
))
|
|
906
938
|
));
|
|
907
939
|
};
|
|
@@ -917,18 +949,18 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
917
949
|
};
|
|
918
950
|
|
|
919
951
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
920
|
-
var
|
|
952
|
+
var React10 = __toESM(require("react"));
|
|
921
953
|
var import_react9 = require("react");
|
|
922
954
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
923
955
|
var import_icons4 = require("@elementor/icons");
|
|
924
|
-
var
|
|
925
|
-
var
|
|
956
|
+
var import_ui10 = require("@elementor/ui");
|
|
957
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
926
958
|
|
|
927
959
|
// src/components/fields/label-field.tsx
|
|
928
|
-
var
|
|
960
|
+
var React6 = __toESM(require("react"));
|
|
929
961
|
var import_react6 = require("react");
|
|
930
962
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
931
|
-
var
|
|
963
|
+
var import_ui6 = require("@elementor/ui");
|
|
932
964
|
function isLabelEqual(a, b) {
|
|
933
965
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
934
966
|
}
|
|
@@ -965,8 +997,8 @@ var LabelField = ({
|
|
|
965
997
|
errorMsg = error.message;
|
|
966
998
|
}
|
|
967
999
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
968
|
-
const textField = /* @__PURE__ */
|
|
969
|
-
|
|
1000
|
+
const textField = /* @__PURE__ */ React6.createElement(
|
|
1001
|
+
import_ui6.TextField,
|
|
970
1002
|
{
|
|
971
1003
|
ref: fieldRef,
|
|
972
1004
|
id: id2,
|
|
@@ -985,7 +1017,7 @@ var LabelField = ({
|
|
|
985
1017
|
);
|
|
986
1018
|
if (showWarningInfotip) {
|
|
987
1019
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
988
|
-
return /* @__PURE__ */
|
|
1020
|
+
return /* @__PURE__ */ React6.createElement(
|
|
989
1021
|
import_editor_ui.WarningInfotip,
|
|
990
1022
|
{
|
|
991
1023
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1002,16 +1034,16 @@ var LabelField = ({
|
|
|
1002
1034
|
};
|
|
1003
1035
|
|
|
1004
1036
|
// src/components/variables-manager/utils/variable-edit-menu.tsx
|
|
1005
|
-
var
|
|
1037
|
+
var React7 = __toESM(require("react"));
|
|
1006
1038
|
var import_react7 = require("react");
|
|
1007
1039
|
var import_icons3 = require("@elementor/icons");
|
|
1008
|
-
var
|
|
1040
|
+
var import_ui7 = require("@elementor/ui");
|
|
1009
1041
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1010
|
-
const menuState = (0,
|
|
1042
|
+
const menuState = (0, import_ui7.usePopupState)({
|
|
1011
1043
|
variant: "popover"
|
|
1012
1044
|
});
|
|
1013
|
-
return /* @__PURE__ */
|
|
1014
|
-
|
|
1045
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui7.IconButton, { ...(0, import_ui7.bindTrigger)(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React7.createElement(import_icons3.DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React7.createElement(
|
|
1046
|
+
import_ui7.Menu,
|
|
1015
1047
|
{
|
|
1016
1048
|
disablePortal: true,
|
|
1017
1049
|
MenuListProps: {
|
|
@@ -1020,7 +1052,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1020
1052
|
PaperProps: {
|
|
1021
1053
|
elevation: 6
|
|
1022
1054
|
},
|
|
1023
|
-
...(0,
|
|
1055
|
+
...(0, import_ui7.bindMenu)(menuState),
|
|
1024
1056
|
anchorEl: menuState.anchorEl,
|
|
1025
1057
|
anchorOrigin: {
|
|
1026
1058
|
vertical: "bottom",
|
|
@@ -1033,8 +1065,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1033
1065
|
open: menuState.isOpen,
|
|
1034
1066
|
onClose: menuState.close
|
|
1035
1067
|
},
|
|
1036
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
1037
|
-
|
|
1068
|
+
menuActions.map((action) => /* @__PURE__ */ React7.createElement(
|
|
1069
|
+
import_ui7.MenuItem,
|
|
1038
1070
|
{
|
|
1039
1071
|
key: action.name,
|
|
1040
1072
|
onClick: () => {
|
|
@@ -1056,8 +1088,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1056
1088
|
};
|
|
1057
1089
|
|
|
1058
1090
|
// src/components/variables-manager/utils/variable-table-cell.tsx
|
|
1059
|
-
var
|
|
1060
|
-
var
|
|
1091
|
+
var React8 = __toESM(require("react"));
|
|
1092
|
+
var import_ui8 = require("@elementor/ui");
|
|
1061
1093
|
var VariableTableCell = ({
|
|
1062
1094
|
children,
|
|
1063
1095
|
isHeader,
|
|
@@ -1076,14 +1108,14 @@ var VariableTableCell = ({
|
|
|
1076
1108
|
...width && { width },
|
|
1077
1109
|
...sx
|
|
1078
1110
|
};
|
|
1079
|
-
return /* @__PURE__ */
|
|
1111
|
+
return /* @__PURE__ */ React8.createElement(import_ui8.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1080
1112
|
};
|
|
1081
1113
|
|
|
1082
1114
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1083
|
-
var
|
|
1115
|
+
var React9 = __toESM(require("react"));
|
|
1084
1116
|
var import_react8 = require("react");
|
|
1085
|
-
var
|
|
1086
|
-
var VariableEditableCell =
|
|
1117
|
+
var import_ui9 = require("@elementor/ui");
|
|
1118
|
+
var VariableEditableCell = React9.memo(
|
|
1087
1119
|
({
|
|
1088
1120
|
initialValue,
|
|
1089
1121
|
children,
|
|
@@ -1149,8 +1181,8 @@ var VariableEditableCell = React8.memo(
|
|
|
1149
1181
|
error: currentError
|
|
1150
1182
|
});
|
|
1151
1183
|
if (isEditing) {
|
|
1152
|
-
return /* @__PURE__ */
|
|
1153
|
-
|
|
1184
|
+
return /* @__PURE__ */ React9.createElement(import_ui9.ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React9.createElement(
|
|
1185
|
+
import_ui9.Stack,
|
|
1154
1186
|
{
|
|
1155
1187
|
ref: rowRef,
|
|
1156
1188
|
direction: "row",
|
|
@@ -1166,8 +1198,8 @@ var VariableEditableCell = React8.memo(
|
|
|
1166
1198
|
editableContent
|
|
1167
1199
|
));
|
|
1168
1200
|
}
|
|
1169
|
-
return /* @__PURE__ */
|
|
1170
|
-
|
|
1201
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1202
|
+
import_ui9.Stack,
|
|
1171
1203
|
{
|
|
1172
1204
|
ref: rowRef,
|
|
1173
1205
|
direction: "row",
|
|
@@ -1190,8 +1222,6 @@ var VariablesManagerTable = ({
|
|
|
1190
1222
|
menuActions,
|
|
1191
1223
|
variables,
|
|
1192
1224
|
onChange: handleOnChange,
|
|
1193
|
-
ids,
|
|
1194
|
-
onIdsChange: setIds,
|
|
1195
1225
|
autoEditVariableId,
|
|
1196
1226
|
onAutoEditComplete,
|
|
1197
1227
|
onFieldError
|
|
@@ -1219,13 +1249,8 @@ var VariablesManagerTable = ({
|
|
|
1219
1249
|
variableRowRefs.current.delete(id2);
|
|
1220
1250
|
}
|
|
1221
1251
|
};
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
if (JSON.stringify(sortedIds) !== JSON.stringify(ids)) {
|
|
1225
|
-
setIds(sortedIds);
|
|
1226
|
-
}
|
|
1227
|
-
}, [ids, variables, setIds]);
|
|
1228
|
-
const rows = ids.filter((id2) => !variables[id2].deleted).sort(sortVariablesOrder(variables)).map((id2) => {
|
|
1252
|
+
const ids = Object.keys(variables).sort(sortVariablesOrder(variables));
|
|
1253
|
+
const rows = ids.filter((id2) => !variables[id2].deleted).map((id2) => {
|
|
1229
1254
|
const variable = variables[id2];
|
|
1230
1255
|
const variableType = getVariableType(variable.type);
|
|
1231
1256
|
return {
|
|
@@ -1240,29 +1265,28 @@ var VariablesManagerTable = ({
|
|
|
1240
1265
|
minWidth: 250,
|
|
1241
1266
|
tableLayout: "fixed"
|
|
1242
1267
|
};
|
|
1243
|
-
|
|
1244
|
-
|
|
1268
|
+
const handleReorder = (newIds) => {
|
|
1269
|
+
const updatedVariables = { ...variables };
|
|
1270
|
+
newIds.forEach((id2, index) => {
|
|
1271
|
+
const current = updatedVariables[id2];
|
|
1272
|
+
if (!current) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
updatedVariables[id2] = Object.assign({}, current, { order: index + 1 });
|
|
1276
|
+
});
|
|
1277
|
+
handleOnChange(updatedVariables);
|
|
1278
|
+
};
|
|
1279
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React10.createElement(import_ui10.Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React10.createElement(import_ui10.TableHead, null, /* @__PURE__ */ React10.createElement(import_ui10.TableRow, null, /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n8.__)("Name", "elementor")), /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n8.__)("Value", "elementor")), /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React10.createElement(import_ui10.TableBody, null, /* @__PURE__ */ React10.createElement(
|
|
1280
|
+
import_ui10.UnstableSortableProvider,
|
|
1245
1281
|
{
|
|
1246
1282
|
value: ids,
|
|
1247
|
-
onChange:
|
|
1248
|
-
const updatedVariables = { ...variables };
|
|
1249
|
-
newIds.forEach((id2, index) => {
|
|
1250
|
-
if (updatedVariables[id2]) {
|
|
1251
|
-
updatedVariables[id2] = {
|
|
1252
|
-
...updatedVariables[id2],
|
|
1253
|
-
order: index + 1
|
|
1254
|
-
};
|
|
1255
|
-
}
|
|
1256
|
-
});
|
|
1257
|
-
handleOnChange(updatedVariables);
|
|
1258
|
-
setIds(newIds);
|
|
1259
|
-
},
|
|
1283
|
+
onChange: handleReorder,
|
|
1260
1284
|
variant: "static",
|
|
1261
1285
|
restrictAxis: true,
|
|
1262
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1286
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React10.createElement(import_ui10.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React10.createElement(import_ui10.TableBody, null, dragOverlayChildren))
|
|
1263
1287
|
},
|
|
1264
|
-
rows.map((row) => /* @__PURE__ */
|
|
1265
|
-
|
|
1288
|
+
rows.map((row) => /* @__PURE__ */ React10.createElement(
|
|
1289
|
+
import_ui10.UnstableSortableItem,
|
|
1266
1290
|
{
|
|
1267
1291
|
key: row.id,
|
|
1268
1292
|
id: row.id,
|
|
@@ -1279,8 +1303,8 @@ var VariablesManagerTable = ({
|
|
|
1279
1303
|
}) => {
|
|
1280
1304
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1281
1305
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1282
|
-
return /* @__PURE__ */
|
|
1283
|
-
|
|
1306
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1307
|
+
import_ui10.TableRow,
|
|
1284
1308
|
{
|
|
1285
1309
|
...itemProps,
|
|
1286
1310
|
selected: isDragged,
|
|
@@ -1309,8 +1333,8 @@ var VariablesManagerTable = ({
|
|
|
1309
1333
|
},
|
|
1310
1334
|
style: { ...itemStyle, ...triggerStyle }
|
|
1311
1335
|
},
|
|
1312
|
-
/* @__PURE__ */
|
|
1313
|
-
|
|
1336
|
+
/* @__PURE__ */ React10.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React10.createElement(
|
|
1337
|
+
import_ui10.IconButton,
|
|
1314
1338
|
{
|
|
1315
1339
|
size: "small",
|
|
1316
1340
|
ref: setTriggerRef,
|
|
@@ -1318,9 +1342,9 @@ var VariablesManagerTable = ({
|
|
|
1318
1342
|
disabled: isSorting,
|
|
1319
1343
|
draggable: true
|
|
1320
1344
|
},
|
|
1321
|
-
/* @__PURE__ */
|
|
1345
|
+
/* @__PURE__ */ React10.createElement(import_icons4.GripVerticalIcon, { fontSize: "inherit" })
|
|
1322
1346
|
)),
|
|
1323
|
-
/* @__PURE__ */
|
|
1347
|
+
/* @__PURE__ */ React10.createElement(VariableTableCell, null, /* @__PURE__ */ React10.createElement(
|
|
1324
1348
|
VariableEditableCell,
|
|
1325
1349
|
{
|
|
1326
1350
|
initialValue: row.name,
|
|
@@ -1338,7 +1362,7 @@ var VariablesManagerTable = ({
|
|
|
1338
1362
|
onChange,
|
|
1339
1363
|
onValidationChange,
|
|
1340
1364
|
error
|
|
1341
|
-
}) => /* @__PURE__ */
|
|
1365
|
+
}) => /* @__PURE__ */ React10.createElement(
|
|
1342
1366
|
LabelField,
|
|
1343
1367
|
{
|
|
1344
1368
|
id: "variable-label-" + row.id,
|
|
@@ -1360,7 +1384,7 @@ var VariablesManagerTable = ({
|
|
|
1360
1384
|
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1361
1385
|
fieldType: "label"
|
|
1362
1386
|
},
|
|
1363
|
-
/* @__PURE__ */
|
|
1387
|
+
/* @__PURE__ */ React10.createElement(
|
|
1364
1388
|
import_editor_ui2.EllipsisWithTooltip,
|
|
1365
1389
|
{
|
|
1366
1390
|
title: row.name,
|
|
@@ -1369,7 +1393,7 @@ var VariablesManagerTable = ({
|
|
|
1369
1393
|
row.name
|
|
1370
1394
|
)
|
|
1371
1395
|
)),
|
|
1372
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ React10.createElement(VariableTableCell, null, /* @__PURE__ */ React10.createElement(
|
|
1373
1397
|
VariableEditableCell,
|
|
1374
1398
|
{
|
|
1375
1399
|
initialValue: row.value,
|
|
@@ -1386,7 +1410,7 @@ var VariablesManagerTable = ({
|
|
|
1386
1410
|
gap: 0.25
|
|
1387
1411
|
},
|
|
1388
1412
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1389
|
-
/* @__PURE__ */
|
|
1413
|
+
/* @__PURE__ */ React10.createElement(
|
|
1390
1414
|
import_editor_ui2.EllipsisWithTooltip,
|
|
1391
1415
|
{
|
|
1392
1416
|
title: row.value,
|
|
@@ -1399,7 +1423,7 @@ var VariablesManagerTable = ({
|
|
|
1399
1423
|
row.value
|
|
1400
1424
|
)
|
|
1401
1425
|
)),
|
|
1402
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ React10.createElement(
|
|
1403
1427
|
VariableTableCell,
|
|
1404
1428
|
{
|
|
1405
1429
|
align: "right",
|
|
@@ -1408,7 +1432,7 @@ var VariablesManagerTable = ({
|
|
|
1408
1432
|
maxWidth: 16,
|
|
1409
1433
|
sx: { paddingInlineEnd: 1 }
|
|
1410
1434
|
},
|
|
1411
|
-
/* @__PURE__ */
|
|
1435
|
+
/* @__PURE__ */ React10.createElement(import_ui10.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React10.createElement(
|
|
1412
1436
|
VariableEditMenu,
|
|
1413
1437
|
{
|
|
1414
1438
|
menuActions,
|
|
@@ -1449,15 +1473,15 @@ function VariablesManagerPanel() {
|
|
|
1449
1473
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui3.useDialog)();
|
|
1450
1474
|
const {
|
|
1451
1475
|
variables,
|
|
1452
|
-
ids,
|
|
1453
1476
|
isDirty,
|
|
1454
1477
|
hasValidationErrors,
|
|
1455
|
-
|
|
1478
|
+
searchValue,
|
|
1456
1479
|
handleOnChange,
|
|
1457
1480
|
createVariable: createVariable2,
|
|
1458
1481
|
handleDeleteVariable,
|
|
1459
1482
|
handleSave,
|
|
1460
1483
|
isSaving,
|
|
1484
|
+
handleSearch,
|
|
1461
1485
|
setHasValidationErrors
|
|
1462
1486
|
} = useVariablesManagerState();
|
|
1463
1487
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
@@ -1488,7 +1512,7 @@ function VariablesManagerPanel() {
|
|
|
1488
1512
|
);
|
|
1489
1513
|
const menuActions = [
|
|
1490
1514
|
{
|
|
1491
|
-
name: (0,
|
|
1515
|
+
name: (0, import_i18n9.__)("Delete", "elementor"),
|
|
1492
1516
|
icon: import_icons5.TrashIcon,
|
|
1493
1517
|
color: "error.main",
|
|
1494
1518
|
onClick: (itemId) => {
|
|
@@ -1498,14 +1522,15 @@ function VariablesManagerPanel() {
|
|
|
1498
1522
|
}
|
|
1499
1523
|
}
|
|
1500
1524
|
];
|
|
1501
|
-
|
|
1525
|
+
const hasVariables = Object.keys(variables).length !== 0;
|
|
1526
|
+
return /* @__PURE__ */ React11.createElement(import_editor_ui3.ThemeProvider, null, /* @__PURE__ */ React11.createElement(import_ui11.ErrorBoundary, { fallback: /* @__PURE__ */ React11.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React11.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React11.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React11.createElement(import_ui11.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui11.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui11.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React11.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React11.createElement(import_icons5.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n9.__)("Variable Manager", "elementor"))), /* @__PURE__ */ React11.createElement(import_ui11.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React11.createElement(
|
|
1502
1527
|
VariableManagerCreateMenu,
|
|
1503
1528
|
{
|
|
1504
1529
|
onCreate: handleCreateVariable,
|
|
1505
1530
|
variables
|
|
1506
1531
|
}
|
|
1507
|
-
), /* @__PURE__ */
|
|
1508
|
-
|
|
1532
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1533
|
+
import_ui11.CloseButton,
|
|
1509
1534
|
{
|
|
1510
1535
|
"aria-label": "Close",
|
|
1511
1536
|
slotProps: { icon: { fontSize: SIZE } },
|
|
@@ -1513,7 +1538,7 @@ function VariablesManagerPanel() {
|
|
|
1513
1538
|
handleClosePanel();
|
|
1514
1539
|
}
|
|
1515
1540
|
}
|
|
1516
|
-
)))
|
|
1541
|
+
))))), /* @__PURE__ */ React11.createElement(
|
|
1517
1542
|
import_editor_panels.PanelBody,
|
|
1518
1543
|
{
|
|
1519
1544
|
sx: {
|
|
@@ -1522,21 +1547,36 @@ function VariablesManagerPanel() {
|
|
|
1522
1547
|
height: "100%"
|
|
1523
1548
|
}
|
|
1524
1549
|
},
|
|
1525
|
-
/* @__PURE__ */
|
|
1550
|
+
/* @__PURE__ */ React11.createElement(
|
|
1551
|
+
import_editor_ui3.SearchField,
|
|
1552
|
+
{
|
|
1553
|
+
placeholder: (0, import_i18n9.__)("Search", "elementor"),
|
|
1554
|
+
value: searchValue,
|
|
1555
|
+
onSearch: handleSearch
|
|
1556
|
+
}
|
|
1557
|
+
),
|
|
1558
|
+
/* @__PURE__ */ React11.createElement(import_ui11.Divider, { sx: { width: "100%" } }),
|
|
1559
|
+
hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1526
1560
|
VariablesManagerTable,
|
|
1527
1561
|
{
|
|
1528
1562
|
menuActions,
|
|
1529
1563
|
variables,
|
|
1530
1564
|
onChange: handleOnChange,
|
|
1531
|
-
ids,
|
|
1532
|
-
onIdsChange: setIds,
|
|
1533
1565
|
autoEditVariableId,
|
|
1534
1566
|
onAutoEditComplete: handleAutoEditComplete,
|
|
1535
1567
|
onFieldError: setHasValidationErrors
|
|
1536
1568
|
}
|
|
1569
|
+
),
|
|
1570
|
+
!hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1571
|
+
NoSearchResults,
|
|
1572
|
+
{
|
|
1573
|
+
searchValue,
|
|
1574
|
+
onClear: () => handleSearch(""),
|
|
1575
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" })
|
|
1576
|
+
}
|
|
1537
1577
|
)
|
|
1538
|
-
), /* @__PURE__ */
|
|
1539
|
-
|
|
1578
|
+
), /* @__PURE__ */ React11.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React11.createElement(
|
|
1579
|
+
import_ui11.Button,
|
|
1540
1580
|
{
|
|
1541
1581
|
fullWidth: true,
|
|
1542
1582
|
size: "small",
|
|
@@ -1546,8 +1586,8 @@ function VariablesManagerPanel() {
|
|
|
1546
1586
|
onClick: handleSave,
|
|
1547
1587
|
loading: isSaving
|
|
1548
1588
|
},
|
|
1549
|
-
(0,
|
|
1550
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
1589
|
+
(0, import_i18n9.__)("Save changes", "elementor")
|
|
1590
|
+
))), deleteConfirmation && /* @__PURE__ */ React11.createElement(
|
|
1551
1591
|
DeleteConfirmationDialog,
|
|
1552
1592
|
{
|
|
1553
1593
|
open: true,
|
|
@@ -1555,19 +1595,19 @@ function VariablesManagerPanel() {
|
|
|
1555
1595
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1556
1596
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1557
1597
|
}
|
|
1558
|
-
)), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
1598
|
+
)), isSaveChangesDialogOpen && /* @__PURE__ */ React11.createElement(import_editor_ui3.SaveChangesDialog, null, /* @__PURE__ */ React11.createElement(import_editor_ui3.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n9.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React11.createElement(import_editor_ui3.SaveChangesDialog.Content, null, /* @__PURE__ */ React11.createElement(import_editor_ui3.SaveChangesDialog.ContentText, null, (0, import_i18n9.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React11.createElement(
|
|
1559
1599
|
import_editor_ui3.SaveChangesDialog.Actions,
|
|
1560
1600
|
{
|
|
1561
1601
|
actions: {
|
|
1562
1602
|
discard: {
|
|
1563
|
-
label: (0,
|
|
1603
|
+
label: (0, import_i18n9.__)("Discard", "elementor"),
|
|
1564
1604
|
action: () => {
|
|
1565
1605
|
closeSaveChangesDialog();
|
|
1566
1606
|
closePanel();
|
|
1567
1607
|
}
|
|
1568
1608
|
},
|
|
1569
1609
|
confirm: {
|
|
1570
|
-
label: (0,
|
|
1610
|
+
label: (0, import_i18n9.__)("Save", "elementor"),
|
|
1571
1611
|
action: async () => {
|
|
1572
1612
|
await handleSave();
|
|
1573
1613
|
closeSaveChangesDialog();
|
|
@@ -1578,7 +1618,7 @@ function VariablesManagerPanel() {
|
|
|
1578
1618
|
}
|
|
1579
1619
|
)));
|
|
1580
1620
|
}
|
|
1581
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
1621
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React11.createElement(import_ui11.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React11.createElement(import_ui11.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React11.createElement("strong", null, (0, import_i18n9.__)("Something went wrong", "elementor"))));
|
|
1582
1622
|
var usePreventUnload = (isDirty) => {
|
|
1583
1623
|
(0, import_react10.useEffect)(() => {
|
|
1584
1624
|
const handleBeforeUnload = (event) => {
|
|
@@ -1626,13 +1666,13 @@ var import_react16 = require("react");
|
|
|
1626
1666
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1627
1667
|
|
|
1628
1668
|
// src/context/variable-selection-popover.context.tsx
|
|
1629
|
-
var
|
|
1669
|
+
var React12 = __toESM(require("react"));
|
|
1630
1670
|
var import_react11 = require("react");
|
|
1631
|
-
var
|
|
1671
|
+
var import_ui12 = require("@elementor/ui");
|
|
1632
1672
|
var PopoverContentRefContext = (0, import_react11.createContext)(null);
|
|
1633
1673
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
1634
1674
|
const [anchorRef, setAnchorRef] = (0, import_react11.useState)(null);
|
|
1635
|
-
return /* @__PURE__ */
|
|
1675
|
+
return /* @__PURE__ */ React12.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React12.createElement(import_ui12.Box, { ref: setAnchorRef }, children));
|
|
1636
1676
|
};
|
|
1637
1677
|
var usePopoverContentRef = () => {
|
|
1638
1678
|
return (0, import_react11.useContext)(PopoverContentRefContext);
|
|
@@ -1654,14 +1694,14 @@ var usePermissions = () => {
|
|
|
1654
1694
|
};
|
|
1655
1695
|
|
|
1656
1696
|
// src/components/variable-creation.tsx
|
|
1657
|
-
var
|
|
1697
|
+
var React14 = __toESM(require("react"));
|
|
1658
1698
|
var import_react12 = require("react");
|
|
1659
1699
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
1660
1700
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
1661
1701
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1662
1702
|
var import_icons6 = require("@elementor/icons");
|
|
1663
|
-
var
|
|
1664
|
-
var
|
|
1703
|
+
var import_ui14 = require("@elementor/ui");
|
|
1704
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1665
1705
|
|
|
1666
1706
|
// src/hooks/use-initial-value.ts
|
|
1667
1707
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -1722,10 +1762,10 @@ var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
|
1722
1762
|
};
|
|
1723
1763
|
|
|
1724
1764
|
// src/components/ui/form-field.tsx
|
|
1725
|
-
var
|
|
1726
|
-
var
|
|
1765
|
+
var React13 = __toESM(require("react"));
|
|
1766
|
+
var import_ui13 = require("@elementor/ui");
|
|
1727
1767
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
1728
|
-
return /* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ React13.createElement(import_ui13.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React13.createElement(import_ui13.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React13.createElement(import_ui13.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React13.createElement(import_ui13.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React13.createElement(import_ui13.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React13.createElement(import_ui13.FormHelperText, null, noticeMsg)));
|
|
1729
1769
|
};
|
|
1730
1770
|
|
|
1731
1771
|
// src/components/variable-creation.tsx
|
|
@@ -1789,22 +1829,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1789
1829
|
return !!errorMessage;
|
|
1790
1830
|
};
|
|
1791
1831
|
const isSubmitDisabled = hasEmptyFields() || hasErrors();
|
|
1792
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ React14.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React14.createElement(
|
|
1793
1833
|
import_editor_ui4.PopoverHeader,
|
|
1794
1834
|
{
|
|
1795
|
-
icon: /* @__PURE__ */
|
|
1796
|
-
title: (0,
|
|
1835
|
+
icon: /* @__PURE__ */ React14.createElement(React14.Fragment, null, onGoBack && /* @__PURE__ */ React14.createElement(import_ui14.IconButton, { size: SIZE2, "aria-label": (0, import_i18n10.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React14.createElement(import_icons6.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React14.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
1836
|
+
title: (0, import_i18n10.__)("Create variable", "elementor"),
|
|
1797
1837
|
onClose: closePopover
|
|
1798
1838
|
}
|
|
1799
|
-
), /* @__PURE__ */
|
|
1839
|
+
), /* @__PURE__ */ React14.createElement(import_ui14.Divider, null), /* @__PURE__ */ React14.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React14.createElement(
|
|
1800
1840
|
FormField,
|
|
1801
1841
|
{
|
|
1802
1842
|
id: "variable-label",
|
|
1803
|
-
label: (0,
|
|
1843
|
+
label: (0, import_i18n10.__)("Name", "elementor"),
|
|
1804
1844
|
errorMsg: labelFieldError?.message,
|
|
1805
1845
|
noticeMsg: labelHint(label)
|
|
1806
1846
|
},
|
|
1807
|
-
/* @__PURE__ */
|
|
1847
|
+
/* @__PURE__ */ React14.createElement(
|
|
1808
1848
|
LabelField,
|
|
1809
1849
|
{
|
|
1810
1850
|
id: "variable-label",
|
|
@@ -1822,7 +1862,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1822
1862
|
}
|
|
1823
1863
|
}
|
|
1824
1864
|
)
|
|
1825
|
-
), /* @__PURE__ */
|
|
1865
|
+
), /* @__PURE__ */ React14.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n10.__)("Value", "elementor") }, /* @__PURE__ */ React14.createElement(import_ui14.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React14.createElement(
|
|
1826
1866
|
ValueField,
|
|
1827
1867
|
{
|
|
1828
1868
|
value,
|
|
@@ -1834,8 +1874,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1834
1874
|
onValidationChange: setValueFieldError,
|
|
1835
1875
|
propType
|
|
1836
1876
|
}
|
|
1837
|
-
))), errorMessage && /* @__PURE__ */
|
|
1838
|
-
|
|
1877
|
+
))), errorMessage && /* @__PURE__ */ React14.createElement(import_ui14.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React14.createElement(import_ui14.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React14.createElement(
|
|
1878
|
+
import_ui14.Button,
|
|
1839
1879
|
{
|
|
1840
1880
|
id: "create-variable-button",
|
|
1841
1881
|
size: "small",
|
|
@@ -1843,27 +1883,27 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1843
1883
|
disabled: isSubmitDisabled,
|
|
1844
1884
|
onClick: handleCreateAndTrack
|
|
1845
1885
|
},
|
|
1846
|
-
(0,
|
|
1886
|
+
(0, import_i18n10.__)("Create", "elementor")
|
|
1847
1887
|
)));
|
|
1848
1888
|
};
|
|
1849
1889
|
|
|
1850
1890
|
// src/components/variable-edit.tsx
|
|
1851
|
-
var
|
|
1891
|
+
var React16 = __toESM(require("react"));
|
|
1852
1892
|
var import_react14 = require("react");
|
|
1853
1893
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
1854
1894
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
1855
1895
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
1856
1896
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1857
1897
|
var import_icons8 = require("@elementor/icons");
|
|
1858
|
-
var
|
|
1859
|
-
var
|
|
1898
|
+
var import_ui16 = require("@elementor/ui");
|
|
1899
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1860
1900
|
|
|
1861
1901
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
1862
|
-
var
|
|
1902
|
+
var React15 = __toESM(require("react"));
|
|
1863
1903
|
var import_react13 = require("react");
|
|
1864
1904
|
var import_icons7 = require("@elementor/icons");
|
|
1865
|
-
var
|
|
1866
|
-
var
|
|
1905
|
+
var import_ui15 = require("@elementor/ui");
|
|
1906
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1867
1907
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
1868
1908
|
var EditConfirmationDialog = ({
|
|
1869
1909
|
closeDialog,
|
|
@@ -1877,23 +1917,23 @@ var EditConfirmationDialog = ({
|
|
|
1877
1917
|
}
|
|
1878
1918
|
onConfirm?.();
|
|
1879
1919
|
};
|
|
1880
|
-
return /* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ React15.createElement(import_ui15.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React15.createElement(import_ui15.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React15.createElement(import_icons7.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n11.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React15.createElement(import_ui15.DialogContent, null, /* @__PURE__ */ React15.createElement(import_ui15.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n11.__)(
|
|
1881
1921
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
1882
1922
|
"elementor"
|
|
1883
|
-
))), /* @__PURE__ */
|
|
1884
|
-
|
|
1923
|
+
))), /* @__PURE__ */ React15.createElement(import_ui15.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React15.createElement(
|
|
1924
|
+
import_ui15.FormControlLabel,
|
|
1885
1925
|
{
|
|
1886
|
-
control: /* @__PURE__ */
|
|
1887
|
-
|
|
1926
|
+
control: /* @__PURE__ */ React15.createElement(
|
|
1927
|
+
import_ui15.Checkbox,
|
|
1888
1928
|
{
|
|
1889
1929
|
checked: dontShowAgain,
|
|
1890
1930
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
1891
1931
|
size: "small"
|
|
1892
1932
|
}
|
|
1893
1933
|
),
|
|
1894
|
-
label: /* @__PURE__ */
|
|
1934
|
+
label: /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "body2" }, (0, import_i18n11.__)("Don't show me again", "elementor"))
|
|
1895
1935
|
}
|
|
1896
|
-
), /* @__PURE__ */
|
|
1936
|
+
), /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(import_ui15.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n11.__)("Keep editing", "elementor")), /* @__PURE__ */ React15.createElement(import_ui15.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n11.__)("Save", "elementor")))));
|
|
1897
1937
|
};
|
|
1898
1938
|
|
|
1899
1939
|
// src/components/variable-edit.tsx
|
|
@@ -1978,15 +2018,15 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1978
2018
|
const actions = [];
|
|
1979
2019
|
if (userPermissions.canDelete()) {
|
|
1980
2020
|
actions.push(
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
|
|
2021
|
+
/* @__PURE__ */ React16.createElement(
|
|
2022
|
+
import_ui16.IconButton,
|
|
1983
2023
|
{
|
|
1984
2024
|
key: "delete",
|
|
1985
2025
|
size: SIZE3,
|
|
1986
|
-
"aria-label": (0,
|
|
2026
|
+
"aria-label": (0, import_i18n12.__)("Delete", "elementor"),
|
|
1987
2027
|
onClick: handleDeleteConfirmation
|
|
1988
2028
|
},
|
|
1989
|
-
/* @__PURE__ */
|
|
2029
|
+
/* @__PURE__ */ React16.createElement(import_icons8.TrashIcon, { fontSize: SIZE3 })
|
|
1990
2030
|
)
|
|
1991
2031
|
);
|
|
1992
2032
|
}
|
|
@@ -2006,31 +2046,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2006
2046
|
return !!errorMessage;
|
|
2007
2047
|
};
|
|
2008
2048
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
2009
|
-
return /* @__PURE__ */
|
|
2049
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React16.createElement(
|
|
2010
2050
|
import_editor_ui5.PopoverHeader,
|
|
2011
2051
|
{
|
|
2012
|
-
title: (0,
|
|
2052
|
+
title: (0, import_i18n12.__)("Edit variable", "elementor"),
|
|
2013
2053
|
onClose,
|
|
2014
|
-
icon: /* @__PURE__ */
|
|
2015
|
-
|
|
2054
|
+
icon: /* @__PURE__ */ React16.createElement(React16.Fragment, null, onGoBack && /* @__PURE__ */ React16.createElement(
|
|
2055
|
+
import_ui16.IconButton,
|
|
2016
2056
|
{
|
|
2017
2057
|
size: SIZE3,
|
|
2018
|
-
"aria-label": (0,
|
|
2058
|
+
"aria-label": (0, import_i18n12.__)("Go Back", "elementor"),
|
|
2019
2059
|
onClick: onGoBack
|
|
2020
2060
|
},
|
|
2021
|
-
/* @__PURE__ */
|
|
2022
|
-
), /* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ React16.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
2062
|
+
), /* @__PURE__ */ React16.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2023
2063
|
actions
|
|
2024
2064
|
}
|
|
2025
|
-
), /* @__PURE__ */
|
|
2065
|
+
), /* @__PURE__ */ React16.createElement(import_ui16.Divider, null), /* @__PURE__ */ React16.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React16.createElement(
|
|
2026
2066
|
FormField,
|
|
2027
2067
|
{
|
|
2028
2068
|
id: "variable-label",
|
|
2029
|
-
label: (0,
|
|
2069
|
+
label: (0, import_i18n12.__)("Name", "elementor"),
|
|
2030
2070
|
errorMsg: labelFieldError?.message,
|
|
2031
2071
|
noticeMsg: labelHint(label)
|
|
2032
2072
|
},
|
|
2033
|
-
/* @__PURE__ */
|
|
2073
|
+
/* @__PURE__ */ React16.createElement(
|
|
2034
2074
|
LabelField,
|
|
2035
2075
|
{
|
|
2036
2076
|
id: "variable-label",
|
|
@@ -2048,7 +2088,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2048
2088
|
}
|
|
2049
2089
|
}
|
|
2050
2090
|
)
|
|
2051
|
-
), /* @__PURE__ */
|
|
2091
|
+
), /* @__PURE__ */ React16.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n12.__)("Value", "elementor") }, /* @__PURE__ */ React16.createElement(import_ui16.Typography, { variant: "h5" }, /* @__PURE__ */ React16.createElement(
|
|
2052
2092
|
ValueField,
|
|
2053
2093
|
{
|
|
2054
2094
|
value,
|
|
@@ -2060,7 +2100,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2060
2100
|
onValidationChange: setValueFieldError,
|
|
2061
2101
|
propType
|
|
2062
2102
|
}
|
|
2063
|
-
))), errorMessage && /* @__PURE__ */
|
|
2103
|
+
))), errorMessage && /* @__PURE__ */ React16.createElement(import_ui16.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React16.createElement(import_ui16.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React16.createElement(import_ui16.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n12.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React16.createElement(
|
|
2064
2104
|
DeleteConfirmationDialog,
|
|
2065
2105
|
{
|
|
2066
2106
|
open: true,
|
|
@@ -2068,7 +2108,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2068
2108
|
onConfirm: handleDelete,
|
|
2069
2109
|
closeDialog: closeDeleteDialog()
|
|
2070
2110
|
}
|
|
2071
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2111
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React16.createElement(
|
|
2072
2112
|
EditConfirmationDialog,
|
|
2073
2113
|
{
|
|
2074
2114
|
closeDialog: closeEditDialog(),
|
|
@@ -2088,13 +2128,13 @@ var import_ui20 = require("@elementor/ui");
|
|
|
2088
2128
|
var import_i18n15 = require("@wordpress/i18n");
|
|
2089
2129
|
|
|
2090
2130
|
// src/components/ui/empty-state.tsx
|
|
2091
|
-
var
|
|
2092
|
-
var
|
|
2093
|
-
var
|
|
2131
|
+
var React17 = __toESM(require("react"));
|
|
2132
|
+
var import_ui17 = require("@elementor/ui");
|
|
2133
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2094
2134
|
var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
2095
2135
|
const canAdd = usePermissions().canAdd();
|
|
2096
|
-
return /* @__PURE__ */
|
|
2097
|
-
|
|
2136
|
+
return /* @__PURE__ */ React17.createElement(
|
|
2137
|
+
import_ui17.Stack,
|
|
2098
2138
|
{
|
|
2099
2139
|
gap: 1,
|
|
2100
2140
|
alignItems: "center",
|
|
@@ -2104,30 +2144,30 @@ var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
|
2104
2144
|
sx: { p: 2.5, pb: 5.5 }
|
|
2105
2145
|
},
|
|
2106
2146
|
icon,
|
|
2107
|
-
canAdd ? /* @__PURE__ */
|
|
2147
|
+
canAdd ? /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n13.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React17.createElement(
|
|
2108
2148
|
Content,
|
|
2109
2149
|
{
|
|
2110
|
-
title: (0,
|
|
2111
|
-
message: (0,
|
|
2150
|
+
title: (0, import_i18n13.__)("There are no variables", "elementor"),
|
|
2151
|
+
message: (0, import_i18n13.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
2112
2152
|
}
|
|
2113
2153
|
)
|
|
2114
2154
|
);
|
|
2115
2155
|
};
|
|
2116
2156
|
function Content({ title, message }) {
|
|
2117
|
-
return /* @__PURE__ */
|
|
2157
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React17.createElement(import_ui17.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
2118
2158
|
}
|
|
2119
2159
|
|
|
2120
2160
|
// src/components/ui/menu-item-content.tsx
|
|
2121
|
-
var
|
|
2161
|
+
var React18 = __toESM(require("react"));
|
|
2122
2162
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2123
2163
|
var import_icons9 = require("@elementor/icons");
|
|
2124
|
-
var
|
|
2125
|
-
var
|
|
2164
|
+
var import_ui18 = require("@elementor/ui");
|
|
2165
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2126
2166
|
var SIZE4 = "tiny";
|
|
2127
2167
|
var MenuItemContent = ({ item }) => {
|
|
2128
2168
|
const onEdit = item.onEdit;
|
|
2129
|
-
return /* @__PURE__ */
|
|
2130
|
-
|
|
2169
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_ui18.ListItemIcon, null, item.icon), /* @__PURE__ */ React18.createElement(
|
|
2170
|
+
import_ui18.Box,
|
|
2131
2171
|
{
|
|
2132
2172
|
sx: {
|
|
2133
2173
|
flex: 1,
|
|
@@ -2137,64 +2177,42 @@ var MenuItemContent = ({ item }) => {
|
|
|
2137
2177
|
gap: 1
|
|
2138
2178
|
}
|
|
2139
2179
|
},
|
|
2140
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ React18.createElement(
|
|
2141
2181
|
import_editor_ui6.EllipsisWithTooltip,
|
|
2142
2182
|
{
|
|
2143
2183
|
title: item.label || item.value,
|
|
2144
|
-
as:
|
|
2184
|
+
as: import_ui18.Typography,
|
|
2145
2185
|
variant: "caption",
|
|
2146
2186
|
color: "text.primary",
|
|
2147
2187
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2148
2188
|
maxWidth: "50%"
|
|
2149
2189
|
}
|
|
2150
2190
|
),
|
|
2151
|
-
item.secondaryText && /* @__PURE__ */
|
|
2191
|
+
item.secondaryText && /* @__PURE__ */ React18.createElement(
|
|
2152
2192
|
import_editor_ui6.EllipsisWithTooltip,
|
|
2153
2193
|
{
|
|
2154
2194
|
title: item.secondaryText,
|
|
2155
|
-
as:
|
|
2195
|
+
as: import_ui18.Typography,
|
|
2156
2196
|
variant: "caption",
|
|
2157
2197
|
color: "text.tertiary",
|
|
2158
2198
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2159
2199
|
maxWidth: "50%"
|
|
2160
2200
|
}
|
|
2161
2201
|
)
|
|
2162
|
-
), !!onEdit && /* @__PURE__ */
|
|
2163
|
-
|
|
2202
|
+
), !!onEdit && /* @__PURE__ */ React18.createElement(
|
|
2203
|
+
import_ui18.IconButton,
|
|
2164
2204
|
{
|
|
2165
2205
|
sx: { mx: 1, opacity: "0" },
|
|
2166
2206
|
onClick: (e) => {
|
|
2167
2207
|
e.stopPropagation();
|
|
2168
2208
|
onEdit(item.value);
|
|
2169
2209
|
},
|
|
2170
|
-
"aria-label": (0,
|
|
2210
|
+
"aria-label": (0, import_i18n14.__)("Edit", "elementor")
|
|
2171
2211
|
},
|
|
2172
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ React18.createElement(import_icons9.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2173
2213
|
));
|
|
2174
2214
|
};
|
|
2175
2215
|
|
|
2176
|
-
// src/components/ui/no-search-results.tsx
|
|
2177
|
-
var React18 = __toESM(require("react"));
|
|
2178
|
-
var import_ui18 = require("@elementor/ui");
|
|
2179
|
-
var import_i18n14 = require("@wordpress/i18n");
|
|
2180
|
-
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
2181
|
-
return /* @__PURE__ */ React18.createElement(
|
|
2182
|
-
import_ui18.Stack,
|
|
2183
|
-
{
|
|
2184
|
-
gap: 1,
|
|
2185
|
-
alignItems: "center",
|
|
2186
|
-
justifyContent: "center",
|
|
2187
|
-
height: "100%",
|
|
2188
|
-
p: 2.5,
|
|
2189
|
-
color: "text.secondary",
|
|
2190
|
-
sx: { pb: 3.5 }
|
|
2191
|
-
},
|
|
2192
|
-
icon,
|
|
2193
|
-
/* @__PURE__ */ React18.createElement(import_ui18.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n14.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React18.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
2194
|
-
/* @__PURE__ */ React18.createElement(import_ui18.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n14.__)("Try something else.", "elementor"), /* @__PURE__ */ React18.createElement(import_ui18.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n14.__)("Clear & try again", "elementor")))
|
|
2195
|
-
);
|
|
2196
|
-
};
|
|
2197
|
-
|
|
2198
2216
|
// src/components/ui/styled-menu-list.tsx
|
|
2199
2217
|
var import_ui19 = require("@elementor/ui");
|
|
2200
2218
|
var VariablesStyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ theme }) => ({
|
|
@@ -2296,7 +2314,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2296
2314
|
actions
|
|
2297
2315
|
}
|
|
2298
2316
|
), hasVariables && /* @__PURE__ */ React19.createElement(
|
|
2299
|
-
import_editor_ui7.
|
|
2317
|
+
import_editor_ui7.SearchField,
|
|
2300
2318
|
{
|
|
2301
2319
|
value: searchValue,
|
|
2302
2320
|
onSearch: handleSearch,
|