@elementor/editor-variables 4.0.0-573 → 4.0.0-597

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
@@ -56,6 +56,7 @@ var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
56
56
  // src/components/variables-manager/variables-manager-panel.tsx
57
57
  var React14 = __toESM(require("react"));
58
58
  var import_react13 = require("react");
59
+ var import_editor_current_user2 = require("@elementor/editor-current-user");
59
60
  var import_editor_panels = require("@elementor/editor-panels");
60
61
  var import_editor_ui5 = require("@elementor/editor-ui");
61
62
  var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
@@ -1854,6 +1855,7 @@ function sortVariablesOrder(variables) {
1854
1855
 
1855
1856
  // src/components/variables-manager/variables-manager-panel.tsx
1856
1857
  var id = "variables-manager";
1858
+ var STOP_SYNC_MESSAGE_KEY = "stop-sync-variable";
1857
1859
  var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
1858
1860
  id,
1859
1861
  component: VariablesManagerPanel,
@@ -1869,6 +1871,7 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
1869
1871
  function VariablesManagerPanel() {
1870
1872
  const { close: closePanel } = usePanelActions();
1871
1873
  const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui5.useDialog)();
1874
+ const [isStopSyncSuppressed] = (0, import_editor_current_user2.useSuppressedMessage)(STOP_SYNC_MESSAGE_KEY);
1872
1875
  const createMenuState = (0, import_ui14.usePopupState)({
1873
1876
  variant: "popover"
1874
1877
  });
@@ -1949,6 +1952,16 @@ function VariablesManagerPanel() {
1949
1952
  },
1950
1953
  [handleStopSync]
1951
1954
  );
1955
+ const handleShowStopSyncDialog = (0, import_react13.useCallback)(
1956
+ (itemId) => {
1957
+ if (!isStopSyncSuppressed) {
1958
+ setStopSyncConfirmation(itemId);
1959
+ } else {
1960
+ handleStopSync(itemId);
1961
+ }
1962
+ },
1963
+ [isStopSyncSuppressed, handleStopSync]
1964
+ );
1952
1965
  const buildMenuActions = (0, import_react13.useCallback)(
1953
1966
  (variableId) => {
1954
1967
  const variable = variables[variableId];
@@ -1960,7 +1973,7 @@ function VariablesManagerPanel() {
1960
1973
  variableId,
1961
1974
  handlers: {
1962
1975
  onStartSync: handleStartSync,
1963
- onStopSync: (itemId) => setStopSyncConfirmation(itemId)
1976
+ onStopSync: handleShowStopSyncDialog
1964
1977
  }
1965
1978
  });
1966
1979
  const deleteAction = {
@@ -1978,7 +1991,7 @@ function VariablesManagerPanel() {
1978
1991
  };
1979
1992
  return [...typeActions, deleteAction];
1980
1993
  },
1981
- [variables, handleStartSync]
1994
+ [variables, handleStartSync, handleShowStopSyncDialog]
1982
1995
  );
1983
1996
  const hasVariables = Object.keys(variables).length > 0;
1984
1997
  return /* @__PURE__ */ React14.createElement(import_editor_ui5.ThemeProvider, null, /* @__PURE__ */ React14.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React14.createElement(
@@ -2153,19 +2166,24 @@ var usePreventUnload = (isDirty) => {
2153
2166
  };
2154
2167
  }, [isDirty]);
2155
2168
  };
2156
- var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Title, { icon: import_icons5.ColorFilterIcon, iconColor: "secondary" }, (0, import_i18n10.__)("Stop syncing variable color", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.ContentText, null, (0, import_i18n10.__)(
2157
- "This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
2158
- "elementor"
2159
- ))), /* @__PURE__ */ React14.createElement(
2160
- import_editor_ui5.ConfirmationDialog.Actions,
2161
- {
2162
- onClose,
2163
- onConfirm,
2164
- cancelLabel: (0, import_i18n10.__)("Cancel", "elementor"),
2165
- confirmLabel: (0, import_i18n10.__)("Got it", "elementor"),
2166
- color: "secondary"
2167
- }
2168
- ));
2169
+ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
2170
+ const [, suppressStopSyncMessage] = (0, import_editor_current_user2.useSuppressedMessage)(STOP_SYNC_MESSAGE_KEY);
2171
+ return /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Title, { icon: import_icons5.ColorFilterIcon, iconColor: "primary" }, (0, import_i18n10.__)("Stop syncing variable color", "elementor")), /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.Content, null, /* @__PURE__ */ React14.createElement(import_editor_ui5.ConfirmationDialog.ContentText, null, (0, import_i18n10.__)(
2172
+ "This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
2173
+ "elementor"
2174
+ ))), /* @__PURE__ */ React14.createElement(
2175
+ import_editor_ui5.ConfirmationDialog.Actions,
2176
+ {
2177
+ onClose,
2178
+ onConfirm,
2179
+ cancelLabel: (0, import_i18n10.__)("Cancel", "elementor"),
2180
+ confirmLabel: (0, import_i18n10.__)("Got it", "elementor"),
2181
+ color: "primary",
2182
+ onSuppressMessage: suppressStopSyncMessage,
2183
+ suppressLabel: (0, import_i18n10.__)("Don't show again", "elementor")
2184
+ }
2185
+ ));
2186
+ };
2169
2187
 
2170
2188
  // src/components/open-panel-from-url.tsx
2171
2189
  var ACTIVE_PANEL_PARAM = "active-panel";
@@ -2428,7 +2446,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2428
2446
  var React19 = __toESM(require("react"));
2429
2447
  var import_react18 = require("react");
2430
2448
  var import_editor_controls5 = require("@elementor/editor-controls");
2431
- var import_editor_current_user2 = require("@elementor/editor-current-user");
2449
+ var import_editor_current_user3 = require("@elementor/editor-current-user");
2432
2450
  var import_editor_ui7 = require("@elementor/editor-ui");
2433
2451
  var import_icons8 = require("@elementor/icons");
2434
2452
  var import_ui19 = require("@elementor/ui");
@@ -2479,7 +2497,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2479
2497
  const { icon: VariableIcon, valueField: ValueField, variableType, propTypeUtil } = useVariableType();
2480
2498
  const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
2481
2499
  const { propType } = (0, import_editor_controls5.useBoundProp)();
2482
- const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user2.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
2500
+ const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user3.useSuppressedMessage)(EDIT_CONFIRMATION_DIALOG_ID);
2483
2501
  const [deleteConfirmation, setDeleteConfirmation] = (0, import_react18.useState)(false);
2484
2502
  const [editConfirmation, setEditConfirmation] = (0, import_react18.useState)(false);
2485
2503
  const [errorMessage, setErrorMessage] = (0, import_react18.useState)("");
@@ -4025,6 +4043,7 @@ function init() {
4025
4043
  });
4026
4044
  registerPopoverAction({
4027
4045
  id: "variables",
4046
+ priority: 40,
4028
4047
  useProps: usePropVariableAction
4029
4048
  });
4030
4049
  service.init().then(() => {