@elementor/editor-variables 3.33.0-153 → 3.33.0-155

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.mjs CHANGED
@@ -745,6 +745,7 @@ var useVariablesManagerState = () => {
745
745
  const [ids, setIds] = useState2(() => Object.keys(getVariables(false)));
746
746
  const [isDirty, setIsDirty] = useState2(false);
747
747
  const [hasValidationErrors, setHasValidationErrors] = useState2(false);
748
+ const [isSaving, setIsSaving] = useState2(false);
748
749
  const handleOnChange = useCallback2((newVariables) => {
749
750
  setVariables(newVariables);
750
751
  setIsDirty(true);
@@ -770,6 +771,7 @@ var useVariablesManagerState = () => {
770
771
  const handleSave = useCallback2(async () => {
771
772
  try {
772
773
  const originalVariables = getVariables(false);
774
+ setIsSaving(true);
773
775
  const result = await service.batchSave(originalVariables, variables);
774
776
  if (result.success) {
775
777
  await service.load();
@@ -778,11 +780,13 @@ var useVariablesManagerState = () => {
778
780
  setIds(Object.keys(updatedVariables));
779
781
  setDeletedVariables([]);
780
782
  setIsDirty(false);
783
+ setIsSaving(false);
781
784
  return { success: true };
782
785
  }
783
786
  throw new Error(__5("Failed to save variables. Please try again.", "elementor"));
784
787
  } catch (error) {
785
788
  const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNEXPECTED_ERROR;
789
+ setIsSaving(false);
786
790
  return { success: false, error: errorMessage };
787
791
  }
788
792
  }, [variables]);
@@ -797,6 +801,7 @@ var useVariablesManagerState = () => {
797
801
  createVariable: createVariable2,
798
802
  handleDeleteVariable,
799
803
  handleSave,
804
+ isSaving,
800
805
  setHasValidationErrors
801
806
  };
802
807
  };
@@ -1439,6 +1444,7 @@ function VariablesManagerPanel() {
1439
1444
  createVariable: createVariable2,
1440
1445
  handleDeleteVariable,
1441
1446
  handleSave,
1447
+ isSaving,
1442
1448
  setHasValidationErrors
1443
1449
  } = useVariablesManagerState();
1444
1450
  const { autoEditVariableId, startAutoEdit, handleAutoEditComplete } = useAutoEdit();
@@ -1523,8 +1529,9 @@ function VariablesManagerPanel() {
1523
1529
  size: "small",
1524
1530
  color: "global",
1525
1531
  variant: "contained",
1526
- disabled: !isDirty || hasValidationErrors,
1527
- onClick: handleSave
1532
+ disabled: !isDirty || hasValidationErrors || isSaving,
1533
+ onClick: handleSave,
1534
+ loading: isSaving
1528
1535
  },
1529
1536
  __8("Save changes", "elementor")
1530
1537
  ))), deleteConfirmation && /* @__PURE__ */ React10.createElement(