@elementor/editor-variables 3.33.0-160 → 3.33.0-162
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 +232 -211
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +232 -211
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/components/ui/empty-state.tsx +2 -2
- package/src/components/ui/no-search-results.tsx +1 -1
- package/src/components/variables-manager/variables-manager-create-menu.tsx +13 -9
- package/src/components/variables-manager/variables-manager-panel.tsx +22 -3
- package/src/components/variables-manager/variables-manager-table.tsx +2 -2
- /package/src/components/variables-manager/{utils → ui}/variable-edit-menu.tsx +0 -0
- /package/src/components/variables-manager/{utils → ui}/variable-table-cell.tsx +0 -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 React12 = __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_ui12 = require("@elementor/ui");
|
|
53
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
54
54
|
|
|
55
55
|
// src/components/ui/delete-confirmation-dialog.tsx
|
|
56
56
|
var React = __toESM(require("react"));
|
|
@@ -67,24 +67,71 @@ 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/
|
|
70
|
+
// src/components/ui/empty-state.tsx
|
|
71
71
|
var React2 = __toESM(require("react"));
|
|
72
72
|
var import_ui2 = require("@elementor/ui");
|
|
73
73
|
var import_i18n2 = require("@wordpress/i18n");
|
|
74
|
-
|
|
74
|
+
|
|
75
|
+
// src/hooks/use-permissions.ts
|
|
76
|
+
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
77
|
+
var usePermissions = () => {
|
|
78
|
+
const { canUser } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
79
|
+
return {
|
|
80
|
+
canAssign: () => canUser("edit_posts"),
|
|
81
|
+
canUnlink: () => canUser("edit_posts"),
|
|
82
|
+
canAdd: () => canUser("manage_options"),
|
|
83
|
+
canDelete: () => canUser("manage_options"),
|
|
84
|
+
canEdit: () => canUser("manage_options"),
|
|
85
|
+
canRestore: () => canUser("manage_options"),
|
|
86
|
+
canManageSettings: () => canUser("manage_options")
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// src/components/ui/empty-state.tsx
|
|
91
|
+
var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
92
|
+
const canAdd = usePermissions().canAdd();
|
|
75
93
|
return /* @__PURE__ */ React2.createElement(
|
|
76
94
|
import_ui2.Stack,
|
|
95
|
+
{
|
|
96
|
+
gap: 1,
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
justifyContent: "flex-start",
|
|
99
|
+
height: "100%",
|
|
100
|
+
color: "text.secondary",
|
|
101
|
+
sx: { p: 2.5, pt: 8, pb: 5.5 }
|
|
102
|
+
},
|
|
103
|
+
icon,
|
|
104
|
+
canAdd ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React2.createElement(import_ui2.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n2.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React2.createElement(
|
|
105
|
+
Content,
|
|
106
|
+
{
|
|
107
|
+
title: (0, import_i18n2.__)("There are no variables", "elementor"),
|
|
108
|
+
message: (0, import_i18n2.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
function Content({ title, message }) {
|
|
114
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_ui2.Typography, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React2.createElement(import_ui2.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/components/ui/no-search-results.tsx
|
|
118
|
+
var React3 = __toESM(require("react"));
|
|
119
|
+
var import_ui3 = require("@elementor/ui");
|
|
120
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
121
|
+
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
122
|
+
return /* @__PURE__ */ React3.createElement(
|
|
123
|
+
import_ui3.Stack,
|
|
77
124
|
{
|
|
78
125
|
gap: 1,
|
|
79
126
|
alignItems: "center",
|
|
80
127
|
justifyContent: "center",
|
|
81
128
|
p: 2.5,
|
|
82
129
|
color: "text.secondary",
|
|
83
|
-
sx: { pb: 3.5, pt:
|
|
130
|
+
sx: { pb: 3.5, pt: 8 }
|
|
84
131
|
},
|
|
85
132
|
icon,
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ React3.createElement(import_ui3.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n3.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React3.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
134
|
+
/* @__PURE__ */ React3.createElement(import_ui3.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n3.__)("Try something else.", "elementor"), /* @__PURE__ */ React3.createElement(import_ui3.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n3.__)("Clear & try again", "elementor")))
|
|
88
135
|
);
|
|
89
136
|
};
|
|
90
137
|
|
|
@@ -109,7 +156,7 @@ var useAutoEdit = () => {
|
|
|
109
156
|
|
|
110
157
|
// src/components/variables-manager/hooks/use-variables-manager-state.ts
|
|
111
158
|
var import_react4 = require("react");
|
|
112
|
-
var
|
|
159
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
113
160
|
|
|
114
161
|
// src/batch-operations.ts
|
|
115
162
|
var generateTempId = () => {
|
|
@@ -176,7 +223,7 @@ var import_react3 = require("react");
|
|
|
176
223
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
177
224
|
|
|
178
225
|
// src/context/variable-type-context.tsx
|
|
179
|
-
var
|
|
226
|
+
var React5 = __toESM(require("react"));
|
|
180
227
|
var import_react2 = require("react");
|
|
181
228
|
|
|
182
229
|
// src/variables-registry/create-variable-type-registry.ts
|
|
@@ -184,14 +231,14 @@ var import_editor_canvas3 = require("@elementor/editor-canvas");
|
|
|
184
231
|
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
185
232
|
|
|
186
233
|
// src/transformers/inheritance-transformer.tsx
|
|
187
|
-
var
|
|
234
|
+
var React4 = __toESM(require("react"));
|
|
188
235
|
var import_editor_canvas = require("@elementor/editor-canvas");
|
|
189
|
-
var
|
|
190
|
-
var
|
|
236
|
+
var import_ui5 = require("@elementor/ui");
|
|
237
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
191
238
|
|
|
192
239
|
// src/components/ui/color-indicator.tsx
|
|
193
|
-
var
|
|
194
|
-
var ColorIndicator = (0,
|
|
240
|
+
var import_ui4 = require("@elementor/ui");
|
|
241
|
+
var ColorIndicator = (0, import_ui4.styled)(import_ui4.UnstableColorIndicator)(({ theme }) => ({
|
|
195
242
|
borderRadius: `${theme.shape.borderRadius / 2}px`,
|
|
196
243
|
marginRight: theme.spacing(0.25)
|
|
197
244
|
}));
|
|
@@ -202,7 +249,7 @@ var import_schema = require("@elementor/schema");
|
|
|
202
249
|
var colorVariablePropTypeUtil = (0, import_editor_props.createPropUtils)("global-color-variable", import_schema.z.string());
|
|
203
250
|
|
|
204
251
|
// src/service.ts
|
|
205
|
-
var
|
|
252
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
206
253
|
|
|
207
254
|
// src/api.ts
|
|
208
255
|
var import_http_client = require("@elementor/http-client");
|
|
@@ -407,7 +454,7 @@ var service = {
|
|
|
407
454
|
return apiClient.create(type, label, value).then((response) => {
|
|
408
455
|
const { success, data: payload } = response.data;
|
|
409
456
|
if (!success) {
|
|
410
|
-
const errorMessage = payload?.message || (0,
|
|
457
|
+
const errorMessage = payload?.message || (0, import_i18n4.__)("Unexpected response from server", "elementor");
|
|
411
458
|
throw new Error(errorMessage);
|
|
412
459
|
}
|
|
413
460
|
return payload;
|
|
@@ -429,7 +476,7 @@ var service = {
|
|
|
429
476
|
return apiClient.update(id2, label, value).then((response) => {
|
|
430
477
|
const { success, data: payload } = response.data;
|
|
431
478
|
if (!success) {
|
|
432
|
-
const errorMessage = payload?.message || (0,
|
|
479
|
+
const errorMessage = payload?.message || (0, import_i18n4.__)("Unexpected response from server", "elementor");
|
|
433
480
|
throw new Error(errorMessage);
|
|
434
481
|
}
|
|
435
482
|
return payload;
|
|
@@ -562,11 +609,11 @@ var inheritanceTransformer = (0, import_editor_canvas.createTransformer)((id2) =
|
|
|
562
609
|
const variables = service.variables();
|
|
563
610
|
const variable = variables[id2];
|
|
564
611
|
if (!variable) {
|
|
565
|
-
return /* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ React4.createElement("span", null, (0, import_i18n5.__)("Missing variable", "elementor"));
|
|
566
613
|
}
|
|
567
614
|
const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
|
|
568
615
|
const css = resolveCssVariable(id2, variable);
|
|
569
|
-
return /* @__PURE__ */
|
|
616
|
+
return /* @__PURE__ */ React4.createElement(import_ui5.Stack, { direction: "row", spacing: 0.5, sx: { paddingInline: "1px" }, alignItems: "center" }, showColorIndicator && /* @__PURE__ */ React4.createElement(ColorIndicator, { size: "inherit", value: variable.value }), /* @__PURE__ */ React4.createElement(import_ui5.Typography, { variant: "caption", overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }, css));
|
|
570
617
|
});
|
|
571
618
|
|
|
572
619
|
// src/transformers/variable-transformer.ts
|
|
@@ -651,7 +698,7 @@ var { registerVariableType, getVariableType, getVariableTypes, hasVariableType }
|
|
|
651
698
|
// src/context/variable-type-context.tsx
|
|
652
699
|
var VariableTypeContext = (0, import_react2.createContext)(null);
|
|
653
700
|
function VariableTypeProvider({ children, propTypeKey }) {
|
|
654
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ React5.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
|
|
655
702
|
}
|
|
656
703
|
function useVariableType() {
|
|
657
704
|
const context = (0, import_react2.useContext)(VariableTypeContext);
|
|
@@ -733,15 +780,15 @@ var restoreVariable = (restoreId, label, value) => {
|
|
|
733
780
|
};
|
|
734
781
|
|
|
735
782
|
// src/utils/validations.ts
|
|
736
|
-
var
|
|
783
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
737
784
|
var ERROR_MESSAGES = {
|
|
738
|
-
MISSING_VARIABLE_NAME: (0,
|
|
739
|
-
MISSING_VARIABLE_VALUE: (0,
|
|
740
|
-
INVALID_CHARACTERS: (0,
|
|
741
|
-
NO_NON_SPECIAL_CHARACTER: (0,
|
|
742
|
-
VARIABLE_LABEL_MAX_LENGTH: (0,
|
|
743
|
-
DUPLICATED_LABEL: (0,
|
|
744
|
-
UNEXPECTED_ERROR: (0,
|
|
785
|
+
MISSING_VARIABLE_NAME: (0, import_i18n6.__)("Give your variable a name.", "elementor"),
|
|
786
|
+
MISSING_VARIABLE_VALUE: (0, import_i18n6.__)("Add a value to complete your variable.", "elementor"),
|
|
787
|
+
INVALID_CHARACTERS: (0, import_i18n6.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
|
|
788
|
+
NO_NON_SPECIAL_CHARACTER: (0, import_i18n6.__)("Names have to include at least one non-special character.", "elementor"),
|
|
789
|
+
VARIABLE_LABEL_MAX_LENGTH: (0, import_i18n6.__)("Keep names up to 50 characters.", "elementor"),
|
|
790
|
+
DUPLICATED_LABEL: (0, import_i18n6.__)("This variable name already exists. Please choose a unique name.", "elementor"),
|
|
791
|
+
UNEXPECTED_ERROR: (0, import_i18n6.__)("There was a glitch. Try saving your variable again.", "elementor")
|
|
745
792
|
};
|
|
746
793
|
var VARIABLE_LABEL_MAX_LENGTH = 50;
|
|
747
794
|
var mapServerError = (error) => {
|
|
@@ -833,7 +880,7 @@ var useVariablesManagerState = () => {
|
|
|
833
880
|
setIsSaving(false);
|
|
834
881
|
return { success: true };
|
|
835
882
|
}
|
|
836
|
-
throw new Error((0,
|
|
883
|
+
throw new Error((0, import_i18n7.__)("Failed to save variables. Please try again.", "elementor"));
|
|
837
884
|
} catch (error) {
|
|
838
885
|
const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNEXPECTED_ERROR;
|
|
839
886
|
setIsSaving(false);
|
|
@@ -862,16 +909,19 @@ var useVariablesManagerState = () => {
|
|
|
862
909
|
};
|
|
863
910
|
|
|
864
911
|
// src/components/variables-manager/variables-manager-create-menu.tsx
|
|
865
|
-
var
|
|
912
|
+
var React6 = __toESM(require("react"));
|
|
866
913
|
var import_react5 = require("react");
|
|
867
914
|
var import_icons2 = require("@elementor/icons");
|
|
868
|
-
var
|
|
869
|
-
var
|
|
915
|
+
var import_ui6 = require("@elementor/ui");
|
|
916
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
870
917
|
var SIZE = "tiny";
|
|
871
|
-
var VariableManagerCreateMenu = ({
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
918
|
+
var VariableManagerCreateMenu = ({
|
|
919
|
+
variables,
|
|
920
|
+
onCreate,
|
|
921
|
+
disabled,
|
|
922
|
+
menuState
|
|
923
|
+
}) => {
|
|
924
|
+
const buttonRef = (0, import_react5.useRef)(null);
|
|
875
925
|
const variableTypes = getVariableTypes();
|
|
876
926
|
const menuOptions = Object.entries(variableTypes).map(([key, variable]) => {
|
|
877
927
|
const displayName = variable.variableType.charAt(0).toUpperCase() + variable.variableType.slice(1);
|
|
@@ -885,17 +935,18 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
885
935
|
}
|
|
886
936
|
};
|
|
887
937
|
});
|
|
888
|
-
return /* @__PURE__ */
|
|
889
|
-
|
|
938
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
939
|
+
import_ui6.IconButton,
|
|
890
940
|
{
|
|
891
|
-
...(0,
|
|
941
|
+
...(0, import_ui6.bindTrigger)(menuState),
|
|
942
|
+
ref: buttonRef,
|
|
892
943
|
disabled,
|
|
893
944
|
size: SIZE,
|
|
894
|
-
"aria-label": (0,
|
|
945
|
+
"aria-label": (0, import_i18n8.__)("Add variable", "elementor")
|
|
895
946
|
},
|
|
896
|
-
/* @__PURE__ */
|
|
897
|
-
), /* @__PURE__ */
|
|
898
|
-
|
|
947
|
+
/* @__PURE__ */ React6.createElement(import_icons2.PlusIcon, { fontSize: SIZE })
|
|
948
|
+
), /* @__PURE__ */ React6.createElement(
|
|
949
|
+
import_ui6.Menu,
|
|
899
950
|
{
|
|
900
951
|
disablePortal: true,
|
|
901
952
|
MenuListProps: {
|
|
@@ -904,8 +955,8 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
904
955
|
PaperProps: {
|
|
905
956
|
elevation: 6
|
|
906
957
|
},
|
|
907
|
-
...(0,
|
|
908
|
-
anchorEl:
|
|
958
|
+
...(0, import_ui6.bindMenu)(menuState),
|
|
959
|
+
anchorEl: buttonRef.current,
|
|
909
960
|
anchorOrigin: {
|
|
910
961
|
vertical: "bottom",
|
|
911
962
|
horizontal: "right"
|
|
@@ -914,11 +965,10 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
914
965
|
vertical: "top",
|
|
915
966
|
horizontal: "right"
|
|
916
967
|
},
|
|
917
|
-
|
|
918
|
-
onClose: menuState.close
|
|
968
|
+
"data-testid": "variable-manager-create-menu"
|
|
919
969
|
},
|
|
920
|
-
menuOptions.map((option) => /* @__PURE__ */
|
|
921
|
-
|
|
970
|
+
menuOptions.map((option) => /* @__PURE__ */ React6.createElement(
|
|
971
|
+
import_ui6.MenuItem,
|
|
922
972
|
{
|
|
923
973
|
key: option.key,
|
|
924
974
|
onClick: () => {
|
|
@@ -933,7 +983,7 @@ var VariableManagerCreateMenu = ({ variables, onCreate, disabled }) => {
|
|
|
933
983
|
fontSize: SIZE,
|
|
934
984
|
color: "action"
|
|
935
985
|
}),
|
|
936
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ React6.createElement(import_ui6.Typography, { variant: "caption", color: "text.primary" }, option.name)
|
|
937
987
|
))
|
|
938
988
|
));
|
|
939
989
|
};
|
|
@@ -949,18 +999,18 @@ var getDefaultName = (variables, type, baseName) => {
|
|
|
949
999
|
};
|
|
950
1000
|
|
|
951
1001
|
// src/components/variables-manager/variables-manager-table.tsx
|
|
952
|
-
var
|
|
1002
|
+
var React11 = __toESM(require("react"));
|
|
953
1003
|
var import_react9 = require("react");
|
|
954
1004
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
955
1005
|
var import_icons4 = require("@elementor/icons");
|
|
956
|
-
var
|
|
957
|
-
var
|
|
1006
|
+
var import_ui11 = require("@elementor/ui");
|
|
1007
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
958
1008
|
|
|
959
1009
|
// src/components/fields/label-field.tsx
|
|
960
|
-
var
|
|
1010
|
+
var React7 = __toESM(require("react"));
|
|
961
1011
|
var import_react6 = require("react");
|
|
962
1012
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
963
|
-
var
|
|
1013
|
+
var import_ui7 = require("@elementor/ui");
|
|
964
1014
|
function isLabelEqual(a, b) {
|
|
965
1015
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
966
1016
|
}
|
|
@@ -997,8 +1047,8 @@ var LabelField = ({
|
|
|
997
1047
|
errorMsg = error.message;
|
|
998
1048
|
}
|
|
999
1049
|
const hintMsg = !errorMsg ? labelHint(label) : "";
|
|
1000
|
-
const textField = /* @__PURE__ */
|
|
1001
|
-
|
|
1050
|
+
const textField = /* @__PURE__ */ React7.createElement(
|
|
1051
|
+
import_ui7.TextField,
|
|
1002
1052
|
{
|
|
1003
1053
|
ref: fieldRef,
|
|
1004
1054
|
id: id2,
|
|
@@ -1017,7 +1067,7 @@ var LabelField = ({
|
|
|
1017
1067
|
);
|
|
1018
1068
|
if (showWarningInfotip) {
|
|
1019
1069
|
const tooltipWidth = Math.max(240, fieldRef.current?.getBoundingClientRect().width ?? 240);
|
|
1020
|
-
return /* @__PURE__ */
|
|
1070
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1021
1071
|
import_editor_ui.WarningInfotip,
|
|
1022
1072
|
{
|
|
1023
1073
|
open: Boolean(errorMsg || hintMsg),
|
|
@@ -1033,17 +1083,17 @@ var LabelField = ({
|
|
|
1033
1083
|
return textField;
|
|
1034
1084
|
};
|
|
1035
1085
|
|
|
1036
|
-
// src/components/variables-manager/
|
|
1037
|
-
var
|
|
1086
|
+
// src/components/variables-manager/ui/variable-edit-menu.tsx
|
|
1087
|
+
var React8 = __toESM(require("react"));
|
|
1038
1088
|
var import_react7 = require("react");
|
|
1039
1089
|
var import_icons3 = require("@elementor/icons");
|
|
1040
|
-
var
|
|
1090
|
+
var import_ui8 = require("@elementor/ui");
|
|
1041
1091
|
var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
1042
|
-
const menuState = (0,
|
|
1092
|
+
const menuState = (0, import_ui8.usePopupState)({
|
|
1043
1093
|
variant: "popover"
|
|
1044
1094
|
});
|
|
1045
|
-
return /* @__PURE__ */
|
|
1046
|
-
|
|
1095
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(import_ui8.IconButton, { ...(0, import_ui8.bindTrigger)(menuState), disabled, size: "tiny" }, /* @__PURE__ */ React8.createElement(import_icons3.DotsVerticalIcon, { fontSize: "tiny" })), /* @__PURE__ */ React8.createElement(
|
|
1096
|
+
import_ui8.Menu,
|
|
1047
1097
|
{
|
|
1048
1098
|
disablePortal: true,
|
|
1049
1099
|
MenuListProps: {
|
|
@@ -1052,7 +1102,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1052
1102
|
PaperProps: {
|
|
1053
1103
|
elevation: 6
|
|
1054
1104
|
},
|
|
1055
|
-
...(0,
|
|
1105
|
+
...(0, import_ui8.bindMenu)(menuState),
|
|
1056
1106
|
anchorEl: menuState.anchorEl,
|
|
1057
1107
|
anchorOrigin: {
|
|
1058
1108
|
vertical: "bottom",
|
|
@@ -1065,8 +1115,8 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1065
1115
|
open: menuState.isOpen,
|
|
1066
1116
|
onClose: menuState.close
|
|
1067
1117
|
},
|
|
1068
|
-
menuActions.map((action) => /* @__PURE__ */
|
|
1069
|
-
|
|
1118
|
+
menuActions.map((action) => /* @__PURE__ */ React8.createElement(
|
|
1119
|
+
import_ui8.MenuItem,
|
|
1070
1120
|
{
|
|
1071
1121
|
key: action.name,
|
|
1072
1122
|
onClick: () => {
|
|
@@ -1087,9 +1137,9 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
|
|
|
1087
1137
|
));
|
|
1088
1138
|
};
|
|
1089
1139
|
|
|
1090
|
-
// src/components/variables-manager/
|
|
1091
|
-
var
|
|
1092
|
-
var
|
|
1140
|
+
// src/components/variables-manager/ui/variable-table-cell.tsx
|
|
1141
|
+
var React9 = __toESM(require("react"));
|
|
1142
|
+
var import_ui9 = require("@elementor/ui");
|
|
1093
1143
|
var VariableTableCell = ({
|
|
1094
1144
|
children,
|
|
1095
1145
|
isHeader,
|
|
@@ -1108,14 +1158,14 @@ var VariableTableCell = ({
|
|
|
1108
1158
|
...width && { width },
|
|
1109
1159
|
...sx
|
|
1110
1160
|
};
|
|
1111
|
-
return /* @__PURE__ */
|
|
1161
|
+
return /* @__PURE__ */ React9.createElement(import_ui9.TableCell, { size: "small", padding: noPadding ? "none" : void 0, align, sx: baseSx }, children);
|
|
1112
1162
|
};
|
|
1113
1163
|
|
|
1114
1164
|
// src/components/variables-manager/variable-editable-cell.tsx
|
|
1115
|
-
var
|
|
1165
|
+
var React10 = __toESM(require("react"));
|
|
1116
1166
|
var import_react8 = require("react");
|
|
1117
|
-
var
|
|
1118
|
-
var VariableEditableCell =
|
|
1167
|
+
var import_ui10 = require("@elementor/ui");
|
|
1168
|
+
var VariableEditableCell = React10.memo(
|
|
1119
1169
|
({
|
|
1120
1170
|
initialValue,
|
|
1121
1171
|
children,
|
|
@@ -1192,8 +1242,8 @@ var VariableEditableCell = React9.memo(
|
|
|
1192
1242
|
error: currentError
|
|
1193
1243
|
});
|
|
1194
1244
|
if (isEditing) {
|
|
1195
|
-
return /* @__PURE__ */
|
|
1196
|
-
|
|
1245
|
+
return /* @__PURE__ */ React10.createElement(import_ui10.ClickAwayListener, { onClickAway: handleSave }, /* @__PURE__ */ React10.createElement(
|
|
1246
|
+
import_ui10.Stack,
|
|
1197
1247
|
{
|
|
1198
1248
|
ref: rowRef,
|
|
1199
1249
|
direction: "row",
|
|
@@ -1209,8 +1259,8 @@ var VariableEditableCell = React9.memo(
|
|
|
1209
1259
|
editableContent
|
|
1210
1260
|
));
|
|
1211
1261
|
}
|
|
1212
|
-
return /* @__PURE__ */
|
|
1213
|
-
|
|
1262
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1263
|
+
import_ui10.Stack,
|
|
1214
1264
|
{
|
|
1215
1265
|
ref: rowRef,
|
|
1216
1266
|
direction: "row",
|
|
@@ -1287,17 +1337,17 @@ var VariablesManagerTable = ({
|
|
|
1287
1337
|
});
|
|
1288
1338
|
handleOnChange(updatedVariables);
|
|
1289
1339
|
};
|
|
1290
|
-
return /* @__PURE__ */
|
|
1291
|
-
|
|
1340
|
+
return /* @__PURE__ */ React11.createElement(import_ui11.TableContainer, { ref: tableContainerRef, sx: { overflow: "initial" } }, /* @__PURE__ */ React11.createElement(import_ui11.Table, { sx: tableSX, "aria-label": "Variables manager list with drag and drop reordering", stickyHeader: true }, /* @__PURE__ */ React11.createElement(import_ui11.TableHead, null, /* @__PURE__ */ React11.createElement(import_ui11.TableRow, null, /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 10, maxWidth: 10 }), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n9.__)("Name", "elementor")), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n9.__)("Value", "elementor")), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React11.createElement(import_ui11.TableBody, null, /* @__PURE__ */ React11.createElement(
|
|
1341
|
+
import_ui11.UnstableSortableProvider,
|
|
1292
1342
|
{
|
|
1293
1343
|
value: ids,
|
|
1294
1344
|
onChange: handleReorder,
|
|
1295
1345
|
variant: "static",
|
|
1296
1346
|
restrictAxis: true,
|
|
1297
|
-
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */
|
|
1347
|
+
dragOverlay: ({ children: dragOverlayChildren, ...dragOverlayProps }) => /* @__PURE__ */ React11.createElement(import_ui11.Table, { sx: tableSX, ...dragOverlayProps }, /* @__PURE__ */ React11.createElement(import_ui11.TableBody, null, dragOverlayChildren))
|
|
1298
1348
|
},
|
|
1299
|
-
rows.map((row) => /* @__PURE__ */
|
|
1300
|
-
|
|
1349
|
+
rows.map((row) => /* @__PURE__ */ React11.createElement(
|
|
1350
|
+
import_ui11.UnstableSortableItem,
|
|
1301
1351
|
{
|
|
1302
1352
|
key: row.id,
|
|
1303
1353
|
id: row.id,
|
|
@@ -1314,8 +1364,8 @@ var VariablesManagerTable = ({
|
|
|
1314
1364
|
}) => {
|
|
1315
1365
|
const showIndicationBefore = showDropIndication && dropPosition === "before";
|
|
1316
1366
|
const showIndicationAfter = showDropIndication && dropPosition === "after";
|
|
1317
|
-
return /* @__PURE__ */
|
|
1318
|
-
|
|
1367
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1368
|
+
import_ui11.TableRow,
|
|
1319
1369
|
{
|
|
1320
1370
|
...itemProps,
|
|
1321
1371
|
selected: isDragged,
|
|
@@ -1344,8 +1394,8 @@ var VariablesManagerTable = ({
|
|
|
1344
1394
|
},
|
|
1345
1395
|
style: { ...itemStyle, ...triggerStyle }
|
|
1346
1396
|
},
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
|
|
1397
|
+
/* @__PURE__ */ React11.createElement(VariableTableCell, { noPadding: true, width: 10, maxWidth: 10 }, /* @__PURE__ */ React11.createElement(
|
|
1398
|
+
import_ui11.IconButton,
|
|
1349
1399
|
{
|
|
1350
1400
|
size: "small",
|
|
1351
1401
|
ref: setTriggerRef,
|
|
@@ -1353,9 +1403,9 @@ var VariablesManagerTable = ({
|
|
|
1353
1403
|
disabled: isSorting,
|
|
1354
1404
|
draggable: true
|
|
1355
1405
|
},
|
|
1356
|
-
/* @__PURE__ */
|
|
1406
|
+
/* @__PURE__ */ React11.createElement(import_icons4.GripVerticalIcon, { fontSize: "inherit" })
|
|
1357
1407
|
)),
|
|
1358
|
-
/* @__PURE__ */
|
|
1408
|
+
/* @__PURE__ */ React11.createElement(VariableTableCell, null, /* @__PURE__ */ React11.createElement(
|
|
1359
1409
|
VariableEditableCell,
|
|
1360
1410
|
{
|
|
1361
1411
|
initialValue: row.name,
|
|
@@ -1373,7 +1423,7 @@ var VariablesManagerTable = ({
|
|
|
1373
1423
|
onChange,
|
|
1374
1424
|
onValidationChange,
|
|
1375
1425
|
error
|
|
1376
|
-
}) => /* @__PURE__ */
|
|
1426
|
+
}) => /* @__PURE__ */ React11.createElement(
|
|
1377
1427
|
LabelField,
|
|
1378
1428
|
{
|
|
1379
1429
|
id: "variable-label-" + row.id,
|
|
@@ -1395,7 +1445,7 @@ var VariablesManagerTable = ({
|
|
|
1395
1445
|
onAutoEditComplete: autoEditVariableId === row.id ? onAutoEditComplete : void 0,
|
|
1396
1446
|
fieldType: "label"
|
|
1397
1447
|
},
|
|
1398
|
-
/* @__PURE__ */
|
|
1448
|
+
/* @__PURE__ */ React11.createElement(
|
|
1399
1449
|
import_editor_ui2.EllipsisWithTooltip,
|
|
1400
1450
|
{
|
|
1401
1451
|
title: row.name,
|
|
@@ -1404,7 +1454,7 @@ var VariablesManagerTable = ({
|
|
|
1404
1454
|
row.name
|
|
1405
1455
|
)
|
|
1406
1456
|
)),
|
|
1407
|
-
/* @__PURE__ */
|
|
1457
|
+
/* @__PURE__ */ React11.createElement(VariableTableCell, null, /* @__PURE__ */ React11.createElement(
|
|
1408
1458
|
VariableEditableCell,
|
|
1409
1459
|
{
|
|
1410
1460
|
initialValue: row.value,
|
|
@@ -1435,7 +1485,7 @@ var VariablesManagerTable = ({
|
|
|
1435
1485
|
fieldType: "value"
|
|
1436
1486
|
},
|
|
1437
1487
|
row.startIcon && row.startIcon({ value: row.value }),
|
|
1438
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ React11.createElement(
|
|
1439
1489
|
import_editor_ui2.EllipsisWithTooltip,
|
|
1440
1490
|
{
|
|
1441
1491
|
title: row.value,
|
|
@@ -1448,7 +1498,7 @@ var VariablesManagerTable = ({
|
|
|
1448
1498
|
row.value
|
|
1449
1499
|
)
|
|
1450
1500
|
)),
|
|
1451
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ React11.createElement(
|
|
1452
1502
|
VariableTableCell,
|
|
1453
1503
|
{
|
|
1454
1504
|
align: "right",
|
|
@@ -1457,7 +1507,7 @@ var VariablesManagerTable = ({
|
|
|
1457
1507
|
maxWidth: 16,
|
|
1458
1508
|
sx: { paddingInlineEnd: 1 }
|
|
1459
1509
|
},
|
|
1460
|
-
/* @__PURE__ */
|
|
1510
|
+
/* @__PURE__ */ React11.createElement(import_ui11.Stack, { role: "toolbar", direction: "row", justifyContent: "flex-end" }, /* @__PURE__ */ React11.createElement(
|
|
1461
1511
|
VariableEditMenu,
|
|
1462
1512
|
{
|
|
1463
1513
|
menuActions,
|
|
@@ -1496,6 +1546,9 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1496
1546
|
function VariablesManagerPanel() {
|
|
1497
1547
|
const { close: closePanel } = usePanelActions();
|
|
1498
1548
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui3.useDialog)();
|
|
1549
|
+
const createMenuState = (0, import_ui12.usePopupState)({
|
|
1550
|
+
variant: "popover"
|
|
1551
|
+
});
|
|
1499
1552
|
const {
|
|
1500
1553
|
variables,
|
|
1501
1554
|
isDirty,
|
|
@@ -1537,7 +1590,7 @@ function VariablesManagerPanel() {
|
|
|
1537
1590
|
);
|
|
1538
1591
|
const menuActions = [
|
|
1539
1592
|
{
|
|
1540
|
-
name: (0,
|
|
1593
|
+
name: (0, import_i18n10.__)("Delete", "elementor"),
|
|
1541
1594
|
icon: import_icons5.TrashIcon,
|
|
1542
1595
|
color: "error.main",
|
|
1543
1596
|
onClick: (itemId) => {
|
|
@@ -1547,15 +1600,16 @@ function VariablesManagerPanel() {
|
|
|
1547
1600
|
}
|
|
1548
1601
|
}
|
|
1549
1602
|
];
|
|
1550
|
-
const hasVariables = Object.
|
|
1551
|
-
return /* @__PURE__ */
|
|
1603
|
+
const hasVariables = Object.values(variables).some((variable) => !variable.deleted);
|
|
1604
|
+
return /* @__PURE__ */ React12.createElement(import_editor_ui3.ThemeProvider, null, /* @__PURE__ */ React12.createElement(import_ui12.ErrorBoundary, { fallback: /* @__PURE__ */ React12.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React12.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React12.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React12.createElement(import_ui12.Stack, { width: "100%", direction: "column", alignItems: "center" }, /* @__PURE__ */ React12.createElement(import_ui12.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React12.createElement(import_ui12.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React12.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React12.createElement(import_icons5.ColorFilterIcon, { fontSize: "inherit" }), (0, import_i18n10.__)("Variable Manager", "elementor"))), /* @__PURE__ */ React12.createElement(import_ui12.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React12.createElement(
|
|
1552
1605
|
VariableManagerCreateMenu,
|
|
1553
1606
|
{
|
|
1554
1607
|
onCreate: handleCreateVariable,
|
|
1555
|
-
variables
|
|
1608
|
+
variables,
|
|
1609
|
+
menuState: createMenuState
|
|
1556
1610
|
}
|
|
1557
|
-
), /* @__PURE__ */
|
|
1558
|
-
|
|
1611
|
+
), /* @__PURE__ */ React12.createElement(
|
|
1612
|
+
import_ui12.CloseButton,
|
|
1559
1613
|
{
|
|
1560
1614
|
"aria-label": "Close",
|
|
1561
1615
|
slotProps: { icon: { fontSize: SIZE } },
|
|
@@ -1563,7 +1617,7 @@ function VariablesManagerPanel() {
|
|
|
1563
1617
|
handleClosePanel();
|
|
1564
1618
|
}
|
|
1565
1619
|
}
|
|
1566
|
-
))))), /* @__PURE__ */
|
|
1620
|
+
))))), /* @__PURE__ */ React12.createElement(
|
|
1567
1621
|
import_editor_panels.PanelBody,
|
|
1568
1622
|
{
|
|
1569
1623
|
sx: {
|
|
@@ -1572,16 +1626,16 @@ function VariablesManagerPanel() {
|
|
|
1572
1626
|
height: "100%"
|
|
1573
1627
|
}
|
|
1574
1628
|
},
|
|
1575
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ React12.createElement(
|
|
1576
1630
|
import_editor_ui3.SearchField,
|
|
1577
1631
|
{
|
|
1578
|
-
placeholder: (0,
|
|
1632
|
+
placeholder: (0, import_i18n10.__)("Search", "elementor"),
|
|
1579
1633
|
value: searchValue,
|
|
1580
1634
|
onSearch: handleSearch
|
|
1581
1635
|
}
|
|
1582
1636
|
),
|
|
1583
|
-
/* @__PURE__ */
|
|
1584
|
-
hasVariables && /* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ React12.createElement(import_ui12.Divider, { sx: { width: "100%" } }),
|
|
1638
|
+
hasVariables && /* @__PURE__ */ React12.createElement(
|
|
1585
1639
|
VariablesManagerTable,
|
|
1586
1640
|
{
|
|
1587
1641
|
menuActions,
|
|
@@ -1592,16 +1646,28 @@ function VariablesManagerPanel() {
|
|
|
1592
1646
|
onFieldError: setHasValidationErrors
|
|
1593
1647
|
}
|
|
1594
1648
|
),
|
|
1595
|
-
!hasVariables && /* @__PURE__ */
|
|
1649
|
+
!hasVariables && searchValue && /* @__PURE__ */ React12.createElement(
|
|
1596
1650
|
NoSearchResults,
|
|
1597
1651
|
{
|
|
1598
1652
|
searchValue,
|
|
1599
1653
|
onClear: () => handleSearch(""),
|
|
1600
|
-
icon: /* @__PURE__ */
|
|
1654
|
+
icon: /* @__PURE__ */ React12.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" })
|
|
1655
|
+
}
|
|
1656
|
+
),
|
|
1657
|
+
!hasVariables && !searchValue && /* @__PURE__ */ React12.createElement(
|
|
1658
|
+
EmptyState,
|
|
1659
|
+
{
|
|
1660
|
+
title: (0, import_i18n10.__)("Create your first variable", "elementor"),
|
|
1661
|
+
message: (0, import_i18n10.__)(
|
|
1662
|
+
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1663
|
+
"elementor"
|
|
1664
|
+
),
|
|
1665
|
+
icon: /* @__PURE__ */ React12.createElement(import_icons5.ColorFilterIcon, { fontSize: "large" }),
|
|
1666
|
+
onAdd: createMenuState.open
|
|
1601
1667
|
}
|
|
1602
1668
|
)
|
|
1603
|
-
), /* @__PURE__ */
|
|
1604
|
-
|
|
1669
|
+
), /* @__PURE__ */ React12.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React12.createElement(
|
|
1670
|
+
import_ui12.Button,
|
|
1605
1671
|
{
|
|
1606
1672
|
fullWidth: true,
|
|
1607
1673
|
size: "small",
|
|
@@ -1611,8 +1677,8 @@ function VariablesManagerPanel() {
|
|
|
1611
1677
|
onClick: handleSave,
|
|
1612
1678
|
loading: isSaving
|
|
1613
1679
|
},
|
|
1614
|
-
(0,
|
|
1615
|
-
))), deleteConfirmation && /* @__PURE__ */
|
|
1680
|
+
(0, import_i18n10.__)("Save changes", "elementor")
|
|
1681
|
+
))), deleteConfirmation && /* @__PURE__ */ React12.createElement(
|
|
1616
1682
|
DeleteConfirmationDialog,
|
|
1617
1683
|
{
|
|
1618
1684
|
open: true,
|
|
@@ -1620,19 +1686,19 @@ function VariablesManagerPanel() {
|
|
|
1620
1686
|
onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
|
|
1621
1687
|
closeDialog: () => setDeleteConfirmation(null)
|
|
1622
1688
|
}
|
|
1623
|
-
)), isSaveChangesDialogOpen && /* @__PURE__ */
|
|
1689
|
+
)), isSaveChangesDialogOpen && /* @__PURE__ */ React12.createElement(import_editor_ui3.SaveChangesDialog, null, /* @__PURE__ */ React12.createElement(import_editor_ui3.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n10.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React12.createElement(import_editor_ui3.SaveChangesDialog.Content, null, /* @__PURE__ */ React12.createElement(import_editor_ui3.SaveChangesDialog.ContentText, null, (0, import_i18n10.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React12.createElement(
|
|
1624
1690
|
import_editor_ui3.SaveChangesDialog.Actions,
|
|
1625
1691
|
{
|
|
1626
1692
|
actions: {
|
|
1627
1693
|
discard: {
|
|
1628
|
-
label: (0,
|
|
1694
|
+
label: (0, import_i18n10.__)("Discard", "elementor"),
|
|
1629
1695
|
action: () => {
|
|
1630
1696
|
closeSaveChangesDialog();
|
|
1631
1697
|
closePanel();
|
|
1632
1698
|
}
|
|
1633
1699
|
},
|
|
1634
1700
|
confirm: {
|
|
1635
|
-
label: (0,
|
|
1701
|
+
label: (0, import_i18n10.__)("Save", "elementor"),
|
|
1636
1702
|
action: async () => {
|
|
1637
1703
|
await handleSave();
|
|
1638
1704
|
closeSaveChangesDialog();
|
|
@@ -1643,7 +1709,7 @@ function VariablesManagerPanel() {
|
|
|
1643
1709
|
}
|
|
1644
1710
|
)));
|
|
1645
1711
|
}
|
|
1646
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
1712
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React12.createElement(import_ui12.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React12.createElement(import_ui12.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React12.createElement("strong", null, (0, import_i18n10.__)("Something went wrong", "elementor"))));
|
|
1647
1713
|
var usePreventUnload = (isDirty) => {
|
|
1648
1714
|
(0, import_react10.useEffect)(() => {
|
|
1649
1715
|
const handleBeforeUnload = (event) => {
|
|
@@ -1691,42 +1757,27 @@ var import_react16 = require("react");
|
|
|
1691
1757
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1692
1758
|
|
|
1693
1759
|
// src/context/variable-selection-popover.context.tsx
|
|
1694
|
-
var
|
|
1760
|
+
var React13 = __toESM(require("react"));
|
|
1695
1761
|
var import_react11 = require("react");
|
|
1696
|
-
var
|
|
1762
|
+
var import_ui13 = require("@elementor/ui");
|
|
1697
1763
|
var PopoverContentRefContext = (0, import_react11.createContext)(null);
|
|
1698
1764
|
var PopoverContentRefContextProvider = ({ children }) => {
|
|
1699
1765
|
const [anchorRef, setAnchorRef] = (0, import_react11.useState)(null);
|
|
1700
|
-
return /* @__PURE__ */
|
|
1766
|
+
return /* @__PURE__ */ React13.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React13.createElement(import_ui13.Box, { ref: setAnchorRef }, children));
|
|
1701
1767
|
};
|
|
1702
1768
|
var usePopoverContentRef = () => {
|
|
1703
1769
|
return (0, import_react11.useContext)(PopoverContentRefContext);
|
|
1704
1770
|
};
|
|
1705
1771
|
|
|
1706
|
-
// src/hooks/use-permissions.ts
|
|
1707
|
-
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
1708
|
-
var usePermissions = () => {
|
|
1709
|
-
const { canUser } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
1710
|
-
return {
|
|
1711
|
-
canAssign: () => canUser("edit_posts"),
|
|
1712
|
-
canUnlink: () => canUser("edit_posts"),
|
|
1713
|
-
canAdd: () => canUser("manage_options"),
|
|
1714
|
-
canDelete: () => canUser("manage_options"),
|
|
1715
|
-
canEdit: () => canUser("manage_options"),
|
|
1716
|
-
canRestore: () => canUser("manage_options"),
|
|
1717
|
-
canManageSettings: () => canUser("manage_options")
|
|
1718
|
-
};
|
|
1719
|
-
};
|
|
1720
|
-
|
|
1721
1772
|
// src/components/variable-creation.tsx
|
|
1722
|
-
var
|
|
1773
|
+
var React15 = __toESM(require("react"));
|
|
1723
1774
|
var import_react12 = require("react");
|
|
1724
1775
|
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
1725
1776
|
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
1726
1777
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1727
1778
|
var import_icons6 = require("@elementor/icons");
|
|
1728
|
-
var
|
|
1729
|
-
var
|
|
1779
|
+
var import_ui15 = require("@elementor/ui");
|
|
1780
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1730
1781
|
|
|
1731
1782
|
// src/hooks/use-initial-value.ts
|
|
1732
1783
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
@@ -1787,10 +1838,10 @@ var trackVariableEvent = ({ varType, controlPath, action }) => {
|
|
|
1787
1838
|
};
|
|
1788
1839
|
|
|
1789
1840
|
// src/components/ui/form-field.tsx
|
|
1790
|
-
var
|
|
1791
|
-
var
|
|
1841
|
+
var React14 = __toESM(require("react"));
|
|
1842
|
+
var import_ui14 = require("@elementor/ui");
|
|
1792
1843
|
var FormField = ({ id: id2, label, errorMsg, noticeMsg, children }) => {
|
|
1793
|
-
return /* @__PURE__ */
|
|
1844
|
+
return /* @__PURE__ */ React14.createElement(import_ui14.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React14.createElement(import_ui14.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React14.createElement(import_ui14.FormLabel, { htmlFor: id2, size: "tiny" }, label)), /* @__PURE__ */ React14.createElement(import_ui14.Grid, { item: true, xs: 12 }, children, errorMsg && /* @__PURE__ */ React14.createElement(import_ui14.FormHelperText, { error: true }, errorMsg), noticeMsg && /* @__PURE__ */ React14.createElement(import_ui14.FormHelperText, null, noticeMsg)));
|
|
1794
1845
|
};
|
|
1795
1846
|
|
|
1796
1847
|
// src/components/variable-creation.tsx
|
|
@@ -1854,22 +1905,22 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1854
1905
|
return !!errorMessage;
|
|
1855
1906
|
};
|
|
1856
1907
|
const isSubmitDisabled = hasEmptyFields() || hasErrors();
|
|
1857
|
-
return /* @__PURE__ */
|
|
1908
|
+
return /* @__PURE__ */ React15.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React15.createElement(
|
|
1858
1909
|
import_editor_ui4.PopoverHeader,
|
|
1859
1910
|
{
|
|
1860
|
-
icon: /* @__PURE__ */
|
|
1861
|
-
title: (0,
|
|
1911
|
+
icon: /* @__PURE__ */ React15.createElement(React15.Fragment, null, onGoBack && /* @__PURE__ */ React15.createElement(import_ui15.IconButton, { size: SIZE2, "aria-label": (0, import_i18n11.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React15.createElement(import_icons6.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React15.createElement(VariableIcon, { fontSize: SIZE2 })),
|
|
1912
|
+
title: (0, import_i18n11.__)("Create variable", "elementor"),
|
|
1862
1913
|
onClose: closePopover
|
|
1863
1914
|
}
|
|
1864
|
-
), /* @__PURE__ */
|
|
1915
|
+
), /* @__PURE__ */ React15.createElement(import_ui15.Divider, null), /* @__PURE__ */ React15.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React15.createElement(
|
|
1865
1916
|
FormField,
|
|
1866
1917
|
{
|
|
1867
1918
|
id: "variable-label",
|
|
1868
|
-
label: (0,
|
|
1919
|
+
label: (0, import_i18n11.__)("Name", "elementor"),
|
|
1869
1920
|
errorMsg: labelFieldError?.message,
|
|
1870
1921
|
noticeMsg: labelHint(label)
|
|
1871
1922
|
},
|
|
1872
|
-
/* @__PURE__ */
|
|
1923
|
+
/* @__PURE__ */ React15.createElement(
|
|
1873
1924
|
LabelField,
|
|
1874
1925
|
{
|
|
1875
1926
|
id: "variable-label",
|
|
@@ -1887,7 +1938,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1887
1938
|
}
|
|
1888
1939
|
}
|
|
1889
1940
|
)
|
|
1890
|
-
), /* @__PURE__ */
|
|
1941
|
+
), /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n11.__)("Value", "elementor") }, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React15.createElement(
|
|
1891
1942
|
ValueField,
|
|
1892
1943
|
{
|
|
1893
1944
|
value,
|
|
@@ -1899,8 +1950,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1899
1950
|
onValidationChange: setValueFieldError,
|
|
1900
1951
|
propType
|
|
1901
1952
|
}
|
|
1902
|
-
))), errorMessage && /* @__PURE__ */
|
|
1903
|
-
|
|
1953
|
+
))), errorMessage && /* @__PURE__ */ React15.createElement(import_ui15.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React15.createElement(import_ui15.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React15.createElement(
|
|
1954
|
+
import_ui15.Button,
|
|
1904
1955
|
{
|
|
1905
1956
|
id: "create-variable-button",
|
|
1906
1957
|
size: "small",
|
|
@@ -1908,27 +1959,27 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
1908
1959
|
disabled: isSubmitDisabled,
|
|
1909
1960
|
onClick: handleCreateAndTrack
|
|
1910
1961
|
},
|
|
1911
|
-
(0,
|
|
1962
|
+
(0, import_i18n11.__)("Create", "elementor")
|
|
1912
1963
|
)));
|
|
1913
1964
|
};
|
|
1914
1965
|
|
|
1915
1966
|
// src/components/variable-edit.tsx
|
|
1916
|
-
var
|
|
1967
|
+
var React17 = __toESM(require("react"));
|
|
1917
1968
|
var import_react14 = require("react");
|
|
1918
1969
|
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
1919
1970
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
1920
1971
|
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
1921
1972
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1922
1973
|
var import_icons8 = require("@elementor/icons");
|
|
1923
|
-
var
|
|
1924
|
-
var
|
|
1974
|
+
var import_ui17 = require("@elementor/ui");
|
|
1975
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
1925
1976
|
|
|
1926
1977
|
// src/components/ui/edit-confirmation-dialog.tsx
|
|
1927
|
-
var
|
|
1978
|
+
var React16 = __toESM(require("react"));
|
|
1928
1979
|
var import_react13 = require("react");
|
|
1929
1980
|
var import_icons7 = require("@elementor/icons");
|
|
1930
|
-
var
|
|
1931
|
-
var
|
|
1981
|
+
var import_ui16 = require("@elementor/ui");
|
|
1982
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1932
1983
|
var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
|
|
1933
1984
|
var EditConfirmationDialog = ({
|
|
1934
1985
|
closeDialog,
|
|
@@ -1942,23 +1993,23 @@ var EditConfirmationDialog = ({
|
|
|
1942
1993
|
}
|
|
1943
1994
|
onConfirm?.();
|
|
1944
1995
|
};
|
|
1945
|
-
return /* @__PURE__ */
|
|
1996
|
+
return /* @__PURE__ */ React16.createElement(import_ui16.Dialog, { open: true, onClose: closeDialog, maxWidth: "xs" }, /* @__PURE__ */ React16.createElement(import_ui16.DialogTitle, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(import_icons7.AlertTriangleFilledIcon, { color: "secondary" }), (0, import_i18n12.__)("Changes to variables go live right away.", "elementor")), /* @__PURE__ */ React16.createElement(import_ui16.DialogContent, null, /* @__PURE__ */ React16.createElement(import_ui16.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n12.__)(
|
|
1946
1997
|
"Don't worry - all other changes you make will wait until you publish your site.",
|
|
1947
1998
|
"elementor"
|
|
1948
|
-
))), /* @__PURE__ */
|
|
1949
|
-
|
|
1999
|
+
))), /* @__PURE__ */ React16.createElement(import_ui16.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React16.createElement(
|
|
2000
|
+
import_ui16.FormControlLabel,
|
|
1950
2001
|
{
|
|
1951
|
-
control: /* @__PURE__ */
|
|
1952
|
-
|
|
2002
|
+
control: /* @__PURE__ */ React16.createElement(
|
|
2003
|
+
import_ui16.Checkbox,
|
|
1953
2004
|
{
|
|
1954
2005
|
checked: dontShowAgain,
|
|
1955
2006
|
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
1956
2007
|
size: "small"
|
|
1957
2008
|
}
|
|
1958
2009
|
),
|
|
1959
|
-
label: /* @__PURE__ */
|
|
2010
|
+
label: /* @__PURE__ */ React16.createElement(import_ui16.Typography, { variant: "body2" }, (0, import_i18n12.__)("Don't show me again", "elementor"))
|
|
1960
2011
|
}
|
|
1961
|
-
), /* @__PURE__ */
|
|
2012
|
+
), /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement(import_ui16.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n12.__)("Keep editing", "elementor")), /* @__PURE__ */ React16.createElement(import_ui16.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n12.__)("Save", "elementor")))));
|
|
1962
2013
|
};
|
|
1963
2014
|
|
|
1964
2015
|
// src/components/variable-edit.tsx
|
|
@@ -2043,15 +2094,15 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2043
2094
|
const actions = [];
|
|
2044
2095
|
if (userPermissions.canDelete()) {
|
|
2045
2096
|
actions.push(
|
|
2046
|
-
/* @__PURE__ */
|
|
2047
|
-
|
|
2097
|
+
/* @__PURE__ */ React17.createElement(
|
|
2098
|
+
import_ui17.IconButton,
|
|
2048
2099
|
{
|
|
2049
2100
|
key: "delete",
|
|
2050
2101
|
size: SIZE3,
|
|
2051
|
-
"aria-label": (0,
|
|
2102
|
+
"aria-label": (0, import_i18n13.__)("Delete", "elementor"),
|
|
2052
2103
|
onClick: handleDeleteConfirmation
|
|
2053
2104
|
},
|
|
2054
|
-
/* @__PURE__ */
|
|
2105
|
+
/* @__PURE__ */ React17.createElement(import_icons8.TrashIcon, { fontSize: SIZE3 })
|
|
2055
2106
|
)
|
|
2056
2107
|
);
|
|
2057
2108
|
}
|
|
@@ -2071,31 +2122,31 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2071
2122
|
return !!errorMessage;
|
|
2072
2123
|
};
|
|
2073
2124
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
2074
|
-
return /* @__PURE__ */
|
|
2125
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2075
2126
|
import_editor_ui5.PopoverHeader,
|
|
2076
2127
|
{
|
|
2077
|
-
title: (0,
|
|
2128
|
+
title: (0, import_i18n13.__)("Edit variable", "elementor"),
|
|
2078
2129
|
onClose,
|
|
2079
|
-
icon: /* @__PURE__ */
|
|
2080
|
-
|
|
2130
|
+
icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(
|
|
2131
|
+
import_ui17.IconButton,
|
|
2081
2132
|
{
|
|
2082
2133
|
size: SIZE3,
|
|
2083
|
-
"aria-label": (0,
|
|
2134
|
+
"aria-label": (0, import_i18n13.__)("Go Back", "elementor"),
|
|
2084
2135
|
onClick: onGoBack
|
|
2085
2136
|
},
|
|
2086
|
-
/* @__PURE__ */
|
|
2087
|
-
), /* @__PURE__ */
|
|
2137
|
+
/* @__PURE__ */ React17.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE3 })
|
|
2138
|
+
), /* @__PURE__ */ React17.createElement(VariableIcon, { fontSize: SIZE3 })),
|
|
2088
2139
|
actions
|
|
2089
2140
|
}
|
|
2090
|
-
), /* @__PURE__ */
|
|
2141
|
+
), /* @__PURE__ */ React17.createElement(import_ui17.Divider, null), /* @__PURE__ */ React17.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React17.createElement(
|
|
2091
2142
|
FormField,
|
|
2092
2143
|
{
|
|
2093
2144
|
id: "variable-label",
|
|
2094
|
-
label: (0,
|
|
2145
|
+
label: (0, import_i18n13.__)("Name", "elementor"),
|
|
2095
2146
|
errorMsg: labelFieldError?.message,
|
|
2096
2147
|
noticeMsg: labelHint(label)
|
|
2097
2148
|
},
|
|
2098
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ React17.createElement(
|
|
2099
2150
|
LabelField,
|
|
2100
2151
|
{
|
|
2101
2152
|
id: "variable-label",
|
|
@@ -2113,7 +2164,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2113
2164
|
}
|
|
2114
2165
|
}
|
|
2115
2166
|
)
|
|
2116
|
-
), /* @__PURE__ */
|
|
2167
|
+
), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n13.__)("Value", "elementor") }, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
|
|
2117
2168
|
ValueField,
|
|
2118
2169
|
{
|
|
2119
2170
|
value,
|
|
@@ -2125,7 +2176,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2125
2176
|
onValidationChange: setValueFieldError,
|
|
2126
2177
|
propType
|
|
2127
2178
|
}
|
|
2128
|
-
))), errorMessage && /* @__PURE__ */
|
|
2179
|
+
))), errorMessage && /* @__PURE__ */ React17.createElement(import_ui17.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React17.createElement(import_ui17.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React17.createElement(import_ui17.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, (0, import_i18n13.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React17.createElement(
|
|
2129
2180
|
DeleteConfirmationDialog,
|
|
2130
2181
|
{
|
|
2131
2182
|
open: true,
|
|
@@ -2133,7 +2184,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2133
2184
|
onConfirm: handleDelete,
|
|
2134
2185
|
closeDialog: closeDeleteDialog()
|
|
2135
2186
|
}
|
|
2136
|
-
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */
|
|
2187
|
+
), editConfirmation && !isMessageSuppressed && /* @__PURE__ */ React17.createElement(
|
|
2137
2188
|
EditConfirmationDialog,
|
|
2138
2189
|
{
|
|
2139
2190
|
closeDialog: closeEditDialog(),
|
|
@@ -2152,36 +2203,6 @@ var import_icons10 = require("@elementor/icons");
|
|
|
2152
2203
|
var import_ui20 = require("@elementor/ui");
|
|
2153
2204
|
var import_i18n15 = require("@wordpress/i18n");
|
|
2154
2205
|
|
|
2155
|
-
// src/components/ui/empty-state.tsx
|
|
2156
|
-
var React17 = __toESM(require("react"));
|
|
2157
|
-
var import_ui17 = require("@elementor/ui");
|
|
2158
|
-
var import_i18n13 = require("@wordpress/i18n");
|
|
2159
|
-
var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
2160
|
-
const canAdd = usePermissions().canAdd();
|
|
2161
|
-
return /* @__PURE__ */ React17.createElement(
|
|
2162
|
-
import_ui17.Stack,
|
|
2163
|
-
{
|
|
2164
|
-
gap: 1,
|
|
2165
|
-
alignItems: "center",
|
|
2166
|
-
justifyContent: "center",
|
|
2167
|
-
height: "100%",
|
|
2168
|
-
color: "text.secondary",
|
|
2169
|
-
sx: { p: 2.5, pb: 5.5 }
|
|
2170
|
-
},
|
|
2171
|
-
icon,
|
|
2172
|
-
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(
|
|
2173
|
-
Content,
|
|
2174
|
-
{
|
|
2175
|
-
title: (0, import_i18n13.__)("There are no variables", "elementor"),
|
|
2176
|
-
message: (0, import_i18n13.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
2177
|
-
}
|
|
2178
|
-
)
|
|
2179
|
-
);
|
|
2180
|
-
};
|
|
2181
|
-
function Content({ title, message }) {
|
|
2182
|
-
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));
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
2206
|
// src/components/ui/menu-item-content.tsx
|
|
2186
2207
|
var React18 = __toESM(require("react"));
|
|
2187
2208
|
var import_editor_ui6 = require("@elementor/editor-ui");
|