@elementor/editor-variables 3.33.0-105 → 3.33.0-107
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 +75 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/ui/{no-variables.tsx → empty-state.tsx} +6 -11
- package/src/components/variables-selection.tsx +24 -3
- package/src/hooks/use-prop-variables.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -606,7 +606,8 @@ var useFilteredVariables = (searchValue, propTypeKey) => {
|
|
|
606
606
|
return {
|
|
607
607
|
list: searchFilteredVariables,
|
|
608
608
|
hasMatches: searchFilteredVariables.length > 0,
|
|
609
|
-
isSourceNotEmpty: typeFilteredVariables.length > 0
|
|
609
|
+
isSourceNotEmpty: typeFilteredVariables.length > 0,
|
|
610
|
+
hasNoCompatibleVariables: baseVariables.length > 0 && typeFilteredVariables.length === 0
|
|
610
611
|
};
|
|
611
612
|
};
|
|
612
613
|
var useVariableSelectionFilter = (variables) => {
|
|
@@ -1649,17 +1650,47 @@ var import_icons9 = require("@elementor/icons");
|
|
|
1649
1650
|
var import_ui19 = require("@elementor/ui");
|
|
1650
1651
|
var import_i18n13 = require("@wordpress/i18n");
|
|
1651
1652
|
|
|
1652
|
-
// src/components/ui/
|
|
1653
|
+
// src/components/ui/empty-state.tsx
|
|
1653
1654
|
var React15 = __toESM(require("react"));
|
|
1654
|
-
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1655
|
-
var import_icons8 = require("@elementor/icons");
|
|
1656
1655
|
var import_ui15 = require("@elementor/ui");
|
|
1657
1656
|
var import_i18n10 = require("@wordpress/i18n");
|
|
1657
|
+
var EmptyState = ({ icon, title, message, onAdd }) => {
|
|
1658
|
+
const canAdd = usePermissions().canAdd();
|
|
1659
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1660
|
+
import_ui15.Stack,
|
|
1661
|
+
{
|
|
1662
|
+
gap: 1,
|
|
1663
|
+
alignItems: "center",
|
|
1664
|
+
justifyContent: "center",
|
|
1665
|
+
height: "100%",
|
|
1666
|
+
color: "text.secondary",
|
|
1667
|
+
sx: { p: 2.5, pb: 5.5 }
|
|
1668
|
+
},
|
|
1669
|
+
icon,
|
|
1670
|
+
canAdd ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(Content, { title, message }), onAdd && /* @__PURE__ */ React15.createElement(import_ui15.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n10.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React15.createElement(
|
|
1671
|
+
Content,
|
|
1672
|
+
{
|
|
1673
|
+
title: (0, import_i18n10.__)("There are no variables", "elementor"),
|
|
1674
|
+
message: (0, import_i18n10.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
1675
|
+
}
|
|
1676
|
+
)
|
|
1677
|
+
);
|
|
1678
|
+
};
|
|
1679
|
+
function Content({ title, message }) {
|
|
1680
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React15.createElement(import_ui15.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
// src/components/ui/menu-item-content.tsx
|
|
1684
|
+
var React16 = __toESM(require("react"));
|
|
1685
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1686
|
+
var import_icons8 = require("@elementor/icons");
|
|
1687
|
+
var import_ui16 = require("@elementor/ui");
|
|
1688
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1658
1689
|
var SIZE3 = "tiny";
|
|
1659
1690
|
var MenuItemContent = ({ item }) => {
|
|
1660
1691
|
const onEdit = item.onEdit;
|
|
1661
|
-
return /* @__PURE__ */
|
|
1662
|
-
|
|
1692
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(import_ui16.ListItemIcon, null, item.icon), /* @__PURE__ */ React16.createElement(
|
|
1693
|
+
import_ui16.Box,
|
|
1663
1694
|
{
|
|
1664
1695
|
sx: {
|
|
1665
1696
|
flex: 1,
|
|
@@ -1669,70 +1700,47 @@ var MenuItemContent = ({ item }) => {
|
|
|
1669
1700
|
gap: 1
|
|
1670
1701
|
}
|
|
1671
1702
|
},
|
|
1672
|
-
/* @__PURE__ */
|
|
1703
|
+
/* @__PURE__ */ React16.createElement(
|
|
1673
1704
|
import_editor_ui5.EllipsisWithTooltip,
|
|
1674
1705
|
{
|
|
1675
1706
|
title: item.label || item.value,
|
|
1676
|
-
as:
|
|
1707
|
+
as: import_ui16.Typography,
|
|
1677
1708
|
variant: "caption",
|
|
1678
1709
|
color: "text.primary",
|
|
1679
1710
|
sx: { marginTop: "1px", lineHeight: "2" },
|
|
1680
1711
|
maxWidth: "50%"
|
|
1681
1712
|
}
|
|
1682
1713
|
),
|
|
1683
|
-
item.secondaryText && /* @__PURE__ */
|
|
1714
|
+
item.secondaryText && /* @__PURE__ */ React16.createElement(
|
|
1684
1715
|
import_editor_ui5.EllipsisWithTooltip,
|
|
1685
1716
|
{
|
|
1686
1717
|
title: item.secondaryText,
|
|
1687
|
-
as:
|
|
1718
|
+
as: import_ui16.Typography,
|
|
1688
1719
|
variant: "caption",
|
|
1689
1720
|
color: "text.tertiary",
|
|
1690
1721
|
sx: { marginTop: "1px", lineHeight: "1" },
|
|
1691
1722
|
maxWidth: "50%"
|
|
1692
1723
|
}
|
|
1693
1724
|
)
|
|
1694
|
-
), !!onEdit && /* @__PURE__ */
|
|
1695
|
-
|
|
1725
|
+
), !!onEdit && /* @__PURE__ */ React16.createElement(
|
|
1726
|
+
import_ui16.IconButton,
|
|
1696
1727
|
{
|
|
1697
1728
|
sx: { mx: 1, opacity: "0" },
|
|
1698
1729
|
onClick: (e) => {
|
|
1699
1730
|
e.stopPropagation();
|
|
1700
1731
|
onEdit(item.value);
|
|
1701
1732
|
},
|
|
1702
|
-
"aria-label": (0,
|
|
1733
|
+
"aria-label": (0, import_i18n11.__)("Edit", "elementor")
|
|
1703
1734
|
},
|
|
1704
|
-
/* @__PURE__ */
|
|
1735
|
+
/* @__PURE__ */ React16.createElement(import_icons8.EditIcon, { color: "action", fontSize: SIZE3 })
|
|
1705
1736
|
));
|
|
1706
1737
|
};
|
|
1707
1738
|
|
|
1708
1739
|
// src/components/ui/no-search-results.tsx
|
|
1709
|
-
var React16 = __toESM(require("react"));
|
|
1710
|
-
var import_ui16 = require("@elementor/ui");
|
|
1711
|
-
var import_i18n11 = require("@wordpress/i18n");
|
|
1712
|
-
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
1713
|
-
return /* @__PURE__ */ React16.createElement(
|
|
1714
|
-
import_ui16.Stack,
|
|
1715
|
-
{
|
|
1716
|
-
gap: 1,
|
|
1717
|
-
alignItems: "center",
|
|
1718
|
-
justifyContent: "center",
|
|
1719
|
-
height: "100%",
|
|
1720
|
-
p: 2.5,
|
|
1721
|
-
color: "text.secondary",
|
|
1722
|
-
sx: { pb: 3.5 }
|
|
1723
|
-
},
|
|
1724
|
-
icon,
|
|
1725
|
-
/* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n11.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React16.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1726
|
-
/* @__PURE__ */ React16.createElement(import_ui16.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n11.__)("Try something else.", "elementor"), /* @__PURE__ */ React16.createElement(import_ui16.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n11.__)("Clear & try again", "elementor")))
|
|
1727
|
-
);
|
|
1728
|
-
};
|
|
1729
|
-
|
|
1730
|
-
// src/components/ui/no-variables.tsx
|
|
1731
1740
|
var React17 = __toESM(require("react"));
|
|
1732
1741
|
var import_ui17 = require("@elementor/ui");
|
|
1733
1742
|
var import_i18n12 = require("@wordpress/i18n");
|
|
1734
|
-
var
|
|
1735
|
-
const canAdd = usePermissions().canAdd();
|
|
1743
|
+
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
1736
1744
|
return /* @__PURE__ */ React17.createElement(
|
|
1737
1745
|
import_ui17.Stack,
|
|
1738
1746
|
{
|
|
@@ -1740,31 +1748,15 @@ var NoVariables = ({ icon, title, onAdd }) => {
|
|
|
1740
1748
|
alignItems: "center",
|
|
1741
1749
|
justifyContent: "center",
|
|
1742
1750
|
height: "100%",
|
|
1751
|
+
p: 2.5,
|
|
1743
1752
|
color: "text.secondary",
|
|
1744
|
-
sx: {
|
|
1753
|
+
sx: { pb: 3.5 }
|
|
1745
1754
|
},
|
|
1746
1755
|
icon,
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
{
|
|
1750
|
-
title: title || (0, import_i18n12.__)("Create your first variable", "elementor"),
|
|
1751
|
-
message: (0, import_i18n12.__)(
|
|
1752
|
-
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1753
|
-
"elementor"
|
|
1754
|
-
)
|
|
1755
|
-
}
|
|
1756
|
-
), onAdd && /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n12.__)("Create a variable", "elementor"))) : /* @__PURE__ */ React17.createElement(
|
|
1757
|
-
NoVariablesContent,
|
|
1758
|
-
{
|
|
1759
|
-
title: (0, import_i18n12.__)("There are no variables", "elementor"),
|
|
1760
|
-
message: (0, import_i18n12.__)("With your current role, you can only connect and detach variables.", "elementor")
|
|
1761
|
-
}
|
|
1762
|
-
)
|
|
1756
|
+
/* @__PURE__ */ React17.createElement(import_ui17.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n12.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React17.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1757
|
+
/* @__PURE__ */ React17.createElement(import_ui17.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n12.__)("Try something else.", "elementor"), /* @__PURE__ */ React17.createElement(import_ui17.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n12.__)("Clear & try again", "elementor")))
|
|
1763
1758
|
);
|
|
1764
1759
|
};
|
|
1765
|
-
function NoVariablesContent({ title, message }) {
|
|
1766
|
-
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { align: "center", variant: "subtitle2" }, title), /* @__PURE__ */ React17.createElement(import_ui17.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, message));
|
|
1767
|
-
}
|
|
1768
1760
|
|
|
1769
1761
|
// src/components/ui/styled-menu-list.tsx
|
|
1770
1762
|
var import_ui18 = require("@elementor/ui");
|
|
@@ -1807,7 +1799,8 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1807
1799
|
const {
|
|
1808
1800
|
list: variables,
|
|
1809
1801
|
hasMatches: hasSearchResults,
|
|
1810
|
-
isSourceNotEmpty: hasVariables
|
|
1802
|
+
isSourceNotEmpty: hasVariables,
|
|
1803
|
+
hasNoCompatibleVariables
|
|
1811
1804
|
} = useFilteredVariables(searchValue, propTypeUtil.key);
|
|
1812
1805
|
const handleSetVariable = (key) => {
|
|
1813
1806
|
setVariable(key);
|
|
@@ -1891,7 +1884,29 @@ var VariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
1891
1884
|
onClear: handleClearSearch,
|
|
1892
1885
|
icon: /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: "large" })
|
|
1893
1886
|
}
|
|
1894
|
-
), !hasVariables &&
|
|
1887
|
+
), !hasVariables && !hasNoCompatibleVariables && /* @__PURE__ */ React18.createElement(
|
|
1888
|
+
EmptyState,
|
|
1889
|
+
{
|
|
1890
|
+
title: noVariableTitle,
|
|
1891
|
+
message: (0, import_i18n13.__)(
|
|
1892
|
+
"Variables are saved attributes that you can apply anywhere on your site.",
|
|
1893
|
+
"elementor"
|
|
1894
|
+
),
|
|
1895
|
+
icon: /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: "large" }),
|
|
1896
|
+
onAdd
|
|
1897
|
+
}
|
|
1898
|
+
), hasNoCompatibleVariables && /* @__PURE__ */ React18.createElement(
|
|
1899
|
+
EmptyState,
|
|
1900
|
+
{
|
|
1901
|
+
title: (0, import_i18n13.__)("No compatible variables", "elementor"),
|
|
1902
|
+
message: (0, import_i18n13.__)(
|
|
1903
|
+
"Looks like none of your variables work with this control. Create a new variable to use it here.",
|
|
1904
|
+
"elementor"
|
|
1905
|
+
),
|
|
1906
|
+
icon: /* @__PURE__ */ React18.createElement(VariableIcon, { fontSize: "large" }),
|
|
1907
|
+
onAdd
|
|
1908
|
+
}
|
|
1909
|
+
));
|
|
1895
1910
|
};
|
|
1896
1911
|
|
|
1897
1912
|
// src/components/variable-selection-popover.tsx
|