@elementor/editor-variables 3.33.0-174 → 3.33.0-176

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 CHANGED
@@ -44,19 +44,107 @@ var import_editor_props6 = require("@elementor/editor-props");
44
44
 
45
45
  // src/components/variables-manager/variables-manager-panel.tsx
46
46
  var React12 = __toESM(require("react"));
47
- var import_react10 = require("react");
47
+ var import_react11 = 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
52
  var import_ui12 = require("@elementor/ui");
53
- var import_i18n10 = require("@wordpress/i18n");
53
+ var import_i18n9 = require("@wordpress/i18n");
54
+
55
+ // src/utils/validations.ts
56
+ var import_i18n = require("@wordpress/i18n");
57
+ var ERROR_MESSAGES = {
58
+ MISSING_VARIABLE_NAME: (0, import_i18n.__)("Give your variable a name.", "elementor"),
59
+ MISSING_VARIABLE_VALUE: (0, import_i18n.__)("Add a value to complete your variable.", "elementor"),
60
+ INVALID_CHARACTERS: (0, import_i18n.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.", "elementor"),
61
+ NO_NON_SPECIAL_CHARACTER: (0, import_i18n.__)("Names have to include at least one non-special character.", "elementor"),
62
+ VARIABLE_LABEL_MAX_LENGTH: (0, import_i18n.__)("Keep names up to 50 characters.", "elementor"),
63
+ DUPLICATED_LABEL: (0, import_i18n.__)("This variable name already exists. Please choose a unique name.", "elementor"),
64
+ UNEXPECTED_ERROR: (0, import_i18n.__)("There was a glitch. Try saving your variable again.", "elementor"),
65
+ BATCH: {
66
+ DUPLICATED_LABELS: (count, name) => (
67
+ // eslint-disable-next-line @wordpress/i18n-translator-comments
68
+ (0, import_i18n.sprintf)((0, import_i18n.__)("We found %1$d duplicated %2$s.", "elementor"), count, name)
69
+ ),
70
+ UNEXPECTED_ERROR: (0, import_i18n.__)("The save didn\u2019t go through.", "elementor"),
71
+ DUPLICATED_LABEL_ACTION: (0, import_i18n.__)("Take me there", "elementor"),
72
+ DUPLICATED_LABEL_ACTION_MESSAGE: (0, import_i18n.__)("Please rename the variables.", "elementor"),
73
+ UNEXPECTED_ERROR_ACTION_MESSAGE: (0, import_i18n.__)("Try saving your variables again.", "elementor")
74
+ }
75
+ };
76
+ var VARIABLE_LABEL_MAX_LENGTH = 50;
77
+ var mapServerError = (error) => {
78
+ if (error?.response?.data?.code === "duplicated_label") {
79
+ return {
80
+ field: "label",
81
+ message: ERROR_MESSAGES.DUPLICATED_LABEL
82
+ };
83
+ }
84
+ if (error?.response?.data?.code === "batch_duplicated_label") {
85
+ const errorData = error?.response?.data?.data ?? {};
86
+ const count = Object.keys(errorData).length;
87
+ const name = count === 1 ? "name" : "names";
88
+ const duplicatedIds = Object.keys(errorData);
89
+ return {
90
+ field: "label",
91
+ message: ERROR_MESSAGES.BATCH.DUPLICATED_LABELS(count, name),
92
+ action: {
93
+ label: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION,
94
+ message: ERROR_MESSAGES.BATCH.DUPLICATED_LABEL_ACTION_MESSAGE,
95
+ data: {
96
+ duplicatedIds
97
+ }
98
+ }
99
+ };
100
+ }
101
+ if (error?.response?.data?.code === "batch_operation_failed") {
102
+ return {
103
+ field: "label",
104
+ message: ERROR_MESSAGES.BATCH.UNEXPECTED_ERROR
105
+ };
106
+ }
107
+ return void 0;
108
+ };
109
+ var validateLabel = (name, variables) => {
110
+ if (!name.trim()) {
111
+ return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
112
+ }
113
+ const allowedChars = /^[a-zA-Z0-9_-]+$/;
114
+ if (!allowedChars.test(name)) {
115
+ return ERROR_MESSAGES.INVALID_CHARACTERS;
116
+ }
117
+ const hasAlphanumeric = /[a-zA-Z0-9]/;
118
+ if (!hasAlphanumeric.test(name)) {
119
+ return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
120
+ }
121
+ if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
122
+ return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
123
+ }
124
+ if (Object.values(variables ?? {}).some((variable) => variable.label === name)) {
125
+ return ERROR_MESSAGES.DUPLICATED_LABEL;
126
+ }
127
+ return "";
128
+ };
129
+ var labelHint = (name) => {
130
+ const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
131
+ if (hintThreshold < name.length) {
132
+ return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
133
+ }
134
+ return "";
135
+ };
136
+ var validateValue = (value) => {
137
+ if (!value.trim()) {
138
+ return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
139
+ }
140
+ return "";
141
+ };
54
142
 
55
143
  // src/components/ui/delete-confirmation-dialog.tsx
56
144
  var React = __toESM(require("react"));
57
145
  var import_icons = require("@elementor/icons");
58
146
  var import_ui = require("@elementor/ui");
59
- var import_i18n = require("@wordpress/i18n");
147
+ var import_i18n2 = require("@wordpress/i18n");
60
148
  var TITLE_ID = "delete-variable-dialog";
61
149
  var DeleteConfirmationDialog = ({
62
150
  open,
@@ -64,13 +152,13 @@ var DeleteConfirmationDialog = ({
64
152
  closeDialog,
65
153
  onConfirm
66
154
  }) => {
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"))));
155
+ 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_i18n2.__)("Delete this variable?", "elementor")), /* @__PURE__ */ React.createElement(import_ui.DialogContent, null, /* @__PURE__ */ React.createElement(import_ui.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n2.__)("All elements using", "elementor"), "\xA0", /* @__PURE__ */ React.createElement(import_ui.Typography, { variant: "subtitle2", component: "span", sx: { lineBreak: "anywhere" } }, label), "\xA0", (0, import_i18n2.__)("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_i18n2.__)("Not now", "elementor")), /* @__PURE__ */ React.createElement(import_ui.Button, { variant: "contained", color: "error", onClick: onConfirm }, (0, import_i18n2.__)("Delete", "elementor"))));
68
156
  };
69
157
 
70
158
  // src/components/ui/empty-state.tsx
71
159
  var React2 = __toESM(require("react"));
72
160
  var import_ui2 = require("@elementor/ui");
73
- var import_i18n2 = require("@wordpress/i18n");
161
+ var import_i18n3 = require("@wordpress/i18n");
74
162
 
75
163
  // src/hooks/use-permissions.ts
76
164
  var import_editor_current_user = require("@elementor/editor-current-user");
@@ -101,11 +189,11 @@ var EmptyState = ({ icon, title, message, onAdd }) => {
101
189
  sx: { p: 2.5, pt: 8, pb: 5.5 }
102
190
  },
103
191
  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(
192
+ 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_i18n3.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React2.createElement(
105
193
  Content,
106
194
  {
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")
195
+ title: (0, import_i18n3.__)("There are no variables", "elementor"),
196
+ message: (0, import_i18n3.__)("With your current role, you can only connect and detach variables.", "elementor")
109
197
  }
110
198
  )
111
199
  );
@@ -117,7 +205,7 @@ function Content({ title, message }) {
117
205
  // src/components/ui/no-search-results.tsx
118
206
  var React3 = __toESM(require("react"));
119
207
  var import_ui3 = require("@elementor/ui");
120
- var import_i18n3 = require("@wordpress/i18n");
208
+ var import_i18n4 = require("@wordpress/i18n");
121
209
  var NoSearchResults = ({ searchValue, onClear, icon }) => {
122
210
  return /* @__PURE__ */ React3.createElement(
123
211
  import_ui3.Stack,
@@ -130,8 +218,8 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
130
218
  sx: { pb: 3.5, pt: 8 }
131
219
  },
132
220
  icon,
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")))
221
+ /* @__PURE__ */ React3.createElement(import_ui3.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n4.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React3.createElement("br", null), "\u201C", searchValue, "\u201D."),
222
+ /* @__PURE__ */ React3.createElement(import_ui3.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n4.__)("Try something else.", "elementor"), /* @__PURE__ */ React3.createElement(import_ui3.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n4.__)("Clear & try again", "elementor")))
135
223
  );
136
224
  };
137
225
 
@@ -154,9 +242,43 @@ var useAutoEdit = () => {
154
242
  };
155
243
  };
156
244
 
245
+ // src/components/variables-manager/hooks/use-error-navigation.ts
246
+ var import_react2 = require("react");
247
+ var useErrorNavigation = () => {
248
+ const currentIndexRef = (0, import_react2.useRef)(0);
249
+ const createNavigationCallback = (0, import_react2.useCallback)(
250
+ (ids, onNavigate, onComplete) => {
251
+ return () => {
252
+ if (!ids?.length) {
253
+ return;
254
+ }
255
+ const currentIndex = currentIndexRef.current;
256
+ const currentId = ids[currentIndex];
257
+ if (currentId) {
258
+ onNavigate(currentId);
259
+ const nextIndex = currentIndex + 1;
260
+ if (nextIndex >= ids.length) {
261
+ onComplete();
262
+ currentIndexRef.current = 0;
263
+ } else {
264
+ currentIndexRef.current = nextIndex;
265
+ }
266
+ }
267
+ };
268
+ },
269
+ []
270
+ );
271
+ const resetNavigation = (0, import_react2.useCallback)(() => {
272
+ currentIndexRef.current = 0;
273
+ }, []);
274
+ return {
275
+ createNavigationCallback,
276
+ resetNavigation
277
+ };
278
+ };
279
+
157
280
  // src/components/variables-manager/hooks/use-variables-manager-state.ts
158
- var import_react4 = require("react");
159
- var import_i18n7 = require("@wordpress/i18n");
281
+ var import_react5 = require("react");
160
282
 
161
283
  // src/batch-operations.ts
162
284
  var generateTempId = () => {
@@ -219,12 +341,12 @@ var buildOperationsArray = (originalVariables, currentVariables) => {
219
341
  };
220
342
 
221
343
  // src/hooks/use-prop-variables.ts
222
- var import_react3 = require("react");
344
+ var import_react4 = require("react");
223
345
  var import_editor_controls = require("@elementor/editor-controls");
224
346
 
225
347
  // src/context/variable-type-context.tsx
226
348
  var React5 = __toESM(require("react"));
227
- var import_react2 = require("react");
349
+ var import_react3 = require("react");
228
350
 
229
351
  // src/variables-registry/create-variable-type-registry.ts
230
352
  var import_editor_canvas3 = require("@elementor/editor-canvas");
@@ -234,7 +356,7 @@ var import_editor_editing_panel = require("@elementor/editor-editing-panel");
234
356
  var React4 = __toESM(require("react"));
235
357
  var import_editor_canvas = require("@elementor/editor-canvas");
236
358
  var import_ui5 = require("@elementor/ui");
237
- var import_i18n5 = require("@wordpress/i18n");
359
+ var import_i18n6 = require("@wordpress/i18n");
238
360
 
239
361
  // src/components/ui/color-indicator.tsx
240
362
  var import_ui4 = require("@elementor/ui");
@@ -249,7 +371,7 @@ var import_schema = require("@elementor/schema");
249
371
  var colorVariablePropTypeUtil = (0, import_editor_props.createPropUtils)("global-color-variable", import_schema.z.string());
250
372
 
251
373
  // src/service.ts
252
- var import_i18n4 = require("@wordpress/i18n");
374
+ var import_i18n5 = require("@wordpress/i18n");
253
375
 
254
376
  // src/api.ts
255
377
  var import_http_client = require("@elementor/http-client");
@@ -454,7 +576,7 @@ var service = {
454
576
  return apiClient.create(type, label, value).then((response) => {
455
577
  const { success, data: payload } = response.data;
456
578
  if (!success) {
457
- const errorMessage = payload?.message || (0, import_i18n4.__)("Unexpected response from server", "elementor");
579
+ const errorMessage = payload?.message || (0, import_i18n5.__)("Unexpected response from server", "elementor");
458
580
  throw new Error(errorMessage);
459
581
  }
460
582
  return payload;
@@ -476,7 +598,7 @@ var service = {
476
598
  return apiClient.update(id2, label, value).then((response) => {
477
599
  const { success, data: payload } = response.data;
478
600
  if (!success) {
479
- const errorMessage = payload?.message || (0, import_i18n4.__)("Unexpected response from server", "elementor");
601
+ const errorMessage = payload?.message || (0, import_i18n5.__)("Unexpected response from server", "elementor");
480
602
  throw new Error(errorMessage);
481
603
  }
482
604
  return payload;
@@ -609,7 +731,7 @@ var inheritanceTransformer = (0, import_editor_canvas.createTransformer)((id2) =
609
731
  const variables = service.variables();
610
732
  const variable = variables[id2];
611
733
  if (!variable) {
612
- return /* @__PURE__ */ React4.createElement("span", null, (0, import_i18n5.__)("Missing variable", "elementor"));
734
+ return /* @__PURE__ */ React4.createElement("span", null, (0, import_i18n6.__)("Missing variable", "elementor"));
613
735
  }
614
736
  const showColorIndicator = variable.type === colorVariablePropTypeUtil.key;
615
737
  const css = resolveCssVariable(id2, variable);
@@ -696,12 +818,12 @@ function createVariableTypeRegistry() {
696
818
  var { registerVariableType, getVariableType, getVariableTypes, hasVariableType } = createVariableTypeRegistry();
697
819
 
698
820
  // src/context/variable-type-context.tsx
699
- var VariableTypeContext = (0, import_react2.createContext)(null);
821
+ var VariableTypeContext = (0, import_react3.createContext)(null);
700
822
  function VariableTypeProvider({ children, propTypeKey }) {
701
823
  return /* @__PURE__ */ React5.createElement(VariableTypeContext.Provider, { value: propTypeKey }, children);
702
824
  }
703
825
  function useVariableType() {
704
- const context = (0, import_react2.useContext)(VariableTypeContext);
826
+ const context = (0, import_react3.useContext)(VariableTypeContext);
705
827
  if (context === null) {
706
828
  throw new Error("useVariableType must be used within a VariableTypeProvider");
707
829
  }
@@ -754,7 +876,7 @@ var useVariableSelectionFilter = (variables) => {
754
876
  return selectionFilter ? selectionFilter(variables, propType) : variables;
755
877
  };
756
878
  var usePropVariables = (propKey) => {
757
- return (0, import_react3.useMemo)(() => normalizeVariables(propKey), [propKey]);
879
+ return (0, import_react4.useMemo)(() => normalizeVariables(propKey), [propKey]);
758
880
  };
759
881
  var normalizeVariables = (propKey) => {
760
882
  const variables = getVariables(false);
@@ -779,77 +901,22 @@ var restoreVariable = (restoreId, label, value) => {
779
901
  return service.restore(restoreId, label, value).then(extractId);
780
902
  };
781
903
 
782
- // src/utils/validations.ts
783
- var import_i18n6 = require("@wordpress/i18n");
784
- var ERROR_MESSAGES = {
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")
792
- };
793
- var VARIABLE_LABEL_MAX_LENGTH = 50;
794
- var mapServerError = (error) => {
795
- if (error?.response?.data?.code === "duplicated_label") {
796
- return {
797
- field: "label",
798
- message: ERROR_MESSAGES.DUPLICATED_LABEL
799
- };
800
- }
801
- return void 0;
802
- };
803
- var validateLabel = (name, variables) => {
804
- if (!name.trim()) {
805
- return ERROR_MESSAGES.MISSING_VARIABLE_NAME;
806
- }
807
- const allowedChars = /^[a-zA-Z0-9_-]+$/;
808
- if (!allowedChars.test(name)) {
809
- return ERROR_MESSAGES.INVALID_CHARACTERS;
810
- }
811
- const hasAlphanumeric = /[a-zA-Z0-9]/;
812
- if (!hasAlphanumeric.test(name)) {
813
- return ERROR_MESSAGES.NO_NON_SPECIAL_CHARACTER;
814
- }
815
- if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
816
- return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
817
- }
818
- if (Object.values(variables ?? {}).some((variable) => variable.label === name)) {
819
- return ERROR_MESSAGES.DUPLICATED_LABEL;
820
- }
821
- return "";
822
- };
823
- var labelHint = (name) => {
824
- const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
825
- if (hintThreshold < name.length) {
826
- return ERROR_MESSAGES.VARIABLE_LABEL_MAX_LENGTH;
827
- }
828
- return "";
829
- };
830
- var validateValue = (value) => {
831
- if (!value.trim()) {
832
- return ERROR_MESSAGES.MISSING_VARIABLE_VALUE;
833
- }
834
- return "";
835
- };
836
-
837
904
  // src/components/variables-manager/hooks/use-variables-manager-state.ts
838
905
  var useVariablesManagerState = () => {
839
- const [variables, setVariables] = (0, import_react4.useState)(() => getVariables(false));
840
- const [deletedVariables, setDeletedVariables] = (0, import_react4.useState)([]);
841
- const [isDirty, setIsDirty] = (0, import_react4.useState)(false);
842
- const [hasValidationErrors, setHasValidationErrors] = (0, import_react4.useState)(false);
843
- const [isSaving, setIsSaving] = (0, import_react4.useState)(false);
844
- const [searchValue, setSearchValue] = (0, import_react4.useState)("");
845
- const handleOnChange = (0, import_react4.useCallback)(
906
+ const [variables, setVariables] = (0, import_react5.useState)(() => getVariables(false));
907
+ const [deletedVariables, setDeletedVariables] = (0, import_react5.useState)([]);
908
+ const [isSaveDisabled, setIsSaveDisabled] = (0, import_react5.useState)(false);
909
+ const [isDirty, setIsDirty] = (0, import_react5.useState)(false);
910
+ const [isSaving, setIsSaving] = (0, import_react5.useState)(false);
911
+ const [searchValue, setSearchValue] = (0, import_react5.useState)("");
912
+ const handleOnChange = (0, import_react5.useCallback)(
846
913
  (newVariables) => {
847
914
  setVariables({ ...variables, ...newVariables });
848
915
  setIsDirty(true);
849
916
  },
850
917
  [variables]
851
918
  );
852
- const createVariable2 = (0, import_react4.useCallback)((type, defaultName, defaultValue) => {
919
+ const createVariable2 = (0, import_react5.useCallback)((type, defaultName, defaultValue) => {
853
920
  const newId = generateTempId();
854
921
  const newVariable = {
855
922
  id: newId,
@@ -861,7 +928,7 @@ var useVariablesManagerState = () => {
861
928
  setIsDirty(true);
862
929
  return newId;
863
930
  }, []);
864
- const handleDeleteVariable = (0, import_react4.useCallback)((itemId) => {
931
+ const handleDeleteVariable = (0, import_react5.useCallback)((itemId) => {
865
932
  setDeletedVariables((prev) => [...prev, itemId]);
866
933
  setVariables((prev) => ({ ...prev, [itemId]: { ...prev[itemId], deleted: true } }));
867
934
  setIsDirty(true);
@@ -869,26 +936,18 @@ var useVariablesManagerState = () => {
869
936
  const handleSearch = (searchTerm) => {
870
937
  setSearchValue(searchTerm);
871
938
  };
872
- const handleSave = (0, import_react4.useCallback)(async () => {
873
- try {
874
- const originalVariables = getVariables(false);
875
- setIsSaving(true);
876
- const result = await service.batchSave(originalVariables, variables);
877
- if (result.success) {
878
- await service.load();
879
- const updatedVariables = service.variables();
880
- setVariables(updatedVariables);
881
- setDeletedVariables([]);
882
- setIsDirty(false);
883
- setIsSaving(false);
884
- return { success: true };
885
- }
886
- throw new Error((0, import_i18n7.__)("Failed to save variables. Please try again.", "elementor"));
887
- } catch (error) {
888
- const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNEXPECTED_ERROR;
889
- setIsSaving(false);
890
- return { success: false, error: errorMessage };
891
- }
939
+ const handleSave = (0, import_react5.useCallback)(async () => {
940
+ const originalVariables = getVariables(false);
941
+ setIsSaving(true);
942
+ const result = await service.batchSave(originalVariables, variables);
943
+ if (result.success) {
944
+ await service.load();
945
+ const updatedVariables = service.variables();
946
+ setVariables(updatedVariables);
947
+ setDeletedVariables([]);
948
+ setIsDirty(false);
949
+ }
950
+ return { success: result.success };
892
951
  }, [variables]);
893
952
  const filteredVariables = () => {
894
953
  const list = Object.entries(variables).map(([id2, value]) => ({ ...value, id: id2 }));
@@ -899,7 +958,7 @@ var useVariablesManagerState = () => {
899
958
  variables: filteredVariables(),
900
959
  deletedVariables,
901
960
  isDirty,
902
- hasValidationErrors,
961
+ isSaveDisabled,
903
962
  handleOnChange,
904
963
  createVariable: createVariable2,
905
964
  handleDeleteVariable,
@@ -907,16 +966,17 @@ var useVariablesManagerState = () => {
907
966
  isSaving,
908
967
  handleSearch,
909
968
  searchValue,
910
- setHasValidationErrors
969
+ setIsSaving,
970
+ setIsSaveDisabled
911
971
  };
912
972
  };
913
973
 
914
974
  // src/components/variables-manager/variables-manager-create-menu.tsx
915
975
  var React6 = __toESM(require("react"));
916
- var import_react5 = require("react");
976
+ var import_react6 = require("react");
917
977
  var import_icons2 = require("@elementor/icons");
918
978
  var import_ui6 = require("@elementor/ui");
919
- var import_i18n8 = require("@wordpress/i18n");
979
+ var import_i18n7 = require("@wordpress/i18n");
920
980
  var SIZE = "tiny";
921
981
  var VariableManagerCreateMenu = ({
922
982
  variables,
@@ -924,7 +984,7 @@ var VariableManagerCreateMenu = ({
924
984
  disabled,
925
985
  menuState
926
986
  }) => {
927
- const buttonRef = (0, import_react5.useRef)(null);
987
+ const buttonRef = (0, import_react6.useRef)(null);
928
988
  const variableTypes = getVariableTypes();
929
989
  const menuOptions = Object.entries(variableTypes).map(([key, variable]) => {
930
990
  const displayName = variable.variableType.charAt(0).toUpperCase() + variable.variableType.slice(1);
@@ -945,7 +1005,7 @@ var VariableManagerCreateMenu = ({
945
1005
  ref: buttonRef,
946
1006
  disabled,
947
1007
  size: SIZE,
948
- "aria-label": (0, import_i18n8.__)("Add variable", "elementor")
1008
+ "aria-label": (0, import_i18n7.__)("Add variable", "elementor")
949
1009
  },
950
1010
  /* @__PURE__ */ React6.createElement(import_icons2.PlusIcon, { fontSize: SIZE })
951
1011
  ), /* @__PURE__ */ React6.createElement(
@@ -982,7 +1042,7 @@ var VariableManagerCreateMenu = ({
982
1042
  gap: 1.5
983
1043
  }
984
1044
  },
985
- (0, import_react5.createElement)(option.icon, {
1045
+ (0, import_react6.createElement)(option.icon, {
986
1046
  fontSize: SIZE,
987
1047
  color: "action"
988
1048
  }),
@@ -1003,22 +1063,22 @@ var getDefaultName = (variables, type, baseName) => {
1003
1063
 
1004
1064
  // src/components/variables-manager/variables-manager-table.tsx
1005
1065
  var React11 = __toESM(require("react"));
1006
- var import_react9 = require("react");
1066
+ var import_react10 = require("react");
1007
1067
  var import_editor_ui2 = require("@elementor/editor-ui");
1008
1068
  var import_icons4 = require("@elementor/icons");
1009
1069
  var import_ui11 = require("@elementor/ui");
1010
- var import_i18n9 = require("@wordpress/i18n");
1070
+ var import_i18n8 = require("@wordpress/i18n");
1011
1071
 
1012
1072
  // src/components/fields/label-field.tsx
1013
1073
  var React7 = __toESM(require("react"));
1014
- var import_react6 = require("react");
1074
+ var import_react7 = require("react");
1015
1075
  var import_editor_ui = require("@elementor/editor-ui");
1016
1076
  var import_ui7 = require("@elementor/ui");
1017
1077
  function isLabelEqual(a, b) {
1018
1078
  return a.trim().toLowerCase() === b.trim().toLowerCase();
1019
1079
  }
1020
1080
  var useLabelError = (initialError) => {
1021
- const [error, setError] = (0, import_react6.useState)(initialError ?? { value: "", message: "" });
1081
+ const [error, setError] = (0, import_react7.useState)(initialError ?? { value: "", message: "" });
1022
1082
  return {
1023
1083
  labelFieldError: error,
1024
1084
  setLabelFieldError: setError
@@ -1036,9 +1096,9 @@ var LabelField = ({
1036
1096
  showWarningInfotip = false,
1037
1097
  variables
1038
1098
  }) => {
1039
- const [label, setLabel] = (0, import_react6.useState)(value);
1040
- const [errorMessage, setErrorMessage] = (0, import_react6.useState)("");
1041
- const fieldRef = (0, import_react6.useRef)(null);
1099
+ const [label, setLabel] = (0, import_react7.useState)(value);
1100
+ const [errorMessage, setErrorMessage] = (0, import_react7.useState)("");
1101
+ const fieldRef = (0, import_react7.useRef)(null);
1042
1102
  const handleChange = (newValue) => {
1043
1103
  setLabel(newValue);
1044
1104
  const errorMsg2 = validateLabel(newValue, variables);
@@ -1089,7 +1149,7 @@ var LabelField = ({
1089
1149
 
1090
1150
  // src/components/variables-manager/ui/variable-edit-menu.tsx
1091
1151
  var React8 = __toESM(require("react"));
1092
- var import_react7 = require("react");
1152
+ var import_react8 = require("react");
1093
1153
  var import_icons3 = require("@elementor/icons");
1094
1154
  var import_ui8 = require("@elementor/ui");
1095
1155
  var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
@@ -1132,7 +1192,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
1132
1192
  gap: 1
1133
1193
  }
1134
1194
  },
1135
- action.icon && (0, import_react7.createElement)(action.icon, {
1195
+ action.icon && (0, import_react8.createElement)(action.icon, {
1136
1196
  fontSize: "inherit"
1137
1197
  }),
1138
1198
  " ",
@@ -1167,7 +1227,7 @@ var VariableTableCell = ({
1167
1227
 
1168
1228
  // src/components/variables-manager/variable-editable-cell.tsx
1169
1229
  var React10 = __toESM(require("react"));
1170
- var import_react8 = require("react");
1230
+ var import_react9 = require("react");
1171
1231
  var import_ui10 = require("@elementor/ui");
1172
1232
  var VariableEditableCell = React10.memo(
1173
1233
  ({
@@ -1182,22 +1242,22 @@ var VariableEditableCell = React10.memo(
1182
1242
  gap = 1,
1183
1243
  fieldType
1184
1244
  }) => {
1185
- const [value, setValue] = (0, import_react8.useState)(initialValue);
1186
- const [isEditing, setIsEditing] = (0, import_react8.useState)(false);
1245
+ const [value, setValue] = (0, import_react9.useState)(initialValue);
1246
+ const [isEditing, setIsEditing] = (0, import_react9.useState)(false);
1187
1247
  const { labelFieldError, setLabelFieldError } = useLabelError();
1188
- const [valueFieldError, setValueFieldError] = (0, import_react8.useState)("");
1189
- const rowRef = (0, import_react8.useRef)(null);
1190
- const handleSave = (0, import_react8.useCallback)(() => {
1248
+ const [valueFieldError, setValueFieldError] = (0, import_react9.useState)("");
1249
+ const rowRef = (0, import_react9.useRef)(null);
1250
+ const handleSave = (0, import_react9.useCallback)(() => {
1191
1251
  const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
1192
1252
  if (!hasError) {
1193
1253
  onChange(value);
1194
1254
  }
1195
1255
  setIsEditing(false);
1196
1256
  }, [value, onChange, fieldType, labelFieldError, valueFieldError]);
1197
- (0, import_react8.useEffect)(() => {
1257
+ (0, import_react9.useEffect)(() => {
1198
1258
  onRowRef?.(rowRef?.current);
1199
1259
  }, [onRowRef]);
1200
- (0, import_react8.useEffect)(() => {
1260
+ (0, import_react9.useEffect)(() => {
1201
1261
  if (autoEdit && !isEditing) {
1202
1262
  setIsEditing(true);
1203
1263
  onAutoEditComplete?.();
@@ -1217,10 +1277,10 @@ var VariableEditableCell = React10.memo(
1217
1277
  setIsEditing(true);
1218
1278
  }
1219
1279
  };
1220
- const handleChange = (0, import_react8.useCallback)((newValue) => {
1280
+ const handleChange = (0, import_react9.useCallback)((newValue) => {
1221
1281
  setValue(newValue);
1222
1282
  }, []);
1223
- const handleValidationChange = (0, import_react8.useCallback)(
1283
+ const handleValidationChange = (0, import_react9.useCallback)(
1224
1284
  (errorMsg) => {
1225
1285
  if (fieldType === "label") {
1226
1286
  setLabelFieldError({
@@ -1291,9 +1351,9 @@ var VariablesManagerTable = ({
1291
1351
  onAutoEditComplete,
1292
1352
  onFieldError
1293
1353
  }) => {
1294
- const tableContainerRef = (0, import_react9.useRef)(null);
1295
- const variableRowRefs = (0, import_react9.useRef)(/* @__PURE__ */ new Map());
1296
- (0, import_react9.useEffect)(() => {
1354
+ const tableContainerRef = (0, import_react10.useRef)(null);
1355
+ const variableRowRefs = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
1356
+ (0, import_react10.useEffect)(() => {
1297
1357
  if (autoEditVariableId && tableContainerRef.current) {
1298
1358
  const rowElement = variableRowRefs.current.get(autoEditVariableId);
1299
1359
  if (rowElement) {
@@ -1341,7 +1401,7 @@ var VariablesManagerTable = ({
1341
1401
  });
1342
1402
  handleOnChange(updatedVariables);
1343
1403
  };
1344
- 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(
1404
+ 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_i18n8.__)("Name", "elementor")), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true }, (0, import_i18n8.__)("Value", "elementor")), /* @__PURE__ */ React11.createElement(VariableTableCell, { isHeader: true, noPadding: true, width: 16, maxWidth: 16 }))), /* @__PURE__ */ React11.createElement(import_ui11.TableBody, null, /* @__PURE__ */ React11.createElement(
1345
1405
  import_ui11.UnstableSortableProvider,
1346
1406
  {
1347
1407
  value: ids,
@@ -1421,7 +1481,7 @@ var VariablesManagerTable = ({
1421
1481
  });
1422
1482
  }
1423
1483
  },
1424
- prefixElement: (0, import_react9.createElement)(row.icon, { fontSize: "inherit" }),
1484
+ prefixElement: (0, import_react10.createElement)(row.icon, { fontSize: "inherit" }),
1425
1485
  editableElement: ({
1426
1486
  value,
1427
1487
  onChange,
@@ -1557,18 +1617,21 @@ function VariablesManagerPanel() {
1557
1617
  const {
1558
1618
  variables,
1559
1619
  isDirty,
1560
- hasValidationErrors,
1561
1620
  searchValue,
1621
+ isSaveDisabled,
1562
1622
  handleOnChange,
1563
1623
  createVariable: createVariable2,
1564
1624
  handleDeleteVariable,
1565
1625
  handleSave,
1566
1626
  isSaving,
1567
1627
  handleSearch,
1568
- setHasValidationErrors
1628
+ setIsSaving,
1629
+ setIsSaveDisabled
1569
1630
  } = useVariablesManagerState();
1570
1631
  const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
1571
- const [deleteConfirmation, setDeleteConfirmation] = (0, import_react10.useState)(null);
1632
+ const { createNavigationCallback, resetNavigation } = useErrorNavigation();
1633
+ const [deleteConfirmation, setDeleteConfirmation] = (0, import_react11.useState)(null);
1634
+ const [serverError, setServerError] = (0, import_react11.useState)(null);
1572
1635
  usePreventUnload(isDirty);
1573
1636
  const handleClosePanel = () => {
1574
1637
  if (isDirty) {
@@ -1577,7 +1640,7 @@ function VariablesManagerPanel() {
1577
1640
  }
1578
1641
  closePanel();
1579
1642
  };
1580
- const handleCreateVariable = (0, import_react10.useCallback)(
1643
+ const handleCreateVariable = (0, import_react11.useCallback)(
1581
1644
  (type, defaultName, defaultValue) => {
1582
1645
  const newId = createVariable2(type, defaultName, defaultValue);
1583
1646
  if (newId) {
@@ -1586,7 +1649,30 @@ function VariablesManagerPanel() {
1586
1649
  },
1587
1650
  [createVariable2, startAutoEdit]
1588
1651
  );
1589
- const handleDeleteVariableWithConfirmation = (0, import_react10.useCallback)(
1652
+ const handleSaveClick = async () => {
1653
+ try {
1654
+ setServerError(null);
1655
+ resetNavigation();
1656
+ return await handleSave();
1657
+ } catch (error) {
1658
+ const mappedError = mapServerError(error);
1659
+ const duplicatedIds = mappedError?.action?.data?.duplicatedIds;
1660
+ if (mappedError && "label" === mappedError.field) {
1661
+ if (duplicatedIds && mappedError.action) {
1662
+ mappedError.action.callback = createNavigationCallback(duplicatedIds, startAutoEdit, () => {
1663
+ setIsSaveDisabled(false);
1664
+ });
1665
+ }
1666
+ setServerError(mappedError);
1667
+ setIsSaveDisabled(true);
1668
+ resetNavigation();
1669
+ }
1670
+ return { success: false, error: mappedError };
1671
+ } finally {
1672
+ setIsSaving(false);
1673
+ }
1674
+ };
1675
+ const handleDeleteVariableWithConfirmation = (0, import_react11.useCallback)(
1590
1676
  (itemId) => {
1591
1677
  handleDeleteVariable(itemId);
1592
1678
  setDeleteConfirmation(null);
@@ -1595,7 +1681,7 @@ function VariablesManagerPanel() {
1595
1681
  );
1596
1682
  const menuActions = [
1597
1683
  {
1598
- name: (0, import_i18n10.__)("Delete", "elementor"),
1684
+ name: (0, import_i18n9.__)("Delete", "elementor"),
1599
1685
  icon: import_icons5.TrashIcon,
1600
1686
  color: "error.main",
1601
1687
  onClick: (itemId) => {
@@ -1606,14 +1692,14 @@ function VariablesManagerPanel() {
1606
1692
  }
1607
1693
  ];
1608
1694
  const hasVariables = Object.values(variables).some((variable) => !variable.deleted);
1609
- 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(
1695
+ return /* @__PURE__ */ React12.createElement(import_editor_ui3.ThemeProvider, null, /* @__PURE__ */ React12.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React12.createElement(
1610
1696
  import_editor_panels.PanelHeader,
1611
1697
  {
1612
1698
  sx: {
1613
1699
  height: "unset"
1614
1700
  }
1615
1701
  },
1616
- /* @__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(
1702
+ /* @__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_i18n9.__)("Variable Manager", "elementor"))), /* @__PURE__ */ React12.createElement(import_ui12.Stack, { direction: "row", gap: 0.5, alignItems: "center" }, /* @__PURE__ */ React12.createElement(
1617
1703
  VariableManagerCreateMenu,
1618
1704
  {
1619
1705
  onCreate: handleCreateVariable,
@@ -1636,7 +1722,7 @@ function VariablesManagerPanel() {
1636
1722
  display: "flex",
1637
1723
  flex: 1
1638
1724
  },
1639
- placeholder: (0, import_i18n10.__)("Search", "elementor"),
1725
+ placeholder: (0, import_i18n9.__)("Search", "elementor"),
1640
1726
  value: searchValue,
1641
1727
  onSearch: handleSearch
1642
1728
  }
@@ -1658,7 +1744,7 @@ function VariablesManagerPanel() {
1658
1744
  onChange: handleOnChange,
1659
1745
  autoEditVariableId,
1660
1746
  onAutoEditComplete: handleAutoEditComplete,
1661
- onFieldError: setHasValidationErrors
1747
+ onFieldError: setIsSaveDisabled
1662
1748
  }
1663
1749
  ),
1664
1750
  !hasVariables && searchValue && /* @__PURE__ */ React12.createElement(
@@ -1672,8 +1758,8 @@ function VariablesManagerPanel() {
1672
1758
  !hasVariables && !searchValue && /* @__PURE__ */ React12.createElement(
1673
1759
  EmptyState,
1674
1760
  {
1675
- title: (0, import_i18n10.__)("Create your first variable", "elementor"),
1676
- message: (0, import_i18n10.__)(
1761
+ title: (0, import_i18n9.__)("Create your first variable", "elementor"),
1762
+ message: (0, import_i18n9.__)(
1677
1763
  "Variables are saved attributes that you can apply anywhere on your site.",
1678
1764
  "elementor"
1679
1765
  ),
@@ -1682,17 +1768,45 @@ function VariablesManagerPanel() {
1682
1768
  }
1683
1769
  )
1684
1770
  ), /* @__PURE__ */ React12.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React12.createElement(
1685
- import_ui12.Button,
1771
+ import_ui12.Infotip,
1686
1772
  {
1687
- fullWidth: true,
1688
- size: "small",
1689
- color: "global",
1690
- variant: "contained",
1691
- disabled: !isDirty || hasValidationErrors || isSaving,
1692
- onClick: handleSave,
1693
- loading: isSaving
1773
+ placement: "right",
1774
+ open: !!serverError,
1775
+ content: serverError ? /* @__PURE__ */ React12.createElement(
1776
+ import_ui12.Alert,
1777
+ {
1778
+ severity: "error",
1779
+ action: serverError.action ? /* @__PURE__ */ React12.createElement(import_ui12.AlertAction, { onClick: serverError.action.callback }, serverError.action.label) : void 0,
1780
+ icon: /* @__PURE__ */ React12.createElement(import_icons5.AlertTriangleFilledIcon, null)
1781
+ },
1782
+ /* @__PURE__ */ React12.createElement(import_ui12.AlertTitle, null, serverError.message),
1783
+ serverError.action?.message
1784
+ ) : null,
1785
+ arrow: false,
1786
+ slotProps: {
1787
+ popper: {
1788
+ modifiers: [
1789
+ {
1790
+ name: "offset",
1791
+ options: { offset: [-10, 10] }
1792
+ }
1793
+ ]
1794
+ }
1795
+ }
1694
1796
  },
1695
- (0, import_i18n10.__)("Save changes", "elementor")
1797
+ /* @__PURE__ */ React12.createElement(
1798
+ import_ui12.Button,
1799
+ {
1800
+ fullWidth: true,
1801
+ size: "small",
1802
+ color: "global",
1803
+ variant: "contained",
1804
+ disabled: isSaveDisabled || !isDirty || isSaving,
1805
+ onClick: handleSaveClick,
1806
+ loading: isSaving
1807
+ },
1808
+ (0, import_i18n9.__)("Save changes", "elementor")
1809
+ )
1696
1810
  ))), deleteConfirmation && /* @__PURE__ */ React12.createElement(
1697
1811
  DeleteConfirmationDialog,
1698
1812
  {
@@ -1701,32 +1815,33 @@ function VariablesManagerPanel() {
1701
1815
  onConfirm: () => handleDeleteVariableWithConfirmation(deleteConfirmation.id),
1702
1816
  closeDialog: () => setDeleteConfirmation(null)
1703
1817
  }
1704
- )), 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(
1818
+ ), isSaveChangesDialogOpen && /* @__PURE__ */ React12.createElement(import_editor_ui3.SaveChangesDialog, null, /* @__PURE__ */ React12.createElement(import_editor_ui3.SaveChangesDialog.Title, { onClose: closeSaveChangesDialog }, (0, import_i18n9.__)("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_i18n9.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React12.createElement(
1705
1819
  import_editor_ui3.SaveChangesDialog.Actions,
1706
1820
  {
1707
1821
  actions: {
1708
1822
  discard: {
1709
- label: (0, import_i18n10.__)("Discard", "elementor"),
1823
+ label: (0, import_i18n9.__)("Discard", "elementor"),
1710
1824
  action: () => {
1711
1825
  closeSaveChangesDialog();
1712
1826
  closePanel();
1713
1827
  }
1714
1828
  },
1715
1829
  confirm: {
1716
- label: (0, import_i18n10.__)("Save", "elementor"),
1830
+ label: (0, import_i18n9.__)("Save", "elementor"),
1717
1831
  action: async () => {
1718
- await handleSave();
1832
+ const result = await handleSaveClick();
1719
1833
  closeSaveChangesDialog();
1720
- closePanel();
1834
+ if (result?.success) {
1835
+ closePanel();
1836
+ }
1721
1837
  }
1722
1838
  }
1723
1839
  }
1724
1840
  }
1725
1841
  )));
1726
1842
  }
1727
- 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"))));
1728
1843
  var usePreventUnload = (isDirty) => {
1729
- (0, import_react10.useEffect)(() => {
1844
+ (0, import_react11.useEffect)(() => {
1730
1845
  const handleBeforeUnload = (event) => {
1731
1846
  if (isDirty) {
1732
1847
  event.preventDefault();
@@ -1744,7 +1859,7 @@ var React31 = __toESM(require("react"));
1744
1859
  var import_editor_controls11 = require("@elementor/editor-controls");
1745
1860
 
1746
1861
  // src/components/ui/variable/assigned-variable.tsx
1747
- var import_react17 = require("react");
1862
+ var import_react18 = require("react");
1748
1863
  var React22 = __toESM(require("react"));
1749
1864
  var import_editor_controls6 = require("@elementor/editor-controls");
1750
1865
  var import_icons12 = require("@elementor/icons");
@@ -1768,31 +1883,31 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
1768
1883
 
1769
1884
  // src/components/variable-selection-popover.tsx
1770
1885
  var React20 = __toESM(require("react"));
1771
- var import_react16 = require("react");
1886
+ var import_react17 = require("react");
1772
1887
  var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
1773
1888
 
1774
1889
  // src/context/variable-selection-popover.context.tsx
1775
1890
  var React13 = __toESM(require("react"));
1776
- var import_react11 = require("react");
1891
+ var import_react12 = require("react");
1777
1892
  var import_ui13 = require("@elementor/ui");
1778
- var PopoverContentRefContext = (0, import_react11.createContext)(null);
1893
+ var PopoverContentRefContext = (0, import_react12.createContext)(null);
1779
1894
  var PopoverContentRefContextProvider = ({ children }) => {
1780
- const [anchorRef, setAnchorRef] = (0, import_react11.useState)(null);
1895
+ const [anchorRef, setAnchorRef] = (0, import_react12.useState)(null);
1781
1896
  return /* @__PURE__ */ React13.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React13.createElement(import_ui13.Box, { ref: setAnchorRef }, children));
1782
1897
  };
1783
1898
  var usePopoverContentRef = () => {
1784
- return (0, import_react11.useContext)(PopoverContentRefContext);
1899
+ return (0, import_react12.useContext)(PopoverContentRefContext);
1785
1900
  };
1786
1901
 
1787
1902
  // src/components/variable-creation.tsx
1788
1903
  var React15 = __toESM(require("react"));
1789
- var import_react12 = require("react");
1904
+ var import_react13 = require("react");
1790
1905
  var import_editor_controls4 = require("@elementor/editor-controls");
1791
1906
  var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
1792
1907
  var import_editor_ui4 = require("@elementor/editor-ui");
1793
1908
  var import_icons6 = require("@elementor/icons");
1794
1909
  var import_ui15 = require("@elementor/ui");
1795
- var import_i18n11 = require("@wordpress/i18n");
1910
+ var import_i18n10 = require("@wordpress/i18n");
1796
1911
 
1797
1912
  // src/hooks/use-initial-value.ts
1798
1913
  var import_editor_controls2 = require("@elementor/editor-controls");
@@ -1866,10 +1981,10 @@ var VariableCreation = ({ onGoBack, onClose }) => {
1866
1981
  const { setVariableValue: setVariable, path } = useVariableBoundProp();
1867
1982
  const { propType } = (0, import_editor_controls4.useBoundProp)();
1868
1983
  const initialValue = useInitialValue();
1869
- const [value, setValue] = (0, import_react12.useState)(initialValue);
1870
- const [label, setLabel] = (0, import_react12.useState)("");
1871
- const [errorMessage, setErrorMessage] = (0, import_react12.useState)("");
1872
- const [valueFieldError, setValueFieldError] = (0, import_react12.useState)("");
1984
+ const [value, setValue] = (0, import_react13.useState)(initialValue);
1985
+ const [label, setLabel] = (0, import_react13.useState)("");
1986
+ const [errorMessage, setErrorMessage] = (0, import_react13.useState)("");
1987
+ const [valueFieldError, setValueFieldError] = (0, import_react13.useState)("");
1873
1988
  const { labelFieldError, setLabelFieldError } = useLabelError();
1874
1989
  const resetFields = () => {
1875
1990
  setValue("");
@@ -1923,15 +2038,15 @@ var VariableCreation = ({ onGoBack, onClose }) => {
1923
2038
  return /* @__PURE__ */ React15.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React15.createElement(
1924
2039
  import_editor_ui4.PopoverHeader,
1925
2040
  {
1926
- 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 })),
1927
- title: (0, import_i18n11.__)("Create variable", "elementor"),
2041
+ icon: /* @__PURE__ */ React15.createElement(React15.Fragment, null, onGoBack && /* @__PURE__ */ React15.createElement(import_ui15.IconButton, { size: SIZE2, "aria-label": (0, import_i18n10.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React15.createElement(import_icons6.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React15.createElement(VariableIcon, { fontSize: SIZE2 })),
2042
+ title: (0, import_i18n10.__)("Create variable", "elementor"),
1928
2043
  onClose: closePopover
1929
2044
  }
1930
2045
  ), /* @__PURE__ */ React15.createElement(import_ui15.Divider, null), /* @__PURE__ */ React15.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React15.createElement(
1931
2046
  FormField,
1932
2047
  {
1933
2048
  id: "variable-label",
1934
- label: (0, import_i18n11.__)("Name", "elementor"),
2049
+ label: (0, import_i18n10.__)("Name", "elementor"),
1935
2050
  errorMsg: labelFieldError?.message,
1936
2051
  noticeMsg: labelHint(label)
1937
2052
  },
@@ -1953,7 +2068,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
1953
2068
  }
1954
2069
  }
1955
2070
  )
1956
- ), /* @__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(
2071
+ ), /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n10.__)("Value", "elementor") }, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React15.createElement(
1957
2072
  ValueField,
1958
2073
  {
1959
2074
  value,
@@ -1974,41 +2089,41 @@ var VariableCreation = ({ onGoBack, onClose }) => {
1974
2089
  disabled: isSubmitDisabled,
1975
2090
  onClick: handleCreateAndTrack
1976
2091
  },
1977
- (0, import_i18n11.__)("Create", "elementor")
2092
+ (0, import_i18n10.__)("Create", "elementor")
1978
2093
  )));
1979
2094
  };
1980
2095
 
1981
2096
  // src/components/variable-edit.tsx
1982
2097
  var React17 = __toESM(require("react"));
1983
- var import_react14 = require("react");
2098
+ var import_react15 = require("react");
1984
2099
  var import_editor_controls5 = require("@elementor/editor-controls");
1985
2100
  var import_editor_current_user2 = require("@elementor/editor-current-user");
1986
2101
  var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
1987
2102
  var import_editor_ui5 = require("@elementor/editor-ui");
1988
2103
  var import_icons8 = require("@elementor/icons");
1989
2104
  var import_ui17 = require("@elementor/ui");
1990
- var import_i18n13 = require("@wordpress/i18n");
2105
+ var import_i18n12 = require("@wordpress/i18n");
1991
2106
 
1992
2107
  // src/components/ui/edit-confirmation-dialog.tsx
1993
2108
  var React16 = __toESM(require("react"));
1994
- var import_react13 = require("react");
2109
+ var import_react14 = require("react");
1995
2110
  var import_icons7 = require("@elementor/icons");
1996
2111
  var import_ui16 = require("@elementor/ui");
1997
- var import_i18n12 = require("@wordpress/i18n");
2112
+ var import_i18n11 = require("@wordpress/i18n");
1998
2113
  var EDIT_CONFIRMATION_DIALOG_ID = "edit-confirmation-dialog";
1999
2114
  var EditConfirmationDialog = ({
2000
2115
  closeDialog,
2001
2116
  onConfirm,
2002
2117
  onSuppressMessage
2003
2118
  }) => {
2004
- const [dontShowAgain, setDontShowAgain] = (0, import_react13.useState)(false);
2119
+ const [dontShowAgain, setDontShowAgain] = (0, import_react14.useState)(false);
2005
2120
  const handleSave = () => {
2006
2121
  if (dontShowAgain) {
2007
2122
  onSuppressMessage?.();
2008
2123
  }
2009
2124
  onConfirm?.();
2010
2125
  };
2011
- 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.__)(
2126
+ 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_i18n11.__)("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_i18n11.__)(
2012
2127
  "Don't worry - all other changes you make will wait until you publish your site.",
2013
2128
  "elementor"
2014
2129
  ))), /* @__PURE__ */ React16.createElement(import_ui16.DialogActions, { sx: { justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React16.createElement(
@@ -2022,31 +2137,32 @@ var EditConfirmationDialog = ({
2022
2137
  size: "small"
2023
2138
  }
2024
2139
  ),
2025
- label: /* @__PURE__ */ React16.createElement(import_ui16.Typography, { variant: "body2" }, (0, import_i18n12.__)("Don't show me again", "elementor"))
2140
+ label: /* @__PURE__ */ React16.createElement(import_ui16.Typography, { variant: "body2" }, (0, import_i18n11.__)("Don't show me again", "elementor"))
2026
2141
  }
2027
- ), /* @__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")))));
2142
+ ), /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement(import_ui16.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n11.__)("Keep editing", "elementor")), /* @__PURE__ */ React16.createElement(import_ui16.Button, { variant: "contained", color: "secondary", onClick: handleSave, sx: { ml: 1 } }, (0, import_i18n11.__)("Save", "elementor")))));
2028
2143
  };
2029
2144
 
2030
2145
  // src/components/variable-edit.tsx
2031
2146
  var SIZE3 = "tiny";
2147
+ var DELETE_LABEL = (0, import_i18n12.__)("Delete variable", "elementor");
2032
2148
  var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2033
2149
  const { icon: VariableIcon, valueField: ValueField, variableType } = useVariableType();
2034
2150
  const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
2035
2151
  const { propType } = (0, import_editor_controls5.useBoundProp)();
2036
2152
  const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
2037
- const [deleteConfirmation, setDeleteConfirmation] = (0, import_react14.useState)(false);
2038
- const [editConfirmation, setEditConfirmation] = (0, import_react14.useState)(false);
2039
- const [errorMessage, setErrorMessage] = (0, import_react14.useState)("");
2040
- const [valueFieldError, setValueFieldError] = (0, import_react14.useState)("");
2153
+ const [deleteConfirmation, setDeleteConfirmation] = (0, import_react15.useState)(false);
2154
+ const [editConfirmation, setEditConfirmation] = (0, import_react15.useState)(false);
2155
+ const [errorMessage, setErrorMessage] = (0, import_react15.useState)("");
2156
+ const [valueFieldError, setValueFieldError] = (0, import_react15.useState)("");
2041
2157
  const { labelFieldError, setLabelFieldError } = useLabelError();
2042
2158
  const variable = useVariable(editId);
2043
2159
  if (!variable) {
2044
2160
  throw new Error(`Global ${variableType} variable not found`);
2045
2161
  }
2046
2162
  const userPermissions = usePermissions();
2047
- const [value, setValue] = (0, import_react14.useState)(() => variable.value);
2048
- const [label, setLabel] = (0, import_react14.useState)(() => variable.label);
2049
- (0, import_react14.useEffect)(() => {
2163
+ const [value, setValue] = (0, import_react15.useState)(() => variable.value);
2164
+ const [label, setLabel] = (0, import_react15.useState)(() => variable.label);
2165
+ (0, import_react15.useEffect)(() => {
2050
2166
  styleVariablesRepository.update({
2051
2167
  [editId]: {
2052
2168
  ...variable,
@@ -2109,16 +2225,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2109
2225
  const actions = [];
2110
2226
  if (userPermissions.canDelete()) {
2111
2227
  actions.push(
2112
- /* @__PURE__ */ React17.createElement(
2113
- import_ui17.IconButton,
2114
- {
2115
- key: "delete",
2116
- size: SIZE3,
2117
- "aria-label": (0, import_i18n13.__)("Delete", "elementor"),
2118
- onClick: handleDeleteConfirmation
2119
- },
2120
- /* @__PURE__ */ React17.createElement(import_icons8.TrashIcon, { fontSize: SIZE3 })
2121
- )
2228
+ /* @__PURE__ */ React17.createElement(import_ui17.Tooltip, { key: "delete", placement: "top", title: DELETE_LABEL }, /* @__PURE__ */ React17.createElement(import_ui17.IconButton, { size: SIZE3, onClick: handleDeleteConfirmation, "aria-label": DELETE_LABEL }, /* @__PURE__ */ React17.createElement(import_icons8.TrashIcon, { fontSize: SIZE3 })))
2122
2229
  );
2123
2230
  }
2124
2231
  const hasEmptyFields = () => {
@@ -2140,13 +2247,13 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2140
2247
  return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
2141
2248
  import_editor_ui5.PopoverHeader,
2142
2249
  {
2143
- title: (0, import_i18n13.__)("Edit variable", "elementor"),
2250
+ title: (0, import_i18n12.__)("Edit variable", "elementor"),
2144
2251
  onClose,
2145
2252
  icon: /* @__PURE__ */ React17.createElement(React17.Fragment, null, onGoBack && /* @__PURE__ */ React17.createElement(
2146
2253
  import_ui17.IconButton,
2147
2254
  {
2148
2255
  size: SIZE3,
2149
- "aria-label": (0, import_i18n13.__)("Go Back", "elementor"),
2256
+ "aria-label": (0, import_i18n12.__)("Go Back", "elementor"),
2150
2257
  onClick: onGoBack
2151
2258
  },
2152
2259
  /* @__PURE__ */ React17.createElement(import_icons8.ArrowLeftIcon, { fontSize: SIZE3 })
@@ -2157,7 +2264,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2157
2264
  FormField,
2158
2265
  {
2159
2266
  id: "variable-label",
2160
- label: (0, import_i18n13.__)("Name", "elementor"),
2267
+ label: (0, import_i18n12.__)("Name", "elementor"),
2161
2268
  errorMsg: labelFieldError?.message,
2162
2269
  noticeMsg: labelHint(label)
2163
2270
  },
@@ -2179,7 +2286,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2179
2286
  }
2180
2287
  }
2181
2288
  )
2182
- ), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n13.__)("Value", "elementor") }, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
2289
+ ), /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n12.__)("Value", "elementor") }, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
2183
2290
  ValueField,
2184
2291
  {
2185
2292
  value,
@@ -2191,7 +2298,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2191
2298
  onValidationChange: setValueFieldError,
2192
2299
  propType
2193
2300
  }
2194
- ))), 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(
2301
+ ))), 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_i18n12.__)("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React17.createElement(
2195
2302
  DeleteConfirmationDialog,
2196
2303
  {
2197
2304
  open: true,
@@ -2211,20 +2318,21 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2211
2318
 
2212
2319
  // src/components/variables-selection.tsx
2213
2320
  var React19 = __toESM(require("react"));
2214
- var import_react15 = require("react");
2321
+ var import_react16 = require("react");
2215
2322
  var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
2216
2323
  var import_editor_ui7 = require("@elementor/editor-ui");
2217
2324
  var import_icons10 = require("@elementor/icons");
2218
2325
  var import_ui20 = require("@elementor/ui");
2219
- var import_i18n15 = require("@wordpress/i18n");
2326
+ var import_i18n14 = require("@wordpress/i18n");
2220
2327
 
2221
2328
  // src/components/ui/menu-item-content.tsx
2222
2329
  var React18 = __toESM(require("react"));
2223
2330
  var import_editor_ui6 = require("@elementor/editor-ui");
2224
2331
  var import_icons9 = require("@elementor/icons");
2225
2332
  var import_ui18 = require("@elementor/ui");
2226
- var import_i18n14 = require("@wordpress/i18n");
2333
+ var import_i18n13 = require("@wordpress/i18n");
2227
2334
  var SIZE4 = "tiny";
2335
+ var EDIT_LABEL = (0, import_i18n13.__)("Edit variable", "elementor");
2228
2336
  var MenuItemContent = ({ item }) => {
2229
2337
  const onEdit = item.onEdit;
2230
2338
  return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_ui18.ListItemIcon, null, item.icon), /* @__PURE__ */ React18.createElement(
@@ -2260,7 +2368,7 @@ var MenuItemContent = ({ item }) => {
2260
2368
  maxWidth: "50%"
2261
2369
  }
2262
2370
  )
2263
- ), !!onEdit && /* @__PURE__ */ React18.createElement(
2371
+ ), !!onEdit && /* @__PURE__ */ React18.createElement(import_ui18.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React18.createElement(
2264
2372
  import_ui18.IconButton,
2265
2373
  {
2266
2374
  sx: { mx: 1, opacity: "0" },
@@ -2268,10 +2376,10 @@ var MenuItemContent = ({ item }) => {
2268
2376
  e.stopPropagation();
2269
2377
  onEdit(item.value);
2270
2378
  },
2271
- "aria-label": (0, import_i18n14.__)("Edit", "elementor")
2379
+ "aria-label": EDIT_LABEL
2272
2380
  },
2273
2381
  /* @__PURE__ */ React18.createElement(import_icons9.EditIcon, { color: "action", fontSize: SIZE4 })
2274
- ));
2382
+ )));
2275
2383
  };
2276
2384
 
2277
2385
  // src/components/ui/styled-menu-list.tsx
@@ -2308,10 +2416,12 @@ var VariablesStyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ t
2308
2416
 
2309
2417
  // src/components/variables-selection.tsx
2310
2418
  var SIZE5 = "tiny";
2419
+ var CREATE_LABEL = (0, import_i18n14.__)("Create variable", "elementor");
2420
+ var MANAGER_LABEL = (0, import_i18n14.__)("Variable Manager", "elementor");
2311
2421
  var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
2312
2422
  const { icon: VariableIcon, startIcon, variableType, propTypeUtil } = useVariableType();
2313
2423
  const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
2314
- const [searchValue, setSearchValue] = (0, import_react15.useState)("");
2424
+ const [searchValue, setSearchValue] = (0, import_react16.useState)("");
2315
2425
  const {
2316
2426
  list: variables,
2317
2427
  hasMatches: hasSearchResults,
@@ -2338,12 +2448,30 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
2338
2448
  const actions = [];
2339
2449
  if (onAdd) {
2340
2450
  actions.push(
2341
- /* @__PURE__ */ React19.createElement(import_ui20.IconButton, { id: "add-variable-button", key: "add", size: SIZE5, onClick: onAddAndTrack }, /* @__PURE__ */ React19.createElement(import_icons10.PlusIcon, { fontSize: SIZE5 }))
2451
+ /* @__PURE__ */ React19.createElement(import_ui20.Tooltip, { key: "add", placement: "top", title: CREATE_LABEL }, /* @__PURE__ */ React19.createElement(
2452
+ import_ui20.IconButton,
2453
+ {
2454
+ id: "add-variable-button",
2455
+ size: SIZE5,
2456
+ onClick: onAddAndTrack,
2457
+ "aria-label": CREATE_LABEL
2458
+ },
2459
+ /* @__PURE__ */ React19.createElement(import_icons10.PlusIcon, { fontSize: SIZE5 })
2460
+ ))
2342
2461
  );
2343
2462
  }
2344
2463
  if (onSettings) {
2345
2464
  actions.push(
2346
- /* @__PURE__ */ React19.createElement(import_ui20.IconButton, { id: "variables-manager-button", key: "settings", size: SIZE5, onClick: onSettings }, /* @__PURE__ */ React19.createElement(import_icons10.SettingsIcon, { fontSize: SIZE5 }))
2465
+ /* @__PURE__ */ React19.createElement(import_ui20.Tooltip, { key: "settings", placement: "top", title: MANAGER_LABEL }, /* @__PURE__ */ React19.createElement(
2466
+ import_ui20.IconButton,
2467
+ {
2468
+ id: "variables-manager-button",
2469
+ size: SIZE5,
2470
+ onClick: onSettings,
2471
+ "aria-label": MANAGER_LABEL
2472
+ },
2473
+ /* @__PURE__ */ React19.createElement(import_icons10.SettingsIcon, { fontSize: SIZE5 })
2474
+ ))
2347
2475
  );
2348
2476
  }
2349
2477
  const StartIcon = startIcon || (() => /* @__PURE__ */ React19.createElement(VariableIcon, { fontSize: SIZE5 }));
@@ -2361,15 +2489,15 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
2361
2489
  const handleClearSearch = () => {
2362
2490
  setSearchValue("");
2363
2491
  };
2364
- const noVariableTitle = (0, import_i18n15.sprintf)(
2492
+ const noVariableTitle = (0, import_i18n14.sprintf)(
2365
2493
  /* translators: %s: Variable Type. */
2366
- (0, import_i18n15.__)("Create your first %s variable", "elementor"),
2494
+ (0, import_i18n14.__)("Create your first %s variable", "elementor"),
2367
2495
  variableType
2368
2496
  );
2369
2497
  return /* @__PURE__ */ React19.createElement(import_editor_editing_panel4.PopoverBody, null, /* @__PURE__ */ React19.createElement(
2370
2498
  import_editor_ui7.PopoverHeader,
2371
2499
  {
2372
- title: (0, import_i18n15.__)("Variables", "elementor"),
2500
+ title: (0, import_i18n14.__)("Variables", "elementor"),
2373
2501
  icon: /* @__PURE__ */ React19.createElement(import_icons10.ColorFilterIcon, { fontSize: SIZE5 }),
2374
2502
  onClose: closePopover,
2375
2503
  actions
@@ -2379,7 +2507,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
2379
2507
  {
2380
2508
  value: searchValue,
2381
2509
  onSearch: handleSearch,
2382
- placeholder: (0, import_i18n15.__)("Search", "elementor")
2510
+ placeholder: (0, import_i18n14.__)("Search", "elementor")
2383
2511
  }
2384
2512
  ), /* @__PURE__ */ React19.createElement(import_ui20.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React19.createElement(
2385
2513
  import_editor_ui7.PopoverMenuList,
@@ -2404,7 +2532,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
2404
2532
  EmptyState,
2405
2533
  {
2406
2534
  title: noVariableTitle,
2407
- message: (0, import_i18n15.__)(
2535
+ message: (0, import_i18n14.__)(
2408
2536
  "Variables are saved attributes that you can apply anywhere on your site.",
2409
2537
  "elementor"
2410
2538
  ),
@@ -2414,8 +2542,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
2414
2542
  ), hasNoCompatibleVariables && /* @__PURE__ */ React19.createElement(
2415
2543
  EmptyState,
2416
2544
  {
2417
- title: (0, import_i18n15.__)("No compatible variables", "elementor"),
2418
- message: (0, import_i18n15.__)(
2545
+ title: (0, import_i18n14.__)("No compatible variables", "elementor"),
2546
+ message: (0, import_i18n14.__)(
2419
2547
  "Looks like none of your variables work with this control. Create a new variable to use it here.",
2420
2548
  "elementor"
2421
2549
  ),
@@ -2430,8 +2558,8 @@ var VIEW_LIST = "list";
2430
2558
  var VIEW_ADD = "add";
2431
2559
  var VIEW_EDIT = "edit";
2432
2560
  var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
2433
- const [currentView, setCurrentView] = (0, import_react16.useState)(VIEW_LIST);
2434
- const [editId, setEditId] = (0, import_react16.useState)("");
2561
+ const [currentView, setCurrentView] = (0, import_react17.useState)(VIEW_LIST);
2562
+ const [editId, setEditId] = (0, import_react17.useState)("");
2435
2563
  const { open } = usePanelActions();
2436
2564
  const onSettingsAvailable = (0, import_editor_v1_adapters2.isExperimentActive)("e_variables_manager") ? () => {
2437
2565
  open();
@@ -2513,13 +2641,14 @@ function RenderView(props) {
2513
2641
  var React21 = __toESM(require("react"));
2514
2642
  var import_icons11 = require("@elementor/icons");
2515
2643
  var import_ui21 = require("@elementor/ui");
2516
- var import_i18n16 = require("@wordpress/i18n");
2644
+ var import_i18n15 = require("@wordpress/i18n");
2517
2645
  var SIZE6 = "tiny";
2646
+ var UNLINK_LABEL = (0, import_i18n15.__)("Unlink variable", "elementor");
2518
2647
  var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
2519
2648
  const actions = [];
2520
2649
  if (onUnlink) {
2521
2650
  actions.push(
2522
- /* @__PURE__ */ React21.createElement(import_ui21.IconButton, { key: "unlink", size: SIZE6, onClick: onUnlink, "aria-label": (0, import_i18n16.__)("Unlink", "elementor") }, /* @__PURE__ */ React21.createElement(import_icons11.DetachIcon, { fontSize: SIZE6 }))
2651
+ /* @__PURE__ */ React21.createElement(import_ui21.Tooltip, { key: "unlink", title: UNLINK_LABEL, placement: "bottom" }, /* @__PURE__ */ React21.createElement(import_ui21.IconButton, { size: SIZE6, onClick: onUnlink, "aria-label": UNLINK_LABEL }, /* @__PURE__ */ React21.createElement(import_icons11.DetachIcon, { fontSize: SIZE6 })))
2523
2652
  );
2524
2653
  }
2525
2654
  return /* @__PURE__ */ React21.createElement(import_ui21.Tooltip, { title: label, placement: "top" }, /* @__PURE__ */ React21.createElement(
@@ -2539,8 +2668,8 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
2539
2668
  var AssignedVariable = ({ variable, propTypeKey }) => {
2540
2669
  const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
2541
2670
  const { setValue } = (0, import_editor_controls6.useBoundProp)();
2542
- const anchorRef = (0, import_react17.useRef)(null);
2543
- const popupId = (0, import_react17.useId)();
2671
+ const anchorRef = (0, import_react18.useRef)(null);
2672
+ const popupId = (0, import_react18.useId)();
2544
2673
  const popupState = (0, import_ui22.usePopupState)({
2545
2674
  variant: "popover",
2546
2675
  popupId: `elementor-variables-list-${popupId}`
@@ -2580,19 +2709,19 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
2580
2709
 
2581
2710
  // src/components/ui/variable/deleted-variable.tsx
2582
2711
  var React26 = __toESM(require("react"));
2583
- var import_react19 = require("react");
2712
+ var import_react20 = require("react");
2584
2713
  var import_editor_controls8 = require("@elementor/editor-controls");
2585
2714
  var import_ui26 = require("@elementor/ui");
2586
- var import_i18n19 = require("@wordpress/i18n");
2715
+ var import_i18n18 = require("@wordpress/i18n");
2587
2716
 
2588
2717
  // src/components/variable-restore.tsx
2589
2718
  var React23 = __toESM(require("react"));
2590
- var import_react18 = require("react");
2719
+ var import_react19 = require("react");
2591
2720
  var import_editor_controls7 = require("@elementor/editor-controls");
2592
2721
  var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
2593
2722
  var import_editor_ui8 = require("@elementor/editor-ui");
2594
2723
  var import_ui23 = require("@elementor/ui");
2595
- var import_i18n17 = require("@wordpress/i18n");
2724
+ var import_i18n16 = require("@wordpress/i18n");
2596
2725
  var SIZE7 = "tiny";
2597
2726
  var VariableRestore = ({ variableId, onClose, onSubmit }) => {
2598
2727
  const { icon: VariableIcon, valueField: ValueField, variableType } = useVariableType();
@@ -2602,10 +2731,10 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
2602
2731
  if (!variable) {
2603
2732
  throw new Error(`Global ${variableType} variable not found`);
2604
2733
  }
2605
- const [errorMessage, setErrorMessage] = (0, import_react18.useState)("");
2606
- const [valueFieldError, setValueFieldError] = (0, import_react18.useState)("");
2607
- const [label, setLabel] = (0, import_react18.useState)(variable.label);
2608
- const [value, setValue] = (0, import_react18.useState)(variable.value);
2734
+ const [errorMessage, setErrorMessage] = (0, import_react19.useState)("");
2735
+ const [valueFieldError, setValueFieldError] = (0, import_react19.useState)("");
2736
+ const [label, setLabel] = (0, import_react19.useState)(variable.label);
2737
+ const [value, setValue] = (0, import_react19.useState)(variable.value);
2609
2738
  const { labelFieldError, setLabelFieldError } = useLabelError({
2610
2739
  value: variable.label,
2611
2740
  message: ERROR_MESSAGES.DUPLICATED_LABEL
@@ -2647,14 +2776,14 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
2647
2776
  import_editor_ui8.PopoverHeader,
2648
2777
  {
2649
2778
  icon: /* @__PURE__ */ React23.createElement(VariableIcon, { fontSize: SIZE7 }),
2650
- title: (0, import_i18n17.__)("Restore variable", "elementor"),
2779
+ title: (0, import_i18n16.__)("Restore variable", "elementor"),
2651
2780
  onClose
2652
2781
  }
2653
2782
  ), /* @__PURE__ */ React23.createElement(import_ui23.Divider, null), /* @__PURE__ */ React23.createElement(import_editor_controls7.PopoverContent, { p: 2 }, /* @__PURE__ */ React23.createElement(
2654
2783
  FormField,
2655
2784
  {
2656
2785
  id: "variable-label",
2657
- label: (0, import_i18n17.__)("Name", "elementor"),
2786
+ label: (0, import_i18n16.__)("Name", "elementor"),
2658
2787
  errorMsg: labelFieldError?.message,
2659
2788
  noticeMsg: labelHint(label)
2660
2789
  },
@@ -2676,7 +2805,7 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
2676
2805
  }
2677
2806
  }
2678
2807
  )
2679
- ), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n17.__)("Value", "elementor") }, /* @__PURE__ */ React23.createElement(import_ui23.Typography, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
2808
+ ), /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n16.__)("Value", "elementor") }, /* @__PURE__ */ React23.createElement(import_ui23.Typography, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
2680
2809
  ValueField,
2681
2810
  {
2682
2811
  value,
@@ -2688,13 +2817,13 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
2688
2817
  onValidationChange: setValueFieldError,
2689
2818
  propType
2690
2819
  }
2691
- ))), errorMessage && /* @__PURE__ */ React23.createElement(import_ui23.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React23.createElement(import_ui23.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React23.createElement(import_ui23.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n17.__)("Restore", "elementor")))));
2820
+ ))), errorMessage && /* @__PURE__ */ React23.createElement(import_ui23.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React23.createElement(import_ui23.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React23.createElement(import_ui23.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n16.__)("Restore", "elementor")))));
2692
2821
  };
2693
2822
 
2694
2823
  // src/components/ui/deleted-variable-alert.tsx
2695
2824
  var React24 = __toESM(require("react"));
2696
2825
  var import_ui24 = require("@elementor/ui");
2697
- var import_i18n18 = require("@wordpress/i18n");
2826
+ var import_i18n17 = require("@wordpress/i18n");
2698
2827
  var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
2699
2828
  return /* @__PURE__ */ React24.createElement(import_ui24.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React24.createElement(
2700
2829
  import_ui24.Alert,
@@ -2702,11 +2831,11 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
2702
2831
  variant: "standard",
2703
2832
  severity: "warning",
2704
2833
  onClose,
2705
- action: /* @__PURE__ */ React24.createElement(React24.Fragment, null, onUnlink && /* @__PURE__ */ React24.createElement(import_ui24.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n18.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React24.createElement(import_ui24.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n18.__)("Restore", "elementor"))),
2834
+ action: /* @__PURE__ */ React24.createElement(React24.Fragment, null, onUnlink && /* @__PURE__ */ React24.createElement(import_ui24.AlertAction, { variant: "contained", onClick: onUnlink }, (0, import_i18n17.__)("Unlink", "elementor")), onRestore && /* @__PURE__ */ React24.createElement(import_ui24.AlertAction, { variant: "outlined", onClick: onRestore }, (0, import_i18n17.__)("Restore", "elementor"))),
2706
2835
  sx: { maxWidth: 300 }
2707
2836
  },
2708
- /* @__PURE__ */ React24.createElement(import_ui24.AlertTitle, null, (0, import_i18n18.__)("Deleted variable", "elementor")),
2709
- /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n18.__)("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", (0, import_i18n18.__)(
2837
+ /* @__PURE__ */ React24.createElement(import_ui24.AlertTitle, null, (0, import_i18n17.__)("Deleted variable", "elementor")),
2838
+ /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n17.__)("The variable", "elementor"), "\xA0'", /* @__PURE__ */ React24.createElement(import_ui24.Typography, { variant: "body2", component: "span", sx: { lineBreak: "anywhere" } }, label), "'\xA0", (0, import_i18n17.__)(
2710
2839
  "has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.",
2711
2840
  "elementor"
2712
2841
  ))
@@ -2749,11 +2878,11 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
2749
2878
  const { propTypeUtil } = getVariableType(propTypeKey);
2750
2879
  const boundProp = (0, import_editor_controls8.useBoundProp)();
2751
2880
  const userPermissions = usePermissions();
2752
- const [showInfotip, setShowInfotip] = (0, import_react19.useState)(false);
2881
+ const [showInfotip, setShowInfotip] = (0, import_react20.useState)(false);
2753
2882
  const toggleInfotip = () => setShowInfotip((prev) => !prev);
2754
2883
  const closeInfotip = () => setShowInfotip(false);
2755
- const deletedChipAnchorRef = (0, import_react19.useRef)(null);
2756
- const popupId = (0, import_react19.useId)();
2884
+ const deletedChipAnchorRef = (0, import_react20.useRef)(null);
2885
+ const popupId = (0, import_react20.useId)();
2757
2886
  const popupState = (0, import_ui26.usePopupState)({
2758
2887
  variant: "popover",
2759
2888
  popupId: `elementor-variables-restore-${popupId}`
@@ -2813,7 +2942,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
2813
2942
  {
2814
2943
  label: variable.label,
2815
2944
  onClick: toggleInfotip,
2816
- suffix: (0, import_i18n19.__)("deleted", "elementor")
2945
+ suffix: (0, import_i18n18.__)("deleted", "elementor")
2817
2946
  }
2818
2947
  )
2819
2948
  ), /* @__PURE__ */ React26.createElement(
@@ -2840,24 +2969,24 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
2840
2969
 
2841
2970
  // src/components/ui/variable/mismatch-variable.tsx
2842
2971
  var React28 = __toESM(require("react"));
2843
- var import_react20 = require("react");
2972
+ var import_react21 = require("react");
2844
2973
  var import_editor_controls9 = require("@elementor/editor-controls");
2845
2974
  var import_ui28 = require("@elementor/ui");
2846
- var import_i18n21 = require("@wordpress/i18n");
2975
+ var import_i18n20 = require("@wordpress/i18n");
2847
2976
 
2848
2977
  // src/components/ui/mismatch-variable-alert.tsx
2849
2978
  var React27 = __toESM(require("react"));
2850
2979
  var import_ui27 = require("@elementor/ui");
2851
- var import_i18n20 = require("@wordpress/i18n");
2980
+ var import_i18n19 = require("@wordpress/i18n");
2852
2981
  var i18n = {
2853
- title: (0, import_i18n20.__)("Variable has changed", "elementor"),
2854
- message: (0, import_i18n20.__)(
2982
+ title: (0, import_i18n19.__)("Variable has changed", "elementor"),
2983
+ message: (0, import_i18n19.__)(
2855
2984
  `This variable is no longer compatible with this property. You can clear it or select a different one.`,
2856
2985
  "elementor"
2857
2986
  ),
2858
2987
  buttons: {
2859
- clear: (0, import_i18n20.__)("Clear", "elementor"),
2860
- select: (0, import_i18n20.__)("Select variable", "elementor")
2988
+ clear: (0, import_i18n19.__)("Clear", "elementor"),
2989
+ select: (0, import_i18n19.__)("Select variable", "elementor")
2861
2990
  }
2862
2991
  };
2863
2992
  var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
@@ -2878,13 +3007,13 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
2878
3007
  // src/components/ui/variable/mismatch-variable.tsx
2879
3008
  var MismatchVariable = ({ variable }) => {
2880
3009
  const { setValue, value } = (0, import_editor_controls9.useBoundProp)();
2881
- const anchorRef = (0, import_react20.useRef)(null);
2882
- const popupId = (0, import_react20.useId)();
3010
+ const anchorRef = (0, import_react21.useRef)(null);
3011
+ const popupId = (0, import_react21.useId)();
2883
3012
  const popupState = (0, import_ui28.usePopupState)({
2884
3013
  variant: "popover",
2885
3014
  popupId: `elementor-variables-list-${popupId}`
2886
3015
  });
2887
- const [infotipVisible, setInfotipVisible] = (0, import_react20.useState)(false);
3016
+ const [infotipVisible, setInfotipVisible] = (0, import_react21.useState)(false);
2888
3017
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
2889
3018
  const closeInfotip = () => setInfotipVisible(false);
2890
3019
  const triggerSelect = () => {
@@ -2929,7 +3058,7 @@ var MismatchVariable = ({ variable }) => {
2929
3058
  {
2930
3059
  label: variable.label,
2931
3060
  onClick: toggleInfotip,
2932
- suffix: (0, import_i18n21.__)("changed", "elementor")
3061
+ suffix: (0, import_i18n20.__)("changed", "elementor")
2933
3062
  }
2934
3063
  )
2935
3064
  ), /* @__PURE__ */ React28.createElement(
@@ -2957,15 +3086,15 @@ var MismatchVariable = ({ variable }) => {
2957
3086
 
2958
3087
  // src/components/ui/variable/missing-variable.tsx
2959
3088
  var React30 = __toESM(require("react"));
2960
- var import_react21 = require("react");
3089
+ var import_react22 = require("react");
2961
3090
  var import_editor_controls10 = require("@elementor/editor-controls");
2962
3091
  var import_ui30 = require("@elementor/ui");
2963
- var import_i18n23 = require("@wordpress/i18n");
3092
+ var import_i18n22 = require("@wordpress/i18n");
2964
3093
 
2965
3094
  // src/components/ui/missing-variable-alert.tsx
2966
3095
  var React29 = __toESM(require("react"));
2967
3096
  var import_ui29 = require("@elementor/ui");
2968
- var import_i18n22 = require("@wordpress/i18n");
3097
+ var import_i18n21 = require("@wordpress/i18n");
2969
3098
  var MissingVariableAlert = ({ onClose, onClear }) => {
2970
3099
  return /* @__PURE__ */ React29.createElement(import_ui29.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ React29.createElement(
2971
3100
  import_ui29.Alert,
@@ -2973,11 +3102,11 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
2973
3102
  variant: "standard",
2974
3103
  severity: "warning",
2975
3104
  onClose,
2976
- action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(import_ui29.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n22.__)("Clear", "elementor"))),
3105
+ action: /* @__PURE__ */ React29.createElement(React29.Fragment, null, onClear && /* @__PURE__ */ React29.createElement(import_ui29.AlertAction, { variant: "contained", onClick: onClear }, (0, import_i18n21.__)("Clear", "elementor"))),
2977
3106
  sx: { maxWidth: 300 }
2978
3107
  },
2979
- /* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, (0, import_i18n22.__)("This variable is missing", "elementor")),
2980
- /* @__PURE__ */ React29.createElement(import_ui29.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n22.__)(
3108
+ /* @__PURE__ */ React29.createElement(import_ui29.AlertTitle, null, (0, import_i18n21.__)("This variable is missing", "elementor")),
3109
+ /* @__PURE__ */ React29.createElement(import_ui29.Typography, { variant: "body2", color: "textPrimary" }, (0, import_i18n21.__)(
2981
3110
  "It may have been deleted. Try clearing this field and select a different value or variable.",
2982
3111
  "elementor"
2983
3112
  ))
@@ -2987,7 +3116,7 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
2987
3116
  // src/components/ui/variable/missing-variable.tsx
2988
3117
  var MissingVariable = () => {
2989
3118
  const { setValue } = (0, import_editor_controls10.useBoundProp)();
2990
- const [infotipVisible, setInfotipVisible] = (0, import_react21.useState)(false);
3119
+ const [infotipVisible, setInfotipVisible] = (0, import_react22.useState)(false);
2991
3120
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
2992
3121
  const closeInfotip = () => setInfotipVisible(false);
2993
3122
  const clearValue = () => setValue(null);
@@ -3011,7 +3140,7 @@ var MissingVariable = () => {
3011
3140
  }
3012
3141
  }
3013
3142
  },
3014
- /* @__PURE__ */ React30.createElement(WarningVariableTag, { label: (0, import_i18n23.__)("Missing variable", "elementor"), onClick: toggleInfotip })
3143
+ /* @__PURE__ */ React30.createElement(WarningVariableTag, { label: (0, import_i18n22.__)("Missing variable", "elementor"), onClick: toggleInfotip })
3015
3144
  ));
3016
3145
  };
3017
3146
 
@@ -3038,14 +3167,14 @@ var VariableControl = () => {
3038
3167
  var React32 = __toESM(require("react"));
3039
3168
  var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
3040
3169
  var import_icons14 = require("@elementor/icons");
3041
- var import_i18n24 = require("@wordpress/i18n");
3170
+ var import_i18n23 = require("@wordpress/i18n");
3042
3171
  var usePropVariableAction = () => {
3043
3172
  const { propType, path } = (0, import_editor_editing_panel6.useBoundProp)();
3044
3173
  const variable = resolveVariableFromPropType(propType);
3045
3174
  return {
3046
3175
  visible: Boolean(variable),
3047
3176
  icon: import_icons14.ColorFilterIcon,
3048
- title: (0, import_i18n24.__)("Variables", "elementor"),
3177
+ title: (0, import_i18n23.__)("Variables", "elementor"),
3049
3178
  content: ({ close: closePopover }) => {
3050
3179
  if (!variable) {
3051
3180
  return null;
@@ -3334,12 +3463,12 @@ var import_icons16 = require("@elementor/icons");
3334
3463
 
3335
3464
  // src/components/fields/color-field.tsx
3336
3465
  var React33 = __toESM(require("react"));
3337
- var import_react22 = require("react");
3466
+ var import_react23 = require("react");
3338
3467
  var import_ui31 = require("@elementor/ui");
3339
3468
  var ColorField = ({ value, onChange, onValidationChange }) => {
3340
- const [color, setColor] = (0, import_react22.useState)(value);
3341
- const [errorMessage, setErrorMessage] = (0, import_react22.useState)("");
3342
- const defaultRef = (0, import_react22.useRef)(null);
3469
+ const [color, setColor] = (0, import_react23.useState)(value);
3470
+ const [errorMessage, setErrorMessage] = (0, import_react23.useState)("");
3471
+ const defaultRef = (0, import_react23.useRef)(null);
3343
3472
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
3344
3473
  const handleChange = (newValue) => {
3345
3474
  setColor(newValue);
@@ -3378,15 +3507,15 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
3378
3507
 
3379
3508
  // src/components/fields/font-field.tsx
3380
3509
  var React34 = __toESM(require("react"));
3381
- var import_react23 = require("react");
3510
+ var import_react24 = require("react");
3382
3511
  var import_editor_controls12 = require("@elementor/editor-controls");
3383
3512
  var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
3384
3513
  var import_icons15 = require("@elementor/icons");
3385
3514
  var import_ui32 = require("@elementor/ui");
3386
- var import_i18n25 = require("@wordpress/i18n");
3515
+ var import_i18n24 = require("@wordpress/i18n");
3387
3516
  var FontField = ({ value, onChange, onValidationChange }) => {
3388
- const [fontFamily, setFontFamily] = (0, import_react23.useState)(value);
3389
- const defaultRef = (0, import_react23.useRef)(null);
3517
+ const [fontFamily, setFontFamily] = (0, import_react24.useState)(value);
3518
+ const defaultRef = (0, import_react24.useRef)(null);
3390
3519
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
3391
3520
  const fontPopoverState = (0, import_ui32.usePopupState)({ variant: "popover" });
3392
3521
  const fontFamilies = (0, import_editor_editing_panel7.useFontFamilies)();
@@ -3407,7 +3536,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
3407
3536
  handleChange(newFontFamily);
3408
3537
  fontPopoverState.close();
3409
3538
  };
3410
- const id2 = (0, import_react23.useId)();
3539
+ const id2 = (0, import_react24.useId)();
3411
3540
  return /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(
3412
3541
  import_ui32.UnstableTag,
3413
3542
  {
@@ -3437,7 +3566,7 @@ var FontField = ({ value, onChange, onValidationChange }) => {
3437
3566
  onItemChange: handleFontFamilyChange,
3438
3567
  onClose: fontPopoverState.close,
3439
3568
  sectionWidth,
3440
- title: (0, import_i18n25.__)("Font Family", "elementor"),
3569
+ title: (0, import_i18n24.__)("Font Family", "elementor"),
3441
3570
  itemStyle: (item) => ({ fontFamily: item.value }),
3442
3571
  onDebounce: import_editor_controls12.enqueueFont,
3443
3572
  icon: import_icons15.TextIcon
@@ -3469,7 +3598,7 @@ function registerVariableTypes() {
3469
3598
 
3470
3599
  // src/renderers/style-variables-renderer.tsx
3471
3600
  var React36 = __toESM(require("react"));
3472
- var import_react24 = require("react");
3601
+ var import_react25 = require("react");
3473
3602
  var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
3474
3603
  var import_ui33 = require("@elementor/ui");
3475
3604
 
@@ -3496,8 +3625,8 @@ function usePortalContainer() {
3496
3625
  return (0, import_editor_v1_adapters3.__privateUseListenTo)((0, import_editor_v1_adapters3.commandEndEvent)("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
3497
3626
  }
3498
3627
  function useStyleVariables() {
3499
- const [variables, setVariables] = (0, import_react24.useState)({});
3500
- (0, import_react24.useEffect)(() => {
3628
+ const [variables, setVariables] = (0, import_react25.useState)({});
3629
+ (0, import_react25.useEffect)(() => {
3501
3630
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
3502
3631
  return () => {
3503
3632
  unsubscribe();