@elementor/editor-variables 3.35.0-440 → 3.35.0-441

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
@@ -1027,7 +1027,7 @@ import * as React6 from "react";
1027
1027
  import { createElement as createElement7, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
1028
1028
  import { PromotionChip, PromotionPopover } from "@elementor/editor-ui";
1029
1029
  import { PlusIcon } from "@elementor/icons";
1030
- import { bindMenu, bindTrigger, Box, IconButton, Menu, MenuItem, Typography as Typography5 } from "@elementor/ui";
1030
+ import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typography5 } from "@elementor/ui";
1031
1031
  import { capitalize } from "@elementor/utils";
1032
1032
  import { __ as __7, sprintf as sprintf2 } from "@wordpress/i18n";
1033
1033
 
@@ -1126,6 +1126,9 @@ var MenuOption = ({
1126
1126
  const isDisabled = !userQuotaPermissions.canAdd();
1127
1127
  const handleClick = () => {
1128
1128
  if (isDisabled) {
1129
+ if (!isPopoverOpen) {
1130
+ setIsPopoverOpen(true);
1131
+ }
1129
1132
  return;
1130
1133
  }
1131
1134
  const defaultName = getDefaultName(variables, config.key, config.variableType);
@@ -1143,34 +1146,19 @@ var MenuOption = ({
1143
1146
  __7("Upgrade to continue creating and editing %s variables.", "elementor"),
1144
1147
  config.variableType
1145
1148
  );
1146
- return /* @__PURE__ */ React6.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: isDisabled ? "default" : "pointer" } }, createElement7(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React6.createElement(Typography5, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React6.createElement(
1147
- Box,
1149
+ return /* @__PURE__ */ React6.createElement(MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: "pointer" } }, createElement7(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React6.createElement(Typography5, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React6.createElement(
1150
+ PromotionPopover,
1148
1151
  {
1149
- onClick: (event) => {
1150
- event.stopPropagation();
1152
+ open: isPopoverOpen,
1153
+ title,
1154
+ content,
1155
+ ctaText: __7("Upgrade now", "elementor"),
1156
+ ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
1157
+ onClose: () => {
1158
+ setIsPopoverOpen(false);
1151
1159
  }
1152
1160
  },
1153
- /* @__PURE__ */ React6.createElement(
1154
- PromotionPopover,
1155
- {
1156
- open: isPopoverOpen,
1157
- title,
1158
- content,
1159
- ctaText: __7("Upgrade now", "elementor"),
1160
- ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
1161
- onClose: () => {
1162
- setIsPopoverOpen(false);
1163
- }
1164
- },
1165
- /* @__PURE__ */ React6.createElement(
1166
- PromotionChip,
1167
- {
1168
- onClick: () => {
1169
- setIsPopoverOpen(true);
1170
- }
1171
- }
1172
- )
1173
- )
1161
+ /* @__PURE__ */ React6.createElement(PromotionChip, null)
1174
1162
  ));
1175
1163
  };
1176
1164
  var getDefaultName = (variables, type, baseName) => {
@@ -2022,7 +2010,7 @@ import { useId, useRef as useRef6 } from "react";
2022
2010
  import * as React22 from "react";
2023
2011
  import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
2024
2012
  import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
2025
- import { bindPopover, bindTrigger as bindTrigger3, Box as Box5, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
2013
+ import { bindPopover, bindTrigger as bindTrigger3, Box as Box4, Popover, usePopupState as usePopupState3 } from "@elementor/ui";
2026
2014
 
2027
2015
  // src/utils/unlink-variable.ts
2028
2016
  function transformValueBeforeUnlink(variable, propTypeKey) {
@@ -2048,11 +2036,11 @@ import { isExperimentActive } from "@elementor/editor-v1-adapters";
2048
2036
  // src/context/variable-selection-popover.context.tsx
2049
2037
  import * as React13 from "react";
2050
2038
  import { createContext as createContext2, useContext as useContext2, useState as useState7 } from "react";
2051
- import { Box as Box2 } from "@elementor/ui";
2039
+ import { Box } from "@elementor/ui";
2052
2040
  var PopoverContentRefContext = createContext2(null);
2053
2041
  var PopoverContentRefContextProvider = ({ children }) => {
2054
2042
  const [anchorRef, setAnchorRef] = useState7(null);
2055
- return /* @__PURE__ */ React13.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React13.createElement(Box2, { ref: setAnchorRef }, children));
2043
+ return /* @__PURE__ */ React13.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React13.createElement(Box, { ref: setAnchorRef }, children));
2056
2044
  };
2057
2045
  var usePopoverContentRef = () => {
2058
2046
  return useContext2(PopoverContentRefContext);
@@ -2484,14 +2472,14 @@ import { __ as __14, sprintf as sprintf3 } from "@wordpress/i18n";
2484
2472
  import * as React18 from "react";
2485
2473
  import { EllipsisWithTooltip as EllipsisWithTooltip2 } from "@elementor/editor-ui";
2486
2474
  import { EditIcon } from "@elementor/icons";
2487
- import { Box as Box3, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography9 } from "@elementor/ui";
2475
+ import { Box as Box2, IconButton as IconButton6, ListItemIcon, Tooltip as Tooltip2, Typography as Typography9 } from "@elementor/ui";
2488
2476
  import { __ as __13 } from "@wordpress/i18n";
2489
2477
  var SIZE4 = "tiny";
2490
2478
  var EDIT_LABEL = __13("Edit variable", "elementor");
2491
2479
  var MenuItemContent = ({ item }) => {
2492
2480
  const onEdit = item.onEdit;
2493
2481
  return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React18.createElement(
2494
- Box3,
2482
+ Box2,
2495
2483
  {
2496
2484
  sx: {
2497
2485
  flex: 1,
@@ -2821,7 +2809,7 @@ function RenderView(props) {
2821
2809
  // src/components/ui/tags/assigned-tag.tsx
2822
2810
  import * as React21 from "react";
2823
2811
  import { DetachIcon } from "@elementor/icons";
2824
- import { Box as Box4, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography10, UnstableTag as Tag } from "@elementor/ui";
2812
+ import { Box as Box3, IconButton as IconButton8, Stack as Stack7, Tooltip as Tooltip4, Typography as Typography10, UnstableTag as Tag } from "@elementor/ui";
2825
2813
  import { __ as __15 } from "@wordpress/i18n";
2826
2814
  var SIZE6 = "tiny";
2827
2815
  var UNLINK_LABEL = __15("Unlink variable", "elementor");
@@ -2838,7 +2826,7 @@ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
2838
2826
  fullWidth: true,
2839
2827
  showActionsOnHover: true,
2840
2828
  startIcon: /* @__PURE__ */ React21.createElement(Stack7, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
2841
- label: /* @__PURE__ */ React21.createElement(Box4, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React21.createElement(Typography10, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
2829
+ label: /* @__PURE__ */ React21.createElement(Box3, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React21.createElement(Typography10, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
2842
2830
  actions,
2843
2831
  ...props
2844
2832
  }
@@ -2857,7 +2845,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
2857
2845
  });
2858
2846
  const unlinkVariable = createUnlinkHandler(variable, propTypeKey, setValue);
2859
2847
  const StartIcon = startIcon || (() => null);
2860
- return /* @__PURE__ */ React22.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React22.createElement(
2848
+ return /* @__PURE__ */ React22.createElement(Box4, { ref: anchorRef }, /* @__PURE__ */ React22.createElement(
2861
2849
  AssignedTag,
2862
2850
  {
2863
2851
  label: variable.label,
@@ -2892,7 +2880,7 @@ var AssignedVariable = ({ variable, propTypeKey }) => {
2892
2880
  import * as React26 from "react";
2893
2881
  import { useId as useId2, useRef as useRef7, useState as useState14 } from "react";
2894
2882
  import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
2895
- import { Backdrop, bindPopover as bindPopover2, Box as Box7, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
2883
+ import { Backdrop, bindPopover as bindPopover2, Box as Box6, Infotip as Infotip2, Popover as Popover2, usePopupState as usePopupState4 } from "@elementor/ui";
2896
2884
  import { __ as __18 } from "@wordpress/i18n";
2897
2885
 
2898
2886
  // src/components/variable-restore.tsx
@@ -3031,7 +3019,7 @@ var DeletedVariableAlert = ({ onClose, onUnlink, onRestore, label }) => {
3031
3019
  // src/components/ui/tags/warning-variable-tag.tsx
3032
3020
  import * as React25 from "react";
3033
3021
  import { AlertTriangleFilledIcon as AlertTriangleFilledIcon4 } from "@elementor/icons";
3034
- import { Box as Box6, Chip, Tooltip as Tooltip5, Typography as Typography13 } from "@elementor/ui";
3022
+ import { Box as Box5, Chip, Tooltip as Tooltip5, Typography as Typography13 } from "@elementor/ui";
3035
3023
  var WarningVariableTag = React25.forwardRef(
3036
3024
  ({ label, suffix, onClick, icon, ...props }, ref) => {
3037
3025
  const displayText = suffix ? `${label} (${suffix})` : label;
@@ -3045,7 +3033,7 @@ var WarningVariableTag = React25.forwardRef(
3045
3033
  variant: "standard",
3046
3034
  onClick,
3047
3035
  icon: /* @__PURE__ */ React25.createElement(AlertTriangleFilledIcon4, null),
3048
- label: /* @__PURE__ */ React25.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React25.createElement(Box6, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React25.createElement(Typography13, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
3036
+ label: /* @__PURE__ */ React25.createElement(Tooltip5, { title: displayText, placement: "top" }, /* @__PURE__ */ React25.createElement(Box5, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React25.createElement(Typography13, { variant: "caption", noWrap: true, sx: { lineHeight: 1.34 } }, displayText))),
3049
3037
  sx: {
3050
3038
  height: (theme) => theme.spacing(3.5),
3051
3039
  borderRadius: (theme) => theme.spacing(1),
@@ -3095,7 +3083,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3095
3083
  const handleRestoreWithOverrides = () => {
3096
3084
  popupState.close();
3097
3085
  };
3098
- return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Box7, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React26.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React26.createElement(
3086
+ return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Box6, { ref: deletedChipAnchorRef }, showInfotip && /* @__PURE__ */ React26.createElement(Backdrop, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React26.createElement(
3099
3087
  Infotip2,
3100
3088
  {
3101
3089
  color: "warning",
@@ -3157,7 +3145,7 @@ var DeletedVariable = ({ variable, propTypeKey }) => {
3157
3145
  import * as React28 from "react";
3158
3146
  import { useId as useId3, useRef as useRef8, useState as useState15 } from "react";
3159
3147
  import { useBoundProp as useBoundProp9 } from "@elementor/editor-controls";
3160
- import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box8, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
3148
+ import { Backdrop as Backdrop2, bindPopover as bindPopover3, Box as Box7, Infotip as Infotip3, Popover as Popover3, usePopupState as usePopupState5 } from "@elementor/ui";
3161
3149
  import { __ as __20 } from "@wordpress/i18n";
3162
3150
 
3163
3151
  // src/components/ui/mismatch-variable-alert.tsx
@@ -3212,7 +3200,7 @@ var MismatchVariable = ({ variable }) => {
3212
3200
  setValue(null);
3213
3201
  };
3214
3202
  const showClearButton = !!value;
3215
- return /* @__PURE__ */ React28.createElement(Box8, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React28.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
3203
+ return /* @__PURE__ */ React28.createElement(Box7, { ref: anchorRef }, infotipVisible && /* @__PURE__ */ React28.createElement(Backdrop2, { open: true, onClick: closeInfotip, invisible: true }), /* @__PURE__ */ React28.createElement(
3216
3204
  Infotip3,
3217
3205
  {
3218
3206
  color: "warning",
@@ -3802,16 +3790,12 @@ function registerVariableTypes() {
3802
3790
  // src/renderers/style-variables-renderer.tsx
3803
3791
  import * as React36 from "react";
3804
3792
  import { useEffect as useEffect5, useState as useState19 } from "react";
3805
- import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
3793
+ import {
3794
+ __privateUseListenTo as useListenTo,
3795
+ commandEndEvent,
3796
+ getCanvasIframeDocument
3797
+ } from "@elementor/editor-v1-adapters";
3806
3798
  import { Portal } from "@elementor/ui";
3807
-
3808
- // src/sync/get-canvas-iframe-document.ts
3809
- function getCanvasIframeDocument() {
3810
- const extendedWindow = window;
3811
- return extendedWindow.elementor?.$preview?.[0]?.contentDocument;
3812
- }
3813
-
3814
- // src/renderers/style-variables-renderer.tsx
3815
3799
  var VARIABLES_WRAPPER = "body";
3816
3800
  function StyleVariablesRenderer() {
3817
3801
  const container = usePortalContainer();