@elementor/editor-variables 4.0.0-manual → 4.1.0-684

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
@@ -5,13 +5,17 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
5
5
  import { isTransformable as isTransformable2 } from "@elementor/editor-props";
6
6
  import { controlActionsMenu } from "@elementor/menus";
7
7
 
8
- // src/components/open-panel-from-url.tsx
9
- import { useEffect as useEffect4, useRef as useRef7 } from "react";
10
- import { __privateListenTo as listenTo, routeOpenEvent } from "@elementor/editor-v1-adapters";
8
+ // src/components/open-panel-from-event.tsx
9
+ import { useEffect as useEffect4, useRef as useRef7, useState as useState7 } from "react";
10
+ import {
11
+ __privateListenTo as listenTo,
12
+ __privateOpenRoute as openRoute,
13
+ routeOpenEvent
14
+ } from "@elementor/editor-v1-adapters";
11
15
 
12
16
  // src/components/variables-manager/variables-manager-panel.tsx
13
17
  import * as React14 from "react";
14
- import { useCallback as useCallback5, useEffect as useEffect3, useState as useState6 } from "react";
18
+ import { useCallback as useCallback6, useEffect as useEffect3, useState as useState6 } from "react";
15
19
  import { useSuppressedMessage } from "@elementor/editor-current-user";
16
20
  import {
17
21
  __createPanel as createPanel,
@@ -1102,17 +1106,25 @@ var useQuotaPermissions = (variableType) => {
1102
1106
 
1103
1107
  // src/components/ui/variable-promotion-chip.tsx
1104
1108
  import * as React6 from "react";
1105
- import { forwardRef, useImperativeHandle, useState as useState3 } from "react";
1109
+ import { forwardRef, useCallback as useCallback4, useImperativeHandle, useState as useState3 } from "react";
1110
+ import { trackUpgradePromotionClick, trackViewPromotion } from "@elementor/editor-controls";
1106
1111
  import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
1107
1112
  import { Box } from "@elementor/ui";
1108
1113
  import { capitalize } from "@elementor/utils";
1109
1114
  import { __ as __7, sprintf as sprintf2 } from "@wordpress/i18n";
1110
1115
  var VariablePromotionChip = forwardRef(
1111
- ({ variableType, upgradeUrl }, ref) => {
1116
+ ({ variableType, upgradeUrl, trackingData }, ref) => {
1112
1117
  const [isOpen, setIsOpen] = useState3(false);
1113
1118
  useCanvasClickHandler(isOpen, () => setIsOpen(false));
1114
- const toggle = () => setIsOpen((prev) => !prev);
1115
- useImperativeHandle(ref, () => ({ toggle }), []);
1119
+ const toggle = useCallback4(() => {
1120
+ setIsOpen((prev) => {
1121
+ if (!prev) {
1122
+ trackViewPromotion(trackingData);
1123
+ }
1124
+ return !prev;
1125
+ });
1126
+ }, [trackingData]);
1127
+ useImperativeHandle(ref, () => ({ toggle }), [toggle]);
1116
1128
  const title = sprintf2(
1117
1129
  /* translators: %s: Variable Type. */
1118
1130
  __7("%s variables", "elementor"),
@@ -1134,7 +1146,8 @@ var VariablePromotionChip = forwardRef(
1134
1146
  onClose: (e) => {
1135
1147
  e.stopPropagation();
1136
1148
  setIsOpen(false);
1137
- }
1149
+ },
1150
+ onCtaClick: () => trackUpgradePromotionClick(trackingData)
1138
1151
  },
1139
1152
  /* @__PURE__ */ React6.createElement(
1140
1153
  Box,
@@ -1152,6 +1165,11 @@ var VariablePromotionChip = forwardRef(
1152
1165
  );
1153
1166
 
1154
1167
  // src/components/variables-manager/variables-manager-create-menu.tsx
1168
+ var TRACKING_DATA = {
1169
+ target_name: "variables_manager",
1170
+ target_location: "variables_manager",
1171
+ location_l1: "create variable menu"
1172
+ };
1155
1173
  var SIZE = "tiny";
1156
1174
  var VariableManagerCreateMenu = ({ variables, onCreate, menuState }) => {
1157
1175
  const buttonRef = useRef2(null);
@@ -1234,18 +1252,24 @@ var MenuOption = ({
1234
1252
  {
1235
1253
  variableType: config.variableType,
1236
1254
  upgradeUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
1237
- ref: promotionRef
1255
+ ref: promotionRef,
1256
+ trackingData: TRACKING_DATA
1238
1257
  }
1239
1258
  ));
1240
1259
  };
1241
1260
  var getDefaultName = (variables, baseName) => {
1242
1261
  const pattern = new RegExp(`^${baseName}-(\\d+)$`, "i");
1243
- let counter = 1;
1262
+ const takenNumbers = /* @__PURE__ */ new Set();
1244
1263
  Object.values(variables).forEach((variable) => {
1245
- if (pattern.test(variable.label)) {
1246
- counter = Math.max(counter, parseInt(variable.label.match(pattern)?.[1] ?? "0", 10) + 1);
1264
+ const match = variable.label.match(pattern);
1265
+ if (match) {
1266
+ takenNumbers.add(parseInt(match[1], 10));
1247
1267
  }
1248
1268
  });
1269
+ let counter = 1;
1270
+ while (takenNumbers.has(counter)) {
1271
+ counter++;
1272
+ }
1249
1273
  return `${baseName}-${counter}`;
1250
1274
  };
1251
1275
 
@@ -1376,7 +1400,7 @@ var LabelField = ({
1376
1400
 
1377
1401
  // src/components/variables-manager/variable-editable-cell.tsx
1378
1402
  import * as React10 from "react";
1379
- import { useCallback as useCallback4, useEffect, useRef as useRef4, useState as useState5 } from "react";
1403
+ import { useCallback as useCallback5, useEffect, useRef as useRef4, useState as useState5 } from "react";
1380
1404
  import { ClickAwayListener, Stack as Stack4 } from "@elementor/ui";
1381
1405
  var VariableEditableCell = React10.memo(
1382
1406
  ({
@@ -1397,7 +1421,7 @@ var VariableEditableCell = React10.memo(
1397
1421
  const { labelFieldError, setLabelFieldError } = useLabelError();
1398
1422
  const [valueFieldError, setValueFieldError] = useState5("");
1399
1423
  const rowRef = useRef4(null);
1400
- const handleSave = useCallback4(() => {
1424
+ const handleSave = useCallback5(() => {
1401
1425
  const hasError = fieldType === "label" && labelFieldError?.message || fieldType === "value" && valueFieldError;
1402
1426
  if (!hasError) {
1403
1427
  onChange(value);
@@ -1433,10 +1457,10 @@ var VariableEditableCell = React10.memo(
1433
1457
  setIsEditing(true);
1434
1458
  }
1435
1459
  };
1436
- const handleChange = useCallback4((newValue) => {
1460
+ const handleChange = useCallback5((newValue) => {
1437
1461
  setValue(newValue);
1438
1462
  }, []);
1439
- const handleValidationChange = useCallback4(
1463
+ const handleValidationChange = useCallback5(
1440
1464
  (errorMsg) => {
1441
1465
  if (fieldType === "label") {
1442
1466
  setLabelFieldError({
@@ -1567,6 +1591,7 @@ var VariableEditMenu = ({ menuActions, disabled, itemId }) => {
1567
1591
  };
1568
1592
 
1569
1593
  // src/components/variables-manager/ui/variable-table-row.tsx
1594
+ var TRACKING_DATA2 = { target_name: "variables_manager", target_location: "variables_manager" };
1570
1595
  var VariableRow = (props) => {
1571
1596
  const {
1572
1597
  row,
@@ -1729,7 +1754,8 @@ var VariableRow = (props) => {
1729
1754
  {
1730
1755
  variableType: row.variableType,
1731
1756
  upgradeUrl: `https://go.elementor.com/renew-license-manager-${row.variableType}-variable`,
1732
- ref: promotionRef
1757
+ ref: promotionRef,
1758
+ trackingData: TRACKING_DATA2
1733
1759
  }
1734
1760
  ), /* @__PURE__ */ React12.createElement(VariableEditMenu, { menuActions: menuActions(row.id), disabled: isSorting, itemId: row.id })))
1735
1761
  );
@@ -1888,7 +1914,7 @@ function VariablesManagerPanel() {
1888
1914
  }
1889
1915
  closePanel();
1890
1916
  };
1891
- const handleCreateVariable = useCallback5(
1917
+ const handleCreateVariable = useCallback6(
1892
1918
  (type, defaultName, defaultValue) => {
1893
1919
  const newId = createVariable2(type, defaultName, defaultValue);
1894
1920
  if (newId) {
@@ -1922,21 +1948,21 @@ function VariablesManagerPanel() {
1922
1948
  setIsSaving(false);
1923
1949
  }
1924
1950
  };
1925
- const handleDeleteVariableWithConfirmation = useCallback5(
1951
+ const handleDeleteVariableWithConfirmation = useCallback6(
1926
1952
  (itemId) => {
1927
1953
  handleDeleteVariable(itemId);
1928
1954
  setDeleteConfirmation(null);
1929
1955
  },
1930
1956
  [handleDeleteVariable]
1931
1957
  );
1932
- const handleStopSyncWithConfirmation = useCallback5(
1958
+ const handleStopSyncWithConfirmation = useCallback6(
1933
1959
  (itemId) => {
1934
1960
  handleStopSync(itemId);
1935
1961
  setStopSyncConfirmation(null);
1936
1962
  },
1937
1963
  [handleStopSync]
1938
1964
  );
1939
- const handleShowStopSyncDialog = useCallback5(
1965
+ const handleShowStopSyncDialog = useCallback6(
1940
1966
  (itemId) => {
1941
1967
  if (!isStopSyncSuppressed) {
1942
1968
  setStopSyncConfirmation(itemId);
@@ -1946,7 +1972,7 @@ function VariablesManagerPanel() {
1946
1972
  },
1947
1973
  [isStopSyncSuppressed, handleStopSync]
1948
1974
  );
1949
- const buildMenuActions = useCallback5(
1975
+ const buildMenuActions = useCallback6(
1950
1976
  (variableId) => {
1951
1977
  const variable = variables[variableId];
1952
1978
  if (!variable) {
@@ -2153,7 +2179,7 @@ var usePreventUnload = (isDirty) => {
2153
2179
  var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
2154
2180
  const [, suppressStopSyncMessage] = useSuppressedMessage(STOP_SYNC_MESSAGE_KEY);
2155
2181
  return /* @__PURE__ */ React14.createElement(ConfirmationDialog2, { open, onClose }, /* @__PURE__ */ React14.createElement(ConfirmationDialog2.Title, { icon: ColorFilterIcon, iconColor: "primary" }, __10("Stop syncing variable color", "elementor")), /* @__PURE__ */ React14.createElement(ConfirmationDialog2.Content, null, /* @__PURE__ */ React14.createElement(ConfirmationDialog2.ContentText, null, __10(
2156
- "This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.",
2182
+ "This will disconnect the variable color from Global Colors. Existing uses on your site will automatically switch to a default color.",
2157
2183
  "elementor"
2158
2184
  ))), /* @__PURE__ */ React14.createElement(
2159
2185
  ConfirmationDialog2.Actions,
@@ -2169,20 +2195,54 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
2169
2195
  ));
2170
2196
  };
2171
2197
 
2198
+ // src/components/open-panel-from-event.tsx
2199
+ var EVENT_NAME = "elementor/open-variables-manager";
2200
+ var DEFAULT_PANEL_ROUTE = "panel/elements/categories";
2201
+ function OpenPanelFromEvent() {
2202
+ const { open } = usePanelActions();
2203
+ const pendingRef = useRef7(false);
2204
+ const [readyToOpen, setReadyToOpen] = useState7(false);
2205
+ useEffect4(() => {
2206
+ if (readyToOpen) {
2207
+ setReadyToOpen(false);
2208
+ open();
2209
+ }
2210
+ }, [readyToOpen, open]);
2211
+ useEffect4(() => {
2212
+ return listenTo(routeOpenEvent(DEFAULT_PANEL_ROUTE), () => {
2213
+ if (pendingRef.current) {
2214
+ pendingRef.current = false;
2215
+ setReadyToOpen(true);
2216
+ }
2217
+ });
2218
+ }, []);
2219
+ useEffect4(() => {
2220
+ const handler = () => {
2221
+ pendingRef.current = true;
2222
+ openRoute(DEFAULT_PANEL_ROUTE);
2223
+ };
2224
+ window.addEventListener(EVENT_NAME, handler);
2225
+ return () => window.removeEventListener(EVENT_NAME, handler);
2226
+ }, []);
2227
+ return null;
2228
+ }
2229
+
2172
2230
  // src/components/open-panel-from-url.tsx
2231
+ import { useEffect as useEffect5, useRef as useRef8 } from "react";
2232
+ import { __privateListenTo as listenTo2, routeOpenEvent as routeOpenEvent2 } from "@elementor/editor-v1-adapters";
2173
2233
  var ACTIVE_PANEL_PARAM = "active-panel";
2174
2234
  var PANEL_ID = "variables-manager";
2175
- var DEFAULT_PANEL_ROUTE = "panel/elements";
2235
+ var DEFAULT_PANEL_ROUTE2 = "panel/elements";
2176
2236
  function OpenPanelFromUrl() {
2177
2237
  const { open } = usePanelActions();
2178
- const hasOpened = useRef7(false);
2179
- useEffect4(() => {
2238
+ const hasOpened = useRef8(false);
2239
+ useEffect5(() => {
2180
2240
  const urlParams = new URLSearchParams(window.location.search);
2181
2241
  const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
2182
2242
  if (activePanel !== PANEL_ID) {
2183
2243
  return;
2184
2244
  }
2185
- const cleanup = listenTo(routeOpenEvent(DEFAULT_PANEL_ROUTE), () => {
2245
+ const cleanup = listenTo2(routeOpenEvent2(DEFAULT_PANEL_ROUTE2), () => {
2186
2246
  if (hasOpened.current) {
2187
2247
  return;
2188
2248
  }
@@ -2201,7 +2261,7 @@ import * as React33 from "react";
2201
2261
  import { useBoundProp as useBoundProp11 } from "@elementor/editor-controls";
2202
2262
 
2203
2263
  // src/components/ui/variable/assigned-variable.tsx
2204
- import { useId, useRef as useRef8 } from "react";
2264
+ import { useId, useRef as useRef9 } from "react";
2205
2265
  import * as React24 from "react";
2206
2266
  import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
2207
2267
  import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
@@ -2225,16 +2285,16 @@ function createUnlinkHandler(variable, propTypeKey, setValue) {
2225
2285
 
2226
2286
  // src/components/variable-selection-popover.tsx
2227
2287
  import * as React22 from "react";
2228
- import { useState as useState12 } from "react";
2288
+ import { useState as useState13 } from "react";
2229
2289
  import { isExperimentActive } from "@elementor/editor-v1-adapters";
2230
2290
 
2231
2291
  // src/context/variable-selection-popover.context.tsx
2232
2292
  import * as React15 from "react";
2233
- import { createContext as createContext2, useContext as useContext2, useState as useState7 } from "react";
2293
+ import { createContext as createContext2, useContext as useContext2, useState as useState8 } from "react";
2234
2294
  import { Box as Box2 } from "@elementor/ui";
2235
2295
  var PopoverContentRefContext = createContext2(null);
2236
2296
  var PopoverContentRefContextProvider = ({ children }) => {
2237
- const [anchorRef, setAnchorRef] = useState7(null);
2297
+ const [anchorRef, setAnchorRef] = useState8(null);
2238
2298
  return /* @__PURE__ */ React15.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React15.createElement(Box2, { ref: setAnchorRef }, children));
2239
2299
  };
2240
2300
  var usePopoverContentRef = () => {
@@ -2243,7 +2303,7 @@ var usePopoverContentRef = () => {
2243
2303
 
2244
2304
  // src/components/variable-creation.tsx
2245
2305
  import * as React17 from "react";
2246
- import { useState as useState8 } from "react";
2306
+ import { useState as useState9 } from "react";
2247
2307
  import { PopoverContent, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
2248
2308
  import { PopoverHeader, SectionPopoverBody } from "@elementor/editor-ui";
2249
2309
  import { ArrowLeftIcon } from "@elementor/icons";
@@ -2304,11 +2364,11 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2304
2364
  const { setVariableValue: setVariable, path } = useVariableBoundProp();
2305
2365
  const { propType } = useBoundProp4();
2306
2366
  const initialValue = useInitialValue();
2307
- const [value, setValue] = useState8(initialValue);
2308
- const [label, setLabel] = useState8("");
2309
- const [errorMessage, setErrorMessage] = useState8("");
2310
- const [valueFieldError, setValueFieldError] = useState8("");
2311
- const [propTypeKey, setPropTypeKey] = useState8(propTypeUtil.key);
2367
+ const [value, setValue] = useState9(initialValue);
2368
+ const [label, setLabel] = useState9("");
2369
+ const [errorMessage, setErrorMessage] = useState9("");
2370
+ const [valueFieldError, setValueFieldError] = useState9("");
2371
+ const [propTypeKey, setPropTypeKey] = useState9(propTypeUtil.key);
2312
2372
  const { labelFieldError, setLabelFieldError } = useLabelError();
2313
2373
  const resetFields = () => {
2314
2374
  setValue("");
@@ -2428,7 +2488,7 @@ var VariableCreation = ({ onGoBack, onClose }) => {
2428
2488
 
2429
2489
  // src/components/variable-edit.tsx
2430
2490
  import * as React19 from "react";
2431
- import { useEffect as useEffect5, useState as useState10 } from "react";
2491
+ import { useEffect as useEffect6, useState as useState11 } from "react";
2432
2492
  import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
2433
2493
  import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
2434
2494
  import { PopoverHeader as PopoverHeader2, SectionPopoverBody as SectionPopoverBody2 } from "@elementor/editor-ui";
@@ -2438,7 +2498,7 @@ import { __ as __13 } from "@wordpress/i18n";
2438
2498
 
2439
2499
  // src/components/ui/edit-confirmation-dialog.tsx
2440
2500
  import * as React18 from "react";
2441
- import { useState as useState9 } from "react";
2501
+ import { useState as useState10 } from "react";
2442
2502
  import { AlertTriangleFilledIcon as AlertTriangleFilledIcon3 } from "@elementor/icons";
2443
2503
  import {
2444
2504
  Button as Button4,
@@ -2458,7 +2518,7 @@ var EditConfirmationDialog = ({
2458
2518
  onConfirm,
2459
2519
  onSuppressMessage
2460
2520
  }) => {
2461
- const [dontShowAgain, setDontShowAgain] = useState9(false);
2521
+ const [dontShowAgain, setDontShowAgain] = useState10(false);
2462
2522
  const handleSave = () => {
2463
2523
  if (dontShowAgain) {
2464
2524
  onSuppressMessage?.();
@@ -2492,20 +2552,20 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2492
2552
  const { setVariableValue: notifyBoundPropChange, variableId } = useVariableBoundProp();
2493
2553
  const { propType } = useBoundProp5();
2494
2554
  const [isMessageSuppressed, suppressMessage] = useSuppressedMessage2(EDIT_CONFIRMATION_DIALOG_ID);
2495
- const [deleteConfirmation, setDeleteConfirmation] = useState10(false);
2496
- const [editConfirmation, setEditConfirmation] = useState10(false);
2497
- const [errorMessage, setErrorMessage] = useState10("");
2498
- const [valueFieldError, setValueFieldError] = useState10("");
2555
+ const [deleteConfirmation, setDeleteConfirmation] = useState11(false);
2556
+ const [editConfirmation, setEditConfirmation] = useState11(false);
2557
+ const [errorMessage, setErrorMessage] = useState11("");
2558
+ const [valueFieldError, setValueFieldError] = useState11("");
2499
2559
  const { labelFieldError, setLabelFieldError } = useLabelError();
2500
2560
  const variable = useVariable(editId);
2501
- const [propTypeKey, setPropTypeKey] = useState10(variable?.type ?? propTypeUtil.key);
2561
+ const [propTypeKey, setPropTypeKey] = useState11(variable?.type ?? propTypeUtil.key);
2502
2562
  if (!variable) {
2503
2563
  throw new Error(`Global ${variableType} variable not found`);
2504
2564
  }
2505
2565
  const userPermissions = usePermissions();
2506
- const [value, setValue] = useState10(() => variable.value);
2507
- const [label, setLabel] = useState10(() => variable.label);
2508
- useEffect5(() => {
2566
+ const [value, setValue] = useState11(() => variable.value);
2567
+ const [label, setLabel] = useState11(() => variable.label);
2568
+ useEffect6(() => {
2509
2569
  styleVariablesRepository.update({
2510
2570
  [editId]: {
2511
2571
  ...variable,
@@ -2669,8 +2729,9 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
2669
2729
  };
2670
2730
 
2671
2731
  // src/components/variables-selection.tsx
2672
- import { useState as useState11 } from "react";
2732
+ import { useEffect as useEffect7, useState as useState12 } from "react";
2673
2733
  import * as React21 from "react";
2734
+ import { trackUpgradePromotionClick as trackUpgradePromotionClick2, trackViewPromotion as trackViewPromotion2 } from "@elementor/editor-controls";
2674
2735
  import {
2675
2736
  PopoverHeader as PopoverHeader3,
2676
2737
  PopoverMenuList,
@@ -2781,7 +2842,7 @@ var getProUpgradeUrl = (variableType) => `https://go.elementor.com/renew-license
2781
2842
  var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
2782
2843
  const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
2783
2844
  const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
2784
- const [searchValue, setSearchValue] = useState11("");
2845
+ const [searchValue, setSearchValue] = useState12("");
2785
2846
  const {
2786
2847
  list: variables,
2787
2848
  hasMatches: hasSearchResults,
@@ -2858,6 +2919,15 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
2858
2919
  const handleClearSearch = () => {
2859
2920
  setSearchValue("");
2860
2921
  };
2922
+ useEffect7(() => {
2923
+ if (disabled) {
2924
+ trackViewPromotion2({
2925
+ target_name: "variables_popover",
2926
+ target_location: "widget_panel",
2927
+ location_l1: "variables_list"
2928
+ });
2929
+ }
2930
+ }, [disabled]);
2861
2931
  return /* @__PURE__ */ React21.createElement(SectionPopoverBody3, null, /* @__PURE__ */ React21.createElement(
2862
2932
  PopoverHeader3,
2863
2933
  {
@@ -2894,7 +2964,11 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
2894
2964
  __15("Upgrade to continue creating and editing %s variables.", "elementor"),
2895
2965
  variableType
2896
2966
  ),
2897
- upgradeUrl: getProUpgradeUrl(variableType)
2967
+ upgradeUrl: getProUpgradeUrl(variableType),
2968
+ onCtaClick: () => trackUpgradePromotionClick2({
2969
+ target_name: "variables_popover",
2970
+ location_l1: "variables_list"
2971
+ })
2898
2972
  }
2899
2973
  )), !hasSearchResults && hasVariables && /* @__PURE__ */ React21.createElement(
2900
2974
  NoSearchResults,
@@ -2953,8 +3027,8 @@ var VIEW_LIST = "list";
2953
3027
  var VIEW_ADD = "add";
2954
3028
  var VIEW_EDIT = "edit";
2955
3029
  var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
2956
- const [currentView, setCurrentView] = useState12(VIEW_LIST);
2957
- const [editId, setEditId] = useState12("");
3030
+ const [currentView, setCurrentView] = useState13(VIEW_LIST);
3031
+ const [editId, setEditId] = useState13("");
2958
3032
  const { open } = usePanelActions();
2959
3033
  const onSettingsAvailable = isExperimentActive("e_variables_manager") ? () => {
2960
3034
  open();
@@ -3065,7 +3139,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
3065
3139
  var AssignedVariable = ({ variable, propTypeKey }) => {
3066
3140
  const { startIcon, propTypeUtil } = getVariableType(propTypeKey);
3067
3141
  const { setValue } = useBoundProp6();
3068
- const anchorRef = useRef8(null);
3142
+ const anchorRef = useRef9(null);
3069
3143
  const popupId = useId();
3070
3144
  const popupState = usePopupState3({
3071
3145
  variant: "popover",
@@ -3106,14 +3180,14 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
3106
3180
 
3107
3181
  // src/components/ui/variable/deleted-variable.tsx
3108
3182
  import * as React28 from "react";
3109
- import { useId as useId2, useRef as useRef9, useState as useState14 } from "react";
3183
+ import { useId as useId2, useRef as useRef10, useState as useState15 } from "react";
3110
3184
  import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
3111
3185
  import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
3112
3186
  import { __ as __19 } from "@wordpress/i18n";
3113
3187
 
3114
3188
  // src/components/variable-restore.tsx
3115
3189
  import * as React25 from "react";
3116
- import { useState as useState13 } from "react";
3190
+ import { useState as useState14 } from "react";
3117
3191
  import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
3118
3192
  import { PopoverHeader as PopoverHeader4, SectionPopoverBody as SectionPopoverBody4 } from "@elementor/editor-ui";
3119
3193
  import { Button as Button6, CardActions as CardActions3, Divider as Divider5, FormHelperText as FormHelperText4, Typography as Typography11 } from "@elementor/ui";
@@ -3127,11 +3201,11 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
3127
3201
  if (!variable) {
3128
3202
  throw new Error(`Global ${variableType} variable not found`);
3129
3203
  }
3130
- const [errorMessage, setErrorMessage] = useState13("");
3131
- const [valueFieldError, setValueFieldError] = useState13("");
3132
- const [label, setLabel] = useState13(variable.label);
3133
- const [value, setValue] = useState13(variable.value);
3134
- const [propTypeKey, setPropTypeKey] = useState13(variable?.type ?? propTypeUtil.key);
3204
+ const [errorMessage, setErrorMessage] = useState14("");
3205
+ const [valueFieldError, setValueFieldError] = useState14("");
3206
+ const [label, setLabel] = useState14(variable.label);
3207
+ const [value, setValue] = useState14(variable.value);
3208
+ const [propTypeKey, setPropTypeKey] = useState14(variable?.type ?? propTypeUtil.key);
3135
3209
  const { labelFieldError, setLabelFieldError } = useLabelError({
3136
3210
  value: variable.label,
3137
3211
  message: ERROR_MESSAGES.DUPLICATED_LABEL
@@ -3287,10 +3361,10 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3287
3361
  const { propTypeUtil } = getVariableType(propTypeKey);
3288
3362
  const boundProp = useBoundProp8();
3289
3363
  const userPermissions = usePermissions();
3290
- const [showInfotip, setShowInfotip] = useState14(false);
3364
+ const [showInfotip, setShowInfotip] = useState15(false);
3291
3365
  const toggleInfotip = () => setShowInfotip((prev) => !prev);
3292
3366
  const closeInfotip = () => setShowInfotip(false);
3293
- const deletedChipAnchorRef = useRef9(null);
3367
+ const deletedChipAnchorRef = useRef10(null);
3294
3368
  const popupId = useId2();
3295
3369
  const popupState = usePopupState4({
3296
3370
  variant: "popover",
@@ -3378,7 +3452,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3378
3452
 
3379
3453
  // src/components/ui/variable/mismatch-variable.tsx
3380
3454
  import * as React30 from "react";
3381
- import { useId as useId3, useRef as useRef10, useState as useState15 } from "react";
3455
+ import { useId as useId3, useRef as useRef11, useState as useState16 } from "react";
3382
3456
  import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
3383
3457
  import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box8, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
3384
3458
  import { __ as __21 } from "@wordpress/i18n";
@@ -3416,13 +3490,13 @@ var MismatchVariableAlert = ({ onClose, onClear, triggerSelect }) => {
3416
3490
  // src/components/ui/variable/mismatch-variable.tsx
3417
3491
  var MismatchVariable = ({ variable }) => {
3418
3492
  const { setValue, value } = useBoundProp9();
3419
- const anchorRef = useRef10(null);
3493
+ const anchorRef = useRef11(null);
3420
3494
  const popupId = useId3();
3421
3495
  const popupState = usePopupState5({
3422
3496
  variant: "popover",
3423
3497
  popupId: `elementor-variables-list-${popupId}`
3424
3498
  });
3425
- const [infotipVisible, setInfotipVisible] = useState15(false);
3499
+ const [infotipVisible, setInfotipVisible] = useState16(false);
3426
3500
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
3427
3501
  const closeInfotip = () => setInfotipVisible(false);
3428
3502
  const triggerSelect = () => {
@@ -3495,7 +3569,7 @@ var MismatchVariable = ({ variable }) => {
3495
3569
 
3496
3570
  // src/components/ui/variable/missing-variable.tsx
3497
3571
  import * as React32 from "react";
3498
- import { useState as useState16 } from "react";
3572
+ import { useState as useState17 } from "react";
3499
3573
  import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
3500
3574
  import { Backdrop as Backdrop3, Infotip as Infotip4 } from "@elementor/ui";
3501
3575
  import { __ as __23 } from "@wordpress/i18n";
@@ -3525,7 +3599,7 @@ var MissingVariableAlert = ({ onClose, onClear }) => {
3525
3599
  // src/components/ui/variable/missing-variable.tsx
3526
3600
  var MissingVariable = () => {
3527
3601
  const { setValue } = useBoundProp10();
3528
- const [infotipVisible, setInfotipVisible] = useState16(false);
3602
+ const [infotipVisible, setInfotipVisible] = useState17(false);
3529
3603
  const toggleInfotip = () => setInfotipVisible((prev) => !prev);
3530
3604
  const closeInfotip = () => setInfotipVisible(false);
3531
3605
  const clearValue = () => setValue(null);
@@ -3736,6 +3810,7 @@ function initMcp() {
3736
3810
 
3737
3811
  // src/register-variable-types.tsx
3738
3812
  import * as React37 from "react";
3813
+ import { trackUpgradePromotionClick as trackUpgradePromotionClick3 } from "@elementor/editor-controls";
3739
3814
  import { colorPropTypeUtil, sizePropTypeUtil, stringPropTypeUtil } from "@elementor/editor-props";
3740
3815
  import { CtaButton } from "@elementor/editor-ui";
3741
3816
  import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
@@ -3744,12 +3819,12 @@ import { __ as __26 } from "@wordpress/i18n";
3744
3819
 
3745
3820
  // src/components/fields/color-field.tsx
3746
3821
  import * as React35 from "react";
3747
- import { useRef as useRef11, useState as useState17 } from "react";
3822
+ import { useRef as useRef12, useState as useState18 } from "react";
3748
3823
  import { UnstableColorField } from "@elementor/ui";
3749
3824
  var ColorField = ({ value, onChange, onValidationChange }) => {
3750
- const [color, setColor] = useState17(value);
3751
- const [errorMessage, setErrorMessage] = useState17("");
3752
- const defaultRef = useRef11(null);
3825
+ const [color, setColor] = useState18(value);
3826
+ const [errorMessage, setErrorMessage] = useState18("");
3827
+ const defaultRef = useRef12(null);
3753
3828
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
3754
3829
  const handleChange = (newValue) => {
3755
3830
  setColor(newValue);
@@ -3788,15 +3863,15 @@ var ColorField = ({ value, onChange, onValidationChange }) => {
3788
3863
 
3789
3864
  // src/components/fields/font-field.tsx
3790
3865
  import * as React36 from "react";
3791
- import { useId as useId4, useRef as useRef12, useState as useState18 } from "react";
3866
+ import { useId as useId4, useRef as useRef13, useState as useState19 } from "react";
3792
3867
  import { enqueueFont as enqueueFont2, ItemSelector, useFontFamilies } from "@elementor/editor-controls";
3793
3868
  import { useSectionWidth } from "@elementor/editor-ui";
3794
3869
  import { ChevronDownIcon, TextIcon } from "@elementor/icons";
3795
3870
  import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Popover as Popover4, UnstableTag, usePopupState as usePopupState6 } from "@elementor/ui";
3796
3871
  import { __ as __25 } from "@wordpress/i18n";
3797
3872
  var FontField = ({ value, onChange, onValidationChange }) => {
3798
- const [fontFamily, setFontFamily] = useState18(value);
3799
- const defaultRef = useRef12(null);
3873
+ const [fontFamily, setFontFamily] = useState19(value);
3874
+ const defaultRef = useRef13(null);
3800
3875
  const anchorRef = usePopoverContentRef() ?? defaultRef.current;
3801
3876
  const fontPopoverState = usePopupState6({ variant: "popover" });
3802
3877
  const fontFamilies = useFontFamilies();
@@ -3885,14 +3960,14 @@ function registerVariableTypes() {
3885
3960
  }
3886
3961
  if (variable.sync_to_v3) {
3887
3962
  actions.push({
3888
- name: __26("Stop syncing to Version 3", "elementor"),
3963
+ name: __26("Stop syncing to Global Colors", "elementor"),
3889
3964
  icon: ResetIcon,
3890
3965
  color: "text.primary",
3891
3966
  onClick: () => handlers.onStopSync(variableId)
3892
3967
  });
3893
3968
  } else {
3894
3969
  actions.push({
3895
- name: __26("Sync to Version 3", "elementor"),
3970
+ name: __26("Sync to Global Colors", "elementor"),
3896
3971
  icon: ResetIcon,
3897
3972
  color: "text.primary",
3898
3973
  onClick: () => handlers.onStartSync(variableId)
@@ -3918,7 +3993,14 @@ function registerVariableTypes() {
3918
3993
  styleTransformer: EmptyTransformer,
3919
3994
  variableType: "size",
3920
3995
  selectionFilter: () => [],
3921
- emptyState: /* @__PURE__ */ React37.createElement(CtaButton, { size: "small", href: "https://go.elementor.com/go-pro-panel-size-variable/" })
3996
+ emptyState: /* @__PURE__ */ React37.createElement(
3997
+ CtaButton,
3998
+ {
3999
+ size: "small",
4000
+ href: "https://go.elementor.com/go-pro-panel-size-variable/",
4001
+ onClick: () => trackUpgradePromotionClick3({ target_name: "variables_popover", location_l1: "variables_list" })
4002
+ }
4003
+ )
3922
4004
  };
3923
4005
  registerVariableType({
3924
4006
  ...sizePromotions,
@@ -3933,14 +4015,14 @@ function registerVariableTypes() {
3933
4015
 
3934
4016
  // src/renderers/style-variables-renderer.tsx
3935
4017
  import * as React38 from "react";
3936
- import { useEffect as useEffect6, useState as useState19 } from "react";
4018
+ import { useEffect as useEffect8, useState as useState20 } from "react";
3937
4019
  import {
3938
4020
  __privateUseListenTo as useListenTo,
3939
4021
  commandEndEvent,
3940
4022
  getCanvasIframeDocument
3941
4023
  } from "@elementor/editor-v1-adapters";
3942
4024
  import { Portal } from "@elementor/ui";
3943
- var VARIABLES_WRAPPER = "body";
4025
+ var VARIABLES_WRAPPER = ":root";
3944
4026
  function StyleVariablesRenderer() {
3945
4027
  const container = usePortalContainer();
3946
4028
  const styleVariables = useStyleVariables();
@@ -3956,8 +4038,8 @@ function usePortalContainer() {
3956
4038
  return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
3957
4039
  }
3958
4040
  function useStyleVariables() {
3959
- const [variables, setVariables] = useState19({});
3960
- useEffect6(() => {
4041
+ const [variables, setVariables] = useState20({});
4042
+ useEffect8(() => {
3961
4043
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
3962
4044
  return () => {
3963
4045
  unsubscribe();
@@ -4059,6 +4141,10 @@ function init() {
4059
4141
  id: "variables-open-panel-from-url",
4060
4142
  component: OpenPanelFromUrl
4061
4143
  });
4144
+ injectIntoLogic({
4145
+ id: "variables-open-panel-from-event",
4146
+ component: OpenPanelFromEvent
4147
+ });
4062
4148
  registerPanel(panel);
4063
4149
  }
4064
4150
  function hasVariableAssigned(value) {