@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.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
|
5
5
|
import { isTransformable as isTransformable2 } from "@elementor/editor-props";
|
|
6
6
|
|
|
7
7
|
// src/components/variables-manager/variables-manager-panel.tsx
|
|
8
|
-
import * as
|
|
8
|
+
import * as React11 from "react";
|
|
9
9
|
import { useCallback as useCallback4, useEffect as useEffect3, useState as useState5 } from "react";
|
|
10
10
|
import {
|
|
11
11
|
__createPanel as createPanel,
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
PanelHeader,
|
|
16
16
|
PanelHeaderTitle
|
|
17
17
|
} from "@elementor/editor-panels";
|
|
18
|
-
import { SaveChangesDialog, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
18
|
+
import { SaveChangesDialog, SearchField, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
19
19
|
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
20
20
|
import { ColorFilterIcon, TrashIcon } from "@elementor/icons";
|
|
21
|
-
import { Alert, Box, Button as Button2, CloseButton, Divider, ErrorBoundary, Stack as
|
|
22
|
-
import { __ as
|
|
21
|
+
import { Alert, Box, Button as Button2, CloseButton, Divider, ErrorBoundary, Stack as Stack5 } from "@elementor/ui";
|
|
22
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
23
23
|
|
|
24
24
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
25
25
|
import * as React from "react";
|
|
@@ -44,6 +44,27 @@ var DeleteConfirmationDialog = ({
|
|
|
44
44
|
return /* @__PURE__ */ React.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React.createElement(AlertOctagonFilledIcon, { color: "error" }), __("Delete this variable?", "elementor")), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __("All elements using", "elementor"), "\xA0", /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2", component: "span", sx: { lineBreak: "anywhere" } }, label), "\xA0", __("will keep their current values, but the variable itself will be removed.", "elementor"))), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { color: "secondary", onClick: closeDialog }, __("Not now", "elementor")), /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "error", onClick: onConfirm }, __("Delete", "elementor"))));
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
// src/components/ui/no-search-results.tsx
|
|
48
|
+
import * as React2 from "react";
|
|
49
|
+
import { Link, Stack, Typography as Typography2 } from "@elementor/ui";
|
|
50
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
51
|
+
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
52
|
+
return /* @__PURE__ */ React2.createElement(
|
|
53
|
+
Stack,
|
|
54
|
+
{
|
|
55
|
+
gap: 1,
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
p: 2.5,
|
|
59
|
+
color: "text.secondary",
|
|
60
|
+
sx: { pb: 3.5, pt: 5 }
|
|
61
|
+
},
|
|
62
|
+
icon,
|
|
63
|
+
/* @__PURE__ */ React2.createElement(Typography2, { align: "center", variant: "subtitle2" }, __2("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React2.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
64
|
+
/* @__PURE__ */ React2.createElement(Typography2, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __2("Try something else.", "elementor"), /* @__PURE__ */ React2.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __2("Clear & try again", "elementor")))
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
47
68
|
// src/components/variables-manager/hooks/use-auto-edit.ts
|
|
48
69
|
import { useCallback, useState } from "react";
|
|
49
70
|
var useAutoEdit = () => {
|
|
@@ -65,7 +86,7 @@ var useAutoEdit = () => {
|
|
|
65
86
|
|
|
66
87
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
67
88
|
import { useCallback as useCallback2, useState as useState2 } from "react";
|
|
68
|
-
import { __ as
|
|
89
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
69
90
|
|
|
70
91
|
// src/batch-operations.ts
|
|
71
92
|
var generateTempId = () => {
|
|
@@ -132,7 +153,7 @@ import { useMemo } from "react";
|
|
|
132
153
|
import { useBoundProp } from "@elementor/editor-controls";
|
|
133
154
|
|
|
134
155
|
// src/context/variable-type-context.tsx
|
|
135
|
-
import * as
|
|
156
|
+
import * as React4 from "react";
|
|
136
157
|
import { createContext, useContext } from "react";
|
|
137
158
|
|
|
138
159
|
// src/variables-registry/create-variable-type-registry.ts
|
|
@@ -140,10 +161,10 @@ import { styleTransformersRegistry } from "@elementor/editor-canvas";
|
|
|
140
161
|
import { stylesInheritanceTransformersRegistry } from "@elementor/editor-editing-panel";
|
|
141
162
|
|
|
142
163
|
// src/transformers/inheritance-transformer.tsx
|
|
143
|
-
import * as
|
|
164
|
+
import * as React3 from "react";
|
|
144
165
|
import { createTransformer } from "@elementor/editor-canvas";
|
|
145
|
-
import { Stack, Typography as
|
|
146
|
-
import { __ as
|
|
166
|
+
import { Stack as Stack2, Typography as Typography3 } from "@elementor/ui";
|
|
167
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
147
168
|
|
|
148
169
|
// src/components/ui/color-indicator.tsx
|
|
149
170
|
import { styled, UnstableColorIndicator } from "@elementor/ui";
|
|
@@ -158,7 +179,7 @@ import { z } from "@elementor/schema";
|
|
|
158
179
|
var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
|
|
159
180
|
|
|
160
181
|
// src/service.ts
|
|
161
|
-
import { __ as
|
|
182
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
162
183
|
|
|
163
184
|
// src/api.ts
|
|
164
185
|
import { httpService } from "@elementor/http-client";
|
|
@@ -363,7 +384,7 @@ var service = {
|
|
|
363
384
|
return apiClient.create(type, label, value).then((response) => {
|
|
364
385
|
const { success, data: payload } = response.data;
|
|
365
386
|
if (!success) {
|
|
366
|
-
const errorMessage = payload?.message ||
|
|
387
|
+
const errorMessage = payload?.message || __3("Unexpected response from server", "elementor");
|
|
367
388
|
throw new Error(errorMessage);
|
|
368
389
|
}
|
|
369
390
|
return payload;
|
|
@@ -385,7 +406,7 @@ var service = {
|
|
|
385
406
|
return apiClient.update(id2, label, value).then((response) => {
|
|
386
407
|
const { success, data: payload } = response.data;
|
|
387
408
|
if (!success) {
|
|
388
|
-
const errorMessage = payload?.message ||
|
|
409
|
+
const errorMessage = payload?.message || __3("Unexpected response from server", "elementor");
|
|
389
410
|
throw new Error(errorMessage);
|
|
390
411
|
}
|
|
391
412
|
return payload;
|
|
@@ -518,11 +539,11 @@ var inheritanceTransformer = createTransformer((id2) => {
|
|
|
518
539
|
const variables = service.variables();
|
|
519
540
|
const variable = variables[id2];
|
|
520
541
|
if (!variable) {
|
|
521
|
-
return /* @__PURE__ */
|
|
542
|
+
return /* @__PURE__ */ React3.createElement("span", null, __4("Missing variable", "elementor"));
|
|
522
543
|
}
|
|
523
544
|
const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
|
|
524
545
|
const css = resolveCssVariable(id2, variable);
|
|
525
|
-
return /* @__PURE__ */
|
|
546
|
+
return /* @__PURE__ */ React3.createElement(Stack2, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React3.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React3.createElement(Typography3, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
|
|
526
547
|
});
|
|
527
548
|
|
|
528
549
|
// src/transformers/variable-transformer.ts
|
|
@@ -607,7 +628,7 @@ var { registerVariableType, getVariableType, getVariableTypes, hasVariableType }
|
|
|
607
628
|
// src/context/variable-type-context.tsx
|
|
608
629
|
var VariableTypeContext = createContext(null);
|
|
609
630
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
610
|
-
return /* @__PURE__ */
|
|
631
|
+
return /* @__PURE__ */ React4.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
611
632
|
}
|
|
612
633
|
function useVariableType() {
|
|
613
634
|
const context = useContext(VariableTypeContext);
|
|
@@ -617,6 +638,12 @@ function useVariableType() {
|
|
|
617
638
|
return getVariableType(context);
|
|
618
639
|
}
|
|
619
640
|
|
|
641
|
+
// src/utils/filter-by-search.ts
|
|
642
|
+
function filterBySearch(variables, searchValue) {
|
|
643
|
+
const lowerSearchValue = searchValue.toLowerCase();
|
|
644
|
+
return variables.filter((variable) => variable.label.toLowerCase().includes(lowerSearchValue));
|
|
645
|
+
}
|
|
646
|
+
|
|
620
647
|
// src/hooks/use-prop-variables.ts
|
|
621
648
|
var getVariables = (includeDeleted = true) => {
|
|
622
649
|
const variables = service.variables();
|
|
@@ -638,7 +665,7 @@ var useVariable = (key) => {
|
|
|
638
665
|
var useFilteredVariables = (searchValue, propTypeKey) => {
|
|
639
666
|
const baseVariables = usePropVariables(propTypeKey);
|
|
640
667
|
const typeFilteredVariables = useVariableSelectionFilter(baseVariables);
|
|
641
|
-
const searchFilteredVariables =
|
|
668
|
+
const searchFilteredVariables = filterBySearch(typeFilteredVariables, searchValue);
|
|
642
669
|
const sortedVariables = searchFilteredVariables.sort((a, b) => {
|
|
643
670
|
const orderA = a.order ?? Number.MAX_SAFE_INTEGER;
|
|
644
671
|
const orderB = b.order ?? Number.MAX_SAFE_INTEGER;
|
|
@@ -656,10 +683,6 @@ var useVariableSelectionFilter = (variables) => {
|
|
|
656
683
|
const { propType } = useBoundProp();
|
|
657
684
|
return selectionFilter ? selectionFilter(variables, propType) : variables;
|
|
658
685
|
};
|
|
659
|
-
var filterVariablesBySearchValue = (variables, searchValue) => {
|
|
660
|
-
const lowerSearchValue = searchValue.toLowerCase();
|
|
661
|
-
return variables.filter(({ label }) => label.toLowerCase().includes(lowerSearchValue));
|
|
662
|
-
};
|
|
663
686
|
var usePropVariables = (propKey) => {
|
|
664
687
|
return useMemo(() => normalizeVariables(propKey), [propKey]);
|
|
665
688
|
};
|
|
@@ -687,15 +710,15 @@ var restoreVariable = (restoreId, label, value) => {
|
|
|
687
710
|
};
|
|
688
711
|
|
|
689
712
|
// src/utils/validations.ts
|
|
690
|
-
import { __ as
|
|
713
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
691
714
|
var ERROR_MESSAGES = {
|
|
692
|
-
MISSING_VARIABLE_NAME:
|
|
693
|
-
MISSING_VARIABLE_VALUE:
|
|
694
|
-
INVALID_CHARACTERS:
|
|
695
|
-
NO_NON_SPECIAL_CHARACTER:
|
|
696
|
-
VARIABLE_LABEL_MAX_LENGTH:
|
|
697
|
-
DUPLICATED_LABEL:
|
|
698
|
-
UNEXPECTED_ERROR:
|
|
715
|
+
MISSING_VARIABLE_NAME: __5("Give your variable a name.", "elementor"),
|
|
716
|
+
MISSING_VARIABLE_VALUE: __5("Add a value to complete your variable.", "elementor"),
|
|
717
|
+
INVALID_CHARACTERS: __5("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
718
|
+
NO_NON_SPECIAL_CHARACTER: __5("Names have to include at least one non-special character.", "elementor"),
|
|
719
|
+
VARIABLE_LABEL_MAX_LENGTH: __5("Keep names up to 50 characters.", "elementor"),
|
|
720
|
+
DUPLICATED_LABEL: __5("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
721
|
+
UNEXPECTED_ERROR: __5("There was a glitch. Try saving your variable again.", "elementor")
|
|
699
722
|
};
|
|
700
723
|
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
701
724
|
var mapServerError = (error) => {
|
|
@@ -742,14 +765,17 @@ var validateValue = (value) => {
|
|
|
742
765
|
var useVariablesManagerState = () => {
|
|
743
766
|
const [variables, setVariables] = useState2(() => getVariables(false));
|
|
744
767
|
const [deletedVariables, setDeletedVariables] = useState2([]);
|
|
745
|
-
const [ids, setIds] = useState2(() => Object.keys(getVariables(false)));
|
|
746
768
|
const [isDirty, setIsDirty] = useState2(false);
|
|
747
769
|
const [hasValidationErrors, setHasValidationErrors] = useState2(false);
|
|
748
770
|
const [isSaving, setIsSaving] = useState2(false);
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
771
|
+
const [searchValue, setSearchValue] = useState2("");
|
|
772
|
+
const handleOnChange = useCallback2(
|
|
773
|
+
(newVariables) => {
|
|
774
|
+
setVariables({ ...variables, ...newVariables });
|
|
775
|
+
setIsDirty(true);
|
|
776
|
+
},
|
|
777
|
+
[variables]
|
|
778
|
+
);
|
|
753
779
|
const createVariable2 = useCallback2((type, defaultName, defaultValue) => {
|
|
754
780
|
const newId = generateTempId();
|
|
755
781
|
const newVariable = {
|
|
@@ -759,7 +785,6 @@ var useVariablesManagerState = () => {
|
|
|
759
785
|
type
|
|
760
786
|
};
|
|
761
787
|
setVariables((prev) => ({ ...prev, [newId]: newVariable }));
|
|
762
|
-
setIds((prev) => [...prev, newId]);
|
|
763
788
|
setIsDirty(true);
|
|
764
789
|
return newId;
|
|
765
790
|
}, []);
|
|
@@ -768,6 +793,9 @@ var useVariablesManagerState = () => {
|
|
|
768
793
|
setVariables((prev) => ({ ...prev, [itemId]: { ...prev[itemId], deleted: true } }));
|
|
769
794
|
setIsDirty(true);
|
|
770
795
|
}, []);
|
|
796
|
+
const handleSearch = (searchTerm) => {
|
|
797
|
+
setSearchValue(searchTerm);
|
|
798
|
+
};
|
|
771
799
|
const handleSave = useCallback2(async () => {
|
|
772
800
|
try {
|
|
773
801
|
const originalVariables = getVariables(false);
|
|
@@ -777,41 +805,45 @@ var useVariablesManagerState = () => {
|
|
|
777
805
|
await service.load();
|
|
778
806
|
const updatedVariables = service.variables();
|
|
779
807
|
setVariables(updatedVariables);
|
|
780
|
-
setIds(Object.keys(updatedVariables));
|
|
781
808
|
setDeletedVariables([]);
|
|
782
809
|
setIsDirty(false);
|
|
783
810
|
setIsSaving(false);
|
|
784
811
|
return { success: true };
|
|
785
812
|
}
|
|
786
|
-
throw new Error(
|
|
813
|
+
throw new Error(__6("Failed to save variables. Please try again.", "elementor"));
|
|
787
814
|
} catch (error) {
|
|
788
815
|
const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNEXPECTED_ERROR;
|
|
789
816
|
setIsSaving(false);
|
|
790
817
|
return { success: false, error: errorMessage };
|
|
791
818
|
}
|
|
792
819
|
}, [variables]);
|
|
820
|
+
const filteredVariables = () => {
|
|
821
|
+
const list = Object.entries(variables).map(([id2, value]) => ({ ...value, id: id2 }));
|
|
822
|
+
const filtered = filterBySearch(list, searchValue);
|
|
823
|
+
return Object.fromEntries(filtered.map(({ id: id2, ...rest }) => [id2, rest]));
|
|
824
|
+
};
|
|
793
825
|
return {
|
|
794
|
-
variables,
|
|
826
|
+
variables: filteredVariables(),
|
|
795
827
|
deletedVariables,
|
|
796
|
-
ids,
|
|
797
828
|
isDirty,
|
|
798
829
|
hasValidationErrors,
|
|
799
|
-
setIds,
|
|
800
830
|
handleOnChange,
|
|
801
831
|
createVariable: createVariable2,
|
|
802
832
|
handleDeleteVariable,
|
|
803
833
|
handleSave,
|
|
804
834
|
isSaving,
|
|
835
|
+
handleSearch,
|
|
836
|
+
searchValue,
|
|
805
837
|
setHasValidationErrors
|
|
806
838
|
};
|
|
807
839
|
};
|
|
808
840
|
|
|
809
841
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
810
|
-
import * as
|
|
811
|
-
import { createElement as
|
|
842
|
+
import * as React5 from "react";
|
|
843
|
+
import { createElement as createElement6 } from "react";
|
|
812
844
|
import { PlusIcon } from "@elementor/icons";
|
|
813
|
-
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as
|
|
814
|
-
import { __ as
|
|
845
|
+
import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography4, usePopupState } from "@elementor/ui";
|
|
846
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
815
847
|
var SIZE = "tiny";
|
|
816
848
|
var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
817
849
|
const menuState = usePopupState({
|
|
@@ -830,16 +862,16 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
830
862
|
}
|
|
831
863
|
};
|
|
832
864
|
});
|
|
833
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
|
|
834
866
|
IconButton,
|
|
835
867
|
{
|
|
836
868
|
...bindTrigger(menuState),
|
|
837
869
|
disabled,
|
|
838
870
|
size: SIZE,
|
|
839
|
-
"aria-label":
|
|
871
|
+
"aria-label": __7("Add variable", "elementor")
|
|
840
872
|
},
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
), /* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ React5.createElement(PlusIcon, { fontSize: SIZE })
|
|
874
|
+
), /* @__PURE__ */ React5.createElement(
|
|
843
875
|
Menu,
|
|
844
876
|
{
|
|
845
877
|
disablePortal: true,
|
|
@@ -862,7 +894,7 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
862
894
|
open: menuState.isOpen,
|
|
863
895
|
onClose: menuState.close
|
|
864
896
|
},
|
|
865
|
-
menuOptions.map((option) => /* @__PURE__ */
|
|
897
|
+
menuOptions.map((option) => /* @__PURE__ */ React5.createElement(
|
|
866
898
|
MenuItem,
|
|
867
899
|
{
|
|
868
900
|
key: option.key,
|
|
@@ -874,11 +906,11 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
874
906
|
gap: 1.5
|
|
875
907
|
}
|
|
876
908
|
},
|
|
877
|
-
|
|
909
|
+
createElement6(option.icon, {
|
|
878
910
|
fontSize: SIZE,
|
|
879
911
|
color: "action"
|
|
880
912
|
}),
|
|
881
|
-
/* @__PURE__ */
|
|
913
|
+
/* @__PURE__ */ React5.createElement(Typography4, { variant: "caption", color: "text.primary" }, option.name)
|
|
882
914
|
))
|
|
883
915
|
));
|
|
884
916
|
};
|
|
@@ -894,13 +926,13 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
894
926
|
};
|
|
895
927
|
|
|
896
928
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
897
|
-
import * as
|
|
898
|
-
import { createElement as
|
|
929
|
+
import * as React10 from "react";
|
|
930
|
+
import { createElement as createElement13, useEffect as useEffect2, useRef as useRef3 } from "react";
|
|
899
931
|
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
900
932
|
import { GripVerticalIcon } from "@elementor/icons";
|
|
901
933
|
import {
|
|
902
934
|
IconButton as IconButton3,
|
|
903
|
-
Stack as
|
|
935
|
+
Stack as Stack4,
|
|
904
936
|
Table,
|
|
905
937
|
TableBody,
|
|
906
938
|
TableContainer,
|
|
@@ -909,10 +941,10 @@ import {
|
|
|
909
941
|
UnstableSortableItem,
|
|
910
942
|
UnstableSortableProvider
|
|
911
943
|
} from "@elementor/ui";
|
|
912
|
-
import { __ as
|
|
944
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
913
945
|
|
|
914
946
|
// src/components/fields/label-field.tsx
|
|
915
|
-
import * as
|
|
947
|
+
import * as React6 from "react";
|
|
916
948
|
import { useRef, useState as useState3 } from "react";
|
|
917
949
|
import { WarningInfotip } from "@elementor/editor-ui";
|
|
918
950
|
import { TextField } from "@elementor/ui";
|
|
@@ -952,7 +984,7 @@ var LabelField = ({
|
|
|
952
984
|
errorMsg = error.message;
|
|
953
985
|
}
|
|
954
986
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
955
|
-
const textField = /* @__PURE__ */
|
|
987
|
+
const textField = /* @__PURE__ */ React6.createElement(
|
|
956
988
|
TextField,
|
|
957
989
|
{
|
|
958
990
|
ref: fieldRef,
|
|
@@ -972,7 +1004,7 @@ var LabelField = ({
|
|
|
972
1004
|
);
|
|
973
1005
|
if (showWarningInfotip) {
|
|
974
1006
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
975
|
-
return /* @__PURE__ */
|
|
1007
|
+
return /* @__PURE__ */ React6.createElement(
|
|
976
1008
|
WarningInfotip,
|
|
977
1009
|
{
|
|
978
1010
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -989,15 +1021,15 @@ var LabelField = ({
|
|
|
989
1021
|
};
|
|
990
1022
|
|
|
991
1023
|
// src/components/variables-manager/utils/variable-edit-menu.tsx
|
|
992
|
-
import * as
|
|
993
|
-
import { createElement as
|
|
1024
|
+
import * as React7 from "react";
|
|
1025
|
+
import { createElement as createElement9 } from "react";
|
|
994
1026
|
import { DotsVerticalIcon } from "@elementor/icons";
|
|
995
1027
|
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, IconButton as IconButton2, Menu as Menu2, MenuItem as MenuItem2, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
996
1028
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
997
1029
|
const menuState = usePopupState2({
|
|
998
1030
|
variant: "popover"
|
|
999
1031
|
});
|
|
1000
|
-
return /* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(IconButton2, { ...bindTrigger2(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React7.createElement(DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React7.createElement(
|
|
1001
1033
|
Menu2,
|
|
1002
1034
|
{
|
|
1003
1035
|
disablePortal: true,
|
|
@@ -1020,7 +1052,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1020
1052
|
open: menuState.isOpen,
|
|
1021
1053
|
onClose: menuState.close
|
|
1022
1054
|
},
|
|
1023
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
1055
|
+
menuActions.map((action) => /* @__PURE__ */ React7.createElement(
|
|
1024
1056
|
MenuItem2,
|
|
1025
1057
|
{
|
|
1026
1058
|
key: action.name,
|
|
@@ -1033,7 +1065,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1033
1065
|
gap: 1
|
|
1034
1066
|
}
|
|
1035
1067
|
},
|
|
1036
|
-
action.icon &&
|
|
1068
|
+
action.icon && createElement9(action.icon, {
|
|
1037
1069
|
fontSize: "inherit"
|
|
1038
1070
|
}),
|
|
1039
1071
|
" ",
|
|
@@ -1043,7 +1075,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1043
1075
|
};
|
|
1044
1076
|
|
|
1045
1077
|
// src/components/variables-manager/utils/variable-table-cell.tsx
|
|
1046
|
-
import * as
|
|
1078
|
+
import * as React8 from "react";
|
|
1047
1079
|
import { TableCell } from "@elementor/ui";
|
|
1048
1080
|
var VariableTableCell = ({
|
|
1049
1081
|
children,
|
|
@@ -1063,14 +1095,14 @@ var VariableTableCell = ({
|
|
|
1063
1095
|
...width && { width },
|
|
1064
1096
|
...sx
|
|
1065
1097
|
};
|
|
1066
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ React8.createElement(TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1067
1099
|
};
|
|
1068
1100
|
|
|
1069
1101
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1070
|
-
import * as
|
|
1102
|
+
import * as React9 from "react";
|
|
1071
1103
|
import { useCallback as useCallback3, useEffect, useRef as useRef2, useState as useState4 } from "react";
|
|
1072
|
-
import { ClickAwayListener, Stack as
|
|
1073
|
-
var VariableEditableCell =
|
|
1104
|
+
import { ClickAwayListener, Stack as Stack3 } from "@elementor/ui";
|
|
1105
|
+
var VariableEditableCell = React9.memo(
|
|
1074
1106
|
({
|
|
1075
1107
|
initialValue,
|
|
1076
1108
|
children,
|
|
@@ -1136,8 +1168,8 @@ var VariableEditableCell = React8.memo(
|
|
|
1136
1168
|
error: currentError
|
|
1137
1169
|
});
|
|
1138
1170
|
if (isEditing) {
|
|
1139
|
-
return /* @__PURE__ */
|
|
1140
|
-
|
|
1171
|
+
return /* @__PURE__ */ React9.createElement(ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React9.createElement(
|
|
1172
|
+
Stack3,
|
|
1141
1173
|
{
|
|
1142
1174
|
ref: rowRef,
|
|
1143
1175
|
direction: "row",
|
|
@@ -1153,8 +1185,8 @@ var VariableEditableCell = React8.memo(
|
|
|
1153
1185
|
editableContent
|
|
1154
1186
|
));
|
|
1155
1187
|
}
|
|
1156
|
-
return /* @__PURE__ */
|
|
1157
|
-
|
|
1188
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1189
|
+
Stack3,
|
|
1158
1190
|
{
|
|
1159
1191
|
ref: rowRef,
|
|
1160
1192
|
direction: "row",
|
|
@@ -1177,8 +1209,6 @@ var VariablesManagerTable = ({
|
|
|
1177
1209
|
menuActions,
|
|
1178
1210
|
variables,
|
|
1179
1211
|
onChange: handleOnChange,
|
|
1180
|
-
ids,
|
|
1181
|
-
onIdsChange: setIds,
|
|
1182
1212
|
autoEditVariableId,
|
|
1183
1213
|
onAutoEditComplete,
|
|
1184
1214
|
onFieldError
|
|
@@ -1206,13 +1236,8 @@ var VariablesManagerTable = ({
|
|
|
1206
1236
|
variableRowRefs.current.delete(id2);
|
|
1207
1237
|
}
|
|
1208
1238
|
};
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
if (JSON.stringify(sortedIds) !== JSON.stringify(ids)) {
|
|
1212
|
-
setIds(sortedIds);
|
|
1213
|
-
}
|
|
1214
|
-
}, [ids, variables, setIds]);
|
|
1215
|
-
const rows = ids.filter((id2) => !variables[id2].deleted).sort(sortVariablesOrder(variables)).map((id2) => {
|
|
1239
|
+
const ids = Object.keys(variables).sort(sortVariablesOrder(variables));
|
|
1240
|
+
const rows = ids.filter((id2) => !variables[id2].deleted).map((id2) => {
|
|
1216
1241
|
const variable = variables[id2];
|
|
1217
1242
|
const variableType = getVariableType(variable.type);
|
|
1218
1243
|
return {
|
|
@@ -1227,28 +1252,27 @@ var VariablesManagerTable = ({
|
|
|
1227
1252
|
minWidth: 250,
|
|
1228
1253
|
tableLayout: "fixed"
|
|
1229
1254
|
};
|
|
1230
|
-
|
|
1255
|
+
const handleReorder = (newIds) => {
|
|
1256
|
+
const updatedVariables = { ...variables };
|
|
1257
|
+
newIds.forEach((id2, index) => {
|
|
1258
|
+
const current = updatedVariables[id2];
|
|
1259
|
+
if (!current) {
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
updatedVariables[id2] = Object.assign({}, current, { order: index + 1 });
|
|
1263
|
+
});
|
|
1264
|
+
handleOnChange(updatedVariables);
|
|
1265
|
+
};
|
|
1266
|
+
return /* @__PURE__ */ React10.createElement(TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React10.createElement(Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React10.createElement(TableHead, null, /* @__PURE__ */ React10.createElement(TableRow, null, /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true }, __8("Name", "elementor")), /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true }, __8("Value", "elementor")), /* @__PURE__ */ React10.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React10.createElement(TableBody, null, /* @__PURE__ */ React10.createElement(
|
|
1231
1267
|
UnstableSortableProvider,
|
|
1232
1268
|
{
|
|
1233
1269
|
value: ids,
|
|
1234
|
-
onChange:
|
|
1235
|
-
const updatedVariables = { ...variables };
|
|
1236
|
-
newIds.forEach((id2, index) => {
|
|
1237
|
-
if (updatedVariables[id2]) {
|
|
1238
|
-
updatedVariables[id2] = {
|
|
1239
|
-
...updatedVariables[id2],
|
|
1240
|
-
order: index + 1
|
|
1241
|
-
};
|
|
1242
|
-
}
|
|
1243
|
-
});
|
|
1244
|
-
handleOnChange(updatedVariables);
|
|
1245
|
-
setIds(newIds);
|
|
1246
|
-
},
|
|
1270
|
+
onChange: handleReorder,
|
|
1247
1271
|
variant: "static",
|
|
1248
1272
|
restrictAxis: true,
|
|
1249
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1273
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React10.createElement(Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React10.createElement(TableBody, null, dragOverlayChildren))
|
|
1250
1274
|
},
|
|
1251
|
-
rows.map((row) => /* @__PURE__ */
|
|
1275
|
+
rows.map((row) => /* @__PURE__ */ React10.createElement(
|
|
1252
1276
|
UnstableSortableItem,
|
|
1253
1277
|
{
|
|
1254
1278
|
key: row.id,
|
|
@@ -1266,7 +1290,7 @@ var VariablesManagerTable = ({
|
|
|
1266
1290
|
}) => {
|
|
1267
1291
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1268
1292
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1269
|
-
return /* @__PURE__ */
|
|
1293
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1270
1294
|
TableRow,
|
|
1271
1295
|
{
|
|
1272
1296
|
...itemProps,
|
|
@@ -1296,7 +1320,7 @@ var VariablesManagerTable = ({
|
|
|
1296
1320
|
},
|
|
1297
1321
|
style: { ...itemStyle, ...triggerStyle }
|
|
1298
1322
|
},
|
|
1299
|
-
/* @__PURE__ */
|
|
1323
|
+
/* @__PURE__ */ React10.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React10.createElement(
|
|
1300
1324
|
IconButton3,
|
|
1301
1325
|
{
|
|
1302
1326
|
size: "small",
|
|
@@ -1305,9 +1329,9 @@ var VariablesManagerTable = ({
|
|
|
1305
1329
|
disabled: isSorting,
|
|
1306
1330
|
draggable: true
|
|
1307
1331
|
},
|
|
1308
|
-
/* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ React10.createElement(GripVerticalIcon, { fontSize: "inherit" })
|
|
1309
1333
|
)),
|
|
1310
|
-
/* @__PURE__ */
|
|
1334
|
+
/* @__PURE__ */ React10.createElement(VariableTableCell, null, /* @__PURE__ */ React10.createElement(
|
|
1311
1335
|
VariableEditableCell,
|
|
1312
1336
|
{
|
|
1313
1337
|
initialValue: row.name,
|
|
@@ -1319,13 +1343,13 @@ var VariablesManagerTable = ({
|
|
|
1319
1343
|
});
|
|
1320
1344
|
}
|
|
1321
1345
|
},
|
|
1322
|
-
prefixElement:
|
|
1346
|
+
prefixElement: createElement13(row.icon, { fontSize: "inherit" }),
|
|
1323
1347
|
editableElement: ({
|
|
1324
1348
|
value,
|
|
1325
1349
|
onChange,
|
|
1326
1350
|
onValidationChange,
|
|
1327
1351
|
error
|
|
1328
|
-
}) => /* @__PURE__ */
|
|
1352
|
+
}) => /* @__PURE__ */ React10.createElement(
|
|
1329
1353
|
LabelField,
|
|
1330
1354
|
{
|
|
1331
1355
|
id: "variable-label-" + row.id,
|
|
@@ -1347,7 +1371,7 @@ var VariablesManagerTable = ({
|
|
|
1347
1371
|
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1348
1372
|
fieldType: "label"
|
|
1349
1373
|
},
|
|
1350
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ React10.createElement(
|
|
1351
1375
|
EllipsisWithTooltip,
|
|
1352
1376
|
{
|
|
1353
1377
|
title: row.name,
|
|
@@ -1356,7 +1380,7 @@ var VariablesManagerTable = ({
|
|
|
1356
1380
|
row.name
|
|
1357
1381
|
)
|
|
1358
1382
|
)),
|
|
1359
|
-
/* @__PURE__ */
|
|
1383
|
+
/* @__PURE__ */ React10.createElement(VariableTableCell, null, /* @__PURE__ */ React10.createElement(
|
|
1360
1384
|
VariableEditableCell,
|
|
1361
1385
|
{
|
|
1362
1386
|
initialValue: row.value,
|
|
@@ -1373,7 +1397,7 @@ var VariablesManagerTable = ({
|
|
|
1373
1397
|
gap: 0.25
|
|
1374
1398
|
},
|
|
1375
1399
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1376
|
-
/* @__PURE__ */
|
|
1400
|
+
/* @__PURE__ */ React10.createElement(
|
|
1377
1401
|
EllipsisWithTooltip,
|
|
1378
1402
|
{
|
|
1379
1403
|
title: row.value,
|
|
@@ -1386,7 +1410,7 @@ var VariablesManagerTable = ({
|
|
|
1386
1410
|
row.value
|
|
1387
1411
|
)
|
|
1388
1412
|
)),
|
|
1389
|
-
/* @__PURE__ */
|
|
1413
|
+
/* @__PURE__ */ React10.createElement(
|
|
1390
1414
|
VariableTableCell,
|
|
1391
1415
|
{
|
|
1392
1416
|
align: "right",
|
|
@@ -1395,7 +1419,7 @@ var VariablesManagerTable = ({
|
|
|
1395
1419
|
maxWidth: 16,
|
|
1396
1420
|
sx: { paddingInlineEnd: 1 }
|
|
1397
1421
|
},
|
|
1398
|
-
/* @__PURE__ */
|
|
1422
|
+
/* @__PURE__ */ React10.createElement(Stack4, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React10.createElement(
|
|
1399
1423
|
VariableEditMenu,
|
|
1400
1424
|
{
|
|
1401
1425
|
menuActions,
|
|
@@ -1436,15 +1460,15 @@ function VariablesManagerPanel() {
|
|
|
1436
1460
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
1437
1461
|
const {
|
|
1438
1462
|
variables,
|
|
1439
|
-
ids,
|
|
1440
1463
|
isDirty,
|
|
1441
1464
|
hasValidationErrors,
|
|
1442
|
-
|
|
1465
|
+
searchValue,
|
|
1443
1466
|
handleOnChange,
|
|
1444
1467
|
createVariable: createVariable2,
|
|
1445
1468
|
handleDeleteVariable,
|
|
1446
1469
|
handleSave,
|
|
1447
1470
|
isSaving,
|
|
1471
|
+
handleSearch,
|
|
1448
1472
|
setHasValidationErrors
|
|
1449
1473
|
} = useVariablesManagerState();
|
|
1450
1474
|
const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
|
|
@@ -1475,7 +1499,7 @@ function VariablesManagerPanel() {
|
|
|
1475
1499
|
);
|
|
1476
1500
|
const menuActions = [
|
|
1477
1501
|
{
|
|
1478
|
-
name:
|
|
1502
|
+
name: __9("Delete", "elementor"),
|
|
1479
1503
|
icon: TrashIcon,
|
|
1480
1504
|
color: "error.main",
|
|
1481
1505
|
onClick: (itemId) => {
|
|
@@ -1485,13 +1509,14 @@ function VariablesManagerPanel() {
|
|
|
1485
1509
|
}
|
|
1486
1510
|
}
|
|
1487
1511
|
];
|
|
1488
|
-
|
|
1512
|
+
const hasVariables = Object.keys(variables).length !== 0;
|
|
1513
|
+
return /* @__PURE__ */ React11.createElement(ThemeProvider, null, /* @__PURE__ */ React11.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React11.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React11.createElement(Panel, null, /* @__PURE__ */ React11.createElement(PanelHeader, null, /* @__PURE__ */ React11.createElement(Stack5, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React11.createElement(Stack5, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React11.createElement(Stack5, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React11.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React11.createElement(ColorFilterIcon, { fontSize: "inherit" }), __9("Variable Manager", "elementor"))), /* @__PURE__ */ React11.createElement(Stack5, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React11.createElement(
|
|
1489
1514
|
VariableManagerCreateMenu,
|
|
1490
1515
|
{
|
|
1491
1516
|
onCreate: handleCreateVariable,
|
|
1492
1517
|
variables
|
|
1493
1518
|
}
|
|
1494
|
-
), /* @__PURE__ */
|
|
1519
|
+
), /* @__PURE__ */ React11.createElement(
|
|
1495
1520
|
CloseButton,
|
|
1496
1521
|
{
|
|
1497
1522
|
"aria-label": "Close",
|
|
@@ -1500,7 +1525,7 @@ function VariablesManagerPanel() {
|
|
|
1500
1525
|
handleClosePanel();
|
|
1501
1526
|
}
|
|
1502
1527
|
}
|
|
1503
|
-
)))
|
|
1528
|
+
))))), /* @__PURE__ */ React11.createElement(
|
|
1504
1529
|
PanelBody,
|
|
1505
1530
|
{
|
|
1506
1531
|
sx: {
|
|
@@ -1509,20 +1534,35 @@ function VariablesManagerPanel() {
|
|
|
1509
1534
|
height: "100%"
|
|
1510
1535
|
}
|
|
1511
1536
|
},
|
|
1512
|
-
/* @__PURE__ */
|
|
1537
|
+
/* @__PURE__ */ React11.createElement(
|
|
1538
|
+
SearchField,
|
|
1539
|
+
{
|
|
1540
|
+
placeholder: __9("Search", "elementor"),
|
|
1541
|
+
value: searchValue,
|
|
1542
|
+
onSearch: handleSearch
|
|
1543
|
+
}
|
|
1544
|
+
),
|
|
1545
|
+
/* @__PURE__ */ React11.createElement(Divider, { sx: { width: "100%" } }),
|
|
1546
|
+
hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1513
1547
|
VariablesManagerTable,
|
|
1514
1548
|
{
|
|
1515
1549
|
menuActions,
|
|
1516
1550
|
variables,
|
|
1517
1551
|
onChange: handleOnChange,
|
|
1518
|
-
ids,
|
|
1519
|
-
onIdsChange: setIds,
|
|
1520
1552
|
autoEditVariableId,
|
|
1521
1553
|
onAutoEditComplete: handleAutoEditComplete,
|
|
1522
1554
|
onFieldError: setHasValidationErrors
|
|
1523
1555
|
}
|
|
1556
|
+
),
|
|
1557
|
+
!hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1558
|
+
NoSearchResults,
|
|
1559
|
+
{
|
|
1560
|
+
searchValue,
|
|
1561
|
+
onClear: () => handleSearch(""),
|
|
1562
|
+
icon: /* @__PURE__ */ React11.createElement(ColorFilterIcon, { fontSize: "large" })
|
|
1563
|
+
}
|
|
1524
1564
|
)
|
|
1525
|
-
), /* @__PURE__ */
|
|
1565
|
+
), /* @__PURE__ */ React11.createElement(PanelFooter, null, /* @__PURE__ */ React11.createElement(
|
|
1526
1566
|
Button2,
|
|
1527
1567
|
{
|
|
1528
1568
|
fullWidth: true,
|
|
@@ -1533,8 +1573,8 @@ function VariablesManagerPanel() {
|
|
|
1533
1573
|
onClick: handleSave,
|
|
1534
1574
|
loading: isSaving
|
|
1535
1575
|
},
|
|
1536
|
-
|
|
1537
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
1576
|
+
__9("Save changes", "elementor")
|
|
1577
|
+
))), deleteConfirmation && /* @__PURE__ */ React11.createElement(
|
|
1538
1578
|
DeleteConfirmationDialog,
|
|
1539
1579
|
{
|
|
1540
1580
|
open: true,
|
|
@@ -1542,19 +1582,19 @@ function VariablesManagerPanel() {
|
|
|
1542
1582
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1543
1583
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1544
1584
|
}
|
|
1545
|
-
)), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
1585
|
+
)), isSaveChangesDialogOpen && /* @__PURE__ */ React11.createElement(SaveChangesDialog, null, /* @__PURE__ */ React11.createElement(SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, __9("You have unsaved changes", "elementor")), /* @__PURE__ */ React11.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React11.createElement(SaveChangesDialog.ContentText, null, __9("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React11.createElement(
|
|
1546
1586
|
SaveChangesDialog.Actions,
|
|
1547
1587
|
{
|
|
1548
1588
|
actions: {
|
|
1549
1589
|
discard: {
|
|
1550
|
-
label:
|
|
1590
|
+
label: __9("Discard", "elementor"),
|
|
1551
1591
|
action: () => {
|
|
1552
1592
|
closeSaveChangesDialog();
|
|
1553
1593
|
closePanel();
|
|
1554
1594
|
}
|
|
1555
1595
|
},
|
|
1556
1596
|
confirm: {
|
|
1557
|
-
label:
|
|
1597
|
+
label: __9("Save", "elementor"),
|
|
1558
1598
|
action: async () => {
|
|
1559
1599
|
await handleSave();
|
|
1560
1600
|
closeSaveChangesDialog();
|
|
@@ -1565,7 +1605,7 @@ function VariablesManagerPanel() {
|
|
|
1565
1605
|
}
|
|
1566
1606
|
)));
|
|
1567
1607
|
}
|
|
1568
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
1608
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React11.createElement(Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React11.createElement(Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React11.createElement("strong", null, __9("Something went wrong", "elementor"))));
|
|
1569
1609
|
var usePreventUnload = (isDirty) => {
|
|
1570
1610
|
useEffect3(() => {
|
|
1571
1611
|
const handleBeforeUnload = (event) => {
|
|
@@ -1613,13 +1653,13 @@ import { useState as useState11 } from "react";
|
|
|
1613
1653
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
1614
1654
|
|
|
1615
1655
|
// src/context/variable-selection-popover.context.tsx
|
|
1616
|
-
import * as
|
|
1656
|
+
import * as React12 from "react";
|
|
1617
1657
|
import { createContext as createContext2, useContext as useContext2, useState as useState6 } from "react";
|
|
1618
1658
|
import { Box as Box2 } from "@elementor/ui";
|
|
1619
1659
|
var PopoverContentRefContext = createContext2(null);
|
|
1620
1660
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
1621
1661
|
const [anchorRef, setAnchorRef] = useState6(null);
|
|
1622
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ React12.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React12.createElement(Box2, { ref: setAnchorRef }, children));
|
|
1623
1663
|
};
|
|
1624
1664
|
var usePopoverContentRef = () => {
|
|
1625
1665
|
return useContext2(PopoverContentRefContext);
|
|
@@ -1641,14 +1681,14 @@ var usePermissions = () => {
|
|
|
1641
1681
|
};
|
|
1642
1682
|
|
|
1643
1683
|
// src/components/variable-creation.tsx
|
|
1644
|
-
import * as
|
|
1684
|
+
import * as React14 from "react";
|
|
1645
1685
|
import { useState as useState7 } from "react";
|
|
1646
1686
|
import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
1647
1687
|
import { PopoverBody } from "@elementor/editor-editing-panel";
|
|
1648
1688
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
1649
1689
|
import { ArrowLeftIcon } from "@elementor/icons";
|
|
1650
|
-
import { Button as Button3, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as
|
|
1651
|
-
import { __ as
|
|
1690
|
+
import { Button as Button3, CardActions, Divider as Divider2, FormHelperText as FormHelperText2, IconButton as IconButton4, Typography as Typography5 } from "@elementor/ui";
|
|
1691
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1652
1692
|
|
|
1653
1693
|
// src/hooks/use-initial-value.ts
|
|
1654
1694
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
@@ -1709,10 +1749,10 @@ var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
|
1709
1749
|
};
|
|
1710
1750
|
|
|
1711
1751
|
// src/components/ui/form-field.tsx
|
|
1712
|
-
import * as
|
|
1752
|
+
import * as React13 from "react";
|
|
1713
1753
|
import { FormHelperText, FormLabel, Grid } from "@elementor/ui";
|
|
1714
1754
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
1715
|
-
return /* @__PURE__ */
|
|
1755
|
+
return /* @__PURE__ */ React13.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React13.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React13.createElement(FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React13.createElement(Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React13.createElement(FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React13.createElement(FormHelperText, null, noticeMsg)));
|
|
1716
1756
|
};
|
|
1717
1757
|
|
|
1718
1758
|
// src/components/variable-creation.tsx
|
|
@@ -1776,22 +1816,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1776
1816
|
return !!errorMessage;
|
|
1777
1817
|
};
|
|
1778
1818
|
const isSubmitDisabled = hasEmptyFields() || hasErrors();
|
|
1779
|
-
return /* @__PURE__ */
|
|
1819
|
+
return /* @__PURE__ */ React14.createElement(PopoverBody, { height: "auto" }, /* @__PURE__ */ React14.createElement(
|
|
1780
1820
|
PopoverHeader,
|
|
1781
1821
|
{
|
|
1782
|
-
icon: /* @__PURE__ */
|
|
1783
|
-
title:
|
|
1822
|
+
icon: /* @__PURE__ */ React14.createElement(React14.Fragment, null, onGoBack && /* @__PURE__ */ React14.createElement(IconButton4, { size: SIZE2, "aria-label": __10("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React14.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React14.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
1823
|
+
title: __10("Create variable", "elementor"),
|
|
1784
1824
|
onClose: closePopover
|
|
1785
1825
|
}
|
|
1786
|
-
), /* @__PURE__ */
|
|
1826
|
+
), /* @__PURE__ */ React14.createElement(Divider2, null), /* @__PURE__ */ React14.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React14.createElement(
|
|
1787
1827
|
FormField,
|
|
1788
1828
|
{
|
|
1789
1829
|
id: "variable-label",
|
|
1790
|
-
label:
|
|
1830
|
+
label: __10("Name", "elementor"),
|
|
1791
1831
|
errorMsg: labelFieldError?.message,
|
|
1792
1832
|
noticeMsg: labelHint(label)
|
|
1793
1833
|
},
|
|
1794
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ React14.createElement(
|
|
1795
1835
|
LabelField,
|
|
1796
1836
|
{
|
|
1797
1837
|
id: "variable-label",
|
|
@@ -1809,7 +1849,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1809
1849
|
}
|
|
1810
1850
|
}
|
|
1811
1851
|
)
|
|
1812
|
-
), /* @__PURE__ */
|
|
1852
|
+
), /* @__PURE__ */ React14.createElement(FormField, { errorMsg: valueFieldError, label: __10("Value", "elementor") }, /* @__PURE__ */ React14.createElement(Typography5, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React14.createElement(
|
|
1813
1853
|
ValueField,
|
|
1814
1854
|
{
|
|
1815
1855
|
value,
|
|
@@ -1821,7 +1861,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1821
1861
|
onValidationChange: setValueFieldError,
|
|
1822
1862
|
propType
|
|
1823
1863
|
}
|
|
1824
|
-
))), errorMessage && /* @__PURE__ */
|
|
1864
|
+
))), errorMessage && /* @__PURE__ */ React14.createElement(FormHelperText2, { error: true }, errorMessage)), /* @__PURE__ */ React14.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React14.createElement(
|
|
1825
1865
|
Button3,
|
|
1826
1866
|
{
|
|
1827
1867
|
id: "create-variable-button",
|
|
@@ -1830,23 +1870,23 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1830
1870
|
disabled: isSubmitDisabled,
|
|
1831
1871
|
onClick: handleCreateAndTrack
|
|
1832
1872
|
},
|
|
1833
|
-
|
|
1873
|
+
__10("Create", "elementor")
|
|
1834
1874
|
)));
|
|
1835
1875
|
};
|
|
1836
1876
|
|
|
1837
1877
|
// src/components/variable-edit.tsx
|
|
1838
|
-
import * as
|
|
1878
|
+
import * as React16 from "react";
|
|
1839
1879
|
import { useEffect as useEffect4, useState as useState9 } from "react";
|
|
1840
1880
|
import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
1841
1881
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
1842
1882
|
import { PopoverBody as PopoverBody2 } from "@elementor/editor-editing-panel";
|
|
1843
1883
|
import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
1844
1884
|
import { ArrowLeftIcon as ArrowLeftIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
1845
|
-
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Typography as
|
|
1846
|
-
import { __ as
|
|
1885
|
+
import { Button as Button5, CardActions as CardActions2, Divider as Divider3, FormHelperText as FormHelperText3, IconButton as IconButton5, Typography as Typography7 } from "@elementor/ui";
|
|
1886
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1847
1887
|
|
|
1848
1888
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
1849
|
-
import * as
|
|
1889
|
+
import * as React15 from "react";
|
|
1850
1890
|
import { useState as useState8 } from "react";
|
|
1851
1891
|
import { AlertTriangleFilledIcon } from "@elementor/icons";
|
|
1852
1892
|
import {
|
|
@@ -1858,9 +1898,9 @@ import {
|
|
|
1858
1898
|
DialogContentText as DialogContentText2,
|
|
1859
1899
|
DialogTitle as DialogTitle2,
|
|
1860
1900
|
FormControlLabel,
|
|
1861
|
-
Typography as
|
|
1901
|
+
Typography as Typography6
|
|
1862
1902
|
} from "@elementor/ui";
|
|
1863
|
-
import { __ as
|
|
1903
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
1864
1904
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
1865
1905
|
var EditConfirmationDialog = ({
|
|
1866
1906
|
closeDialog,
|
|
@@ -1874,13 +1914,13 @@ var EditConfirmationDialog = ({
|
|
|
1874
1914
|
}
|
|
1875
1915
|
onConfirm?.();
|
|
1876
1916
|
};
|
|
1877
|
-
return /* @__PURE__ */
|
|
1917
|
+
return /* @__PURE__ */ React15.createElement(Dialog2, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React15.createElement(DialogTitle2, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React15.createElement(AlertTriangleFilledIcon, { color: "secondary" }), __11("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React15.createElement(DialogContent2, null, /* @__PURE__ */ React15.createElement(DialogContentText2, { variant: "body2", color: "textPrimary" }, __11(
|
|
1878
1918
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
1879
1919
|
"elementor"
|
|
1880
|
-
))), /* @__PURE__ */
|
|
1920
|
+
))), /* @__PURE__ */ React15.createElement(DialogActions2, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React15.createElement(
|
|
1881
1921
|
FormControlLabel,
|
|
1882
1922
|
{
|
|
1883
|
-
control: /* @__PURE__ */
|
|
1923
|
+
control: /* @__PURE__ */ React15.createElement(
|
|
1884
1924
|
Checkbox,
|
|
1885
1925
|
{
|
|
1886
1926
|
checked: dontShowAgain,
|
|
@@ -1888,9 +1928,9 @@ var EditConfirmationDialog = ({
|
|
|
1888
1928
|
size: "small"
|
|
1889
1929
|
}
|
|
1890
1930
|
),
|
|
1891
|
-
label: /* @__PURE__ */
|
|
1931
|
+
label: /* @__PURE__ */ React15.createElement(Typography6, { variant: "body2" }, __11("Don't show me again", "elementor"))
|
|
1892
1932
|
}
|
|
1893
|
-
), /* @__PURE__ */
|
|
1933
|
+
), /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(Button4, { color: "secondary", onClick: closeDialog }, __11("Keep editing", "elementor")), /* @__PURE__ */ React15.createElement(Button4, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, __11("Save", "elementor")))));
|
|
1894
1934
|
};
|
|
1895
1935
|
|
|
1896
1936
|
// src/components/variable-edit.tsx
|
|
@@ -1975,15 +2015,15 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
1975
2015
|
const actions = [];
|
|
1976
2016
|
if (userPermissions.canDelete()) {
|
|
1977
2017
|
actions.push(
|
|
1978
|
-
/* @__PURE__ */
|
|
2018
|
+
/* @__PURE__ */ React16.createElement(
|
|
1979
2019
|
IconButton5,
|
|
1980
2020
|
{
|
|
1981
2021
|
key: "delete",
|
|
1982
2022
|
size: SIZE3,
|
|
1983
|
-
"aria-label":
|
|
2023
|
+
"aria-label": __12("Delete", "elementor"),
|
|
1984
2024
|
onClick: handleDeleteConfirmation
|
|
1985
2025
|
},
|
|
1986
|
-
/* @__PURE__ */
|
|
2026
|
+
/* @__PURE__ */ React16.createElement(TrashIcon2, { fontSize: SIZE3 })
|
|
1987
2027
|
)
|
|
1988
2028
|
);
|
|
1989
2029
|
}
|
|
@@ -2003,31 +2043,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2003
2043
|
return !!errorMessage;
|
|
2004
2044
|
};
|
|
2005
2045
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
2006
|
-
return /* @__PURE__ */
|
|
2046
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(PopoverBody2, { height: "auto" }, /* @__PURE__ */ React16.createElement(
|
|
2007
2047
|
PopoverHeader2,
|
|
2008
2048
|
{
|
|
2009
|
-
title:
|
|
2049
|
+
title: __12("Edit variable", "elementor"),
|
|
2010
2050
|
onClose,
|
|
2011
|
-
icon: /* @__PURE__ */
|
|
2051
|
+
icon: /* @__PURE__ */ React16.createElement(React16.Fragment, null, onGoBack && /* @__PURE__ */ React16.createElement(
|
|
2012
2052
|
IconButton5,
|
|
2013
2053
|
{
|
|
2014
2054
|
size: SIZE3,
|
|
2015
|
-
"aria-label":
|
|
2055
|
+
"aria-label": __12("Go Back", "elementor"),
|
|
2016
2056
|
onClick: onGoBack
|
|
2017
2057
|
},
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
), /* @__PURE__ */
|
|
2058
|
+
/* @__PURE__ */ React16.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })
|
|
2059
|
+
), /* @__PURE__ */ React16.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2020
2060
|
actions
|
|
2021
2061
|
}
|
|
2022
|
-
), /* @__PURE__ */
|
|
2062
|
+
), /* @__PURE__ */ React16.createElement(Divider3, null), /* @__PURE__ */ React16.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React16.createElement(
|
|
2023
2063
|
FormField,
|
|
2024
2064
|
{
|
|
2025
2065
|
id: "variable-label",
|
|
2026
|
-
label:
|
|
2066
|
+
label: __12("Name", "elementor"),
|
|
2027
2067
|
errorMsg: labelFieldError?.message,
|
|
2028
2068
|
noticeMsg: labelHint(label)
|
|
2029
2069
|
},
|
|
2030
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ React16.createElement(
|
|
2031
2071
|
LabelField,
|
|
2032
2072
|
{
|
|
2033
2073
|
id: "variable-label",
|
|
@@ -2045,7 +2085,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2045
2085
|
}
|
|
2046
2086
|
}
|
|
2047
2087
|
)
|
|
2048
|
-
), /* @__PURE__ */
|
|
2088
|
+
), /* @__PURE__ */ React16.createElement(FormField, { errorMsg: valueFieldError, label: __12("Value", "elementor") }, /* @__PURE__ */ React16.createElement(Typography7, { variant: "h5" }, /* @__PURE__ */ React16.createElement(
|
|
2049
2089
|
ValueField,
|
|
2050
2090
|
{
|
|
2051
2091
|
value,
|
|
@@ -2057,7 +2097,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2057
2097
|
onValidationChange: setValueFieldError,
|
|
2058
2098
|
propType
|
|
2059
2099
|
}
|
|
2060
|
-
))), errorMessage && /* @__PURE__ */
|
|
2100
|
+
))), errorMessage && /* @__PURE__ */ React16.createElement(FormHelperText3, { error: true }, errorMessage)), /* @__PURE__ */ React16.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React16.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __12("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React16.createElement(
|
|
2061
2101
|
DeleteConfirmationDialog,
|
|
2062
2102
|
{
|
|
2063
2103
|
open: true,
|
|
@@ -2065,7 +2105,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2065
2105
|
onConfirm: handleDelete,
|
|
2066
2106
|
closeDialog: closeDeleteDialog()
|
|
2067
2107
|
}
|
|
2068
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2108
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React16.createElement(
|
|
2069
2109
|
EditConfirmationDialog,
|
|
2070
2110
|
{
|
|
2071
2111
|
closeDialog: closeEditDialog(),
|
|
@@ -2079,19 +2119,19 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2079
2119
|
import * as React19 from "react";
|
|
2080
2120
|
import { useState as useState10 } from "react";
|
|
2081
2121
|
import { PopoverBody as PopoverBody3 } from "@elementor/editor-editing-panel";
|
|
2082
|
-
import { PopoverHeader as PopoverHeader3, PopoverMenuList,
|
|
2122
|
+
import { PopoverHeader as PopoverHeader3, PopoverMenuList, SearchField as SearchField2 } from "@elementor/editor-ui";
|
|
2083
2123
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2084
2124
|
import { Divider as Divider4, IconButton as IconButton7 } from "@elementor/ui";
|
|
2085
2125
|
import { __ as __15, sprintf } from "@wordpress/i18n";
|
|
2086
2126
|
|
|
2087
2127
|
// src/components/ui/empty-state.tsx
|
|
2088
|
-
import * as
|
|
2089
|
-
import { Button as Button6, Stack as
|
|
2090
|
-
import { __ as
|
|
2128
|
+
import * as React17 from "react";
|
|
2129
|
+
import { Button as Button6, Stack as Stack6, Typography as Typography8 } from "@elementor/ui";
|
|
2130
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2091
2131
|
var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
2092
2132
|
const canAdd = usePermissions().canAdd();
|
|
2093
|
-
return /* @__PURE__ */
|
|
2094
|
-
|
|
2133
|
+
return /* @__PURE__ */ React17.createElement(
|
|
2134
|
+
Stack6,
|
|
2095
2135
|
{
|
|
2096
2136
|
gap: 1,
|
|
2097
2137
|
alignItems: "center",
|
|
@@ -2101,29 +2141,29 @@ var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
|
2101
2141
|
sx: { p: 2.5, pb: 5.5 }
|
|
2102
2142
|
},
|
|
2103
2143
|
icon,
|
|
2104
|
-
canAdd ? /* @__PURE__ */
|
|
2144
|
+
canAdd ? /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React17.createElement(Button6, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __13("Create a variable", "elementor"))) : /* @__PURE__ */ React17.createElement(
|
|
2105
2145
|
Content,
|
|
2106
2146
|
{
|
|
2107
|
-
title:
|
|
2108
|
-
message:
|
|
2147
|
+
title: __13("There are no variables", "elementor"),
|
|
2148
|
+
message: __13("With your current role, you can only connect and detach variables.", "elementor")
|
|
2109
2149
|
}
|
|
2110
2150
|
)
|
|
2111
2151
|
);
|
|
2112
2152
|
};
|
|
2113
2153
|
function Content({ title, message }) {
|
|
2114
|
-
return /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(Typography8, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React17.createElement(Typography8, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
2115
2155
|
}
|
|
2116
2156
|
|
|
2117
2157
|
// src/components/ui/menu-item-content.tsx
|
|
2118
|
-
import * as
|
|
2158
|
+
import * as React18 from "react";
|
|
2119
2159
|
import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
|
|
2120
2160
|
import { EditIcon } from "@elementor/icons";
|
|
2121
|
-
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Typography as
|
|
2122
|
-
import { __ as
|
|
2161
|
+
import { Box as Box3, IconButton as IconButton6, ListItemIcon, Typography as Typography9 } from "@elementor/ui";
|
|
2162
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
2123
2163
|
var SIZE4 = "tiny";
|
|
2124
2164
|
var MenuItemContent = ({ item }) => {
|
|
2125
2165
|
const onEdit = item.onEdit;
|
|
2126
|
-
return /* @__PURE__ */
|
|
2166
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React18.createElement(
|
|
2127
2167
|
Box3,
|
|
2128
2168
|
{
|
|
2129
2169
|
sx: {
|
|
@@ -2134,29 +2174,29 @@ var MenuItemContent = ({ item }) => {
|
|
|
2134
2174
|
gap: 1
|
|
2135
2175
|
}
|
|
2136
2176
|
},
|
|
2137
|
-
/* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ React18.createElement(
|
|
2138
2178
|
EllipsisWithTooltip2,
|
|
2139
2179
|
{
|
|
2140
2180
|
title: item.label || item.value,
|
|
2141
|
-
as:
|
|
2181
|
+
as: Typography9,
|
|
2142
2182
|
variant: "caption",
|
|
2143
2183
|
color: "text.primary",
|
|
2144
2184
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2145
2185
|
maxWidth: "50%"
|
|
2146
2186
|
}
|
|
2147
2187
|
),
|
|
2148
|
-
item.secondaryText && /* @__PURE__ */
|
|
2188
|
+
item.secondaryText && /* @__PURE__ */ React18.createElement(
|
|
2149
2189
|
EllipsisWithTooltip2,
|
|
2150
2190
|
{
|
|
2151
2191
|
title: item.secondaryText,
|
|
2152
|
-
as:
|
|
2192
|
+
as: Typography9,
|
|
2153
2193
|
variant: "caption",
|
|
2154
2194
|
color: "text.tertiary",
|
|
2155
2195
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2156
2196
|
maxWidth: "50%"
|
|
2157
2197
|
}
|
|
2158
2198
|
)
|
|
2159
|
-
), !!onEdit && /* @__PURE__ */
|
|
2199
|
+
), !!onEdit && /* @__PURE__ */ React18.createElement(
|
|
2160
2200
|
IconButton6,
|
|
2161
2201
|
{
|
|
2162
2202
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2164,34 +2204,12 @@ var MenuItemContent = ({ item }) => {
|
|
|
2164
2204
|
e.stopPropagation();
|
|
2165
2205
|
onEdit(item.value);
|
|
2166
2206
|
},
|
|
2167
|
-
"aria-label":
|
|
2207
|
+
"aria-label": __14("Edit", "elementor")
|
|
2168
2208
|
},
|
|
2169
|
-
/* @__PURE__ */
|
|
2209
|
+
/* @__PURE__ */ React18.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
2170
2210
|
));
|
|
2171
2211
|
};
|
|
2172
2212
|
|
|
2173
|
-
// src/components/ui/no-search-results.tsx
|
|
2174
|
-
import * as React18 from "react";
|
|
2175
|
-
import { Link, Stack as Stack6, Typography as Typography9 } from "@elementor/ui";
|
|
2176
|
-
import { __ as __14 } from "@wordpress/i18n";
|
|
2177
|
-
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
2178
|
-
return /* @__PURE__ */ React18.createElement(
|
|
2179
|
-
Stack6,
|
|
2180
|
-
{
|
|
2181
|
-
gap: 1,
|
|
2182
|
-
alignItems: "center",
|
|
2183
|
-
justifyContent: "center",
|
|
2184
|
-
height: "100%",
|
|
2185
|
-
p: 2.5,
|
|
2186
|
-
color: "text.secondary",
|
|
2187
|
-
sx: { pb: 3.5 }
|
|
2188
|
-
},
|
|
2189
|
-
icon,
|
|
2190
|
-
/* @__PURE__ */ React18.createElement(Typography9, { align: "center", variant: "subtitle2" }, __14("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React18.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
2191
|
-
/* @__PURE__ */ React18.createElement(Typography9, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __14("Try something else.", "elementor"), /* @__PURE__ */ React18.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __14("Clear & try again", "elementor")))
|
|
2192
|
-
);
|
|
2193
|
-
};
|
|
2194
|
-
|
|
2195
2213
|
// src/components/ui/styled-menu-list.tsx
|
|
2196
2214
|
import { MenuList, styled as styled2 } from "@elementor/ui";
|
|
2197
2215
|
var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
@@ -2293,7 +2311,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
2293
2311
|
actions
|
|
2294
2312
|
}
|
|
2295
2313
|
), hasVariables && /* @__PURE__ */ React19.createElement(
|
|
2296
|
-
|
|
2314
|
+
SearchField2,
|
|
2297
2315
|
{
|
|
2298
2316
|
value: searchValue,
|
|
2299
2317
|
onSearch: handleSearch,
|