@elementor/editor-variables 4.0.0-539 → 4.0.0-540
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 +41 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/ui/menu-item-content.tsx +12 -6
- package/src/components/ui/styled-menu-list.tsx +7 -5
- package/src/components/variables-selection.tsx +35 -14
- package/src/hooks/use-quota-permissions.ts +10 -11
- package/src/sync/license-info.ts +0 -5
package/dist/index.js
CHANGED
|
@@ -1147,21 +1147,18 @@ var import_ui7 = require("@elementor/ui");
|
|
|
1147
1147
|
var import_utils = require("@elementor/utils");
|
|
1148
1148
|
var import_i18n8 = require("@wordpress/i18n");
|
|
1149
1149
|
|
|
1150
|
-
// src/sync/license-info.ts
|
|
1151
|
-
function getLicenseInfo() {
|
|
1152
|
-
return {
|
|
1153
|
-
hasPro: !!window.elementorPro
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
1150
|
// src/hooks/use-quota-permissions.ts
|
|
1158
1151
|
var useQuotaPermissions = (variableType) => {
|
|
1159
|
-
const quotaConfig =
|
|
1152
|
+
const quotaConfig = {
|
|
1153
|
+
...window.ElementorVariablesQuotaConfig || {},
|
|
1154
|
+
...window.ElementorVariablesQuotaConfigExtended || {}
|
|
1155
|
+
};
|
|
1156
|
+
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1160
1157
|
const limit = quotaConfig[variableType] || 0;
|
|
1161
|
-
const
|
|
1158
|
+
const hasPermission = hasLegacySupport || limit > 0;
|
|
1162
1159
|
return {
|
|
1163
|
-
canAdd: () =>
|
|
1164
|
-
canEdit: () =>
|
|
1160
|
+
canAdd: () => hasPermission,
|
|
1161
|
+
canEdit: () => hasPermission
|
|
1165
1162
|
};
|
|
1166
1163
|
};
|
|
1167
1164
|
|
|
@@ -2626,8 +2623,8 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2626
2623
|
};
|
|
2627
2624
|
|
|
2628
2625
|
// src/components/variables-selection.tsx
|
|
2629
|
-
var React20 = __toESM(require("react"));
|
|
2630
2626
|
var import_react18 = require("react");
|
|
2627
|
+
var React20 = __toESM(require("react"));
|
|
2631
2628
|
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
2632
2629
|
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2633
2630
|
var import_icons11 = require("@elementor/icons");
|
|
@@ -2642,9 +2639,9 @@ var import_ui19 = require("@elementor/ui");
|
|
|
2642
2639
|
var import_i18n14 = require("@wordpress/i18n");
|
|
2643
2640
|
var SIZE4 = "tiny";
|
|
2644
2641
|
var EDIT_LABEL = (0, import_i18n14.__)("Edit variable", "elementor");
|
|
2645
|
-
var MenuItemContent = ({ item }) => {
|
|
2642
|
+
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2646
2643
|
const onEdit = item.onEdit;
|
|
2647
|
-
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui19.ListItemIcon,
|
|
2644
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui19.ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React19.createElement(
|
|
2648
2645
|
import_ui19.Box,
|
|
2649
2646
|
{
|
|
2650
2647
|
sx: {
|
|
@@ -2661,7 +2658,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
2661
2658
|
title: item.label || item.value,
|
|
2662
2659
|
as: import_ui19.Typography,
|
|
2663
2660
|
variant: "caption",
|
|
2664
|
-
color: "text.primary",
|
|
2661
|
+
color: disabled ? "text.disabled" : "text.primary",
|
|
2665
2662
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2666
2663
|
maxWidth: "50%"
|
|
2667
2664
|
}
|
|
@@ -2672,12 +2669,12 @@ var MenuItemContent = ({ item }) => {
|
|
|
2672
2669
|
title: item.secondaryText,
|
|
2673
2670
|
as: import_ui19.Typography,
|
|
2674
2671
|
variant: "caption",
|
|
2675
|
-
color: "text.tertiary",
|
|
2672
|
+
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2676
2673
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2677
2674
|
maxWidth: "50%"
|
|
2678
2675
|
}
|
|
2679
2676
|
)
|
|
2680
|
-
), !!onEdit && /* @__PURE__ */ React19.createElement(import_ui19.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2677
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React19.createElement(import_ui19.Tooltip, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2681
2678
|
import_ui19.IconButton,
|
|
2682
2679
|
{
|
|
2683
2680
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2693,7 +2690,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
2693
2690
|
|
|
2694
2691
|
// src/components/ui/styled-menu-list.tsx
|
|
2695
2692
|
var import_ui20 = require("@elementor/ui");
|
|
2696
|
-
var VariablesStyledMenuList = (0, import_ui20.styled)(import_ui20.MenuList)(({ theme }) => ({
|
|
2693
|
+
var VariablesStyledMenuList = (0, import_ui20.styled)(import_ui20.MenuList)(({ theme, disabled }) => ({
|
|
2697
2694
|
"& > li": {
|
|
2698
2695
|
height: 32,
|
|
2699
2696
|
width: "100%",
|
|
@@ -2704,13 +2701,15 @@ var VariablesStyledMenuList = (0, import_ui20.styled)(import_ui20.MenuList)(({ t
|
|
|
2704
2701
|
...theme.typography.caption,
|
|
2705
2702
|
lineHeight: "inherit",
|
|
2706
2703
|
padding: theme.spacing(0.5, 1, 0.5, 2),
|
|
2707
|
-
|
|
2708
|
-
|
|
2704
|
+
...!disabled && {
|
|
2705
|
+
"&:hover, &:focus": {
|
|
2706
|
+
backgroundColor: theme.palette.action.hover
|
|
2707
|
+
},
|
|
2708
|
+
cursor: "pointer"
|
|
2709
2709
|
},
|
|
2710
2710
|
'&[aria-selected="true"]': {
|
|
2711
2711
|
backgroundColor: theme.palette.action.selected
|
|
2712
2712
|
},
|
|
2713
|
-
cursor: "pointer",
|
|
2714
2713
|
textOverflow: "ellipsis",
|
|
2715
2714
|
position: "absolute",
|
|
2716
2715
|
top: 0,
|
|
@@ -2727,6 +2726,7 @@ var VariablesStyledMenuList = (0, import_ui20.styled)(import_ui20.MenuList)(({ t
|
|
|
2727
2726
|
var SIZE5 = "tiny";
|
|
2728
2727
|
var CREATE_LABEL = (0, import_i18n15.__)("Create variable", "elementor");
|
|
2729
2728
|
var MANAGER_LABEL = (0, import_i18n15.__)("Variables Manager", "elementor");
|
|
2729
|
+
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/go-pro-panel-${variableType}-variable/`;
|
|
2730
2730
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2731
2731
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2732
2732
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
@@ -2808,7 +2808,7 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2808
2808
|
setSearchValue("");
|
|
2809
2809
|
};
|
|
2810
2810
|
return /* @__PURE__ */ React20.createElement(import_editor_ui9.SectionPopoverBody, null, /* @__PURE__ */ React20.createElement(
|
|
2811
|
-
|
|
2811
|
+
import_editor_ui9.PopoverHeader,
|
|
2812
2812
|
{
|
|
2813
2813
|
title: (0, import_i18n15.__)("Variables", "elementor"),
|
|
2814
2814
|
icon: /* @__PURE__ */ React20.createElement(import_icons11.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
@@ -2816,32 +2816,43 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2816
2816
|
actions
|
|
2817
2817
|
}
|
|
2818
2818
|
), hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2819
|
-
|
|
2819
|
+
import_editor_ui9.SearchField,
|
|
2820
2820
|
{
|
|
2821
2821
|
value: searchValue,
|
|
2822
2822
|
onSearch: handleSearch,
|
|
2823
2823
|
placeholder: (0, import_i18n15.__)("Search", "elementor")
|
|
2824
2824
|
}
|
|
2825
|
-
), /* @__PURE__ */ React20.createElement(import_ui21.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React20.createElement(
|
|
2826
|
-
|
|
2825
|
+
), /* @__PURE__ */ React20.createElement(import_ui21.Divider, null), hasVariables && hasSearchResults && /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
2826
|
+
import_editor_ui9.PopoverMenuList,
|
|
2827
2827
|
{
|
|
2828
2828
|
items,
|
|
2829
|
-
onSelect:
|
|
2829
|
+
onSelect: disabled ? () => {
|
|
2830
|
+
} : handleSetVariable,
|
|
2830
2831
|
onClose: () => {
|
|
2831
2832
|
},
|
|
2832
2833
|
selectedValue: variable,
|
|
2833
2834
|
"data-testid": `${variableType}-variables-list`,
|
|
2834
|
-
menuListTemplate: VariablesStyledMenuList,
|
|
2835
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */ React20.createElement(MenuItemContent, { item })
|
|
2835
|
+
menuListTemplate: (props) => /* @__PURE__ */ React20.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2836
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React20.createElement(MenuItemContent, { item, disabled })
|
|
2836
2837
|
}
|
|
2837
|
-
),
|
|
2838
|
+
), disabled && /* @__PURE__ */ React20.createElement(
|
|
2839
|
+
import_editor_ui10.PromotionAlert,
|
|
2840
|
+
{
|
|
2841
|
+
message: (0, import_i18n15.sprintf)(
|
|
2842
|
+
/* translators: %s: Variable Type. */
|
|
2843
|
+
(0, import_i18n15.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2844
|
+
variableType
|
|
2845
|
+
),
|
|
2846
|
+
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2847
|
+
}
|
|
2848
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2838
2849
|
NoSearchResults,
|
|
2839
2850
|
{
|
|
2840
2851
|
searchValue,
|
|
2841
2852
|
onClear: handleClearSearch,
|
|
2842
2853
|
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" })
|
|
2843
2854
|
}
|
|
2844
|
-
), disabled && /* @__PURE__ */ React20.createElement(
|
|
2855
|
+
), disabled && !hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2845
2856
|
EmptyState,
|
|
2846
2857
|
{
|
|
2847
2858
|
title: (0, import_i18n15.sprintf)(
|