@elementor/editor-variables 3.33.0-154 → 3.33.0-156

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
@@ -768,6 +768,7 @@ var useVariablesManagerState = () => {
768
768
  const [ids, setIds] = (0, import_react4.useState)(() => Object.keys(getVariables(false)));
769
769
  const [isDirty, setIsDirty] = (0, import_react4.useState)(false);
770
770
  const [hasValidationErrors, setHasValidationErrors] = (0, import_react4.useState)(false);
771
+ const [isSaving, setIsSaving] = (0, import_react4.useState)(false);
771
772
  const handleOnChange = (0, import_react4.useCallback)((newVariables) => {
772
773
  setVariables(newVariables);
773
774
  setIsDirty(true);
@@ -793,6 +794,7 @@ var useVariablesManagerState = () => {
793
794
  const handleSave = (0, import_react4.useCallback)(async () => {
794
795
  try {
795
796
  const originalVariables = getVariables(false);
797
+ setIsSaving(true);
796
798
  const result = await service.batchSave(originalVariables, variables);
797
799
  if (result.success) {
798
800
  await service.load();
@@ -801,11 +803,13 @@ var useVariablesManagerState = () => {
801
803
  setIds(Object.keys(updatedVariables));
802
804
  setDeletedVariables([]);
803
805
  setIsDirty(false);
806
+ setIsSaving(false);
804
807
  return { success: true };
805
808
  }
806
809
  throw new Error((0, import_i18n5.__)("Failed to save variables. Please try again.", "elementor"));
807
810
  } catch (error) {
808
811
  const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNEXPECTED_ERROR;
812
+ setIsSaving(false);
809
813
  return { success: false, error: errorMessage };
810
814
  }
811
815
  }, [variables]);
@@ -820,6 +824,7 @@ var useVariablesManagerState = () => {
820
824
  createVariable: createVariable2,
821
825
  handleDeleteVariable,
822
826
  handleSave,
827
+ isSaving,
823
828
  setHasValidationErrors
824
829
  };
825
830
  };
@@ -1452,6 +1457,7 @@ function VariablesManagerPanel() {
1452
1457
  createVariable: createVariable2,
1453
1458
  handleDeleteVariable,
1454
1459
  handleSave,
1460
+ isSaving,
1455
1461
  setHasValidationErrors
1456
1462
  } = useVariablesManagerState();
1457
1463
  const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
@@ -1536,8 +1542,9 @@ function VariablesManagerPanel() {
1536
1542
  size: "small",
1537
1543
  color: "global",
1538
1544
  variant: "contained",
1539
- disabled: !isDirty || hasValidationErrors,
1540
- onClick: handleSave
1545
+ disabled: !isDirty || hasValidationErrors || isSaving,
1546
+ onClick: handleSave,
1547
+ loading: isSaving
1541
1548
  },
1542
1549
  (0, import_i18n8.__)("Save changes", "elementor")
1543
1550
  ))), deleteConfirmation && /* @__PURE__ */ React10.createElement(