@elementor/editor-variables 4.0.0-539 → 4.0.0-541
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.mjs
CHANGED
|
@@ -1133,21 +1133,18 @@ import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, Typography as Typogr
|
|
|
1133
1133
|
import { capitalize } from "@elementor/utils";
|
|
1134
1134
|
import { __ as __8, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
1135
1135
|
|
|
1136
|
-
// src/sync/license-info.ts
|
|
1137
|
-
function getLicenseInfo() {
|
|
1138
|
-
return {
|
|
1139
|
-
hasPro: !!window.elementorPro
|
|
1140
|
-
};
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
1136
|
// src/hooks/use-quota-permissions.ts
|
|
1144
1137
|
var useQuotaPermissions = (variableType) => {
|
|
1145
|
-
const quotaConfig =
|
|
1138
|
+
const quotaConfig = {
|
|
1139
|
+
...window.ElementorVariablesQuotaConfig || {},
|
|
1140
|
+
...window.ElementorVariablesQuotaConfigExtended || {}
|
|
1141
|
+
};
|
|
1142
|
+
const hasLegacySupport = quotaConfig[variableType] === void 0 && window.elementorPro;
|
|
1146
1143
|
const limit = quotaConfig[variableType] || 0;
|
|
1147
|
-
const
|
|
1144
|
+
const hasPermission = hasLegacySupport || limit > 0;
|
|
1148
1145
|
return {
|
|
1149
|
-
canAdd: () =>
|
|
1150
|
-
canEdit: () =>
|
|
1146
|
+
canAdd: () => hasPermission,
|
|
1147
|
+
canEdit: () => hasPermission
|
|
1151
1148
|
};
|
|
1152
1149
|
};
|
|
1153
1150
|
|
|
@@ -2632,10 +2629,15 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2632
2629
|
};
|
|
2633
2630
|
|
|
2634
2631
|
// src/components/variables-selection.tsx
|
|
2635
|
-
import * as React20 from "react";
|
|
2636
2632
|
import { useState as useState12 } from "react";
|
|
2637
|
-
import
|
|
2638
|
-
import {
|
|
2633
|
+
import * as React20 from "react";
|
|
2634
|
+
import {
|
|
2635
|
+
PopoverHeader as PopoverHeader3,
|
|
2636
|
+
PopoverMenuList,
|
|
2637
|
+
SearchField as SearchField2,
|
|
2638
|
+
SectionPopoverBody as SectionPopoverBody3
|
|
2639
|
+
} from "@elementor/editor-ui";
|
|
2640
|
+
import { PromotionAlert } from "@elementor/editor-ui";
|
|
2639
2641
|
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon } from "@elementor/icons";
|
|
2640
2642
|
import { Divider as Divider4, IconButton as IconButton7, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
2641
2643
|
import { __ as __15, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
@@ -2648,9 +2650,9 @@ import { Box as Box2, IconButton as IconButton6, ListItemIcon, Tooltip as Toolti
|
|
|
2648
2650
|
import { __ as __14 } from "@wordpress/i18n";
|
|
2649
2651
|
var SIZE4 = "tiny";
|
|
2650
2652
|
var EDIT_LABEL = __14("Edit variable", "elementor");
|
|
2651
|
-
var MenuItemContent = ({ item }) => {
|
|
2653
|
+
var MenuItemContent = ({ item, disabled = false }) => {
|
|
2652
2654
|
const onEdit = item.onEdit;
|
|
2653
|
-
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(ListItemIcon,
|
|
2655
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(ListItemIcon, { sx: { color: disabled ? "text.disabled" : "inherit" } }, item.icon), /* @__PURE__ */ React19.createElement(
|
|
2654
2656
|
Box2,
|
|
2655
2657
|
{
|
|
2656
2658
|
sx: {
|
|
@@ -2667,7 +2669,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
2667
2669
|
title: item.label || item.value,
|
|
2668
2670
|
as: Typography10,
|
|
2669
2671
|
variant: "caption",
|
|
2670
|
-
color: "text.primary",
|
|
2672
|
+
color: disabled ? "text.disabled" : "text.primary",
|
|
2671
2673
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
2672
2674
|
maxWidth: "50%"
|
|
2673
2675
|
}
|
|
@@ -2678,12 +2680,12 @@ var MenuItemContent = ({ item }) => {
|
|
|
2678
2680
|
title: item.secondaryText,
|
|
2679
2681
|
as: Typography10,
|
|
2680
2682
|
variant: "caption",
|
|
2681
|
-
color: "text.tertiary",
|
|
2683
|
+
color: disabled ? "text.disabled" : "text.tertiary",
|
|
2682
2684
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
2683
2685
|
maxWidth: "50%"
|
|
2684
2686
|
}
|
|
2685
2687
|
)
|
|
2686
|
-
), !!onEdit && /* @__PURE__ */ React19.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2688
|
+
), !!onEdit && !disabled && /* @__PURE__ */ React19.createElement(Tooltip2, { placement: "top", title: EDIT_LABEL }, /* @__PURE__ */ React19.createElement(
|
|
2687
2689
|
IconButton6,
|
|
2688
2690
|
{
|
|
2689
2691
|
sx: { mx: 1, opacity: "0" },
|
|
@@ -2699,7 +2701,7 @@ var MenuItemContent = ({ item }) => {
|
|
|
2699
2701
|
|
|
2700
2702
|
// src/components/ui/styled-menu-list.tsx
|
|
2701
2703
|
import { MenuList, styled as styled2 } from "@elementor/ui";
|
|
2702
|
-
var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
2704
|
+
var VariablesStyledMenuList = styled2(MenuList)(({ theme, disabled }) => ({
|
|
2703
2705
|
"& > li": {
|
|
2704
2706
|
height: 32,
|
|
2705
2707
|
width: "100%",
|
|
@@ -2710,13 +2712,15 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
2710
2712
|
...theme.typography.caption,
|
|
2711
2713
|
lineHeight: "inherit",
|
|
2712
2714
|
padding: theme.spacing(0.5, 1, 0.5, 2),
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
+
...!disabled && {
|
|
2716
|
+
"&:hover, &:focus": {
|
|
2717
|
+
backgroundColor: theme.palette.action.hover
|
|
2718
|
+
},
|
|
2719
|
+
cursor: "pointer"
|
|
2715
2720
|
},
|
|
2716
2721
|
'&[aria-selected="true"]': {
|
|
2717
2722
|
backgroundColor: theme.palette.action.selected
|
|
2718
2723
|
},
|
|
2719
|
-
cursor: "pointer",
|
|
2720
2724
|
textOverflow: "ellipsis",
|
|
2721
2725
|
position: "absolute",
|
|
2722
2726
|
top: 0,
|
|
@@ -2733,6 +2737,7 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
2733
2737
|
var SIZE5 = "tiny";
|
|
2734
2738
|
var CREATE_LABEL = __15("Create variable", "elementor");
|
|
2735
2739
|
var MANAGER_LABEL = __15("Variables Manager", "elementor");
|
|
2740
|
+
var getProUpgradeUrl = (variableType) => `https://go.elementor.com/go-pro-panel-${variableType}-variable/`;
|
|
2736
2741
|
var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled = false }) => {
|
|
2737
2742
|
const { icon: VariableIcon, startIcon, variableType, propTypeUtil, emptyState } = useVariableType();
|
|
2738
2743
|
const { value: variable, setValue: setVariable, path } = useVariableBoundProp();
|
|
@@ -2828,26 +2833,37 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings, disabled =
|
|
|
2828
2833
|
onSearch: handleSearch,
|
|
2829
2834
|
placeholder: __15("Search", "elementor")
|
|
2830
2835
|
}
|
|
2831
|
-
), /* @__PURE__ */ React20.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React20.createElement(
|
|
2836
|
+
), /* @__PURE__ */ React20.createElement(Divider4, null), hasVariables && hasSearchResults && /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
2832
2837
|
PopoverMenuList,
|
|
2833
2838
|
{
|
|
2834
2839
|
items,
|
|
2835
|
-
onSelect:
|
|
2840
|
+
onSelect: disabled ? () => {
|
|
2841
|
+
} : handleSetVariable,
|
|
2836
2842
|
onClose: () => {
|
|
2837
2843
|
},
|
|
2838
2844
|
selectedValue: variable,
|
|
2839
2845
|
"data-testid": `${variableType}-variables-list`,
|
|
2840
|
-
menuListTemplate: VariablesStyledMenuList,
|
|
2841
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */ React20.createElement(MenuItemContent, { item })
|
|
2846
|
+
menuListTemplate: (props) => /* @__PURE__ */ React20.createElement(VariablesStyledMenuList, { ...props, disabled }),
|
|
2847
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React20.createElement(MenuItemContent, { item, disabled })
|
|
2842
2848
|
}
|
|
2843
|
-
),
|
|
2849
|
+
), disabled && /* @__PURE__ */ React20.createElement(
|
|
2850
|
+
PromotionAlert,
|
|
2851
|
+
{
|
|
2852
|
+
message: sprintf3(
|
|
2853
|
+
/* translators: %s: Variable Type. */
|
|
2854
|
+
__15("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
2855
|
+
variableType
|
|
2856
|
+
),
|
|
2857
|
+
upgradeUrl: getProUpgradeUrl(variableType)
|
|
2858
|
+
}
|
|
2859
|
+
)), !hasSearchResults && hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2844
2860
|
NoSearchResults,
|
|
2845
2861
|
{
|
|
2846
2862
|
searchValue,
|
|
2847
2863
|
onClear: handleClearSearch,
|
|
2848
2864
|
icon: /* @__PURE__ */ React20.createElement(VariableIcon, { fontSize: "large" })
|
|
2849
2865
|
}
|
|
2850
|
-
), disabled && /* @__PURE__ */ React20.createElement(
|
|
2866
|
+
), disabled && !hasVariables && /* @__PURE__ */ React20.createElement(
|
|
2851
2867
|
EmptyState,
|
|
2852
2868
|
{
|
|
2853
2869
|
title: sprintf3(
|