@uniformdev/mesh-sdk-react 19.108.0 → 19.112.0
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.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.esm.js +392 -360
- package/dist/index.js +746 -714
- package/dist/index.mjs +392 -360
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1165,8 +1165,8 @@ var ProductPreviewList = ({
|
|
|
1165
1165
|
|
|
1166
1166
|
// src/components/commerce/ProductSearch.tsx
|
|
1167
1167
|
var import_design_system10 = require("@uniformdev/design-system");
|
|
1168
|
-
var
|
|
1169
|
-
var
|
|
1168
|
+
var import_react22 = __toESM(require("react"));
|
|
1169
|
+
var import_react_use4 = require("react-use");
|
|
1170
1170
|
|
|
1171
1171
|
// src/components/legacy/EntrySearch/DefaultSearchRow.tsx
|
|
1172
1172
|
var import_react9 = require("@emotion/react");
|
|
@@ -1575,11 +1575,11 @@ var DefaultSelectedItem = ({
|
|
|
1575
1575
|
};
|
|
1576
1576
|
|
|
1577
1577
|
// src/components/legacy/EntrySearch/EntrySearch.tsx
|
|
1578
|
-
var
|
|
1578
|
+
var import_react17 = require("@emotion/react");
|
|
1579
1579
|
var import_design_system7 = require("@uniformdev/design-system");
|
|
1580
1580
|
var React5 = __toESM(require("react"));
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1581
|
+
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
|
1582
|
+
var import_react_use3 = require("react-use");
|
|
1583
1583
|
var import_uuid = require("uuid");
|
|
1584
1584
|
|
|
1585
1585
|
// src/hooks/useLoadingDelay.ts
|
|
@@ -1615,16 +1615,33 @@ function useLoadingDelay(loading, { delay = 500, minDuration = 200 } = {
|
|
|
1615
1615
|
return state === "DISPLAY" || state === "EXPIRE";
|
|
1616
1616
|
}
|
|
1617
1617
|
|
|
1618
|
+
// src/components/DragDropContext.tsx
|
|
1619
|
+
var import_react15 = require("react");
|
|
1620
|
+
var import_react_beautiful_dnd = require("react-beautiful-dnd");
|
|
1621
|
+
var import_react_use2 = require("react-use");
|
|
1622
|
+
var import_jsx_runtime21 = require("@emotion/react/jsx-runtime");
|
|
1623
|
+
function DragDropContext({ children, ...props }) {
|
|
1624
|
+
const [isReady, setIsReady] = (0, import_react15.useState)(false);
|
|
1625
|
+
(0, import_react_use2.useDebounce)(
|
|
1626
|
+
() => {
|
|
1627
|
+
setIsReady(true);
|
|
1628
|
+
},
|
|
1629
|
+
300,
|
|
1630
|
+
[]
|
|
1631
|
+
);
|
|
1632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_beautiful_dnd.DragDropContext, { ...props, children: isReady ? children : null });
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1618
1635
|
// src/components/legacy/EntrySearch/styles/EntrySearch.styles.ts
|
|
1619
|
-
var
|
|
1620
|
-
var entrySearchWrapper =
|
|
1636
|
+
var import_react16 = require("@emotion/react");
|
|
1637
|
+
var entrySearchWrapper = import_react16.css`
|
|
1621
1638
|
background: var(--white);
|
|
1622
1639
|
border: 1px solid var(--gray-300);
|
|
1623
1640
|
border-radius: var(--rounded-base);
|
|
1624
1641
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
|
|
1625
1642
|
margin-bottom: var(--spacing-base);
|
|
1626
1643
|
`;
|
|
1627
|
-
var entrySearchBtn =
|
|
1644
|
+
var entrySearchBtn = import_react16.css`
|
|
1628
1645
|
align-items: center;
|
|
1629
1646
|
display: flex;
|
|
1630
1647
|
position: relative;
|
|
@@ -1633,7 +1650,7 @@ var entrySearchBtn = import_react15.css`
|
|
|
1633
1650
|
background-color: transparent;
|
|
1634
1651
|
border: 0;
|
|
1635
1652
|
`;
|
|
1636
|
-
var entrySearchLoadMoreBtn =
|
|
1653
|
+
var entrySearchLoadMoreBtn = import_react16.css`
|
|
1637
1654
|
color: var(--typography-base);
|
|
1638
1655
|
display: block;
|
|
1639
1656
|
font-weight: var(--fw-bold);
|
|
@@ -1650,17 +1667,17 @@ var entrySearchLoadMoreBtn = import_react15.css`
|
|
|
1650
1667
|
outline: none;
|
|
1651
1668
|
}
|
|
1652
1669
|
`;
|
|
1653
|
-
var entrySearchConfig =
|
|
1670
|
+
var entrySearchConfig = import_react16.css`
|
|
1654
1671
|
background: var(--white);
|
|
1655
1672
|
border: 1px solid var(--gray-300);
|
|
1656
1673
|
border-radius: var(--rounded-base);
|
|
1657
1674
|
padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
|
|
1658
1675
|
display: block;
|
|
1659
1676
|
`;
|
|
1660
|
-
var entrySearchConfigHidden =
|
|
1677
|
+
var entrySearchConfigHidden = import_react16.css`
|
|
1661
1678
|
display: none;
|
|
1662
1679
|
`;
|
|
1663
|
-
var entrySearchResultList =
|
|
1680
|
+
var entrySearchResultList = import_react16.css`
|
|
1664
1681
|
overflow-y: auto;
|
|
1665
1682
|
height: 16rem;
|
|
1666
1683
|
margin-bottom: var(--spacing-base);
|
|
@@ -1670,11 +1687,11 @@ var entrySearchResultList = import_react15.css`
|
|
|
1670
1687
|
border-bottom: 1px solid var(--gray-200);
|
|
1671
1688
|
}
|
|
1672
1689
|
`;
|
|
1673
|
-
var entrySearchSelectInput =
|
|
1690
|
+
var entrySearchSelectInput = import_react16.css`
|
|
1674
1691
|
background-color: var(--gray-50);
|
|
1675
1692
|
max-width: 33.33%;
|
|
1676
1693
|
`;
|
|
1677
|
-
var entrySearchSelectIcon =
|
|
1694
|
+
var entrySearchSelectIcon = import_react16.css`
|
|
1678
1695
|
align-items: center;
|
|
1679
1696
|
display: flex;
|
|
1680
1697
|
position: absolute;
|
|
@@ -1682,18 +1699,18 @@ var entrySearchSelectIcon = import_react15.css`
|
|
|
1682
1699
|
pointer-events: none;
|
|
1683
1700
|
padding-right: var(--spacing-sm);
|
|
1684
1701
|
`;
|
|
1685
|
-
var entrySearchSelectImg =
|
|
1702
|
+
var entrySearchSelectImg = import_react16.css`
|
|
1686
1703
|
color: var(--typography-base);
|
|
1687
1704
|
width: 1.25rem;
|
|
1688
1705
|
height: 1.25rem;
|
|
1689
1706
|
transition: transform var(--duration-fast) var(--timing-ease-out);
|
|
1690
1707
|
transform: rotate(0);
|
|
1691
1708
|
`;
|
|
1692
|
-
var entrySearchSelectOption =
|
|
1709
|
+
var entrySearchSelectOption = import_react16.css`
|
|
1693
1710
|
background: var(--white);
|
|
1694
1711
|
color: var(--typography-base);
|
|
1695
1712
|
`;
|
|
1696
|
-
var draggableContainer =
|
|
1713
|
+
var draggableContainer = import_react16.css`
|
|
1697
1714
|
position: relative;
|
|
1698
1715
|
margin-block: var(--spacing-sm) 0;
|
|
1699
1716
|
|
|
@@ -1706,7 +1723,7 @@ var draggableContainer = import_react15.css`
|
|
|
1706
1723
|
top: auto !important;
|
|
1707
1724
|
}
|
|
1708
1725
|
`;
|
|
1709
|
-
var draggableIconWrapper =
|
|
1726
|
+
var draggableIconWrapper = import_react16.css`
|
|
1710
1727
|
align-items: center;
|
|
1711
1728
|
display: flex;
|
|
1712
1729
|
position: absolute;
|
|
@@ -1714,20 +1731,20 @@ var draggableIconWrapper = import_react15.css`
|
|
|
1714
1731
|
margin-block: auto;
|
|
1715
1732
|
opacity: 0;
|
|
1716
1733
|
`;
|
|
1717
|
-
var draggableIcon =
|
|
1734
|
+
var draggableIcon = import_react16.css`
|
|
1718
1735
|
color: var(--typography-base);
|
|
1719
1736
|
`;
|
|
1720
|
-
var draggableIconOffset =
|
|
1737
|
+
var draggableIconOffset = import_react16.css`
|
|
1721
1738
|
position: absolute;
|
|
1722
1739
|
left: 0.375rem;
|
|
1723
1740
|
`;
|
|
1724
|
-
var badgeIcon =
|
|
1741
|
+
var badgeIcon = import_react16.css`
|
|
1725
1742
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
1726
1743
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
1727
1744
|
`;
|
|
1728
1745
|
|
|
1729
1746
|
// src/components/legacy/EntrySearch/EntrySearch.tsx
|
|
1730
|
-
var
|
|
1747
|
+
var import_jsx_runtime22 = require("@emotion/react/jsx-runtime");
|
|
1731
1748
|
var DefaultNoResults = ({ searchText, selectedContentType }) => {
|
|
1732
1749
|
let message = "No content found";
|
|
1733
1750
|
if (selectedContentType && selectedContentType !== "any") {
|
|
@@ -1736,7 +1753,7 @@ var DefaultNoResults = ({ searchText, selectedContentType }) => {
|
|
|
1736
1753
|
if (searchText) {
|
|
1737
1754
|
message = `${message} for keyword '${searchText}'.`;
|
|
1738
1755
|
}
|
|
1739
|
-
return /* @__PURE__ */ (0,
|
|
1756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system7.Callout, { type: "info", children: message });
|
|
1740
1757
|
};
|
|
1741
1758
|
var EntrySearch = ({
|
|
1742
1759
|
search,
|
|
@@ -1780,7 +1797,7 @@ var EntrySearch = ({
|
|
|
1780
1797
|
const [selectedListItems, setSelectedListItems] = React5.useState([]);
|
|
1781
1798
|
const [loadingMore, setLoadingMore] = React5.useState(false);
|
|
1782
1799
|
const listBoxId = React5.useRef(`x${(0, import_uuid.v4)()}`);
|
|
1783
|
-
(0,
|
|
1800
|
+
(0, import_react_use3.useDebounce)(
|
|
1784
1801
|
() => {
|
|
1785
1802
|
search(textInput, {
|
|
1786
1803
|
count: pageSize,
|
|
@@ -1859,7 +1876,7 @@ var EntrySearch = ({
|
|
|
1859
1876
|
const ResolvedSelectedItemComponent = selectedItemComponent || DefaultSelectedItem;
|
|
1860
1877
|
const ResolvedNoResultsComponent = noResultsComponent || DefaultNoResults;
|
|
1861
1878
|
const CompIcon = logoIcon && typeof logoIcon !== "string" ? logoIcon : null;
|
|
1862
|
-
const resolvedIcon = CompIcon ? /* @__PURE__ */ (0,
|
|
1879
|
+
const resolvedIcon = CompIcon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CompIcon, { css: badgeIcon }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: logoIcon, alt: "Logo", css: badgeIcon });
|
|
1863
1880
|
const onDragEnd = (res) => {
|
|
1864
1881
|
var _a2, _b2;
|
|
1865
1882
|
if (res.destination && res.source.droppableId === ((_a2 = res.destination) == null ? void 0 : _a2.droppableId)) {
|
|
@@ -1873,22 +1890,22 @@ var EntrySearch = ({
|
|
|
1873
1890
|
return result;
|
|
1874
1891
|
}
|
|
1875
1892
|
};
|
|
1876
|
-
return /* @__PURE__ */ (0,
|
|
1893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1877
1894
|
"div",
|
|
1878
1895
|
{
|
|
1879
|
-
css:
|
|
1896
|
+
css: import_react17.css`
|
|
1880
1897
|
width: 100%;
|
|
1881
1898
|
`,
|
|
1882
|
-
children: /* @__PURE__ */ (0,
|
|
1899
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1883
1900
|
"div",
|
|
1884
1901
|
{
|
|
1885
|
-
css:
|
|
1902
|
+
css: import_react17.css`
|
|
1886
1903
|
position: relative;
|
|
1887
1904
|
margin-block: var(--spacing-base);
|
|
1888
1905
|
`,
|
|
1889
1906
|
children: [
|
|
1890
|
-
showSearchBox ? /* @__PURE__ */ (0,
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
1907
|
+
showSearchBox ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { css: entrySearchWrapper, "data-testid": "component-search", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1892
1909
|
"button",
|
|
1893
1910
|
{
|
|
1894
1911
|
css: entrySearchBtn,
|
|
@@ -1899,21 +1916,21 @@ var EntrySearch = ({
|
|
|
1899
1916
|
"aria-controls": `entry-search-config-${listBoxId.current}`,
|
|
1900
1917
|
children: [
|
|
1901
1918
|
resolvedIcon,
|
|
1902
|
-
/* @__PURE__ */ (0,
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1903
1920
|
"span",
|
|
1904
1921
|
{
|
|
1905
|
-
css:
|
|
1922
|
+
css: import_react17.css`
|
|
1906
1923
|
margin-left: var(--spacing-base);
|
|
1907
1924
|
`,
|
|
1908
1925
|
children: "Select"
|
|
1909
1926
|
}
|
|
1910
1927
|
),
|
|
1911
|
-
/* @__PURE__ */ (0,
|
|
1928
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { css: entrySearchSelectIcon, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1912
1929
|
ChevronDown_default,
|
|
1913
1930
|
{
|
|
1914
1931
|
css: [
|
|
1915
1932
|
entrySearchSelectImg,
|
|
1916
|
-
!listOpen ? void 0 :
|
|
1933
|
+
!listOpen ? void 0 : import_react17.css`
|
|
1917
1934
|
transform: rotate(180deg);
|
|
1918
1935
|
`
|
|
1919
1936
|
]
|
|
@@ -1922,7 +1939,7 @@ var EntrySearch = ({
|
|
|
1922
1939
|
]
|
|
1923
1940
|
}
|
|
1924
1941
|
) }),
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1926
1943
|
"div",
|
|
1927
1944
|
{
|
|
1928
1945
|
id: `entry-search-config-${listBoxId.current}`,
|
|
@@ -1930,16 +1947,16 @@ var EntrySearch = ({
|
|
|
1930
1947
|
css: [entrySearchConfig, listOpen ? void 0 : entrySearchConfigHidden],
|
|
1931
1948
|
children: [
|
|
1932
1949
|
helpComponent || null,
|
|
1933
|
-
/* @__PURE__ */ (0,
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1934
1951
|
"div",
|
|
1935
1952
|
{
|
|
1936
|
-
css:
|
|
1953
|
+
css: import_react17.css`
|
|
1937
1954
|
display: flex;
|
|
1938
1955
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
1939
1956
|
margin-bottom: var(--spacing-base);
|
|
1940
1957
|
`,
|
|
1941
1958
|
children: [
|
|
1942
|
-
/* @__PURE__ */ (0,
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1943
1960
|
import_design_system7.InputSelect,
|
|
1944
1961
|
{
|
|
1945
1962
|
onChange: (e) => setContentTypeSelected(e.target.value),
|
|
@@ -1957,13 +1974,13 @@ var EntrySearch = ({
|
|
|
1957
1974
|
]
|
|
1958
1975
|
}
|
|
1959
1976
|
),
|
|
1960
|
-
/* @__PURE__ */ (0,
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1961
1978
|
"div",
|
|
1962
1979
|
{
|
|
1963
|
-
css:
|
|
1980
|
+
css: import_react17.css`
|
|
1964
1981
|
flex-grow: 1;
|
|
1965
1982
|
`,
|
|
1966
|
-
children: /* @__PURE__ */ (0,
|
|
1983
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1967
1984
|
import_design_system7.InputKeywordSearch,
|
|
1968
1985
|
{
|
|
1969
1986
|
inputFieldName: "searchText",
|
|
@@ -1978,7 +1995,7 @@ var EntrySearch = ({
|
|
|
1978
1995
|
]
|
|
1979
1996
|
}
|
|
1980
1997
|
),
|
|
1981
|
-
/* @__PURE__ */ (0,
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1982
1999
|
"div",
|
|
1983
2000
|
{
|
|
1984
2001
|
css: [entrySearchResultList, import_design_system7.scrollbarStyles],
|
|
@@ -1987,8 +2004,8 @@ var EntrySearch = ({
|
|
|
1987
2004
|
tabIndex: 0,
|
|
1988
2005
|
"data-testid": "entry-list",
|
|
1989
2006
|
children: [
|
|
1990
|
-
/* @__PURE__ */ (0,
|
|
1991
|
-
Array.isArray(results) && results.length > 0 ? results.map((result) => /* @__PURE__ */ (0,
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system7.LoadingOverlay, { isActive: showLoadingOverlay }),
|
|
2008
|
+
Array.isArray(results) && results.length > 0 ? results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1992
2009
|
ResolvedRowComponent,
|
|
1993
2010
|
{
|
|
1994
2011
|
isSelected: selectedListItems.some((item) => item.id === result.id),
|
|
@@ -1996,34 +2013,34 @@ var EntrySearch = ({
|
|
|
1996
2013
|
triggerSelection: () => handleListItemSelect(result)
|
|
1997
2014
|
},
|
|
1998
2015
|
result.id
|
|
1999
|
-
)) : resultsLoading ? null : /* @__PURE__ */ (0,
|
|
2016
|
+
)) : resultsLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2000
2017
|
ResolvedNoResultsComponent,
|
|
2001
2018
|
{
|
|
2002
2019
|
searchText: textInput || textInput,
|
|
2003
2020
|
selectedContentType: (_b = (_a = contentTypes == null ? void 0 : contentTypes.find((t) => t.id === contentTypeSelected)) == null ? void 0 : _a.name) != null ? _b : contentTypeSelected
|
|
2004
2021
|
}
|
|
2005
2022
|
),
|
|
2006
|
-
!resultsLoading && typeof totalResults !== "undefined" && results && (results == null ? void 0 : results.length) < totalResults && /* @__PURE__ */ (0,
|
|
2023
|
+
!resultsLoading && typeof totalResults !== "undefined" && results && (results == null ? void 0 : results.length) < totalResults && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", css: entrySearchLoadMoreBtn, onClick: handleLoadMoreClick, children: !loadingMore ? "Load More" : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system7.LoadingIndicator, {}) })
|
|
2007
2024
|
]
|
|
2008
2025
|
}
|
|
2009
2026
|
),
|
|
2010
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2011
2028
|
"div",
|
|
2012
2029
|
{
|
|
2013
|
-
css:
|
|
2030
|
+
css: import_react17.css`
|
|
2014
2031
|
display: flex;
|
|
2015
2032
|
justify-content: space-between;
|
|
2016
2033
|
`,
|
|
2017
2034
|
children: [
|
|
2018
|
-
/* @__PURE__ */ (0,
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: onAddNew && ((_c = contentTypes == null ? void 0 : contentTypes.length) != null ? _c : 0) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2019
2036
|
import_design_system7.Menu,
|
|
2020
2037
|
{
|
|
2021
2038
|
menuLabel: "Add new menu",
|
|
2022
|
-
menuTrigger: /* @__PURE__ */ (0,
|
|
2023
|
-
children: contentTypes == null ? void 0 : contentTypes.map((ct) => /* @__PURE__ */ (0,
|
|
2039
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system7.Button, { buttonType: "secondary", children: "Add New" }),
|
|
2040
|
+
children: contentTypes == null ? void 0 : contentTypes.map((ct) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2024
2041
|
import_design_system7.MenuItem,
|
|
2025
2042
|
{
|
|
2026
|
-
css:
|
|
2043
|
+
css: import_react17.css`
|
|
2027
2044
|
background: var(--white);
|
|
2028
2045
|
color: var(--typography-base);
|
|
2029
2046
|
`,
|
|
@@ -2034,16 +2051,16 @@ var EntrySearch = ({
|
|
|
2034
2051
|
))
|
|
2035
2052
|
}
|
|
2036
2053
|
) : null }),
|
|
2037
|
-
/* @__PURE__ */ (0,
|
|
2054
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2038
2055
|
"div",
|
|
2039
2056
|
{
|
|
2040
|
-
css:
|
|
2057
|
+
css: import_react17.css`
|
|
2041
2058
|
display: flex;
|
|
2042
2059
|
gap: var(--spacing-base);
|
|
2043
2060
|
`,
|
|
2044
2061
|
children: [
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2046
|
-
/* @__PURE__ */ (0,
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system7.Button, { buttonType: "unimportant", onClick: handleCancelClick, children: "Cancel" }),
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2047
2064
|
import_design_system7.Button,
|
|
2048
2065
|
{
|
|
2049
2066
|
disabled: !selectedListItems.length,
|
|
@@ -2064,19 +2081,19 @@ var EntrySearch = ({
|
|
|
2064
2081
|
] }) : null,
|
|
2065
2082
|
!listOpen ? multiSelect && selectedListItems.length > 1 ? (
|
|
2066
2083
|
//enable dnd only if selected more then 1 item
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_beautiful_dnd2.Droppable, { droppableId: multiSelectId || "canvas-multi-select", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2068
2085
|
"div",
|
|
2069
2086
|
{
|
|
2070
2087
|
...provided.droppableProps,
|
|
2071
2088
|
ref: provided.innerRef,
|
|
2072
|
-
css:
|
|
2089
|
+
css: import_react17.css`
|
|
2073
2090
|
margin-block: var(--spacing-sm) 0;
|
|
2074
2091
|
`,
|
|
2075
2092
|
children: [
|
|
2076
2093
|
selectedListItems == null ? void 0 : selectedListItems.map((selectedItem, index) => {
|
|
2077
2094
|
if (selectedItem == null ? void 0 : selectedItem.id) {
|
|
2078
|
-
return /* @__PURE__ */ (0,
|
|
2079
|
-
return /* @__PURE__ */ (0,
|
|
2095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_beautiful_dnd2.Draggable, { draggableId: selectedItem.id, index, children: (provided2, snapshot) => {
|
|
2096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2080
2097
|
"div",
|
|
2081
2098
|
{
|
|
2082
2099
|
css: draggableContainer,
|
|
@@ -2085,8 +2102,8 @@ var EntrySearch = ({
|
|
|
2085
2102
|
...provided2.draggableProps,
|
|
2086
2103
|
...provided2.dragHandleProps,
|
|
2087
2104
|
children: [
|
|
2088
|
-
/* @__PURE__ */ (0,
|
|
2089
|
-
/* @__PURE__ */ (0,
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { css: draggableIconWrapper, children: [
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2090
2107
|
MoreVerticalAlt_default,
|
|
2091
2108
|
{
|
|
2092
2109
|
css: [draggableIcon, draggableIconOffset],
|
|
@@ -2094,9 +2111,9 @@ var EntrySearch = ({
|
|
|
2094
2111
|
height: 24
|
|
2095
2112
|
}
|
|
2096
2113
|
),
|
|
2097
|
-
/* @__PURE__ */ (0,
|
|
2114
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MoreVerticalAlt_default, { css: draggableIcon, width: 24, height: 24 })
|
|
2098
2115
|
] }),
|
|
2099
|
-
/* @__PURE__ */ (0,
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2100
2117
|
ResolvedSelectedItemComponent,
|
|
2101
2118
|
{
|
|
2102
2119
|
logoIcon,
|
|
@@ -2116,7 +2133,7 @@ var EntrySearch = ({
|
|
|
2116
2133
|
]
|
|
2117
2134
|
}
|
|
2118
2135
|
) }) })
|
|
2119
|
-
) : selectedListItems == null ? void 0 : selectedListItems.map((selectedItem) => /* @__PURE__ */ (0,
|
|
2136
|
+
) : selectedListItems == null ? void 0 : selectedListItems.map((selectedItem) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2120
2137
|
ResolvedSelectedItemComponent,
|
|
2121
2138
|
{
|
|
2122
2139
|
logoIcon,
|
|
@@ -2134,11 +2151,11 @@ var EntrySearch = ({
|
|
|
2134
2151
|
};
|
|
2135
2152
|
|
|
2136
2153
|
// src/components/commerce/ProductSearchRow.tsx
|
|
2137
|
-
var
|
|
2154
|
+
var import_react19 = require("@emotion/react");
|
|
2138
2155
|
|
|
2139
2156
|
// src/components/commerce/styles/ProductSearchRow.styles.ts
|
|
2140
|
-
var
|
|
2141
|
-
var productSearchRowContainer =
|
|
2157
|
+
var import_react18 = require("@emotion/react");
|
|
2158
|
+
var productSearchRowContainer = import_react18.css`
|
|
2142
2159
|
cursor: pointer;
|
|
2143
2160
|
padding: var(--spacing-sm) 0;
|
|
2144
2161
|
margin-right: var(--spacing-sm);
|
|
@@ -2146,7 +2163,7 @@ var productSearchRowContainer = import_react17.css`
|
|
|
2146
2163
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
2147
2164
|
color var(--duration-fast) var(--timing-ease-out);
|
|
2148
2165
|
`;
|
|
2149
|
-
var productSearchRowContent =
|
|
2166
|
+
var productSearchRowContent = import_react18.css`
|
|
2150
2167
|
border: 2px solid transparent;
|
|
2151
2168
|
border-radius: var(--rounded-base);
|
|
2152
2169
|
display: flex;
|
|
@@ -2154,25 +2171,25 @@ var productSearchRowContent = import_react17.css`
|
|
|
2154
2171
|
gap: var(--spacing-base);
|
|
2155
2172
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
2156
2173
|
`;
|
|
2157
|
-
var productSearchRowContentActive =
|
|
2174
|
+
var productSearchRowContentActive = import_react18.css`
|
|
2158
2175
|
background-color: var(--green-50);
|
|
2159
2176
|
`;
|
|
2160
|
-
var productSearchRowTitle =
|
|
2177
|
+
var productSearchRowTitle = import_react18.css`
|
|
2161
2178
|
font-size: var(--fs-sm);
|
|
2162
2179
|
font-weight: var(--fw-bold);
|
|
2163
2180
|
width: 50%;
|
|
2164
2181
|
`;
|
|
2165
|
-
var productSearchRowCategory =
|
|
2182
|
+
var productSearchRowCategory = import_react18.css`
|
|
2166
2183
|
font-weight: var(--fw-normal);
|
|
2167
2184
|
display: block;
|
|
2168
2185
|
`;
|
|
2169
|
-
var productSearchRowDetails =
|
|
2186
|
+
var productSearchRowDetails = import_react18.css`
|
|
2170
2187
|
font-size: var(--fs-sm);
|
|
2171
2188
|
> * {
|
|
2172
2189
|
display: block;
|
|
2173
2190
|
}
|
|
2174
2191
|
`;
|
|
2175
|
-
var productSearchRowActiveIcon =
|
|
2192
|
+
var productSearchRowActiveIcon = import_react18.css`
|
|
2176
2193
|
display: block;
|
|
2177
2194
|
height: 1.5rem;
|
|
2178
2195
|
width: 1.5rem;
|
|
@@ -2181,7 +2198,7 @@ var productSearchRowActiveIcon = import_react17.css`
|
|
|
2181
2198
|
`;
|
|
2182
2199
|
|
|
2183
2200
|
// src/components/commerce/ProductSearchRow.tsx
|
|
2184
|
-
var
|
|
2201
|
+
var import_jsx_runtime23 = require("@emotion/react/jsx-runtime");
|
|
2185
2202
|
function ProductSearchRow({
|
|
2186
2203
|
result,
|
|
2187
2204
|
isSelected,
|
|
@@ -2191,7 +2208,7 @@ function ProductSearchRow({
|
|
|
2191
2208
|
const { categories, logoIcon } = useProductSearchContext();
|
|
2192
2209
|
const [category] = result.categories || [{ id: "", name: "" }];
|
|
2193
2210
|
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
2194
|
-
return /* @__PURE__ */ (0,
|
|
2211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2195
2212
|
"div",
|
|
2196
2213
|
{
|
|
2197
2214
|
"data-value": result.id,
|
|
@@ -2199,40 +2216,40 @@ function ProductSearchRow({
|
|
|
2199
2216
|
tabIndex: -1,
|
|
2200
2217
|
onClick: () => triggerSelection(),
|
|
2201
2218
|
css: [productSearchRowContainer],
|
|
2202
|
-
children: /* @__PURE__ */ (0,
|
|
2203
|
-
result.thumbnailUrl ? /* @__PURE__ */ (0,
|
|
2219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { css: [productSearchRowContent, isSelected ? productSearchRowContentActive : void 0], children: [
|
|
2220
|
+
result.thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2204
2221
|
"img",
|
|
2205
2222
|
{
|
|
2206
2223
|
src: result.thumbnailUrl,
|
|
2207
2224
|
alt: `Thumbnail for ${result.title}`,
|
|
2208
|
-
css:
|
|
2225
|
+
css: import_react19.css`
|
|
2209
2226
|
background-color: var(--gray-200);
|
|
2210
2227
|
width: 3rem;
|
|
2211
2228
|
height: 3rem;
|
|
2212
2229
|
object-fit: cover;
|
|
2213
2230
|
`
|
|
2214
2231
|
}
|
|
2215
|
-
) : /* @__PURE__ */ (0,
|
|
2232
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2216
2233
|
Image,
|
|
2217
2234
|
{
|
|
2218
2235
|
src: logoIcon,
|
|
2219
2236
|
alt: "Logo",
|
|
2220
|
-
css:
|
|
2237
|
+
css: import_react19.css`
|
|
2221
2238
|
height: 2.25rem;
|
|
2222
2239
|
width: 2.25rem;
|
|
2223
2240
|
`
|
|
2224
2241
|
}
|
|
2225
2242
|
),
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("h4", { css: [productSearchRowTitle], children: [
|
|
2227
2244
|
result.title,
|
|
2228
|
-
categoryName ? /* @__PURE__ */ (0,
|
|
2245
|
+
categoryName ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { css: [productSearchRowCategory], children: categoryName }) : null
|
|
2229
2246
|
] }),
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { css: [productSearchRowDetails], children: [
|
|
2231
2248
|
"SKU: ",
|
|
2232
2249
|
result.sku || result.id,
|
|
2233
|
-
result.price !== void 0 ? /* @__PURE__ */ (0,
|
|
2250
|
+
result.price !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: result.price }) : null
|
|
2234
2251
|
] }),
|
|
2235
|
-
isSelected ? /* @__PURE__ */ (0,
|
|
2252
|
+
isSelected ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Checkmark_default, { css: [productSearchRowActiveIcon] }) : null
|
|
2236
2253
|
] })
|
|
2237
2254
|
},
|
|
2238
2255
|
result.id
|
|
@@ -2240,21 +2257,21 @@ function ProductSearchRow({
|
|
|
2240
2257
|
}
|
|
2241
2258
|
|
|
2242
2259
|
// src/components/commerce/ProductSelectedItem.tsx
|
|
2243
|
-
var
|
|
2260
|
+
var import_react21 = require("@emotion/react");
|
|
2244
2261
|
var import_CgClose3 = require("@react-icons/all-files/cg/CgClose");
|
|
2245
2262
|
var import_design_system9 = require("@uniformdev/design-system");
|
|
2246
2263
|
|
|
2247
2264
|
// src/components/commerce/styles/ProductSelectedItem.styles.ts
|
|
2248
|
-
var
|
|
2265
|
+
var import_react20 = require("@emotion/react");
|
|
2249
2266
|
var import_design_system8 = require("@uniformdev/design-system");
|
|
2250
|
-
var productSelectedItemContainer =
|
|
2267
|
+
var productSelectedItemContainer = import_react20.css`
|
|
2251
2268
|
border: 1px solid var(--gray-200);
|
|
2252
2269
|
border-radius: var(--rounded-base);
|
|
2253
2270
|
background: var(--gray-50);
|
|
2254
2271
|
display: flex;
|
|
2255
2272
|
width: 100%;
|
|
2256
2273
|
`;
|
|
2257
|
-
var productSelectedItemDetails =
|
|
2274
|
+
var productSelectedItemDetails = import_react20.css`
|
|
2258
2275
|
align-items: center;
|
|
2259
2276
|
display: flex;
|
|
2260
2277
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
@@ -2263,7 +2280,7 @@ var productSelectedItemDetails = import_react19.css`
|
|
|
2263
2280
|
gap: var(--spacing-sm);
|
|
2264
2281
|
margin-inline: 0 var(--spacing-sm);
|
|
2265
2282
|
`;
|
|
2266
|
-
var productSelectedItemContent =
|
|
2283
|
+
var productSelectedItemContent = import_react20.css`
|
|
2267
2284
|
display: flex;
|
|
2268
2285
|
align-items: center;
|
|
2269
2286
|
gap: var(--spacing-sm);
|
|
@@ -2274,13 +2291,13 @@ var productSelectedItemContent = import_react19.css`
|
|
|
2274
2291
|
margin-bottom: 0;
|
|
2275
2292
|
}
|
|
2276
2293
|
`;
|
|
2277
|
-
var productSelectedItemImage =
|
|
2294
|
+
var productSelectedItemImage = import_react20.css`
|
|
2278
2295
|
background-color: var(--gray-200);
|
|
2279
2296
|
width: 3.5rem;
|
|
2280
2297
|
height: 3.5rem;
|
|
2281
2298
|
object-fit: cover;
|
|
2282
2299
|
`;
|
|
2283
|
-
var productedSelectedItemLinkBtn =
|
|
2300
|
+
var productedSelectedItemLinkBtn = import_react20.css`
|
|
2284
2301
|
align-items: center;
|
|
2285
2302
|
background: var(--white);
|
|
2286
2303
|
border-radius: var(--rounded-base);
|
|
@@ -2296,15 +2313,15 @@ var productedSelectedItemLinkBtn = import_react19.css`
|
|
|
2296
2313
|
background: var(--gray-50);
|
|
2297
2314
|
}
|
|
2298
2315
|
`;
|
|
2299
|
-
var productedSelectedItemSmallText =
|
|
2316
|
+
var productedSelectedItemSmallText = import_react20.css`
|
|
2300
2317
|
font-size: var(--fs-sm);
|
|
2301
2318
|
`;
|
|
2302
|
-
var productSelectedItemIcon =
|
|
2319
|
+
var productSelectedItemIcon = import_react20.css`
|
|
2303
2320
|
display: block;
|
|
2304
2321
|
width: 1rem;
|
|
2305
2322
|
height: 1rem;
|
|
2306
2323
|
`;
|
|
2307
|
-
var productSelectedItemLinkContainer =
|
|
2324
|
+
var productSelectedItemLinkContainer = import_react20.css`
|
|
2308
2325
|
display: flex;
|
|
2309
2326
|
flex-direction: column;
|
|
2310
2327
|
gap: var(--spacing-sm);
|
|
@@ -2317,7 +2334,7 @@ var productSelectedItemLinkContainer = import_react19.css`
|
|
|
2317
2334
|
`;
|
|
2318
2335
|
|
|
2319
2336
|
// src/components/commerce/ProductSelectedItem.tsx
|
|
2320
|
-
var
|
|
2337
|
+
var import_jsx_runtime24 = require("@emotion/react/jsx-runtime");
|
|
2321
2338
|
function ProductSelectedItem({
|
|
2322
2339
|
selectedItem,
|
|
2323
2340
|
onDeselect
|
|
@@ -2326,9 +2343,9 @@ function ProductSelectedItem({
|
|
|
2326
2343
|
const { categories, logoIcon } = useProductSearchContext();
|
|
2327
2344
|
const [category] = selectedItem.categories || [{ id: "", name: "" }];
|
|
2328
2345
|
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
2329
|
-
return /* @__PURE__ */ (0,
|
|
2330
|
-
/* @__PURE__ */ (0,
|
|
2331
|
-
selectedItem.thumbnailUrl ? /* @__PURE__ */ (0,
|
|
2346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { css: [productSelectedItemContainer], children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("article", { css: [productSelectedItemDetails], children: [
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { css: [productSelectedItemContent], children: [
|
|
2348
|
+
selectedItem.thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2332
2349
|
"img",
|
|
2333
2350
|
{
|
|
2334
2351
|
src: selectedItem.thumbnailUrl,
|
|
@@ -2336,29 +2353,29 @@ function ProductSelectedItem({
|
|
|
2336
2353
|
css: [productSelectedItemImage],
|
|
2337
2354
|
loading: "lazy"
|
|
2338
2355
|
}
|
|
2339
|
-
) : /* @__PURE__ */ (0,
|
|
2340
|
-
/* @__PURE__ */ (0,
|
|
2356
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { css: [productSelectedItemImage] }),
|
|
2357
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2341
2358
|
"div",
|
|
2342
2359
|
{
|
|
2343
|
-
css:
|
|
2360
|
+
css: import_react21.css`
|
|
2344
2361
|
> :not(:last-child) {
|
|
2345
2362
|
margin-bottom: var(--spacing-xs);
|
|
2346
2363
|
}
|
|
2347
2364
|
`,
|
|
2348
2365
|
children: [
|
|
2349
|
-
/* @__PURE__ */ (0,
|
|
2366
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2350
2367
|
"h4",
|
|
2351
2368
|
{
|
|
2352
|
-
css:
|
|
2369
|
+
css: import_react21.css`
|
|
2353
2370
|
margin-top: 0px;
|
|
2354
2371
|
font-weight: var(--fw-bold);
|
|
2355
2372
|
`,
|
|
2356
2373
|
children: [
|
|
2357
2374
|
selectedItem.title || selectedItem.id || "",
|
|
2358
|
-
categoryName && /* @__PURE__ */ (0,
|
|
2375
|
+
categoryName && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2359
2376
|
"span",
|
|
2360
2377
|
{
|
|
2361
|
-
css:
|
|
2378
|
+
css: import_react21.css`
|
|
2362
2379
|
display: block;
|
|
2363
2380
|
font-weight: var(--fw-regular);
|
|
2364
2381
|
`,
|
|
@@ -2368,10 +2385,10 @@ function ProductSelectedItem({
|
|
|
2368
2385
|
]
|
|
2369
2386
|
}
|
|
2370
2387
|
),
|
|
2371
|
-
/* @__PURE__ */ (0,
|
|
2388
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2372
2389
|
"ul",
|
|
2373
2390
|
{
|
|
2374
|
-
css:
|
|
2391
|
+
css: import_react21.css`
|
|
2375
2392
|
font-size: var(--fs-sm);
|
|
2376
2393
|
|
|
2377
2394
|
${(0, import_design_system9.mq)("sm")} {
|
|
@@ -2380,11 +2397,11 @@ function ProductSelectedItem({
|
|
|
2380
2397
|
}
|
|
2381
2398
|
`,
|
|
2382
2399
|
children: [
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { children: [
|
|
2401
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2385
2402
|
"span",
|
|
2386
2403
|
{
|
|
2387
|
-
css:
|
|
2404
|
+
css: import_react21.css`
|
|
2388
2405
|
margin-right: var(--spacing-xs);
|
|
2389
2406
|
`,
|
|
2390
2407
|
children: "SKU:"
|
|
@@ -2392,17 +2409,17 @@ function ProductSelectedItem({
|
|
|
2392
2409
|
),
|
|
2393
2410
|
selectedItem.sku || selectedItem.id
|
|
2394
2411
|
] }),
|
|
2395
|
-
selectedItem.price !== void 0 ? /* @__PURE__ */ (0,
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2412
|
+
selectedItem.price !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2397
2414
|
"span",
|
|
2398
2415
|
{
|
|
2399
|
-
css:
|
|
2416
|
+
css: import_react21.css`
|
|
2400
2417
|
margin-right: var(--spacing-xs);
|
|
2401
2418
|
`,
|
|
2402
2419
|
children: "Price:"
|
|
2403
2420
|
}
|
|
2404
2421
|
),
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
2422
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: selectedItem.price })
|
|
2406
2423
|
] }) : null
|
|
2407
2424
|
]
|
|
2408
2425
|
}
|
|
@@ -2411,8 +2428,8 @@ function ProductSelectedItem({
|
|
|
2411
2428
|
}
|
|
2412
2429
|
)
|
|
2413
2430
|
] }),
|
|
2414
|
-
/* @__PURE__ */ (0,
|
|
2415
|
-
selectedItem.editLink ? /* @__PURE__ */ (0,
|
|
2431
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { css: productSelectedItemLinkContainer, children: [
|
|
2432
|
+
selectedItem.editLink ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2416
2433
|
"a",
|
|
2417
2434
|
{
|
|
2418
2435
|
href: selectedItem.editLink,
|
|
@@ -2421,12 +2438,12 @@ function ProductSelectedItem({
|
|
|
2421
2438
|
target: "_blank",
|
|
2422
2439
|
css: productedSelectedItemLinkBtn,
|
|
2423
2440
|
children: [
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { css: productedSelectedItemSmallText, children: "Edit" }),
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Image, { src: logoIcon, alt: "Logo", css: productSelectedItemIcon })
|
|
2426
2443
|
]
|
|
2427
2444
|
}
|
|
2428
2445
|
) : null,
|
|
2429
|
-
/* @__PURE__ */ (0,
|
|
2446
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2430
2447
|
"button",
|
|
2431
2448
|
{
|
|
2432
2449
|
type: "button",
|
|
@@ -2435,8 +2452,8 @@ function ProductSelectedItem({
|
|
|
2435
2452
|
},
|
|
2436
2453
|
css: productedSelectedItemLinkBtn,
|
|
2437
2454
|
children: [
|
|
2438
|
-
/* @__PURE__ */ (0,
|
|
2439
|
-
/* @__PURE__ */ (0,
|
|
2455
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { css: productedSelectedItemSmallText, children: "Unlink" }),
|
|
2456
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system9.Icon, { icon: import_CgClose3.CgClose, iconColor: "red", size: 16 })
|
|
2440
2457
|
]
|
|
2441
2458
|
}
|
|
2442
2459
|
)
|
|
@@ -2445,7 +2462,7 @@ function ProductSelectedItem({
|
|
|
2445
2462
|
}
|
|
2446
2463
|
|
|
2447
2464
|
// src/components/commerce/ProductSearch.tsx
|
|
2448
|
-
var
|
|
2465
|
+
var import_jsx_runtime25 = require("@emotion/react/jsx-runtime");
|
|
2449
2466
|
function ProductSearch({
|
|
2450
2467
|
selectedProducts,
|
|
2451
2468
|
setSelectedProducts,
|
|
@@ -2468,11 +2485,11 @@ function ProductSearch({
|
|
|
2468
2485
|
value: categories,
|
|
2469
2486
|
loading: categoriesLoading,
|
|
2470
2487
|
error: categoriesError
|
|
2471
|
-
} = (0,
|
|
2488
|
+
} = (0, import_react_use4.useAsync)(async () => {
|
|
2472
2489
|
return await onGetCategories();
|
|
2473
2490
|
}, [onGetCategories]);
|
|
2474
2491
|
const categoryIds = categories == null ? void 0 : categories.map((c) => c.id).join(",");
|
|
2475
|
-
const categoryOptions = (0,
|
|
2492
|
+
const categoryOptions = (0, import_react22.useMemo)(
|
|
2476
2493
|
() => {
|
|
2477
2494
|
if (!categories) {
|
|
2478
2495
|
return void 0;
|
|
@@ -2488,8 +2505,8 @@ function ProductSearch({
|
|
|
2488
2505
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2489
2506
|
[categoryIds]
|
|
2490
2507
|
);
|
|
2491
|
-
const combinedSearchResults = (0,
|
|
2492
|
-
const [handleSearchState, handleSearch] = (0,
|
|
2508
|
+
const combinedSearchResults = (0, import_react22.useRef)();
|
|
2509
|
+
const [handleSearchState, handleSearch] = (0, import_react_use4.useAsyncFn)(
|
|
2493
2510
|
async (text, options) => {
|
|
2494
2511
|
const result = await onSearchProducts({
|
|
2495
2512
|
text,
|
|
@@ -2512,13 +2529,13 @@ function ProductSearch({
|
|
|
2512
2529
|
await setSelectedProducts(items);
|
|
2513
2530
|
};
|
|
2514
2531
|
if (categoriesError || handleSearchState.error) {
|
|
2515
|
-
const ErrorComp = errorComponent ? errorComponent : ({ categoriesError: categoriesError2, searchError }) => /* @__PURE__ */ (0,
|
|
2532
|
+
const ErrorComp = errorComponent ? errorComponent : ({ categoriesError: categoriesError2, searchError }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_design_system10.Callout, { type: "error", children: [
|
|
2516
2533
|
"There was an error: ",
|
|
2517
2534
|
(categoriesError2 == null ? void 0 : categoriesError2.message) || (searchError == null ? void 0 : searchError.message)
|
|
2518
2535
|
] });
|
|
2519
|
-
return /* @__PURE__ */ (0,
|
|
2536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ErrorComp, { categoriesError, searchError: handleSearchState.error });
|
|
2520
2537
|
}
|
|
2521
|
-
return /* @__PURE__ */ (0,
|
|
2538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ProductSearchContext.Provider, { value: { categories, logoIcon }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2522
2539
|
EntrySearch,
|
|
2523
2540
|
{
|
|
2524
2541
|
search: handleSearch,
|
|
@@ -2542,9 +2559,9 @@ function ProductSearch({
|
|
|
2542
2559
|
}
|
|
2543
2560
|
) });
|
|
2544
2561
|
}
|
|
2545
|
-
var ProductSearchContext =
|
|
2562
|
+
var ProductSearchContext = import_react22.default.createContext(void 0);
|
|
2546
2563
|
var useProductSearchContext = () => {
|
|
2547
|
-
const context = (0,
|
|
2564
|
+
const context = (0, import_react22.useContext)(ProductSearchContext);
|
|
2548
2565
|
if (!context) {
|
|
2549
2566
|
throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");
|
|
2550
2567
|
}
|
|
@@ -2552,24 +2569,24 @@ var useProductSearchContext = () => {
|
|
|
2552
2569
|
};
|
|
2553
2570
|
|
|
2554
2571
|
// src/components/dam/DamSelectedItem.tsx
|
|
2555
|
-
var
|
|
2572
|
+
var import_react24 = require("@emotion/react");
|
|
2556
2573
|
var import_CgClose4 = require("@react-icons/all-files/cg/CgClose");
|
|
2557
2574
|
var import_CgInfo2 = require("@react-icons/all-files/cg/CgInfo");
|
|
2558
2575
|
var import_design_system12 = require("@uniformdev/design-system");
|
|
2559
|
-
var
|
|
2576
|
+
var import_react25 = require("react");
|
|
2560
2577
|
var import_timeago2 = require("timeago.js");
|
|
2561
2578
|
|
|
2562
2579
|
// src/components/dam/DamSelectedItem.styles.ts
|
|
2563
|
-
var
|
|
2580
|
+
var import_react23 = require("@emotion/react");
|
|
2564
2581
|
var import_design_system11 = require("@uniformdev/design-system");
|
|
2565
|
-
var damSelectedItemContainer =
|
|
2582
|
+
var damSelectedItemContainer = import_react23.css`
|
|
2566
2583
|
border: 1px solid var(--gray-200);
|
|
2567
2584
|
background: var(--gray-50);
|
|
2568
2585
|
border-radius: var(--rounded-base);
|
|
2569
2586
|
display: flex;
|
|
2570
2587
|
width: 100%;
|
|
2571
2588
|
`;
|
|
2572
|
-
var damSelectedItemInner =
|
|
2589
|
+
var damSelectedItemInner = import_react23.css`
|
|
2573
2590
|
align-items: center;
|
|
2574
2591
|
display: flex;
|
|
2575
2592
|
flex-grow: 1;
|
|
@@ -2578,15 +2595,15 @@ var damSelectedItemInner = import_react22.css`
|
|
|
2578
2595
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
2579
2596
|
position: relative;
|
|
2580
2597
|
`;
|
|
2581
|
-
var damSelectedItemDetails =
|
|
2598
|
+
var damSelectedItemDetails = import_react23.css`
|
|
2582
2599
|
flex-grow: 1;
|
|
2583
2600
|
`;
|
|
2584
|
-
var damSelectedItemCopy =
|
|
2601
|
+
var damSelectedItemCopy = import_react23.css`
|
|
2585
2602
|
align-items: center;
|
|
2586
2603
|
display: flex;
|
|
2587
2604
|
position: relative;
|
|
2588
2605
|
`;
|
|
2589
|
-
var damSelectedItemTitle =
|
|
2606
|
+
var damSelectedItemTitle = import_react23.css`
|
|
2590
2607
|
color: var(--typography-base);
|
|
2591
2608
|
font-size: var(--fs-base);
|
|
2592
2609
|
font-weight: var(--fw-bold);
|
|
@@ -2594,11 +2611,11 @@ var damSelectedItemTitle = import_react22.css`
|
|
|
2594
2611
|
margin: 0;
|
|
2595
2612
|
word-break: break-word;
|
|
2596
2613
|
`;
|
|
2597
|
-
var damSelectedItemIcon =
|
|
2614
|
+
var damSelectedItemIcon = import_react23.css`
|
|
2598
2615
|
width: 1.5rem;
|
|
2599
2616
|
height: 1.5rem;
|
|
2600
2617
|
`;
|
|
2601
|
-
var damSelectedItemPopover =
|
|
2618
|
+
var damSelectedItemPopover = import_react23.css`
|
|
2602
2619
|
background: var(--white);
|
|
2603
2620
|
border-radius: var(--rounded-base);
|
|
2604
2621
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -2609,14 +2626,14 @@ var damSelectedItemPopover = import_react22.css`
|
|
|
2609
2626
|
z-index: var(--z-10);
|
|
2610
2627
|
width: max-content;
|
|
2611
2628
|
`;
|
|
2612
|
-
var damSelectedItemSmallText =
|
|
2629
|
+
var damSelectedItemSmallText = import_react23.css`
|
|
2613
2630
|
font-size: var(--fs-sm);
|
|
2614
2631
|
`;
|
|
2615
|
-
var damSelectedItemPopoverLabel =
|
|
2632
|
+
var damSelectedItemPopoverLabel = import_react23.css`
|
|
2616
2633
|
font-weight: var(--fw-bold);
|
|
2617
2634
|
margin-right: var(--spacing-sm);
|
|
2618
2635
|
`;
|
|
2619
|
-
var damSelectedItemLinkContainer =
|
|
2636
|
+
var damSelectedItemLinkContainer = import_react23.css`
|
|
2620
2637
|
display: flex;
|
|
2621
2638
|
flex-direction: column;
|
|
2622
2639
|
gap: var(--spacing-sm);
|
|
@@ -2627,7 +2644,7 @@ var damSelectedItemLinkContainer = import_react22.css`
|
|
|
2627
2644
|
min-width: 200px;
|
|
2628
2645
|
}
|
|
2629
2646
|
`;
|
|
2630
|
-
var damSelectedItemLinkBtn =
|
|
2647
|
+
var damSelectedItemLinkBtn = import_react23.css`
|
|
2631
2648
|
align-items: center;
|
|
2632
2649
|
background: var(--white);
|
|
2633
2650
|
border-radius: var(--rounded-base);
|
|
@@ -2643,18 +2660,18 @@ var damSelectedItemLinkBtn = import_react22.css`
|
|
|
2643
2660
|
background: var(--gray-50);
|
|
2644
2661
|
}
|
|
2645
2662
|
`;
|
|
2646
|
-
var damSelectedItemMediaContainer =
|
|
2663
|
+
var damSelectedItemMediaContainer = import_react23.css`
|
|
2647
2664
|
display: flex;
|
|
2648
2665
|
margin-top: var(--spacing-sm);
|
|
2649
2666
|
gap: var(--spacing-sm);
|
|
2650
2667
|
`;
|
|
2651
|
-
var damSelectedItemInfoBtn =
|
|
2668
|
+
var damSelectedItemInfoBtn = import_react23.css`
|
|
2652
2669
|
background: none;
|
|
2653
2670
|
outline: none;
|
|
2654
2671
|
border: none;
|
|
2655
2672
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
2656
2673
|
`;
|
|
2657
|
-
var damSelectItemImage =
|
|
2674
|
+
var damSelectItemImage = import_react23.css`
|
|
2658
2675
|
display: block;
|
|
2659
2676
|
max-width: 100%;
|
|
2660
2677
|
min-width: 100px;
|
|
@@ -2662,7 +2679,7 @@ var damSelectItemImage = import_react22.css`
|
|
|
2662
2679
|
`;
|
|
2663
2680
|
|
|
2664
2681
|
// src/components/dam/DamSelectedItem.tsx
|
|
2665
|
-
var
|
|
2682
|
+
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
2666
2683
|
function DamSelectedItem({
|
|
2667
2684
|
selectedItem,
|
|
2668
2685
|
onDeselect,
|
|
@@ -2670,9 +2687,9 @@ function DamSelectedItem({
|
|
|
2670
2687
|
logoIcon,
|
|
2671
2688
|
itemDetailsRendererComponent
|
|
2672
2689
|
}) {
|
|
2673
|
-
const popoverRef = (0,
|
|
2674
|
-
const [showInfo, setShowInfo] = (0,
|
|
2675
|
-
(0,
|
|
2690
|
+
const popoverRef = (0, import_react25.useRef)(null);
|
|
2691
|
+
const [showInfo, setShowInfo] = (0, import_react25.useState)(false);
|
|
2692
|
+
(0, import_react25.useEffect)(() => {
|
|
2676
2693
|
const resizeHandler = () => {
|
|
2677
2694
|
setShowInfo(false);
|
|
2678
2695
|
};
|
|
@@ -2682,21 +2699,21 @@ function DamSelectedItem({
|
|
|
2682
2699
|
};
|
|
2683
2700
|
}, [popoverRef]);
|
|
2684
2701
|
const ResolvedItemDetailsRendererComponent = itemDetailsRendererComponent != null ? itemDetailsRendererComponent : DefaultDamItemRenderer;
|
|
2685
|
-
return /* @__PURE__ */ (0,
|
|
2702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2686
2703
|
"div",
|
|
2687
2704
|
{
|
|
2688
2705
|
css: [
|
|
2689
2706
|
damSelectedItemContainer,
|
|
2690
|
-
|
|
2707
|
+
import_react24.css`
|
|
2691
2708
|
margin: 0 0 1rem 0;
|
|
2692
2709
|
`
|
|
2693
2710
|
],
|
|
2694
|
-
children: /* @__PURE__ */ (0,
|
|
2695
|
-
/* @__PURE__ */ (0,
|
|
2696
|
-
/* @__PURE__ */ (0,
|
|
2697
|
-
/* @__PURE__ */ (0,
|
|
2698
|
-
selectedItem.popoverData ? /* @__PURE__ */ (0,
|
|
2699
|
-
/* @__PURE__ */ (0,
|
|
2711
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { css: damSelectedItemInner, children: [
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { css: damSelectedItemDetails, children: [
|
|
2713
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { css: damSelectedItemCopy, children: [
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { css: [damSelectedItemTitle], title: `ID: ${selectedItem.id}`, "data-testid": "dam-selected-item", children: selectedItem.title || selectedItem.id || "" }),
|
|
2715
|
+
selectedItem.popoverData ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { ref: popoverRef, children: [
|
|
2716
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2700
2717
|
"button",
|
|
2701
2718
|
{
|
|
2702
2719
|
type: "button",
|
|
@@ -2704,34 +2721,34 @@ function DamSelectedItem({
|
|
|
2704
2721
|
"aria-controls": "path-details",
|
|
2705
2722
|
"aria-expanded": showInfo,
|
|
2706
2723
|
onClick: () => setShowInfo(!showInfo),
|
|
2707
|
-
children: /* @__PURE__ */ (0,
|
|
2724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2708
2725
|
import_design_system12.Icon,
|
|
2709
2726
|
{
|
|
2710
2727
|
icon: import_CgInfo2.CgInfo,
|
|
2711
2728
|
iconColor: "gray",
|
|
2712
2729
|
size: 24,
|
|
2713
|
-
css:
|
|
2730
|
+
css: import_react24.css`
|
|
2714
2731
|
opacity: var(--opacity-75);
|
|
2715
2732
|
`
|
|
2716
2733
|
}
|
|
2717
2734
|
)
|
|
2718
2735
|
}
|
|
2719
2736
|
),
|
|
2720
|
-
/* @__PURE__ */ (0,
|
|
2737
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2721
2738
|
"div",
|
|
2722
2739
|
{
|
|
2723
2740
|
id: "path-details",
|
|
2724
2741
|
"aria-hidden": !showInfo,
|
|
2725
2742
|
css: [
|
|
2726
2743
|
damSelectedItemPopover,
|
|
2727
|
-
showInfo ?
|
|
2744
|
+
showInfo ? import_react24.css`
|
|
2728
2745
|
visibility: visible;
|
|
2729
|
-
` :
|
|
2746
|
+
` : import_react24.css`
|
|
2730
2747
|
visibility: hidden;
|
|
2731
2748
|
`
|
|
2732
2749
|
],
|
|
2733
|
-
children: Object.entries(selectedItem.popoverData).map(([key, value], index) => /* @__PURE__ */ (0,
|
|
2734
|
-
/* @__PURE__ */ (0,
|
|
2750
|
+
children: Object.entries(selectedItem.popoverData).map(([key, value], index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { css: damSelectedItemSmallText, children: [
|
|
2751
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { css: damSelectedItemPopoverLabel, children: [
|
|
2735
2752
|
key,
|
|
2736
2753
|
":"
|
|
2737
2754
|
] }),
|
|
@@ -2741,10 +2758,10 @@ function DamSelectedItem({
|
|
|
2741
2758
|
)
|
|
2742
2759
|
] }) : null
|
|
2743
2760
|
] }),
|
|
2744
|
-
/* @__PURE__ */ (0,
|
|
2761
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ResolvedItemDetailsRendererComponent, { item: selectedItem })
|
|
2745
2762
|
] }),
|
|
2746
|
-
/* @__PURE__ */ (0,
|
|
2747
|
-
selectedItem.editLink ? typeof selectedItem.editLink === "string" ? /* @__PURE__ */ (0,
|
|
2763
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { css: damSelectedItemLinkContainer, children: [
|
|
2764
|
+
selectedItem.editLink ? typeof selectedItem.editLink === "string" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2748
2765
|
"a",
|
|
2749
2766
|
{
|
|
2750
2767
|
href: selectedItem.editLink,
|
|
@@ -2759,12 +2776,12 @@ function DamSelectedItem({
|
|
|
2759
2776
|
},
|
|
2760
2777
|
css: damSelectedItemLinkBtn,
|
|
2761
2778
|
children: [
|
|
2762
|
-
/* @__PURE__ */ (0,
|
|
2763
|
-
logoIcon ? /* @__PURE__ */ (0,
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { css: damSelectedItemSmallText, children: "Edit" }),
|
|
2780
|
+
logoIcon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Image, { src: logoIcon, css: damSelectedItemIcon, alt: "Logo" }) : null
|
|
2764
2781
|
]
|
|
2765
2782
|
}
|
|
2766
2783
|
) : selectedItem.editLink : null,
|
|
2767
|
-
/* @__PURE__ */ (0,
|
|
2784
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2768
2785
|
"button",
|
|
2769
2786
|
{
|
|
2770
2787
|
type: "button",
|
|
@@ -2773,8 +2790,8 @@ function DamSelectedItem({
|
|
|
2773
2790
|
},
|
|
2774
2791
|
css: damSelectedItemLinkBtn,
|
|
2775
2792
|
children: [
|
|
2776
|
-
/* @__PURE__ */ (0,
|
|
2777
|
-
/* @__PURE__ */ (0,
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { css: damSelectedItemSmallText, children: "Unlink" }),
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system12.Icon, { icon: import_CgClose4.CgClose, iconColor: "red", size: 16 })
|
|
2778
2795
|
]
|
|
2779
2796
|
}
|
|
2780
2797
|
)
|
|
@@ -2788,33 +2805,33 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2788
2805
|
let preview = null;
|
|
2789
2806
|
if (item.previewUrl && typeof item.previewUrl === "string") {
|
|
2790
2807
|
if (item.type === "image") {
|
|
2791
|
-
preview = /* @__PURE__ */ (0,
|
|
2808
|
+
preview = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("img", { src: item.previewUrl, alt: item.id, width: "200", css: damSelectItemImage });
|
|
2792
2809
|
} else if (item.type === "video") {
|
|
2793
|
-
preview = /* @__PURE__ */ (0,
|
|
2810
|
+
preview = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("video", { src: item.previewUrl, title: item.id, width: "200", controls: true, css: damSelectItemImage });
|
|
2794
2811
|
}
|
|
2795
2812
|
} else if (item.previewUrl && typeof item.previewUrl !== "string") {
|
|
2796
2813
|
preview = item.previewUrl;
|
|
2797
2814
|
}
|
|
2798
|
-
return preview || item.metadata ? /* @__PURE__ */ (0,
|
|
2799
|
-
preview ? /* @__PURE__ */ (0,
|
|
2800
|
-
/* @__PURE__ */ (0,
|
|
2815
|
+
return preview || item.metadata ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { css: damSelectedItemMediaContainer, children: [
|
|
2816
|
+
preview ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: preview }) : null,
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("ul", { children: [
|
|
2801
2818
|
item.metadata ? Object.entries(item.metadata).map(([key, value]) => {
|
|
2802
|
-
return /* @__PURE__ */ (0,
|
|
2819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2803
2820
|
"li",
|
|
2804
2821
|
{
|
|
2805
2822
|
css: [
|
|
2806
2823
|
damSelectedItemSmallText,
|
|
2807
|
-
|
|
2824
|
+
import_react24.css`
|
|
2808
2825
|
order: 1;
|
|
2809
2826
|
`
|
|
2810
2827
|
],
|
|
2811
2828
|
children: [
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2813
2830
|
"span",
|
|
2814
2831
|
{
|
|
2815
2832
|
css: [
|
|
2816
2833
|
damSelectedItemPopoverLabel,
|
|
2817
|
-
|
|
2834
|
+
import_react24.css`
|
|
2818
2835
|
order: 1;
|
|
2819
2836
|
`
|
|
2820
2837
|
],
|
|
@@ -2830,8 +2847,8 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2830
2847
|
key
|
|
2831
2848
|
);
|
|
2832
2849
|
}) : null,
|
|
2833
|
-
item.createdDate ? /* @__PURE__ */ (0,
|
|
2834
|
-
/* @__PURE__ */ (0,
|
|
2850
|
+
item.createdDate ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("li", { css: damSelectedItemSmallText, children: [
|
|
2851
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { css: damSelectedItemPopoverLabel, children: "Date:" }),
|
|
2835
2852
|
(0, import_timeago2.format)(item.createdDate)
|
|
2836
2853
|
] }) : null
|
|
2837
2854
|
] })
|
|
@@ -2839,9 +2856,9 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2839
2856
|
}
|
|
2840
2857
|
|
|
2841
2858
|
// src/hooks/useConnectedDataAsVariables.tsx
|
|
2842
|
-
var
|
|
2859
|
+
var import_react26 = require("react");
|
|
2843
2860
|
function useConnectedDataAsVariables(connectedData) {
|
|
2844
|
-
return (0,
|
|
2861
|
+
return (0, import_react26.useMemo)(
|
|
2845
2862
|
() => Object.entries(connectedData != null ? connectedData : {}).reduce(
|
|
2846
2863
|
(acc, [key, value]) => {
|
|
2847
2864
|
if (value === null || value === void 0) {
|
|
@@ -2858,10 +2875,10 @@ function useConnectedDataAsVariables(connectedData) {
|
|
|
2858
2875
|
|
|
2859
2876
|
// src/hooks/useDynamicInputsAsVariables.tsx
|
|
2860
2877
|
var import_canvas = require("@uniformdev/canvas");
|
|
2861
|
-
var
|
|
2862
|
-
var
|
|
2878
|
+
var import_react27 = require("react");
|
|
2879
|
+
var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
|
|
2863
2880
|
function useDynamicInputsAsVariables(dynamicInputs) {
|
|
2864
|
-
return (0,
|
|
2881
|
+
return (0, import_react27.useMemo)(() => {
|
|
2865
2882
|
const result = Object.entries(dynamicInputs).reduce(
|
|
2866
2883
|
(acc, [name, input3]) => {
|
|
2867
2884
|
const source = `from ${name === import_canvas.LOCALE_DYNAMIC_INPUT_NAME ? "current locale" : input3.type === "path" ? "URL path" : "query string"}`;
|
|
@@ -2877,14 +2894,14 @@ Current preview value: ${input3.value || "not provided"}`
|
|
|
2877
2894
|
if (!input3.value) {
|
|
2878
2895
|
acc[name] = {
|
|
2879
2896
|
...acc[name],
|
|
2880
|
-
helpText: /* @__PURE__ */ (0,
|
|
2897
|
+
helpText: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: input3.value || /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("em", { children: "not provided" }) }),
|
|
2881
2898
|
displayName: name
|
|
2882
2899
|
};
|
|
2883
2900
|
} else {
|
|
2884
2901
|
acc[name] = {
|
|
2885
2902
|
...acc[name],
|
|
2886
2903
|
displayName: input3.value,
|
|
2887
|
-
helpText: /* @__PURE__ */ (0,
|
|
2904
|
+
helpText: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: name })
|
|
2888
2905
|
};
|
|
2889
2906
|
}
|
|
2890
2907
|
return acc;
|
|
@@ -2896,18 +2913,18 @@ Current preview value: ${input3.value || "not provided"}`
|
|
|
2896
2913
|
}
|
|
2897
2914
|
|
|
2898
2915
|
// src/hooks/useMeshLocation.ts
|
|
2899
|
-
var
|
|
2916
|
+
var import_react30 = require("react");
|
|
2900
2917
|
|
|
2901
2918
|
// src/components/UniformMeshLocationContext.tsx
|
|
2902
|
-
var
|
|
2919
|
+
var import_react29 = require("react");
|
|
2903
2920
|
|
|
2904
2921
|
// src/components/UniformMeshSdkContext.tsx
|
|
2905
2922
|
var import_design_system13 = require("@uniformdev/design-system");
|
|
2906
|
-
var
|
|
2907
|
-
var
|
|
2908
|
-
var UniformMeshSdkContext = (0,
|
|
2923
|
+
var import_react28 = require("react");
|
|
2924
|
+
var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
|
|
2925
|
+
var UniformMeshSdkContext = (0, import_react28.createContext)(void 0);
|
|
2909
2926
|
var useUniformMeshSdkContext = () => {
|
|
2910
|
-
const context = (0,
|
|
2927
|
+
const context = (0, import_react28.useContext)(UniformMeshSdkContext);
|
|
2911
2928
|
if (!context) {
|
|
2912
2929
|
throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");
|
|
2913
2930
|
}
|
|
@@ -2921,14 +2938,14 @@ function useUniformMeshSdk() {
|
|
|
2921
2938
|
}
|
|
2922
2939
|
|
|
2923
2940
|
// src/components/UniformMeshLocationContext.tsx
|
|
2924
|
-
var
|
|
2925
|
-
var UniformMeshLocationContext = (0,
|
|
2941
|
+
var import_jsx_runtime29 = require("@emotion/react/jsx-runtime");
|
|
2942
|
+
var UniformMeshLocationContext = (0, import_react29.createContext)(void 0);
|
|
2926
2943
|
var UniformMeshLocationContextProvider = ({
|
|
2927
2944
|
children
|
|
2928
2945
|
}) => {
|
|
2929
2946
|
const sdk = useUniformMeshSdk();
|
|
2930
|
-
const [location, setLocation] = (0,
|
|
2931
|
-
(0,
|
|
2947
|
+
const [location, setLocation] = (0, import_react29.useState)(sdk.getCurrentLocation());
|
|
2948
|
+
(0, import_react29.useMemo)(() => {
|
|
2932
2949
|
const valueChangeListener = (event) => {
|
|
2933
2950
|
setLocation((old) => ({ ...old, value: event.newValue }));
|
|
2934
2951
|
};
|
|
@@ -2942,10 +2959,10 @@ var UniformMeshLocationContextProvider = ({
|
|
|
2942
2959
|
sdk.events.off("onMetadataChanged", metaChangeListener);
|
|
2943
2960
|
};
|
|
2944
2961
|
}, [sdk]);
|
|
2945
|
-
return /* @__PURE__ */ (0,
|
|
2962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UniformMeshLocationContext.Provider, { value: { location }, children });
|
|
2946
2963
|
};
|
|
2947
2964
|
var useUniformMeshLocationContext = () => {
|
|
2948
|
-
const context = (0,
|
|
2965
|
+
const context = (0, import_react29.useContext)(UniformMeshLocationContext);
|
|
2949
2966
|
if (!context) {
|
|
2950
2967
|
throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");
|
|
2951
2968
|
}
|
|
@@ -2958,9 +2975,9 @@ function useMeshLocation(expectedLocation) {
|
|
|
2958
2975
|
if (expectedLocation && location.type !== expectedLocation) {
|
|
2959
2976
|
throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
|
|
2960
2977
|
}
|
|
2961
|
-
const backdoorLocation = (0,
|
|
2978
|
+
const backdoorLocation = (0, import_react30.useRef)(location);
|
|
2962
2979
|
backdoorLocation.current = location;
|
|
2963
|
-
const stabilizedSetValueProxy = (0,
|
|
2980
|
+
const stabilizedSetValueProxy = (0, import_react30.useMemo)(
|
|
2964
2981
|
() => (dispatch) => {
|
|
2965
2982
|
const { newValue, options } = dispatch(backdoorLocation.current.value);
|
|
2966
2983
|
backdoorLocation.current.setValue(newValue, options);
|
|
@@ -2980,7 +2997,7 @@ var import_design_system14 = require("@uniformdev/design-system");
|
|
|
2980
2997
|
// src/components/Variables/composer/ControlledValuePlugin.tsx
|
|
2981
2998
|
var import_LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
2982
2999
|
var import_lite = require("dequal/lite");
|
|
2983
|
-
var
|
|
3000
|
+
var import_react31 = require("react");
|
|
2984
3001
|
|
|
2985
3002
|
// src/components/Variables/util/deserializeVariablesEditorState.ts
|
|
2986
3003
|
var import_canvas2 = require("@uniformdev/canvas");
|
|
@@ -3091,8 +3108,8 @@ function ControlledValuePlugin({
|
|
|
3091
3108
|
extraDependencies
|
|
3092
3109
|
}) {
|
|
3093
3110
|
const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
|
|
3094
|
-
const lastValueRef = (0,
|
|
3095
|
-
(0,
|
|
3111
|
+
const lastValueRef = (0, import_react31.useRef)(value);
|
|
3112
|
+
(0, import_react31.useEffect)(() => {
|
|
3096
3113
|
if (!enabled) {
|
|
3097
3114
|
return;
|
|
3098
3115
|
}
|
|
@@ -3117,7 +3134,7 @@ var import_utils2 = require("@lexical/utils");
|
|
|
3117
3134
|
var import_canvas4 = require("@uniformdev/canvas");
|
|
3118
3135
|
var import_design_system18 = require("@uniformdev/design-system");
|
|
3119
3136
|
var import_lexical4 = require("lexical");
|
|
3120
|
-
var
|
|
3137
|
+
var import_react40 = require("react");
|
|
3121
3138
|
|
|
3122
3139
|
// src/components/Variables/util/prettifyBindExpression.tsx
|
|
3123
3140
|
function prettifyBindExpression(bindExpression) {
|
|
@@ -3126,8 +3143,8 @@ function prettifyBindExpression(bindExpression) {
|
|
|
3126
3143
|
|
|
3127
3144
|
// src/components/Variables/composer/VariableChip.tsx
|
|
3128
3145
|
var import_design_system15 = require("@uniformdev/design-system");
|
|
3129
|
-
var
|
|
3130
|
-
var
|
|
3146
|
+
var import_react32 = require("react");
|
|
3147
|
+
var import_jsx_runtime30 = require("@emotion/react/jsx-runtime");
|
|
3131
3148
|
function VariableChip({
|
|
3132
3149
|
displayName,
|
|
3133
3150
|
referenceIsValid,
|
|
@@ -3141,9 +3158,9 @@ function VariableChip({
|
|
|
3141
3158
|
}) {
|
|
3142
3159
|
const hasClickEvent = !!onClick;
|
|
3143
3160
|
const referenceIsValidFr = isFresh ? true : referenceIsValid;
|
|
3144
|
-
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ?
|
|
3161
|
+
const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
|
|
3145
3162
|
const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
|
|
3146
|
-
return /* @__PURE__ */ (0,
|
|
3163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3147
3164
|
import_design_system15.MultilineChip,
|
|
3148
3165
|
{
|
|
3149
3166
|
title: tooltip ? `${tooltip}${extraTitle ? `
|
|
@@ -3152,12 +3169,12 @@ ${extraTitle}` : ""}` : extraTitle,
|
|
|
3152
3169
|
onClick,
|
|
3153
3170
|
"aria-selected": selected ? true : void 0,
|
|
3154
3171
|
"aria-disabled": disabled,
|
|
3155
|
-
children: /* @__PURE__ */ (0,
|
|
3172
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference })
|
|
3156
3173
|
}
|
|
3157
3174
|
);
|
|
3158
3175
|
}
|
|
3159
3176
|
function UndefinedVariableReference({ children }) {
|
|
3160
|
-
return /* @__PURE__ */ (0,
|
|
3177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3161
3178
|
"span",
|
|
3162
3179
|
{
|
|
3163
3180
|
style: {
|
|
@@ -3170,7 +3187,7 @@ function UndefinedVariableReference({ children }) {
|
|
|
3170
3187
|
);
|
|
3171
3188
|
}
|
|
3172
3189
|
function InfoVariableReference({ children }) {
|
|
3173
|
-
return /* @__PURE__ */ (0,
|
|
3190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3174
3191
|
"span",
|
|
3175
3192
|
{
|
|
3176
3193
|
style: {
|
|
@@ -3184,7 +3201,7 @@ function InfoVariableReference({ children }) {
|
|
|
3184
3201
|
}
|
|
3185
3202
|
|
|
3186
3203
|
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3187
|
-
var
|
|
3204
|
+
var import_react38 = require("@emotion/react");
|
|
3188
3205
|
var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerContext");
|
|
3189
3206
|
var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
|
|
3190
3207
|
var import_utils = require("@lexical/utils");
|
|
@@ -3193,12 +3210,12 @@ var import_canvas3 = require("@uniformdev/canvas");
|
|
|
3193
3210
|
var import_design_system17 = require("@uniformdev/design-system");
|
|
3194
3211
|
var import_lite2 = require("dequal/lite");
|
|
3195
3212
|
var import_lexical3 = require("lexical");
|
|
3196
|
-
var
|
|
3213
|
+
var import_react39 = require("react");
|
|
3197
3214
|
var import_react_dom = require("react-dom");
|
|
3198
3215
|
|
|
3199
3216
|
// src/components/Variables/toolbox/SelectVariableMenu.styles.ts
|
|
3200
|
-
var
|
|
3201
|
-
var menuBtn =
|
|
3217
|
+
var import_react33 = require("@emotion/react");
|
|
3218
|
+
var menuBtn = import_react33.css`
|
|
3202
3219
|
background: none;
|
|
3203
3220
|
border: none;
|
|
3204
3221
|
color: var(--gray-500);
|
|
@@ -3208,47 +3225,47 @@ var menuBtn = import_react32.css`
|
|
|
3208
3225
|
outline: none;
|
|
3209
3226
|
}
|
|
3210
3227
|
`;
|
|
3211
|
-
var menuItemTextGroup =
|
|
3228
|
+
var menuItemTextGroup = import_react33.css`
|
|
3212
3229
|
align-items: flex-start;
|
|
3213
3230
|
display: flex;
|
|
3214
3231
|
flex-direction: column;
|
|
3215
3232
|
gap: 0;
|
|
3216
3233
|
line-height: 1em;
|
|
3217
3234
|
`;
|
|
3218
|
-
var smallText =
|
|
3235
|
+
var smallText = import_react33.css`
|
|
3219
3236
|
font-size: var(--fs-xs);
|
|
3220
3237
|
color: var(--gray-500);
|
|
3221
3238
|
`;
|
|
3222
|
-
var variablesTipText =
|
|
3239
|
+
var variablesTipText = import_react33.css`
|
|
3223
3240
|
${smallText}
|
|
3224
3241
|
color: var(--gray-500);
|
|
3225
3242
|
padding: 0 var(--spacing-sm);
|
|
3226
3243
|
`;
|
|
3227
3244
|
|
|
3228
3245
|
// src/components/Variables/useVariableEditor.ts
|
|
3229
|
-
var
|
|
3246
|
+
var import_react37 = require("react");
|
|
3230
3247
|
|
|
3231
3248
|
// src/components/Variables/VariablesProvider.tsx
|
|
3232
3249
|
var import_mitt = __toESM(require("mitt"));
|
|
3233
|
-
var
|
|
3250
|
+
var import_react36 = require("react");
|
|
3234
3251
|
|
|
3235
3252
|
// src/components/Variables/VariableEditor.tsx
|
|
3236
3253
|
var import_zod = require("@hookform/resolvers/zod");
|
|
3237
3254
|
var import_design_system16 = require("@uniformdev/design-system");
|
|
3238
|
-
var
|
|
3255
|
+
var import_react35 = require("react");
|
|
3239
3256
|
var import_react_hook_form = require("react-hook-form");
|
|
3240
3257
|
var import_zod2 = require("zod");
|
|
3241
3258
|
|
|
3242
3259
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
3243
|
-
var
|
|
3244
|
-
var variablesFormContainer =
|
|
3260
|
+
var import_react34 = require("@emotion/react");
|
|
3261
|
+
var variablesFormContainer = import_react34.css`
|
|
3245
3262
|
> * {
|
|
3246
3263
|
margin: var(--spacing-base) 0 0;
|
|
3247
3264
|
}
|
|
3248
3265
|
`;
|
|
3249
3266
|
|
|
3250
3267
|
// src/components/Variables/VariableEditor.tsx
|
|
3251
|
-
var
|
|
3268
|
+
var import_jsx_runtime31 = require("@emotion/react/jsx-runtime");
|
|
3252
3269
|
var schema = import_zod2.z.object({
|
|
3253
3270
|
name: import_zod2.z.string().nonempty("Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
|
|
3254
3271
|
default: import_zod2.z.string(),
|
|
@@ -3293,9 +3310,9 @@ function VariableEditor({
|
|
|
3293
3310
|
},
|
|
3294
3311
|
activeWhenEditing: true
|
|
3295
3312
|
});
|
|
3296
|
-
const nameRef = (0,
|
|
3313
|
+
const nameRef = (0, import_react35.useRef)(null);
|
|
3297
3314
|
const { ref, ...nameRegister } = register("name");
|
|
3298
|
-
(0,
|
|
3315
|
+
(0, import_react35.useLayoutEffect)(() => {
|
|
3299
3316
|
if (nameRef.current && !nameRef.current.value) {
|
|
3300
3317
|
nameRef.current.focus();
|
|
3301
3318
|
}
|
|
@@ -3303,8 +3320,8 @@ function VariableEditor({
|
|
|
3303
3320
|
return (
|
|
3304
3321
|
// NOTE: this is intentionally NOT a <form> because it's regularly used in a nested modal and that can make it bubble
|
|
3305
3322
|
// up a submit to its 'parent form' which is not what we want.
|
|
3306
|
-
/* @__PURE__ */ (0,
|
|
3307
|
-
/* @__PURE__ */ (0,
|
|
3323
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { css: variablesFormContainer, children: [
|
|
3324
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3308
3325
|
import_design_system16.Input,
|
|
3309
3326
|
{
|
|
3310
3327
|
...nameRegister,
|
|
@@ -3318,7 +3335,7 @@ function VariableEditor({
|
|
|
3318
3335
|
}
|
|
3319
3336
|
}
|
|
3320
3337
|
),
|
|
3321
|
-
/* @__PURE__ */ (0,
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3322
3339
|
import_design_system16.Input,
|
|
3323
3340
|
{
|
|
3324
3341
|
...register("helpText"),
|
|
@@ -3328,7 +3345,7 @@ function VariableEditor({
|
|
|
3328
3345
|
errorMessage: (_f = formState.errors.helpText) == null ? void 0 : _f.message
|
|
3329
3346
|
}
|
|
3330
3347
|
),
|
|
3331
|
-
/* @__PURE__ */ (0,
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3332
3349
|
import_design_system16.Input,
|
|
3333
3350
|
{
|
|
3334
3351
|
...register("default"),
|
|
@@ -3337,14 +3354,14 @@ function VariableEditor({
|
|
|
3337
3354
|
errorMessage: (_g = formState.errors.default) == null ? void 0 : _g.message
|
|
3338
3355
|
}
|
|
3339
3356
|
),
|
|
3340
|
-
/* @__PURE__ */ (0,
|
|
3341
|
-
/* @__PURE__ */ (0,
|
|
3342
|
-
/* @__PURE__ */ (0,
|
|
3357
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system16.HorizontalRhythm, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_design_system16.HorizontalRhythm, { gap: "sm", children: [
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system16.Button, { type: "button", onClick: submitHandler, children: "OK" }),
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system16.Button, { type: "button", buttonType: "ghost", onClick: () => onCancel({ disconnect: false }), children: "cancel" })
|
|
3343
3360
|
] }) }),
|
|
3344
|
-
disableMeshTip ? null : /* @__PURE__ */ (0,
|
|
3361
|
+
disableMeshTip ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_design_system16.Callout, { type: "tip", title: "Customized User Interfaces", children: [
|
|
3345
3362
|
"Developers can create customized user interfaces for variable editing by building a Uniform mesh integration. Get started quickly with our",
|
|
3346
3363
|
" ",
|
|
3347
|
-
/* @__PURE__ */ (0,
|
|
3364
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3348
3365
|
"a",
|
|
3349
3366
|
{
|
|
3350
3367
|
href: "https://docs.uniform.app/docs/integrations/mesh-integrations/custom-integrations",
|
|
@@ -3360,8 +3377,8 @@ function VariableEditor({
|
|
|
3360
3377
|
}
|
|
3361
3378
|
|
|
3362
3379
|
// src/components/Variables/VariablesProvider.tsx
|
|
3363
|
-
var
|
|
3364
|
-
var VariablesContext = (0,
|
|
3380
|
+
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
3381
|
+
var VariablesContext = (0, import_react36.createContext)(null);
|
|
3365
3382
|
function VariablesProvider({
|
|
3366
3383
|
value,
|
|
3367
3384
|
onChange,
|
|
@@ -3371,9 +3388,9 @@ function VariablesProvider({
|
|
|
3371
3388
|
children,
|
|
3372
3389
|
knownUndefinedValues = {}
|
|
3373
3390
|
}) {
|
|
3374
|
-
const [editing, setEditing] = (0,
|
|
3375
|
-
const [editingContext, setEditingContext] = (0,
|
|
3376
|
-
const events = (0,
|
|
3391
|
+
const [editing, setEditing] = (0, import_react36.useState)();
|
|
3392
|
+
const [editingContext, setEditingContext] = (0, import_react36.useState)();
|
|
3393
|
+
const events = (0, import_react36.useMemo)(
|
|
3377
3394
|
() => (0, import_mitt.default)(),
|
|
3378
3395
|
[]
|
|
3379
3396
|
);
|
|
@@ -3381,7 +3398,7 @@ function VariablesProvider({
|
|
|
3381
3398
|
throw new Error("onChange must be provided when readOnly is false");
|
|
3382
3399
|
}
|
|
3383
3400
|
const Editor = editVariableComponent != null ? editVariableComponent : VariableEditor;
|
|
3384
|
-
const valueBasedContextValue = (0,
|
|
3401
|
+
const valueBasedContextValue = (0, import_react36.useMemo)(
|
|
3385
3402
|
() => ({
|
|
3386
3403
|
flatVariables: flattenVariables(value),
|
|
3387
3404
|
dispatch: (event) => {
|
|
@@ -3419,7 +3436,7 @@ function VariablesProvider({
|
|
|
3419
3436
|
}),
|
|
3420
3437
|
[onChange, readOnly, value]
|
|
3421
3438
|
);
|
|
3422
|
-
const contextValue = (0,
|
|
3439
|
+
const contextValue = (0, import_react36.useMemo)(() => {
|
|
3423
3440
|
return {
|
|
3424
3441
|
...valueBasedContextValue,
|
|
3425
3442
|
isEditing: typeof editing !== "undefined",
|
|
@@ -3429,9 +3446,9 @@ function VariablesProvider({
|
|
|
3429
3446
|
isLoading: !!isLoading
|
|
3430
3447
|
};
|
|
3431
3448
|
}, [editing, events, knownUndefinedValues, valueBasedContextValue, isLoading]);
|
|
3432
|
-
return /* @__PURE__ */ (0,
|
|
3449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
|
|
3433
3450
|
children,
|
|
3434
|
-
typeof editing !== "undefined" ? /* @__PURE__ */ (0,
|
|
3451
|
+
typeof editing !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3435
3452
|
Editor,
|
|
3436
3453
|
{
|
|
3437
3454
|
context: editingContext,
|
|
@@ -3459,7 +3476,7 @@ function VariablesProvider({
|
|
|
3459
3476
|
] });
|
|
3460
3477
|
}
|
|
3461
3478
|
function useVariables(returnEmptyWithoutProvider = false) {
|
|
3462
|
-
const context = (0,
|
|
3479
|
+
const context = (0, import_react36.useContext)(VariablesContext);
|
|
3463
3480
|
if (!context) {
|
|
3464
3481
|
if (returnEmptyWithoutProvider) {
|
|
3465
3482
|
return {
|
|
@@ -3490,8 +3507,8 @@ function flattenVariables(variables) {
|
|
|
3490
3507
|
// src/components/Variables/useVariableEditor.ts
|
|
3491
3508
|
function useVariableEditor() {
|
|
3492
3509
|
const { variables, events, canDispatch, dispatch, isEditing } = useVariables(true);
|
|
3493
|
-
const [isEditingBinding, setIsEditingBinding] = (0,
|
|
3494
|
-
(0,
|
|
3510
|
+
const [isEditingBinding, setIsEditingBinding] = (0, import_react37.useState)();
|
|
3511
|
+
(0, import_react37.useEffect)(() => {
|
|
3495
3512
|
if (!canDispatch || !isEditingBinding) {
|
|
3496
3513
|
return;
|
|
3497
3514
|
}
|
|
@@ -3502,7 +3519,7 @@ function useVariableEditor() {
|
|
|
3502
3519
|
events.on("editCompleted", fn);
|
|
3503
3520
|
return () => events.off("editCompleted", fn);
|
|
3504
3521
|
}, [canDispatch, events, isEditingBinding, variables]);
|
|
3505
|
-
(0,
|
|
3522
|
+
(0, import_react37.useEffect)(() => {
|
|
3506
3523
|
if (!isEditing) {
|
|
3507
3524
|
setIsEditingBinding(void 0);
|
|
3508
3525
|
}
|
|
@@ -3587,7 +3604,7 @@ function variablesToGroupedList(variables, filterFn, context) {
|
|
|
3587
3604
|
}
|
|
3588
3605
|
|
|
3589
3606
|
// src/components/Variables/composer/VariablesPlugin.tsx
|
|
3590
|
-
var
|
|
3607
|
+
var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
|
|
3591
3608
|
var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:open-insert-variable");
|
|
3592
3609
|
var EDIT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:edit-variable");
|
|
3593
3610
|
var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)(
|
|
@@ -3618,7 +3635,7 @@ function useVariablesMenu({
|
|
|
3618
3635
|
getEditorContext
|
|
3619
3636
|
}) {
|
|
3620
3637
|
const { variables, canDispatch, readOnly } = useVariables(true);
|
|
3621
|
-
const canEditVariable = (0,
|
|
3638
|
+
const canEditVariable = (0, import_react39.useCallback)(
|
|
3622
3639
|
(name, variable) => (
|
|
3623
3640
|
// name === '' means new var. Add var perms computed by menu options.
|
|
3624
3641
|
name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
|
|
@@ -3626,7 +3643,7 @@ function useVariablesMenu({
|
|
|
3626
3643
|
[canDispatch, enableEditingVariables, readOnly]
|
|
3627
3644
|
);
|
|
3628
3645
|
const canAddVariable = canDispatch && showAddVariableMenuOption && !readOnly;
|
|
3629
|
-
const { groupedVariables, menuOptions } = (0,
|
|
3646
|
+
const { groupedVariables, menuOptions } = (0, import_react39.useMemo)(() => {
|
|
3630
3647
|
const groupedVariables2 = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
3631
3648
|
if (canAddVariable) {
|
|
3632
3649
|
groupedVariables2.unshift({
|
|
@@ -3648,7 +3665,7 @@ function useVariablesMenu({
|
|
|
3648
3665
|
);
|
|
3649
3666
|
return { menuOptions: menuOptions2, groupedVariables: groupedVariables2 };
|
|
3650
3667
|
}, [variables, filterVariable, getEditorContext, canAddVariable, showAddVariableMenuOption]);
|
|
3651
|
-
const onSelect = (0,
|
|
3668
|
+
const onSelect = (0, import_react39.useCallback)(
|
|
3652
3669
|
({ queryString, value, nodeToReplace, editor, overwriteExistingValue }) => {
|
|
3653
3670
|
if (value === ADD_VARIABLE_OPTION) {
|
|
3654
3671
|
editor.update(() => {
|
|
@@ -3696,9 +3713,9 @@ function VariablesPlugin({
|
|
|
3696
3713
|
}) {
|
|
3697
3714
|
const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
|
|
3698
3715
|
const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
|
|
3699
|
-
const variablesRef = (0,
|
|
3716
|
+
const variablesRef = (0, import_react39.useRef)({ variables, knownUndefinedValues, isLoading });
|
|
3700
3717
|
variablesRef.current = { variables, knownUndefinedValues, isLoading };
|
|
3701
|
-
const canEditVariable = (0,
|
|
3718
|
+
const canEditVariable = (0, import_react39.useCallback)(
|
|
3702
3719
|
(name, variable) => (
|
|
3703
3720
|
// name === '' means new var. Add var perms computed by menu options.
|
|
3704
3721
|
name === "" || canDispatch && enableEditingVariables && !readOnly && !(variable == null ? void 0 : variable.readOnly)
|
|
@@ -3706,13 +3723,13 @@ function VariablesPlugin({
|
|
|
3706
3723
|
[canDispatch, enableEditingVariables, readOnly]
|
|
3707
3724
|
);
|
|
3708
3725
|
const { editVariable } = useVariableEditor();
|
|
3709
|
-
const [queryString, setQueryString] = (0,
|
|
3726
|
+
const [queryString, setQueryString] = (0, import_react39.useState)(null);
|
|
3710
3727
|
const { groupedVariables, menuOptions, onSelect } = useVariablesMenu({
|
|
3711
3728
|
showAddVariableMenuOption,
|
|
3712
3729
|
filterVariable,
|
|
3713
3730
|
getEditorContext
|
|
3714
3731
|
});
|
|
3715
|
-
const { filteredGroupedVariables, filteredMenuOptions } = (0,
|
|
3732
|
+
const { filteredGroupedVariables, filteredMenuOptions } = (0, import_react39.useMemo)(() => {
|
|
3716
3733
|
if (!queryString) {
|
|
3717
3734
|
return {
|
|
3718
3735
|
filteredGroupedVariables: groupedVariables,
|
|
@@ -3732,7 +3749,7 @@ function VariablesPlugin({
|
|
|
3732
3749
|
)
|
|
3733
3750
|
};
|
|
3734
3751
|
}, [queryString, groupedVariables, menuOptions]);
|
|
3735
|
-
const onSelectOption = (0,
|
|
3752
|
+
const onSelectOption = (0, import_react39.useCallback)(
|
|
3736
3753
|
(selectedOption, nodeToReplace, closeMenu) => {
|
|
3737
3754
|
onSelect({
|
|
3738
3755
|
queryString: queryString != null ? queryString : void 0,
|
|
@@ -3745,7 +3762,7 @@ function VariablesPlugin({
|
|
|
3745
3762
|
},
|
|
3746
3763
|
[editor, onSelect, queryString, replaceValueOnVariableInsert]
|
|
3747
3764
|
);
|
|
3748
|
-
(0,
|
|
3765
|
+
(0, import_react39.useEffect)(() => {
|
|
3749
3766
|
return (0, import_utils.mergeRegister)(
|
|
3750
3767
|
editor.registerCommand(
|
|
3751
3768
|
EDIT_VARIABLE_COMMAND,
|
|
@@ -3866,7 +3883,7 @@ function VariablesPlugin({
|
|
|
3866
3883
|
editVariable,
|
|
3867
3884
|
replaceValueOnVariableInsert
|
|
3868
3885
|
]);
|
|
3869
|
-
const updateExistingNodeIfChanged = (0,
|
|
3886
|
+
const updateExistingNodeIfChanged = (0, import_react39.useCallback)(
|
|
3870
3887
|
(variableNode) => {
|
|
3871
3888
|
var _a, _b, _c;
|
|
3872
3889
|
const targetVar = variablesRef.current.variables[variableNode.reference];
|
|
@@ -3892,14 +3909,14 @@ function VariablesPlugin({
|
|
|
3892
3909
|
},
|
|
3893
3910
|
[canEditVariable]
|
|
3894
3911
|
);
|
|
3895
|
-
(0,
|
|
3912
|
+
(0, import_react39.useEffect)(() => {
|
|
3896
3913
|
editor.update(() => {
|
|
3897
3914
|
(0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
|
|
3898
3915
|
updateExistingNodeIfChanged(variableNode);
|
|
3899
3916
|
});
|
|
3900
3917
|
});
|
|
3901
3918
|
}, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
|
|
3902
|
-
(0,
|
|
3919
|
+
(0, import_react39.useEffect)(() => {
|
|
3903
3920
|
return editor.registerNodeTransform(VariableNode, (variableNode) => {
|
|
3904
3921
|
updateExistingNodeIfChanged(variableNode);
|
|
3905
3922
|
});
|
|
@@ -3907,7 +3924,7 @@ function VariablesPlugin({
|
|
|
3907
3924
|
if (disableVariables) {
|
|
3908
3925
|
return null;
|
|
3909
3926
|
}
|
|
3910
|
-
return /* @__PURE__ */ (0,
|
|
3927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3911
3928
|
import_LexicalTypeaheadMenuPlugin.LexicalTypeaheadMenuPlugin,
|
|
3912
3929
|
{
|
|
3913
3930
|
onQueryChange: setQueryString,
|
|
@@ -3920,11 +3937,11 @@ function VariablesPlugin({
|
|
|
3920
3937
|
}
|
|
3921
3938
|
let currentCumulativeMenuIndex = -1;
|
|
3922
3939
|
return (0, import_react_dom.createPortal)(
|
|
3923
|
-
/* @__PURE__ */ (0,
|
|
3940
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3924
3941
|
"div",
|
|
3925
3942
|
{
|
|
3926
3943
|
"data-auto-resize-opt-in": true,
|
|
3927
|
-
css:
|
|
3944
|
+
css: import_react38.css`
|
|
3928
3945
|
box-shadow: var(--shadow-base);
|
|
3929
3946
|
border-radius: var(--rounded-base);
|
|
3930
3947
|
background: var(--gray-50);
|
|
@@ -3939,14 +3956,14 @@ function VariablesPlugin({
|
|
|
3939
3956
|
position: relative;
|
|
3940
3957
|
z-index: var(--z-50);
|
|
3941
3958
|
`,
|
|
3942
|
-
children: /* @__PURE__ */ (0,
|
|
3959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: filteredGroupedVariables.map((group, index) => {
|
|
3943
3960
|
var _a, _b;
|
|
3944
|
-
return /* @__PURE__ */ (0,
|
|
3945
|
-
/* @__PURE__ */ (0,
|
|
3961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
3962
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.MenuGroup, { title: (_a = group.name) != null ? _a : "", children: group.variables.map((variable) => {
|
|
3946
3963
|
var _a2;
|
|
3947
3964
|
currentCumulativeMenuIndex++;
|
|
3948
3965
|
const myCumulativeIndex = currentCumulativeMenuIndex;
|
|
3949
|
-
return /* @__PURE__ */ (0,
|
|
3966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3950
3967
|
import_design_system17.MenuItemInner,
|
|
3951
3968
|
{
|
|
3952
3969
|
active: selectedIndex === myCumulativeIndex,
|
|
@@ -3958,19 +3975,19 @@ function VariablesPlugin({
|
|
|
3958
3975
|
setHighlightedIndex(myCumulativeIndex);
|
|
3959
3976
|
},
|
|
3960
3977
|
css: menuItemTextGroup,
|
|
3961
|
-
children: variable.name === ADD_VARIABLE_OPTION ? /* @__PURE__ */ (0,
|
|
3962
|
-
/* @__PURE__ */ (0,
|
|
3978
|
+
children: variable.name === ADD_VARIABLE_OPTION ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_design_system17.HorizontalRhythm, { gap: "sm", align: "center", children: [
|
|
3979
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_AiFillPlusCircle.AiFillPlusCircle, { fill: "var(--gray-500)" }),
|
|
3963
3980
|
" ",
|
|
3964
|
-
/* @__PURE__ */ (0,
|
|
3965
|
-
] }) : /* @__PURE__ */ (0,
|
|
3966
|
-
/* @__PURE__ */ (0,
|
|
3967
|
-
variable.helpText ? /* @__PURE__ */ (0,
|
|
3981
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: variable.displayName })
|
|
3982
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
3983
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: (_a2 = variable.displayName) != null ? _a2 : variable.name }),
|
|
3984
|
+
variable.helpText ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("small", { css: smallText, children: variable.helpText }) : null
|
|
3968
3985
|
] })
|
|
3969
3986
|
},
|
|
3970
3987
|
group.name + variable.name
|
|
3971
3988
|
);
|
|
3972
3989
|
}) }, (_b = group.name) != null ? _b : `none${index}`),
|
|
3973
|
-
group.name || index === filteredGroupedVariables.length - 1 ? null : /* @__PURE__ */ (0,
|
|
3990
|
+
group.name || index === filteredGroupedVariables.length - 1 ? null : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_design_system17.MenuItemSeparator, {})
|
|
3974
3991
|
] });
|
|
3975
3992
|
}) })
|
|
3976
3993
|
}
|
|
@@ -3983,7 +4000,7 @@ function VariablesPlugin({
|
|
|
3983
4000
|
}
|
|
3984
4001
|
|
|
3985
4002
|
// src/components/Variables/composer/VariableNode.tsx
|
|
3986
|
-
var
|
|
4003
|
+
var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
|
|
3987
4004
|
var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
|
|
3988
4005
|
constructor(reference, state, key) {
|
|
3989
4006
|
super(key);
|
|
@@ -4048,7 +4065,7 @@ var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
|
|
|
4048
4065
|
* rely on Context, etc in this renderer.
|
|
4049
4066
|
*/
|
|
4050
4067
|
decorate() {
|
|
4051
|
-
return /* @__PURE__ */ (0,
|
|
4068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
|
|
4052
4069
|
}
|
|
4053
4070
|
};
|
|
4054
4071
|
function $createVariableNode(variableReference, state) {
|
|
@@ -4065,7 +4082,7 @@ function VariableNodeComponent({
|
|
|
4065
4082
|
const [editor] = (0, import_LexicalComposerContext3.useLexicalComposerContext)();
|
|
4066
4083
|
const [isSelected, setSelected, clearSelection] = (0, import_useLexicalNodeSelection.useLexicalNodeSelection)(nodeKey);
|
|
4067
4084
|
const readOnly = !editor.isEditable();
|
|
4068
|
-
const onDelete = (0,
|
|
4085
|
+
const onDelete = (0, import_react40.useCallback)(
|
|
4069
4086
|
(event) => {
|
|
4070
4087
|
if (isSelected && (0, import_lexical4.$isNodeSelection)((0, import_lexical4.$getSelection)())) {
|
|
4071
4088
|
event.preventDefault();
|
|
@@ -4078,7 +4095,7 @@ function VariableNodeComponent({
|
|
|
4078
4095
|
},
|
|
4079
4096
|
[isSelected, nodeKey]
|
|
4080
4097
|
);
|
|
4081
|
-
(0,
|
|
4098
|
+
(0, import_react40.useEffect)(() => {
|
|
4082
4099
|
return (0, import_utils2.mergeRegister)(
|
|
4083
4100
|
editor.registerCommand(import_lexical4.KEY_DELETE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
|
|
4084
4101
|
editor.registerCommand(import_lexical4.KEY_BACKSPACE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
|
|
@@ -4141,12 +4158,12 @@ function VariableNodeComponent({
|
|
|
4141
4158
|
)
|
|
4142
4159
|
);
|
|
4143
4160
|
}, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
|
|
4144
|
-
return /* @__PURE__ */ (0,
|
|
4161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4145
4162
|
VariableChip,
|
|
4146
4163
|
{
|
|
4147
4164
|
...state,
|
|
4148
4165
|
reference,
|
|
4149
|
-
displayName: state.isLoading ? /* @__PURE__ */ (0,
|
|
4166
|
+
displayName: state.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system18.LoadingIndicator, { size: "sm" }) : state.displayName,
|
|
4150
4167
|
selected: isSelected,
|
|
4151
4168
|
disabled: readOnly,
|
|
4152
4169
|
clickToEdit: state.hasClickEvent,
|
|
@@ -4167,7 +4184,7 @@ function $isTargetWithinDecorator(target) {
|
|
|
4167
4184
|
|
|
4168
4185
|
// src/components/Variables/InputVariables.tsx
|
|
4169
4186
|
var import_design_system20 = require("@uniformdev/design-system");
|
|
4170
|
-
var
|
|
4187
|
+
var import_react50 = require("react");
|
|
4171
4188
|
var import_uuid2 = require("uuid");
|
|
4172
4189
|
|
|
4173
4190
|
// src/components/Variables/composer/EditorRefPlugin.tsx
|
|
@@ -4188,10 +4205,10 @@ function EditorRefPlugin({
|
|
|
4188
4205
|
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
4189
4206
|
var import_utils3 = require("@lexical/utils");
|
|
4190
4207
|
var import_lexical5 = require("lexical");
|
|
4191
|
-
var
|
|
4208
|
+
var import_react41 = require("react");
|
|
4192
4209
|
function PasteTransformerPlugin({ transformPaste }) {
|
|
4193
4210
|
const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
|
|
4194
|
-
(0,
|
|
4211
|
+
(0, import_react41.useEffect)(() => {
|
|
4195
4212
|
return (0, import_utils3.mergeRegister)(
|
|
4196
4213
|
editor.registerCommand(
|
|
4197
4214
|
import_lexical5.PASTE_COMMAND,
|
|
@@ -4216,17 +4233,17 @@ function PasteTransformerPlugin({ transformPaste }) {
|
|
|
4216
4233
|
}
|
|
4217
4234
|
|
|
4218
4235
|
// src/components/Variables/styles/InputVariables.styles.ts
|
|
4219
|
-
var
|
|
4220
|
-
var menuContainer =
|
|
4236
|
+
var import_react42 = require("@emotion/react");
|
|
4237
|
+
var menuContainer = import_react42.css`
|
|
4221
4238
|
position: relative;
|
|
4222
4239
|
`;
|
|
4223
|
-
var menuBtn2 =
|
|
4240
|
+
var menuBtn2 = import_react42.css`
|
|
4224
4241
|
position: absolute;
|
|
4225
4242
|
top: 50%;
|
|
4226
4243
|
right: var(--spacing-sm);
|
|
4227
4244
|
transform: translateY(-50%);
|
|
4228
4245
|
`;
|
|
4229
|
-
var input =
|
|
4246
|
+
var input = import_react42.css`
|
|
4230
4247
|
appearance: none;
|
|
4231
4248
|
background-color: var(--white);
|
|
4232
4249
|
border: 1px solid var(--gray-200);
|
|
@@ -4260,16 +4277,16 @@ var input = import_react41.css`
|
|
|
4260
4277
|
margin: 0;
|
|
4261
4278
|
}
|
|
4262
4279
|
`;
|
|
4263
|
-
var inputCompact =
|
|
4280
|
+
var inputCompact = import_react42.css`
|
|
4264
4281
|
border: 1px solid var(--white);
|
|
4265
4282
|
padding-block: var(--spacing-sm);
|
|
4266
4283
|
font-size: var(--fs-sm);
|
|
4267
4284
|
`;
|
|
4268
|
-
var inputDisabled =
|
|
4285
|
+
var inputDisabled = import_react42.css`
|
|
4269
4286
|
cursor: not-allowed;
|
|
4270
4287
|
opacity: var(--opacity-50);
|
|
4271
4288
|
`;
|
|
4272
|
-
var placeholderCaption =
|
|
4289
|
+
var placeholderCaption = import_react42.css`
|
|
4273
4290
|
position: absolute;
|
|
4274
4291
|
color: var(--gray-400);
|
|
4275
4292
|
inset: var(--spacing-base) var(--spacing-lg) var(--spacing-base) var(--spacing-base);
|
|
@@ -4278,13 +4295,13 @@ var placeholderCaption = import_react41.css`
|
|
|
4278
4295
|
white-space: nowrap;
|
|
4279
4296
|
pointer-events: none;
|
|
4280
4297
|
`;
|
|
4281
|
-
var placeholderCompact =
|
|
4298
|
+
var placeholderCompact = import_react42.css`
|
|
4282
4299
|
inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
4283
4300
|
`;
|
|
4284
4301
|
|
|
4285
4302
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4286
4303
|
var React10 = __toESM(require("react"));
|
|
4287
|
-
var
|
|
4304
|
+
var import_react43 = require("react");
|
|
4288
4305
|
|
|
4289
4306
|
// src/components/Variables/util/hasReferencedVariables.ts
|
|
4290
4307
|
var import_canvas5 = require("@uniformdev/canvas");
|
|
@@ -4329,7 +4346,7 @@ function useInputVariablesState({
|
|
|
4329
4346
|
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
|
|
4330
4347
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4331
4348
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
4332
|
-
const sharedMenuProps = (0,
|
|
4349
|
+
const sharedMenuProps = (0, import_react43.useMemo)(
|
|
4333
4350
|
() => ({
|
|
4334
4351
|
menuTooltip,
|
|
4335
4352
|
showAddVariableMenuOption,
|
|
@@ -4360,15 +4377,15 @@ function useInputVariablesState({
|
|
|
4360
4377
|
}
|
|
4361
4378
|
|
|
4362
4379
|
// src/components/Variables/toolbox/VariableField.styles.ts
|
|
4363
|
-
var
|
|
4364
|
-
var labelText =
|
|
4380
|
+
var import_react44 = require("@emotion/react");
|
|
4381
|
+
var labelText = import_react44.css`
|
|
4365
4382
|
align-items: center;
|
|
4366
4383
|
display: flex;
|
|
4367
4384
|
gap: var(--spacing-xs);
|
|
4368
4385
|
font-weight: var(--fw-regular);
|
|
4369
4386
|
margin: 0 0 var(--spacing-xs);
|
|
4370
4387
|
`;
|
|
4371
|
-
var variableBindButton =
|
|
4388
|
+
var variableBindButton = import_react44.css`
|
|
4372
4389
|
align-items: center;
|
|
4373
4390
|
border: none;
|
|
4374
4391
|
border-radius: var(--rounded-base);
|
|
@@ -4400,8 +4417,8 @@ var import_lexical6 = require("lexical");
|
|
|
4400
4417
|
var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
|
|
4401
4418
|
var import_CgUsbC = require("@react-icons/all-files/cg/CgUsbC");
|
|
4402
4419
|
var import_design_system19 = require("@uniformdev/design-system");
|
|
4403
|
-
var
|
|
4404
|
-
var
|
|
4420
|
+
var import_react45 = require("react");
|
|
4421
|
+
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4405
4422
|
function SelectVariableMenu({
|
|
4406
4423
|
onSelectVariable,
|
|
4407
4424
|
onResetVariables,
|
|
@@ -4414,7 +4431,7 @@ function SelectVariableMenu({
|
|
|
4414
4431
|
filterVariable
|
|
4415
4432
|
}) {
|
|
4416
4433
|
const { variables, canDispatch, readOnly } = useVariables(true);
|
|
4417
|
-
const btnRef = (0,
|
|
4434
|
+
const btnRef = (0, import_react45.useRef)(null);
|
|
4418
4435
|
const { editVariable } = useVariableEditor();
|
|
4419
4436
|
const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
4420
4437
|
const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
|
|
@@ -4422,12 +4439,12 @@ function SelectVariableMenu({
|
|
|
4422
4439
|
if (!showAddVariableMenuOptionForReals && !menuHasVariableOptions) {
|
|
4423
4440
|
return null;
|
|
4424
4441
|
}
|
|
4425
|
-
return /* @__PURE__ */ (0,
|
|
4442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4426
4443
|
import_design_system19.Menu,
|
|
4427
4444
|
{
|
|
4428
4445
|
placement: "bottom-start",
|
|
4429
4446
|
withoutPortal: true,
|
|
4430
|
-
menuTrigger: /* @__PURE__ */ (0,
|
|
4447
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4431
4448
|
"button",
|
|
4432
4449
|
{
|
|
4433
4450
|
...buttonProps,
|
|
@@ -4436,12 +4453,12 @@ function SelectVariableMenu({
|
|
|
4436
4453
|
css: [menuBtn, buttonCss],
|
|
4437
4454
|
type: "button",
|
|
4438
4455
|
"data-testid": "insert-variable",
|
|
4439
|
-
children: /* @__PURE__ */ (0,
|
|
4456
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_CgUsbC.CgUsbC, { size: "1.4rem" })
|
|
4440
4457
|
}
|
|
4441
4458
|
),
|
|
4442
4459
|
menuLabel: menuTooltip,
|
|
4443
4460
|
children: [
|
|
4444
|
-
showAddVariableMenuOptionForReals ? /* @__PURE__ */ (0,
|
|
4461
|
+
showAddVariableMenuOptionForReals ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4445
4462
|
import_design_system19.MenuItem,
|
|
4446
4463
|
{
|
|
4447
4464
|
onClick: async () => {
|
|
@@ -4452,43 +4469,43 @@ function SelectVariableMenu({
|
|
|
4452
4469
|
onSelectVariable == null ? void 0 : onSelectVariable(result.selectedVariable);
|
|
4453
4470
|
},
|
|
4454
4471
|
"data-testid": "add-variable-button",
|
|
4455
|
-
children: /* @__PURE__ */ (0,
|
|
4456
|
-
/* @__PURE__ */ (0,
|
|
4457
|
-
/* @__PURE__ */ (0,
|
|
4472
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_design_system19.HorizontalRhythm, { gap: "sm", align: "center", children: [
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_BsFillPlusCircleFill.BsFillPlusCircleFill, { fill: "var(--gray-500)", size: "1.25em" }),
|
|
4474
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: typeof showAddVariableMenuOption === "string" ? showAddVariableMenuOption : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: "Add\u2026" }) })
|
|
4458
4475
|
] })
|
|
4459
4476
|
}
|
|
4460
4477
|
) : null,
|
|
4461
|
-
showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0,
|
|
4478
|
+
showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItemSeparator, {}) : null,
|
|
4462
4479
|
variablesGroups.map((group) => {
|
|
4463
4480
|
var _a;
|
|
4464
|
-
return /* @__PURE__ */ (0,
|
|
4481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuGroup, { title: (_a = group.name) != null ? _a : "", children: group.variables.map((variable) => {
|
|
4465
4482
|
const { name, displayName, helpText } = variable;
|
|
4466
|
-
return /* @__PURE__ */ (0,
|
|
4483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4467
4484
|
import_design_system19.MenuItem,
|
|
4468
4485
|
{
|
|
4469
4486
|
id: name,
|
|
4470
4487
|
css: menuItemTextGroup,
|
|
4471
4488
|
onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
|
|
4472
4489
|
children: [
|
|
4473
|
-
/* @__PURE__ */ (0,
|
|
4474
|
-
helpText ? /* @__PURE__ */ (0,
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: displayName != null ? displayName : name }),
|
|
4491
|
+
helpText ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("small", { css: smallText, children: helpText }) : null
|
|
4475
4492
|
]
|
|
4476
4493
|
},
|
|
4477
4494
|
name
|
|
4478
4495
|
);
|
|
4479
4496
|
}) }, group.name);
|
|
4480
4497
|
}),
|
|
4481
|
-
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0,
|
|
4482
|
-
onResetVariables ? /* @__PURE__ */ (0,
|
|
4483
|
-
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0,
|
|
4484
|
-
tip ? /* @__PURE__ */ (0,
|
|
4498
|
+
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItemSeparator, {}) : null,
|
|
4499
|
+
onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItem, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
|
|
4500
|
+
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItemSeparator, {}) : null,
|
|
4501
|
+
tip ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("i", { css: variablesTipText, children: tip }) : null
|
|
4485
4502
|
]
|
|
4486
4503
|
}
|
|
4487
4504
|
);
|
|
4488
4505
|
}
|
|
4489
4506
|
|
|
4490
4507
|
// src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
|
|
4491
|
-
var
|
|
4508
|
+
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
4492
4509
|
function VariablesComposerVariableMenu(props) {
|
|
4493
4510
|
const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
|
|
4494
4511
|
const onSelectVariable = (selectedVariable) => {
|
|
@@ -4504,7 +4521,7 @@ function VariablesComposerVariableMenu(props) {
|
|
|
4504
4521
|
editor.dispatchCommand(import_lexical6.CLEAR_EDITOR_COMMAND, void 0);
|
|
4505
4522
|
(_a = props.onResetVariables) == null ? void 0 : _a.call(props);
|
|
4506
4523
|
};
|
|
4507
|
-
return /* @__PURE__ */ (0,
|
|
4524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4508
4525
|
SelectVariableMenu,
|
|
4509
4526
|
{
|
|
4510
4527
|
...props,
|
|
@@ -4515,7 +4532,7 @@ function VariablesComposerVariableMenu(props) {
|
|
|
4515
4532
|
}
|
|
4516
4533
|
|
|
4517
4534
|
// src/components/Variables/toolbox/VariableField.tsx
|
|
4518
|
-
var
|
|
4535
|
+
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
4519
4536
|
function VariableField({
|
|
4520
4537
|
label,
|
|
4521
4538
|
selectVariableMenuOptions,
|
|
@@ -4526,7 +4543,7 @@ function VariableField({
|
|
|
4526
4543
|
}) {
|
|
4527
4544
|
const { variables } = useVariables(true);
|
|
4528
4545
|
const varCount = Object.keys(variables).length;
|
|
4529
|
-
const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ (0,
|
|
4546
|
+
const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4530
4547
|
VariablesComposerVariableMenu,
|
|
4531
4548
|
{
|
|
4532
4549
|
...selectVariableMenuOptions,
|
|
@@ -4534,10 +4551,10 @@ function VariableField({
|
|
|
4534
4551
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
4535
4552
|
}
|
|
4536
4553
|
) : null;
|
|
4537
|
-
return /* @__PURE__ */ (0,
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
4554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { "data-testid": "variable-field", children: [
|
|
4555
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { htmlFor: id, css: labelText, "data-testid": "field-name", children: [
|
|
4539
4556
|
variableSelector,
|
|
4540
|
-
/* @__PURE__ */ (0,
|
|
4557
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: label })
|
|
4541
4558
|
] }),
|
|
4542
4559
|
children
|
|
4543
4560
|
] });
|
|
@@ -4548,14 +4565,14 @@ var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlug
|
|
|
4548
4565
|
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
4549
4566
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
4550
4567
|
var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
4551
|
-
var
|
|
4568
|
+
var import_react48 = require("react");
|
|
4552
4569
|
|
|
4553
4570
|
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4554
4571
|
var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
|
|
4555
|
-
var
|
|
4572
|
+
var import_react46 = require("react");
|
|
4556
4573
|
function DisablePlugin({ disabled }) {
|
|
4557
4574
|
const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
|
|
4558
|
-
(0,
|
|
4575
|
+
(0, import_react46.useEffect)(() => {
|
|
4559
4576
|
editor.setEditable(!disabled);
|
|
4560
4577
|
}, [editor, disabled]);
|
|
4561
4578
|
return null;
|
|
@@ -4564,10 +4581,10 @@ function DisablePlugin({ disabled }) {
|
|
|
4564
4581
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4565
4582
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
4566
4583
|
var import_lexical7 = require("lexical");
|
|
4567
|
-
var
|
|
4584
|
+
var import_react47 = require("react");
|
|
4568
4585
|
function SingleLineTextPlugin() {
|
|
4569
4586
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
4570
|
-
(0,
|
|
4587
|
+
(0, import_react47.useEffect)(() => {
|
|
4571
4588
|
editor.registerNodeTransform(import_lexical7.LineBreakNode, (node) => {
|
|
4572
4589
|
node.remove();
|
|
4573
4590
|
});
|
|
@@ -4608,7 +4625,7 @@ function serializeRecursive(node, buffer) {
|
|
|
4608
4625
|
}
|
|
4609
4626
|
|
|
4610
4627
|
// src/components/Variables/toolbox/VariablesComposer.tsx
|
|
4611
|
-
var
|
|
4628
|
+
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
4612
4629
|
function VariablesComposer(props) {
|
|
4613
4630
|
const {
|
|
4614
4631
|
value,
|
|
@@ -4620,8 +4637,8 @@ function VariablesComposer(props) {
|
|
|
4620
4637
|
autoFocus,
|
|
4621
4638
|
...variablesPluginProps
|
|
4622
4639
|
} = props;
|
|
4623
|
-
const [lastEmittedValue, setLastEmittedValue] = (0,
|
|
4624
|
-
const editorConfig = (0,
|
|
4640
|
+
const [lastEmittedValue, setLastEmittedValue] = (0, import_react48.useState)(value);
|
|
4641
|
+
const editorConfig = (0, import_react48.useMemo)(
|
|
4625
4642
|
() => ({
|
|
4626
4643
|
namespace: "uniform",
|
|
4627
4644
|
onError(error) {
|
|
@@ -4633,12 +4650,12 @@ function VariablesComposer(props) {
|
|
|
4633
4650
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4634
4651
|
[]
|
|
4635
4652
|
);
|
|
4636
|
-
const editorState = (0,
|
|
4637
|
-
const updateTimeout = (0,
|
|
4653
|
+
const editorState = (0, import_react48.useRef)();
|
|
4654
|
+
const updateTimeout = (0, import_react48.useRef)();
|
|
4638
4655
|
if (typeof document === "undefined")
|
|
4639
4656
|
return null;
|
|
4640
|
-
return /* @__PURE__ */ (0,
|
|
4641
|
-
/* @__PURE__ */ (0,
|
|
4657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
|
|
4658
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4642
4659
|
import_LexicalOnChangePlugin.OnChangePlugin,
|
|
4643
4660
|
{
|
|
4644
4661
|
ignoreSelectionChange: true,
|
|
@@ -4659,12 +4676,12 @@ function VariablesComposer(props) {
|
|
|
4659
4676
|
}
|
|
4660
4677
|
}
|
|
4661
4678
|
),
|
|
4662
|
-
/* @__PURE__ */ (0,
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
4664
|
-
/* @__PURE__ */ (0,
|
|
4665
|
-
/* @__PURE__ */ (0,
|
|
4666
|
-
/* @__PURE__ */ (0,
|
|
4667
|
-
/* @__PURE__ */ (0,
|
|
4679
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: multiLine ? null : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SingleLineTextPlugin, {}) }),
|
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_LexicalClearEditorPlugin.ClearEditorPlugin, {}),
|
|
4681
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(VariablesPlugin, { ...variablesPluginProps }),
|
|
4682
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DisablePlugin, { disabled }),
|
|
4683
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: autoFocus ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_LexicalAutoFocusPlugin.AutoFocusPlugin, {}) : null }),
|
|
4684
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children })
|
|
4668
4685
|
] });
|
|
4669
4686
|
}
|
|
4670
4687
|
|
|
@@ -4677,29 +4694,29 @@ var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin")
|
|
|
4677
4694
|
var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
|
|
4678
4695
|
var import_utils4 = require("@lexical/utils");
|
|
4679
4696
|
var import_lexical9 = require("lexical");
|
|
4680
|
-
var
|
|
4681
|
-
var
|
|
4697
|
+
var import_react49 = require("react");
|
|
4698
|
+
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
4682
4699
|
function VariablesComposerInput({
|
|
4683
4700
|
css: css37,
|
|
4684
4701
|
placeholder,
|
|
4685
4702
|
...contentEditableProps
|
|
4686
4703
|
}) {
|
|
4687
|
-
return /* @__PURE__ */ (0,
|
|
4688
|
-
/* @__PURE__ */ (0,
|
|
4704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { children: [
|
|
4705
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4689
4706
|
import_LexicalPlainTextPlugin.PlainTextPlugin,
|
|
4690
4707
|
{
|
|
4691
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
4692
|
-
placeholder: placeholder ? /* @__PURE__ */ (0,
|
|
4708
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_LexicalContentEditable.ContentEditable, { ...contentEditableProps }),
|
|
4709
|
+
placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: placeholder }) : null,
|
|
4693
4710
|
ErrorBoundary: import_LexicalErrorBoundary.default
|
|
4694
4711
|
}
|
|
4695
4712
|
),
|
|
4696
|
-
/* @__PURE__ */ (0,
|
|
4697
|
-
/* @__PURE__ */ (0,
|
|
4713
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(RichishCopyAndPastePlugin, {}),
|
|
4714
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_LexicalHistoryPlugin.HistoryPlugin, {})
|
|
4698
4715
|
] });
|
|
4699
4716
|
}
|
|
4700
4717
|
function RichishCopyAndPastePlugin() {
|
|
4701
4718
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
4702
|
-
(0,
|
|
4719
|
+
(0, import_react49.useEffect)(() => {
|
|
4703
4720
|
return (0, import_utils4.mergeRegister)(
|
|
4704
4721
|
editor.registerCommand(
|
|
4705
4722
|
import_lexical9.COPY_COMMAND,
|
|
@@ -4774,7 +4791,7 @@ function RichishCopyAndPastePlugin() {
|
|
|
4774
4791
|
}
|
|
4775
4792
|
|
|
4776
4793
|
// src/components/Variables/InputVariables.tsx
|
|
4777
|
-
var
|
|
4794
|
+
var import_jsx_runtime40 = require("@emotion/react/jsx-runtime");
|
|
4778
4795
|
function InputVariables(props) {
|
|
4779
4796
|
const {
|
|
4780
4797
|
id,
|
|
@@ -4801,11 +4818,11 @@ function InputVariables(props) {
|
|
|
4801
4818
|
filterVariable,
|
|
4802
4819
|
styleVariant = "default"
|
|
4803
4820
|
} = props;
|
|
4804
|
-
const [finalId] = (0,
|
|
4821
|
+
const [finalId] = (0, import_react50.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
4805
4822
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
4806
4823
|
const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps } = useInputVariablesState(props);
|
|
4807
4824
|
const useInputWithNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
|
|
4808
|
-
const input3 = /* @__PURE__ */ (0,
|
|
4825
|
+
const input3 = /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4809
4826
|
"div",
|
|
4810
4827
|
{
|
|
4811
4828
|
onKeyDown: () => {
|
|
@@ -4815,14 +4832,14 @@ function InputVariables(props) {
|
|
|
4815
4832
|
},
|
|
4816
4833
|
css: disabled ? inputDisabled : "",
|
|
4817
4834
|
children: [
|
|
4818
|
-
useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0,
|
|
4835
|
+
useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4819
4836
|
InputVariablesOverlayMenu,
|
|
4820
4837
|
{
|
|
4821
4838
|
...sharedMenuProps,
|
|
4822
4839
|
disabled: disableVariablesForReals || disableInlineMenu === true || disableInlineMenu === "by-input",
|
|
4823
4840
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
4824
4841
|
useInputWhenNoVariables: useInputWithNoVariables,
|
|
4825
|
-
children: /* @__PURE__ */ (0,
|
|
4842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4826
4843
|
VariablesComposerInput,
|
|
4827
4844
|
{
|
|
4828
4845
|
id: finalId,
|
|
@@ -4830,7 +4847,7 @@ function InputVariables(props) {
|
|
|
4830
4847
|
"data-testid": dataTestId ? dataTestId : "input-container",
|
|
4831
4848
|
"data-text-value": value,
|
|
4832
4849
|
css: [input, styleVariant === "compact" ? inputCompact : null],
|
|
4833
|
-
placeholder: placeholder ? /* @__PURE__ */ (0,
|
|
4850
|
+
placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4834
4851
|
import_design_system20.Caption,
|
|
4835
4852
|
{
|
|
4836
4853
|
css: [
|
|
@@ -4844,16 +4861,16 @@ function InputVariables(props) {
|
|
|
4844
4861
|
)
|
|
4845
4862
|
}
|
|
4846
4863
|
),
|
|
4847
|
-
caption ? /* @__PURE__ */ (0,
|
|
4848
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
4849
|
-
warningMessage ? /* @__PURE__ */ (0,
|
|
4850
|
-
infoMessage ? /* @__PURE__ */ (0,
|
|
4864
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.Caption, { children: caption }) : null,
|
|
4865
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.ErrorMessage, { message: errorMessage }) : null,
|
|
4866
|
+
warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.WarningMessage, { message: warningMessage }) : null,
|
|
4867
|
+
infoMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.InfoMessage, { message: infoMessage }) : null
|
|
4851
4868
|
]
|
|
4852
4869
|
}
|
|
4853
4870
|
);
|
|
4854
4871
|
let body = input3;
|
|
4855
4872
|
if (label) {
|
|
4856
|
-
body = /* @__PURE__ */ (0,
|
|
4873
|
+
body = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4857
4874
|
VariableField,
|
|
4858
4875
|
{
|
|
4859
4876
|
label,
|
|
@@ -4868,7 +4885,7 @@ function InputVariables(props) {
|
|
|
4868
4885
|
}
|
|
4869
4886
|
);
|
|
4870
4887
|
}
|
|
4871
|
-
return /* @__PURE__ */ (0,
|
|
4888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4872
4889
|
VariablesComposer,
|
|
4873
4890
|
{
|
|
4874
4891
|
onChange,
|
|
@@ -4883,9 +4900,9 @@ function InputVariables(props) {
|
|
|
4883
4900
|
autoFocus,
|
|
4884
4901
|
filterVariable,
|
|
4885
4902
|
children: [
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
4888
|
-
editorRef ? /* @__PURE__ */ (0,
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PasteTransformerPlugin, { transformPaste }),
|
|
4904
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
|
|
4905
|
+
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
4889
4906
|
body
|
|
4890
4907
|
]
|
|
4891
4908
|
}
|
|
@@ -4898,11 +4915,11 @@ function InputVariablesOverlayMenu({
|
|
|
4898
4915
|
...props
|
|
4899
4916
|
}) {
|
|
4900
4917
|
if (disabled) {
|
|
4901
|
-
return /* @__PURE__ */ (0,
|
|
4918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
|
4902
4919
|
}
|
|
4903
|
-
return /* @__PURE__ */ (0,
|
|
4920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { css: menuContainer, children: [
|
|
4904
4921
|
children,
|
|
4905
|
-
/* @__PURE__ */ (0,
|
|
4922
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4906
4923
|
VariablesComposerVariableMenu,
|
|
4907
4924
|
{
|
|
4908
4925
|
...props,
|
|
@@ -4917,12 +4934,12 @@ function InputVariablesOverlayMenu({
|
|
|
4917
4934
|
var import_CgUsbC2 = require("@react-icons/all-files/cg/CgUsbC");
|
|
4918
4935
|
var import_canvas7 = require("@uniformdev/canvas");
|
|
4919
4936
|
var import_design_system22 = require("@uniformdev/design-system");
|
|
4920
|
-
var
|
|
4937
|
+
var import_react52 = require("react");
|
|
4921
4938
|
|
|
4922
4939
|
// src/components/Variables/styles/ParameterVariables.styles.ts
|
|
4923
|
-
var
|
|
4940
|
+
var import_react51 = require("@emotion/react");
|
|
4924
4941
|
var import_design_system21 = require("@uniformdev/design-system");
|
|
4925
|
-
var variableBindButton2 =
|
|
4942
|
+
var variableBindButton2 = import_react51.css`
|
|
4926
4943
|
align-items: center;
|
|
4927
4944
|
border: none;
|
|
4928
4945
|
border-radius: var(--rounded-base);
|
|
@@ -4951,7 +4968,7 @@ var variableBindButton2 = import_react50.css`
|
|
|
4951
4968
|
max-height: unset;
|
|
4952
4969
|
}
|
|
4953
4970
|
`;
|
|
4954
|
-
var input2 =
|
|
4971
|
+
var input2 = import_react51.css`
|
|
4955
4972
|
display: block;
|
|
4956
4973
|
appearance: none;
|
|
4957
4974
|
box-sizing: border-box;
|
|
@@ -5003,7 +5020,7 @@ var input2 = import_react50.css`
|
|
|
5003
5020
|
margin: 0;
|
|
5004
5021
|
}
|
|
5005
5022
|
`;
|
|
5006
|
-
var inputMultiLine = (lines) =>
|
|
5023
|
+
var inputMultiLine = (lines) => import_react51.css`
|
|
5007
5024
|
${import_design_system21.scrollbarStyles}
|
|
5008
5025
|
// 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
|
|
5009
5026
|
// as the text looked to close to the bottom of the input
|
|
@@ -5013,7 +5030,7 @@ var inputMultiLine = (lines) => import_react50.css`
|
|
|
5013
5030
|
`;
|
|
5014
5031
|
|
|
5015
5032
|
// src/components/Variables/ParameterConnectionIndicator.tsx
|
|
5016
|
-
var
|
|
5033
|
+
var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
|
|
5017
5034
|
function ParameterConnectionIndicator({
|
|
5018
5035
|
children,
|
|
5019
5036
|
value,
|
|
@@ -5021,7 +5038,7 @@ function ParameterConnectionIndicator({
|
|
|
5021
5038
|
disabled,
|
|
5022
5039
|
menuTooltip = "Insert variable"
|
|
5023
5040
|
}) {
|
|
5024
|
-
const hasVariablesInValue = (0,
|
|
5041
|
+
const hasVariablesInValue = (0, import_react52.useMemo)(() => {
|
|
5025
5042
|
let result = false;
|
|
5026
5043
|
(0, import_canvas7.bindVariablesToObject)({
|
|
5027
5044
|
value,
|
|
@@ -5032,21 +5049,21 @@ function ParameterConnectionIndicator({
|
|
|
5032
5049
|
});
|
|
5033
5050
|
return result;
|
|
5034
5051
|
}, [value]);
|
|
5035
|
-
return /* @__PURE__ */ (0,
|
|
5036
|
-
/* @__PURE__ */ (0,
|
|
5037
|
-
disabled ? null : /* @__PURE__ */ (0,
|
|
5052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5053
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: { flex: 1 }, children }),
|
|
5054
|
+
disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5038
5055
|
import_design_system22.Menu,
|
|
5039
5056
|
{
|
|
5040
5057
|
placement: "bottom-start",
|
|
5041
5058
|
withoutPortal: true,
|
|
5042
|
-
menuTrigger: /* @__PURE__ */ (0,
|
|
5059
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5043
5060
|
"button",
|
|
5044
5061
|
{
|
|
5045
5062
|
title: menuTooltip,
|
|
5046
5063
|
"aria-pressed": hasVariablesInValue,
|
|
5047
5064
|
css: [menuBtn, variableBindButton2],
|
|
5048
5065
|
type: "button",
|
|
5049
|
-
children: /* @__PURE__ */ (0,
|
|
5066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_CgUsbC2.CgUsbC, { size: "1.4rem" })
|
|
5050
5067
|
}
|
|
5051
5068
|
),
|
|
5052
5069
|
menuLabel: menuTooltip,
|
|
@@ -5058,21 +5075,21 @@ function ParameterConnectionIndicator({
|
|
|
5058
5075
|
|
|
5059
5076
|
// src/components/Variables/ParameterOrSingleVariable.tsx
|
|
5060
5077
|
var import_design_system23 = require("@uniformdev/design-system");
|
|
5061
|
-
var
|
|
5078
|
+
var import_react54 = require("react");
|
|
5062
5079
|
|
|
5063
5080
|
// src/components/Variables/composer/OnDisconnectPlugin.tsx
|
|
5064
5081
|
var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
|
|
5065
5082
|
var import_utils5 = require("@lexical/utils");
|
|
5066
5083
|
var import_lexical10 = require("lexical");
|
|
5067
|
-
var
|
|
5084
|
+
var import_react53 = require("react");
|
|
5068
5085
|
function OnDisconnectPlugin({
|
|
5069
5086
|
onDisconnect
|
|
5070
5087
|
}) {
|
|
5071
5088
|
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
5072
5089
|
const { variables } = useVariables(true);
|
|
5073
|
-
const variablesRef = (0,
|
|
5090
|
+
const variablesRef = (0, import_react53.useRef)(variables);
|
|
5074
5091
|
variablesRef.current = variables;
|
|
5075
|
-
(0,
|
|
5092
|
+
(0, import_react53.useEffect)(() => {
|
|
5076
5093
|
return (0, import_utils5.mergeRegister)(
|
|
5077
5094
|
editor.registerCommand(
|
|
5078
5095
|
DISCONNECT_VARIABLE_COMMAND,
|
|
@@ -5098,7 +5115,7 @@ function OnDisconnectPlugin({
|
|
|
5098
5115
|
}
|
|
5099
5116
|
|
|
5100
5117
|
// src/components/Variables/ParameterOrSingleVariable.tsx
|
|
5101
|
-
var
|
|
5118
|
+
var import_jsx_runtime42 = require("@emotion/react/jsx-runtime");
|
|
5102
5119
|
function ParameterOrSingleVariable(props) {
|
|
5103
5120
|
const {
|
|
5104
5121
|
value,
|
|
@@ -5117,7 +5134,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5117
5134
|
hasVariablesInValue,
|
|
5118
5135
|
setHadVariablesInValue
|
|
5119
5136
|
} = useInputVariablesState(props);
|
|
5120
|
-
const handleDisconnect = (0,
|
|
5137
|
+
const handleDisconnect = (0, import_react54.useCallback)(
|
|
5121
5138
|
(variable) => {
|
|
5122
5139
|
setHadVariablesInValue(false);
|
|
5123
5140
|
if (onDisconnect) {
|
|
@@ -5129,7 +5146,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5129
5146
|
return (
|
|
5130
5147
|
// we use a "fauxical" lexical here to render the vars the same as other editors do,
|
|
5131
5148
|
// and also to enable us to dispatch the same editor commands as other editors do
|
|
5132
|
-
/* @__PURE__ */ (0,
|
|
5149
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5133
5150
|
VariablesComposer,
|
|
5134
5151
|
{
|
|
5135
5152
|
onChange,
|
|
@@ -5140,11 +5157,11 @@ function ParameterOrSingleVariable(props) {
|
|
|
5140
5157
|
replaceValueOnVariableInsert: true,
|
|
5141
5158
|
disabled: true,
|
|
5142
5159
|
children: [
|
|
5143
|
-
/* @__PURE__ */ (0,
|
|
5144
|
-
editorRef ? /* @__PURE__ */ (0,
|
|
5145
|
-
/* @__PURE__ */ (0,
|
|
5146
|
-
/* @__PURE__ */ (0,
|
|
5147
|
-
/* @__PURE__ */ (0,
|
|
5160
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(OnDisconnectPlugin, { onDisconnect: handleDisconnect }),
|
|
5161
|
+
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ControlledValuePlugin, { enabled: true, value }),
|
|
5163
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system23.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5164
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5148
5165
|
VariablesComposerInput,
|
|
5149
5166
|
{
|
|
5150
5167
|
"data-text-value": value,
|
|
@@ -5152,7 +5169,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5152
5169
|
css: input2
|
|
5153
5170
|
}
|
|
5154
5171
|
) }),
|
|
5155
|
-
disableVariablesForReals ? null : /* @__PURE__ */ (0,
|
|
5172
|
+
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5156
5173
|
VariablesComposerVariableMenu,
|
|
5157
5174
|
{
|
|
5158
5175
|
...sharedMenuProps,
|
|
@@ -5170,9 +5187,9 @@ function ParameterOrSingleVariable(props) {
|
|
|
5170
5187
|
}
|
|
5171
5188
|
|
|
5172
5189
|
// src/components/Variables/ParameterVariables.tsx
|
|
5173
|
-
var
|
|
5190
|
+
var import_react55 = require("@emotion/react");
|
|
5174
5191
|
var import_design_system24 = require("@uniformdev/design-system");
|
|
5175
|
-
var
|
|
5192
|
+
var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
|
|
5176
5193
|
function ParameterVariables(props) {
|
|
5177
5194
|
const {
|
|
5178
5195
|
value,
|
|
@@ -5192,7 +5209,7 @@ function ParameterVariables(props) {
|
|
|
5192
5209
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
5193
5210
|
const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps, hasVariablesInValue } = useInputVariablesState(props);
|
|
5194
5211
|
const useInputWhenNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
|
|
5195
|
-
return /* @__PURE__ */ (0,
|
|
5212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5196
5213
|
VariablesComposer,
|
|
5197
5214
|
{
|
|
5198
5215
|
onChange,
|
|
@@ -5207,9 +5224,9 @@ function ParameterVariables(props) {
|
|
|
5207
5224
|
autoFocus,
|
|
5208
5225
|
filterVariable,
|
|
5209
5226
|
children: [
|
|
5210
|
-
editorRef ? /* @__PURE__ */ (0,
|
|
5211
|
-
/* @__PURE__ */ (0,
|
|
5212
|
-
/* @__PURE__ */ (0,
|
|
5227
|
+
editorRef ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EditorRefPlugin, { editorRef }) : null,
|
|
5228
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
|
|
5229
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5213
5230
|
import_design_system24.HorizontalRhythm,
|
|
5214
5231
|
{
|
|
5215
5232
|
align: "center",
|
|
@@ -5221,7 +5238,7 @@ function ParameterVariables(props) {
|
|
|
5221
5238
|
}
|
|
5222
5239
|
},
|
|
5223
5240
|
children: [
|
|
5224
|
-
/* @__PURE__ */ (0,
|
|
5241
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5225
5242
|
VariablesComposerInput,
|
|
5226
5243
|
{
|
|
5227
5244
|
"aria-label": ariaLabel,
|
|
@@ -5229,12 +5246,12 @@ function ParameterVariables(props) {
|
|
|
5229
5246
|
"data-text-value": value,
|
|
5230
5247
|
css: [
|
|
5231
5248
|
input2,
|
|
5232
|
-
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) :
|
|
5233
|
-
inputCss != null ? inputCss :
|
|
5249
|
+
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) : import_react55.css``,
|
|
5250
|
+
inputCss != null ? inputCss : import_react55.css``
|
|
5234
5251
|
]
|
|
5235
5252
|
}
|
|
5236
5253
|
) }),
|
|
5237
|
-
disableVariablesForReals ? null : /* @__PURE__ */ (0,
|
|
5254
|
+
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5238
5255
|
VariablesComposerVariableMenu,
|
|
5239
5256
|
{
|
|
5240
5257
|
...sharedMenuProps,
|
|
@@ -5266,13 +5283,13 @@ ${prettifyBindExpression(bindExpression)}`
|
|
|
5266
5283
|
}
|
|
5267
5284
|
|
|
5268
5285
|
// src/components/Variables/VariablesList.tsx
|
|
5269
|
-
var
|
|
5286
|
+
var import_react57 = require("@emotion/react");
|
|
5270
5287
|
var import_design_system25 = require("@uniformdev/design-system");
|
|
5271
|
-
var
|
|
5288
|
+
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
5272
5289
|
|
|
5273
5290
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
5274
|
-
var
|
|
5275
|
-
var tableRow = (isDragging) =>
|
|
5291
|
+
var import_react56 = require("@emotion/react");
|
|
5292
|
+
var tableRow = (isDragging) => import_react56.css`
|
|
5276
5293
|
position: relative;
|
|
5277
5294
|
${isDragging ? `
|
|
5278
5295
|
display: table;
|
|
@@ -5280,7 +5297,7 @@ var tableRow = (isDragging) => import_react55.css`
|
|
|
5280
5297
|
top: auto !important;
|
|
5281
5298
|
` : void 0}
|
|
5282
5299
|
`;
|
|
5283
|
-
var tableCellDragIcon =
|
|
5300
|
+
var tableCellDragIcon = import_react56.css`
|
|
5284
5301
|
&::after {
|
|
5285
5302
|
content: '';
|
|
5286
5303
|
display: block;
|
|
@@ -5298,7 +5315,7 @@ var tableCellDragIcon = import_react55.css`
|
|
|
5298
5315
|
opacity: 1;
|
|
5299
5316
|
}
|
|
5300
5317
|
`;
|
|
5301
|
-
var variableName =
|
|
5318
|
+
var variableName = import_react56.css`
|
|
5302
5319
|
border: none;
|
|
5303
5320
|
font-weight: var(--fw-medium);
|
|
5304
5321
|
padding: 0;
|
|
@@ -5308,7 +5325,7 @@ var variableName = import_react55.css`
|
|
|
5308
5325
|
white-space: nowrap;
|
|
5309
5326
|
max-width: 20ch;
|
|
5310
5327
|
`;
|
|
5311
|
-
var variableValue =
|
|
5328
|
+
var variableValue = import_react56.css`
|
|
5312
5329
|
overflow: hidden;
|
|
5313
5330
|
text-overflow: ellipsis;
|
|
5314
5331
|
white-space: nowrap;
|
|
@@ -5316,7 +5333,7 @@ var variableValue = import_react55.css`
|
|
|
5316
5333
|
`;
|
|
5317
5334
|
|
|
5318
5335
|
// src/components/Variables/VariablesList.tsx
|
|
5319
|
-
var
|
|
5336
|
+
var import_jsx_runtime44 = require("@emotion/react/jsx-runtime");
|
|
5320
5337
|
function VariablesList() {
|
|
5321
5338
|
const { variables, dispatch, readOnly } = useVariables();
|
|
5322
5339
|
const sorted = variablesToList(variables).filter((variable) => !variable.system);
|
|
@@ -5337,24 +5354,24 @@ function VariablesList() {
|
|
|
5337
5354
|
return result;
|
|
5338
5355
|
}
|
|
5339
5356
|
};
|
|
5340
|
-
return /* @__PURE__ */ (0,
|
|
5341
|
-
/* @__PURE__ */ (0,
|
|
5342
|
-
/* @__PURE__ */ (0,
|
|
5343
|
-
/* @__PURE__ */ (0,
|
|
5344
|
-
/* @__PURE__ */ (0,
|
|
5345
|
-
/* @__PURE__ */ (0,
|
|
5357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_beautiful_dnd3.Droppable, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_design_system25.Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_design_system25.TableRow, { children: [
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.TableCellHead, { children: "Name" }),
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.TableCellHead, { children: "Default Value" }),
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.TableCellHead, {})
|
|
5346
5363
|
] }) }),
|
|
5347
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_design_system25.TableBody, { children: [
|
|
5348
5365
|
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
5349
5366
|
const text = displayName != null ? displayName : name;
|
|
5350
5367
|
const textValue = variableDefaultTextValue(defaultValue);
|
|
5351
|
-
return /* @__PURE__ */ (0,
|
|
5352
|
-
|
|
5368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5369
|
+
import_react_beautiful_dnd3.Draggable,
|
|
5353
5370
|
{
|
|
5354
5371
|
draggableId: name,
|
|
5355
5372
|
index,
|
|
5356
5373
|
isDragDisabled: sorted.length === 1,
|
|
5357
|
-
children: (provided2, snapshot) => /* @__PURE__ */ (0,
|
|
5374
|
+
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5358
5375
|
import_design_system25.TableRow,
|
|
5359
5376
|
{
|
|
5360
5377
|
ref: provided2.innerRef,
|
|
@@ -5364,7 +5381,7 @@ function VariablesList() {
|
|
|
5364
5381
|
css: tableRow(snapshot.isDragging),
|
|
5365
5382
|
"data-dragging": snapshot.isDragging,
|
|
5366
5383
|
children: [
|
|
5367
|
-
/* @__PURE__ */ (0,
|
|
5384
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.TableCellData, { css: sorted.length > 1 ? tableCellDragIcon : void 0, children: readOnly ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { css: variableName, children: text }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5368
5385
|
"button",
|
|
5369
5386
|
{
|
|
5370
5387
|
css: variableName,
|
|
@@ -5377,21 +5394,21 @@ function VariablesList() {
|
|
|
5377
5394
|
children: text
|
|
5378
5395
|
}
|
|
5379
5396
|
) }),
|
|
5380
|
-
/* @__PURE__ */ (0,
|
|
5381
|
-
/* @__PURE__ */ (0,
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.TableCellData, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { css: variableValue, title: textValue, children: textValue }) }),
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.TableCellData, { align: "right", children: readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5382
5399
|
"button",
|
|
5383
5400
|
{
|
|
5384
5401
|
type: "button",
|
|
5385
5402
|
title: `delete ${text}`,
|
|
5386
5403
|
css: [
|
|
5387
5404
|
import_design_system25.button,
|
|
5388
|
-
|
|
5405
|
+
import_react57.css`
|
|
5389
5406
|
background: transparent;
|
|
5390
5407
|
`
|
|
5391
5408
|
],
|
|
5392
5409
|
"aria-controls": text,
|
|
5393
5410
|
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
5394
|
-
children: /* @__PURE__ */ (0,
|
|
5411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.Icon, { icon: "trash", iconColor: "red" })
|
|
5395
5412
|
}
|
|
5396
5413
|
) })
|
|
5397
5414
|
]
|
|
@@ -5404,7 +5421,7 @@ function VariablesList() {
|
|
|
5404
5421
|
provided.placeholder
|
|
5405
5422
|
] })
|
|
5406
5423
|
] }) }) }),
|
|
5407
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
5424
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5408
5425
|
import_design_system25.AddListButton,
|
|
5409
5426
|
{
|
|
5410
5427
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
@@ -5418,37 +5435,37 @@ function VariablesList() {
|
|
|
5418
5435
|
}
|
|
5419
5436
|
|
|
5420
5437
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
5421
|
-
var
|
|
5438
|
+
var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
|
|
5422
5439
|
function DataResourceDynamicInputProvider(props) {
|
|
5423
5440
|
const { children, dynamicInputs } = props;
|
|
5424
5441
|
if (dynamicInputs) {
|
|
5425
|
-
return /* @__PURE__ */ (0,
|
|
5442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceDynamicInputProviderRenderer, { ...props, children });
|
|
5426
5443
|
}
|
|
5427
|
-
return /* @__PURE__ */ (0,
|
|
5444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceDynamicInputProviderContextShim, { children });
|
|
5428
5445
|
}
|
|
5429
5446
|
function DataResourceDynamicInputProviderContextShim(props) {
|
|
5430
5447
|
const {
|
|
5431
5448
|
metadata: { dynamicInputs }
|
|
5432
5449
|
} = useMeshLocation("dataResource");
|
|
5433
|
-
return /* @__PURE__ */ (0,
|
|
5450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
|
|
5434
5451
|
}
|
|
5435
5452
|
function DataResourceDynamicInputProviderRenderer({
|
|
5436
5453
|
children,
|
|
5437
5454
|
dynamicInputs
|
|
5438
5455
|
}) {
|
|
5439
5456
|
const variables = useDynamicInputsAsVariables(dynamicInputs);
|
|
5440
|
-
return /* @__PURE__ */ (0,
|
|
5457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(VariablesProvider, { value: variables, readOnly: true, children });
|
|
5441
5458
|
}
|
|
5442
5459
|
|
|
5443
5460
|
// src/components/DataResourceVariablesList.tsx
|
|
5444
5461
|
var import_design_system26 = require("@uniformdev/design-system");
|
|
5445
|
-
var
|
|
5462
|
+
var import_jsx_runtime46 = require("@emotion/react/jsx-runtime");
|
|
5446
5463
|
function DataResourceVariablesList(props) {
|
|
5447
5464
|
const {
|
|
5448
5465
|
value,
|
|
5449
5466
|
metadata: { dataType, dynamicInputs }
|
|
5450
5467
|
} = useMeshLocation("dataResource");
|
|
5451
|
-
return /* @__PURE__ */ (0,
|
|
5468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5452
5469
|
DataResourceVariablesListExplicit,
|
|
5453
5470
|
{
|
|
5454
5471
|
...props,
|
|
@@ -5469,14 +5486,14 @@ function DataResourceVariablesListExplicit({
|
|
|
5469
5486
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
5470
5487
|
if (variableDefinitions.length === 0) {
|
|
5471
5488
|
if (NoVariablesComponent) {
|
|
5472
|
-
return /* @__PURE__ */ (0,
|
|
5489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(NoVariablesComponent, {});
|
|
5473
5490
|
}
|
|
5474
|
-
return /* @__PURE__ */ (0,
|
|
5491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system26.Callout, { type: "note", children: "No settings are required." });
|
|
5475
5492
|
}
|
|
5476
|
-
return /* @__PURE__ */ (0,
|
|
5493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system26.VerticalRhythm, { children: variableDefinitions.map((variableDefinition) => {
|
|
5477
5494
|
var _a, _b, _c;
|
|
5478
5495
|
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
5479
|
-
return /* @__PURE__ */ (0,
|
|
5496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5480
5497
|
VariableRenderer,
|
|
5481
5498
|
{
|
|
5482
5499
|
definition: variableDefinition,
|
|
@@ -5501,7 +5518,7 @@ function DataResourceVariablesListExplicit({
|
|
|
5501
5518
|
}
|
|
5502
5519
|
function TextVariableRenderer({ definition, value, setValue }) {
|
|
5503
5520
|
var _a;
|
|
5504
|
-
return /* @__PURE__ */ (0,
|
|
5521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { "data-testid": "variable-input-container", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5505
5522
|
InputVariables,
|
|
5506
5523
|
{
|
|
5507
5524
|
label: definition.displayName || definition.name,
|
|
@@ -5514,13 +5531,13 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
5514
5531
|
}
|
|
5515
5532
|
|
|
5516
5533
|
// src/components/Request/RequestBody.tsx
|
|
5517
|
-
var
|
|
5534
|
+
var import_react59 = require("@emotion/react");
|
|
5518
5535
|
var import_design_system27 = require("@uniformdev/design-system");
|
|
5519
|
-
var
|
|
5536
|
+
var import_react60 = require("react");
|
|
5520
5537
|
|
|
5521
5538
|
// src/components/Request/RequestProvider.tsx
|
|
5522
5539
|
var React11 = __toESM(require("react"));
|
|
5523
|
-
var
|
|
5540
|
+
var import_jsx_runtime47 = require("@emotion/react/jsx-runtime");
|
|
5524
5541
|
var RequestContext = React11.createContext(null);
|
|
5525
5542
|
function RequestProvider({ value, onChange, children }) {
|
|
5526
5543
|
const contextValue = React11.useMemo(() => {
|
|
@@ -5589,7 +5606,7 @@ function RequestProvider({ value, onChange, children }) {
|
|
|
5589
5606
|
request: value
|
|
5590
5607
|
};
|
|
5591
5608
|
}, [onChange, value]);
|
|
5592
|
-
return /* @__PURE__ */ (0,
|
|
5609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RequestContext.Provider, { value: contextValue, children });
|
|
5593
5610
|
}
|
|
5594
5611
|
function useRequest() {
|
|
5595
5612
|
const context = React11.useContext(RequestContext);
|
|
@@ -5600,11 +5617,11 @@ function useRequest() {
|
|
|
5600
5617
|
}
|
|
5601
5618
|
|
|
5602
5619
|
// src/components/Request/styles/Request.styles.ts
|
|
5603
|
-
var
|
|
5604
|
-
var innerContentStyles =
|
|
5620
|
+
var import_react58 = require("@emotion/react");
|
|
5621
|
+
var innerContentStyles = import_react58.css`
|
|
5605
5622
|
background: var(--white);
|
|
5606
5623
|
`;
|
|
5607
|
-
var requestTypeContainer = (bgColor) =>
|
|
5624
|
+
var requestTypeContainer = (bgColor) => import_react58.css`
|
|
5608
5625
|
align-items: start;
|
|
5609
5626
|
background: ${bgColor};
|
|
5610
5627
|
display: grid;
|
|
@@ -5613,17 +5630,17 @@ var requestTypeContainer = (bgColor) => import_react57.css`
|
|
|
5613
5630
|
`;
|
|
5614
5631
|
|
|
5615
5632
|
// src/components/Request/RequestTypeContainer.tsx
|
|
5616
|
-
var
|
|
5633
|
+
var import_jsx_runtime48 = require("@emotion/react/jsx-runtime");
|
|
5617
5634
|
var RequestTypeContainer = ({
|
|
5618
5635
|
bgColor = "transparent",
|
|
5619
5636
|
children,
|
|
5620
5637
|
...props
|
|
5621
5638
|
}) => {
|
|
5622
|
-
return /* @__PURE__ */ (0,
|
|
5639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { css: requestTypeContainer(bgColor), ...props, children });
|
|
5623
5640
|
};
|
|
5624
5641
|
|
|
5625
5642
|
// src/components/Request/RequestBody.tsx
|
|
5626
|
-
var
|
|
5643
|
+
var import_jsx_runtime49 = require("@emotion/react/jsx-runtime");
|
|
5627
5644
|
var LANGUAGE_OPTIONS = [
|
|
5628
5645
|
{ label: "Text", value: "plaintext" },
|
|
5629
5646
|
{ label: "JSON", value: "json" },
|
|
@@ -5642,22 +5659,22 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
5642
5659
|
};
|
|
5643
5660
|
function RequestBody() {
|
|
5644
5661
|
const { request, dispatch } = useRequest();
|
|
5645
|
-
const [language, setLanguage] = (0,
|
|
5646
|
-
return /* @__PURE__ */ (0,
|
|
5662
|
+
const [language, setLanguage] = (0, import_react60.useState)("json");
|
|
5663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5647
5664
|
"div",
|
|
5648
5665
|
{
|
|
5649
|
-
css:
|
|
5666
|
+
css: import_react59.css`
|
|
5650
5667
|
background: var(--white);
|
|
5651
5668
|
`,
|
|
5652
5669
|
children: [
|
|
5653
|
-
/* @__PURE__ */ (0,
|
|
5670
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5654
5671
|
RequestTypeContainer,
|
|
5655
5672
|
{
|
|
5656
5673
|
bgColor: "var(--gray-100)",
|
|
5657
|
-
css:
|
|
5674
|
+
css: import_react59.css`
|
|
5658
5675
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
5659
5676
|
`,
|
|
5660
|
-
children: /* @__PURE__ */ (0,
|
|
5677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5661
5678
|
import_design_system27.InputSelect,
|
|
5662
5679
|
{
|
|
5663
5680
|
label: "Language",
|
|
@@ -5680,7 +5697,7 @@ function RequestBody() {
|
|
|
5680
5697
|
)
|
|
5681
5698
|
}
|
|
5682
5699
|
),
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5700
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5684
5701
|
import_design_system27.JsonEditor,
|
|
5685
5702
|
{
|
|
5686
5703
|
height: 200,
|
|
@@ -5699,7 +5716,7 @@ function RequestBody() {
|
|
|
5699
5716
|
|
|
5700
5717
|
// src/components/Request/RequestHeaders.tsx
|
|
5701
5718
|
var import_design_system28 = require("@uniformdev/design-system");
|
|
5702
|
-
var
|
|
5719
|
+
var import_jsx_runtime50 = require("@emotion/react/jsx-runtime");
|
|
5703
5720
|
function RequestHeaders({
|
|
5704
5721
|
disableVariables,
|
|
5705
5722
|
addOmitIfEmpty
|
|
@@ -5718,29 +5735,29 @@ function RequestHeaders({
|
|
|
5718
5735
|
index
|
|
5719
5736
|
});
|
|
5720
5737
|
};
|
|
5721
|
-
return /* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5723
|
-
/* @__PURE__ */ (0,
|
|
5724
|
-
/* @__PURE__ */ (0,
|
|
5725
|
-
addOmitIfEmpty ? /* @__PURE__ */ (0,
|
|
5738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.Table, { children: [
|
|
5739
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.TableRow, { children: [
|
|
5740
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellHead, { children: "Name" }),
|
|
5741
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellHead, { children: "Value" }),
|
|
5742
|
+
addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellHead, { children: "Omit If Empty" }) : null
|
|
5726
5743
|
] }) }),
|
|
5727
|
-
/* @__PURE__ */ (0,
|
|
5744
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.TableBody, { children: [
|
|
5728
5745
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
|
|
5729
|
-
return /* @__PURE__ */ (0,
|
|
5730
|
-
/* @__PURE__ */ (0,
|
|
5746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.TableRow, { children: [
|
|
5747
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.TableCellData, { width: "50%", children: [
|
|
5731
5748
|
baseHeader.key,
|
|
5732
|
-
/* @__PURE__ */ (0,
|
|
5733
|
-
/* @__PURE__ */ (0,
|
|
5749
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("br", {}),
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("small", { children: "from data source" }) })
|
|
5734
5751
|
] }),
|
|
5735
|
-
/* @__PURE__ */ (0,
|
|
5736
|
-
/* @__PURE__ */ (0,
|
|
5737
|
-
request.headers.find((p) => p.key === baseHeader.key) ? /* @__PURE__ */ (0,
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.TableCellData, { width: "50%", children: [
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseHeader.value }),
|
|
5754
|
+
request.headers.find((p) => p.key === baseHeader.key) ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.WarningMessage, { message: "overridden below" }) : null
|
|
5738
5755
|
] })
|
|
5739
5756
|
] }, baseHeader.key);
|
|
5740
5757
|
}),
|
|
5741
5758
|
deezHeaders.map((header, index) => {
|
|
5742
|
-
return /* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.TableRow, { children: [
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5744
5761
|
import_design_system28.Input,
|
|
5745
5762
|
{
|
|
5746
5763
|
label: header.key,
|
|
@@ -5760,7 +5777,7 @@ function RequestHeaders({
|
|
|
5760
5777
|
"data-testid": "header-key"
|
|
5761
5778
|
}
|
|
5762
5779
|
) }),
|
|
5763
|
-
/* @__PURE__ */ (0,
|
|
5780
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5764
5781
|
InputVariables,
|
|
5765
5782
|
{
|
|
5766
5783
|
value: header.value,
|
|
@@ -5771,7 +5788,7 @@ function RequestHeaders({
|
|
|
5771
5788
|
"data-testid": "header-value"
|
|
5772
5789
|
}
|
|
5773
5790
|
) : null }),
|
|
5774
|
-
addOmitIfEmpty ? /* @__PURE__ */ (0,
|
|
5791
|
+
addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5775
5792
|
import_design_system28.Input,
|
|
5776
5793
|
{
|
|
5777
5794
|
type: "checkbox",
|
|
@@ -5796,11 +5813,11 @@ function RequestHeaders({
|
|
|
5796
5813
|
|
|
5797
5814
|
// src/components/Request/RequestMethodSelect.tsx
|
|
5798
5815
|
var import_design_system29 = require("@uniformdev/design-system");
|
|
5799
|
-
var
|
|
5816
|
+
var import_jsx_runtime51 = require("@emotion/react/jsx-runtime");
|
|
5800
5817
|
function RequestMethodSelect(props) {
|
|
5801
5818
|
var _a;
|
|
5802
5819
|
const { request, dispatch } = useRequest();
|
|
5803
|
-
return /* @__PURE__ */ (0,
|
|
5820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5804
5821
|
import_design_system29.InputSelect,
|
|
5805
5822
|
{
|
|
5806
5823
|
...props,
|
|
@@ -5817,7 +5834,7 @@ function RequestMethodSelect(props) {
|
|
|
5817
5834
|
|
|
5818
5835
|
// src/components/Request/RequestParameters.tsx
|
|
5819
5836
|
var import_design_system30 = require("@uniformdev/design-system");
|
|
5820
|
-
var
|
|
5837
|
+
var import_jsx_runtime52 = require("@emotion/react/jsx-runtime");
|
|
5821
5838
|
function RequestParameters({
|
|
5822
5839
|
disableVariables,
|
|
5823
5840
|
addOmitIfEmpty
|
|
@@ -5837,29 +5854,29 @@ function RequestParameters({
|
|
|
5837
5854
|
index
|
|
5838
5855
|
});
|
|
5839
5856
|
};
|
|
5840
|
-
return /* @__PURE__ */ (0,
|
|
5841
|
-
/* @__PURE__ */ (0,
|
|
5842
|
-
/* @__PURE__ */ (0,
|
|
5843
|
-
/* @__PURE__ */ (0,
|
|
5844
|
-
addOmitIfEmpty ? /* @__PURE__ */ (0,
|
|
5857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { css: innerContentStyles, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.Table, { children: [
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.TableRow, { children: [
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellHead, { children: "Name" }),
|
|
5860
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellHead, { children: "Value" }),
|
|
5861
|
+
addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellHead, { children: "Omit If Empty" }) : null
|
|
5845
5862
|
] }) }),
|
|
5846
|
-
/* @__PURE__ */ (0,
|
|
5863
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.TableBody, { children: [
|
|
5847
5864
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
|
|
5848
|
-
return /* @__PURE__ */ (0,
|
|
5849
|
-
/* @__PURE__ */ (0,
|
|
5865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.TableRow, { children: [
|
|
5866
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.TableCellData, { width: "50%", children: [
|
|
5850
5867
|
baseParameter.key,
|
|
5851
|
-
/* @__PURE__ */ (0,
|
|
5852
|
-
/* @__PURE__ */ (0,
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("br", {}),
|
|
5869
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("i", { css: { color: "var(--gray-500)" }, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("small", { children: "from data source" }) })
|
|
5853
5870
|
] }),
|
|
5854
|
-
/* @__PURE__ */ (0,
|
|
5855
|
-
/* @__PURE__ */ (0,
|
|
5856
|
-
request.parameters.find((p) => p.key === baseParameter.key) ? /* @__PURE__ */ (0,
|
|
5871
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.TableCellData, { width: "50%", children: [
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("i", { css: { color: "var(--gray-500)" }, children: baseParameter.value }),
|
|
5873
|
+
request.parameters.find((p) => p.key === baseParameter.key) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.WarningMessage, { message: "overridden below" }) : null
|
|
5857
5874
|
] })
|
|
5858
5875
|
] }, baseParameter.key);
|
|
5859
5876
|
}),
|
|
5860
5877
|
deezParameters.map((parameter, index) => {
|
|
5861
|
-
return /* @__PURE__ */ (0,
|
|
5862
|
-
/* @__PURE__ */ (0,
|
|
5878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.TableRow, { children: [
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellData, { width: "50%", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5863
5880
|
import_design_system30.Input,
|
|
5864
5881
|
{
|
|
5865
5882
|
label: parameter.key,
|
|
@@ -5883,7 +5900,7 @@ function RequestParameters({
|
|
|
5883
5900
|
"data-testid": "parameter-key"
|
|
5884
5901
|
}
|
|
5885
5902
|
) }),
|
|
5886
|
-
/* @__PURE__ */ (0,
|
|
5903
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5887
5904
|
InputVariables,
|
|
5888
5905
|
{
|
|
5889
5906
|
value: parameter.value,
|
|
@@ -5899,7 +5916,7 @@ function RequestParameters({
|
|
|
5899
5916
|
enableEditingVariables: true
|
|
5900
5917
|
}
|
|
5901
5918
|
) : null }),
|
|
5902
|
-
addOmitIfEmpty ? /* @__PURE__ */ (0,
|
|
5919
|
+
addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5903
5920
|
import_design_system30.Input,
|
|
5904
5921
|
{
|
|
5905
5922
|
type: "checkbox",
|
|
@@ -5925,8 +5942,8 @@ function RequestParameters({
|
|
|
5925
5942
|
}
|
|
5926
5943
|
|
|
5927
5944
|
// src/components/Request/RequestUrl.tsx
|
|
5928
|
-
var
|
|
5929
|
-
var
|
|
5945
|
+
var import_react61 = require("@emotion/react");
|
|
5946
|
+
var import_react62 = require("react");
|
|
5930
5947
|
|
|
5931
5948
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
5932
5949
|
function urlEncodeRequestUrl(url, varValues) {
|
|
@@ -5947,35 +5964,35 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
|
|
|
5947
5964
|
}
|
|
5948
5965
|
|
|
5949
5966
|
// src/components/Request/RequestUrl.tsx
|
|
5950
|
-
var
|
|
5967
|
+
var import_jsx_runtime53 = require("@emotion/react/jsx-runtime");
|
|
5951
5968
|
function RequestUrl() {
|
|
5952
5969
|
var _a, _b;
|
|
5953
5970
|
const { variables } = useVariables();
|
|
5954
5971
|
const { request } = useRequest();
|
|
5955
|
-
const mergedParameters = (0,
|
|
5972
|
+
const mergedParameters = (0, import_react62.useMemo)(() => {
|
|
5956
5973
|
var _a2;
|
|
5957
5974
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
5958
5975
|
return request.parameters;
|
|
5959
5976
|
}
|
|
5960
5977
|
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p) => p.key === baseParam.key)).concat(request.parameters);
|
|
5961
5978
|
}, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
|
|
5962
|
-
return /* @__PURE__ */ (0,
|
|
5979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
5963
5980
|
"small",
|
|
5964
5981
|
{
|
|
5965
|
-
css:
|
|
5982
|
+
css: import_react61.css`
|
|
5966
5983
|
display: inline-block;
|
|
5967
5984
|
margin-bottom: var(--spacing-xs);
|
|
5968
5985
|
word-break: break-word;
|
|
5969
5986
|
`,
|
|
5970
5987
|
children: [
|
|
5971
|
-
request.baseRequest ? /* @__PURE__ */ (0,
|
|
5972
|
-
/* @__PURE__ */ (0,
|
|
5988
|
+
request.baseRequest ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: (_b = request.baseRequest) == null ? void 0 : _b.baseUrl }) : null,
|
|
5989
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { css: { fontWeight: request.baseRequest ? "bold" : "inherit" }, children: [
|
|
5973
5990
|
urlEncodeRequestUrl(request.relativeUrl, variables),
|
|
5974
|
-
mergedParameters.length > 0 ? /* @__PURE__ */ (0,
|
|
5991
|
+
mergedParameters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5975
5992
|
"?",
|
|
5976
5993
|
mergedParameters.map((param, index) => {
|
|
5977
5994
|
const encoded = urlEncodeRequestParameter(param, variables);
|
|
5978
|
-
return /* @__PURE__ */ (0,
|
|
5995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { children: [
|
|
5979
5996
|
index > 0 ? "&" : null,
|
|
5980
5997
|
encoded.key,
|
|
5981
5998
|
"=",
|
|
@@ -6014,10 +6031,10 @@ function transformPastedUrl(value, currentRequest, dispatch) {
|
|
|
6014
6031
|
}
|
|
6015
6032
|
|
|
6016
6033
|
// src/components/Request/RequestUrlInput.tsx
|
|
6017
|
-
var
|
|
6034
|
+
var import_jsx_runtime54 = require("@emotion/react/jsx-runtime");
|
|
6018
6035
|
function RequestUrlInput(props) {
|
|
6019
6036
|
const { request, dispatch } = useRequest();
|
|
6020
|
-
return /* @__PURE__ */ (0,
|
|
6037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6021
6038
|
InputVariables,
|
|
6022
6039
|
{
|
|
6023
6040
|
...props,
|
|
@@ -6067,12 +6084,12 @@ function useRequestParameter(paramName) {
|
|
|
6067
6084
|
}
|
|
6068
6085
|
|
|
6069
6086
|
// src/components/DataSourceEditor.tsx
|
|
6070
|
-
var
|
|
6087
|
+
var import_jsx_runtime55 = require("@emotion/react/jsx-runtime");
|
|
6071
6088
|
function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
6072
6089
|
var _a;
|
|
6073
6090
|
const { value } = useMeshLocation("dataSource");
|
|
6074
6091
|
const currentRequestValue = convertDataSourceToRequestData(value);
|
|
6075
|
-
return /* @__PURE__ */ (0,
|
|
6092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6076
6093
|
VariablesProvider,
|
|
6077
6094
|
{
|
|
6078
6095
|
value: (_a = value.variables) != null ? _a : {},
|
|
@@ -6088,7 +6105,7 @@ function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
|
6088
6105
|
},
|
|
6089
6106
|
editVariableComponent,
|
|
6090
6107
|
readOnly: true,
|
|
6091
|
-
children: /* @__PURE__ */ (0,
|
|
6108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6092
6109
|
RequestProvider,
|
|
6093
6110
|
{
|
|
6094
6111
|
value: currentRequestValue,
|
|
@@ -6125,7 +6142,7 @@ function convertRequestDataToDataSource(dataSource, requestData) {
|
|
|
6125
6142
|
}
|
|
6126
6143
|
|
|
6127
6144
|
// src/components/DataTypeEditor.tsx
|
|
6128
|
-
var
|
|
6145
|
+
var import_jsx_runtime56 = require("@emotion/react/jsx-runtime");
|
|
6129
6146
|
function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
6130
6147
|
var _a;
|
|
6131
6148
|
const {
|
|
@@ -6134,7 +6151,7 @@ function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
|
6134
6151
|
isReadOnly
|
|
6135
6152
|
} = useMeshLocation("dataType");
|
|
6136
6153
|
const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
|
|
6137
|
-
return /* @__PURE__ */ (0,
|
|
6154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6138
6155
|
VariablesProvider,
|
|
6139
6156
|
{
|
|
6140
6157
|
value: (_a = value.variables) != null ? _a : {},
|
|
@@ -6150,7 +6167,7 @@ function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
|
6150
6167
|
},
|
|
6151
6168
|
editVariableComponent,
|
|
6152
6169
|
readOnly: isReadOnly,
|
|
6153
|
-
children: /* @__PURE__ */ (0,
|
|
6170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6154
6171
|
RequestProvider,
|
|
6155
6172
|
{
|
|
6156
6173
|
value: currentRequestValue,
|
|
@@ -6200,12 +6217,12 @@ var import_design_system31 = require("@uniformdev/design-system");
|
|
|
6200
6217
|
|
|
6201
6218
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
6202
6219
|
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
6203
|
-
var
|
|
6220
|
+
var import_react63 = require("react");
|
|
6204
6221
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
6205
|
-
const [error, setError] = (0,
|
|
6206
|
-
const [sdk, setSdk] = (0,
|
|
6207
|
-
const initializationInProgress = (0,
|
|
6208
|
-
(0,
|
|
6222
|
+
const [error, setError] = (0, import_react63.useState)();
|
|
6223
|
+
const [sdk, setSdk] = (0, import_react63.useState)();
|
|
6224
|
+
const initializationInProgress = (0, import_react63.useRef)(false);
|
|
6225
|
+
(0, import_react63.useEffect)(
|
|
6209
6226
|
() => {
|
|
6210
6227
|
if (typeof window === "undefined" || sdk) {
|
|
6211
6228
|
return;
|
|
@@ -6238,7 +6255,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
6238
6255
|
};
|
|
6239
6256
|
|
|
6240
6257
|
// src/components/MeshApp.tsx
|
|
6241
|
-
var
|
|
6258
|
+
var import_jsx_runtime57 = require("@emotion/react/jsx-runtime");
|
|
6242
6259
|
var MeshApp = ({
|
|
6243
6260
|
children,
|
|
6244
6261
|
loadingComponent,
|
|
@@ -6247,36 +6264,36 @@ var MeshApp = ({
|
|
|
6247
6264
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
6248
6265
|
if (initializing || !sdk) {
|
|
6249
6266
|
const LoadingComponent = loadingComponent;
|
|
6250
|
-
return LoadingComponent ? /* @__PURE__ */ (0,
|
|
6267
|
+
return LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(LoadingComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system31.LoadingIndicator, {});
|
|
6251
6268
|
}
|
|
6252
6269
|
if (error) {
|
|
6253
6270
|
const ErrorComponent = errorComponent;
|
|
6254
6271
|
if (ErrorComponent) {
|
|
6255
|
-
return /* @__PURE__ */ (0,
|
|
6272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ErrorComponent, { error });
|
|
6256
6273
|
}
|
|
6257
6274
|
throw error;
|
|
6258
6275
|
}
|
|
6259
|
-
return /* @__PURE__ */ (0,
|
|
6260
|
-
/* @__PURE__ */ (0,
|
|
6261
|
-
/* @__PURE__ */ (0,
|
|
6276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
6277
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system31.Theme, {}),
|
|
6278
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(UniformMeshLocationContextProvider, { children })
|
|
6262
6279
|
] });
|
|
6263
6280
|
};
|
|
6264
6281
|
|
|
6265
6282
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
6266
|
-
var
|
|
6283
|
+
var import_react64 = require("@emotion/react");
|
|
6267
6284
|
var import_design_system32 = require("@uniformdev/design-system");
|
|
6268
|
-
var
|
|
6285
|
+
var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
|
|
6269
6286
|
var DataRefreshButton = ({
|
|
6270
6287
|
buttonText,
|
|
6271
6288
|
isLoading,
|
|
6272
6289
|
onRefreshData,
|
|
6273
6290
|
...props
|
|
6274
6291
|
}) => {
|
|
6275
|
-
return /* @__PURE__ */ (0,
|
|
6276
|
-
!isLoading ? null : /* @__PURE__ */ (0,
|
|
6292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_design_system32.Button, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
6293
|
+
!isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6277
6294
|
import_design_system32.LoadingIndicator,
|
|
6278
6295
|
{
|
|
6279
|
-
css:
|
|
6296
|
+
css: import_react64.css`
|
|
6280
6297
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
6281
6298
|
`
|
|
6282
6299
|
}
|
|
@@ -6286,15 +6303,15 @@ var DataRefreshButton = ({
|
|
|
6286
6303
|
};
|
|
6287
6304
|
|
|
6288
6305
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6289
|
-
var
|
|
6306
|
+
var import_react67 = require("@emotion/react");
|
|
6290
6307
|
var import_canvas9 = require("@uniformdev/canvas");
|
|
6291
6308
|
var import_design_system35 = require("@uniformdev/design-system");
|
|
6292
6309
|
|
|
6293
6310
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6294
6311
|
var import_canvas8 = require("@uniformdev/canvas");
|
|
6295
|
-
var
|
|
6296
|
-
var
|
|
6297
|
-
var ObjectSearchContext = (0,
|
|
6312
|
+
var import_react65 = require("react");
|
|
6313
|
+
var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
|
|
6314
|
+
var ObjectSearchContext = (0, import_react65.createContext)({
|
|
6298
6315
|
onSetQuery: () => {
|
|
6299
6316
|
},
|
|
6300
6317
|
onSelectItem: () => {
|
|
@@ -6315,16 +6332,16 @@ var ObjectSearchProvider = ({
|
|
|
6315
6332
|
children,
|
|
6316
6333
|
defaultQuery
|
|
6317
6334
|
}) => {
|
|
6318
|
-
const [query, setQuery] = (0,
|
|
6335
|
+
const [query, setQuery] = (0, import_react65.useState)({
|
|
6319
6336
|
contentType: "",
|
|
6320
6337
|
keyword: "",
|
|
6321
6338
|
...defaultQuery
|
|
6322
6339
|
});
|
|
6323
6340
|
const { flatVariables } = useVariables(true);
|
|
6324
|
-
const querySearchDeferred = (0,
|
|
6325
|
-
const [selectedItems, setSelectedItems] = (0,
|
|
6326
|
-
const [list, setList] = (0,
|
|
6327
|
-
const onSetQuery = (0,
|
|
6341
|
+
const querySearchDeferred = (0, import_react65.useDeferredValue)(query);
|
|
6342
|
+
const [selectedItems, setSelectedItems] = (0, import_react65.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
6343
|
+
const [list, setList] = (0, import_react65.useState)({});
|
|
6344
|
+
const onSetQuery = (0, import_react65.useCallback)(
|
|
6328
6345
|
(value2) => {
|
|
6329
6346
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
6330
6347
|
return setQuery({
|
|
@@ -6336,7 +6353,7 @@ var ObjectSearchProvider = ({
|
|
|
6336
6353
|
},
|
|
6337
6354
|
[setQuery]
|
|
6338
6355
|
);
|
|
6339
|
-
const onSelectItem = (0,
|
|
6356
|
+
const onSelectItem = (0, import_react65.useCallback)(
|
|
6340
6357
|
(selectedResult) => {
|
|
6341
6358
|
if (Array.isArray(selectedResult)) {
|
|
6342
6359
|
setSelectedItems(selectedResult);
|
|
@@ -6350,17 +6367,17 @@ var ObjectSearchProvider = ({
|
|
|
6350
6367
|
},
|
|
6351
6368
|
[setSelectedItems, selectedItems]
|
|
6352
6369
|
);
|
|
6353
|
-
const onRemoveAllSelectedItems = (0,
|
|
6370
|
+
const onRemoveAllSelectedItems = (0, import_react65.useCallback)(() => {
|
|
6354
6371
|
setSelectedItems([]);
|
|
6355
6372
|
}, [setSelectedItems]);
|
|
6356
|
-
const onSetList = (0,
|
|
6373
|
+
const onSetList = (0, import_react65.useCallback)(
|
|
6357
6374
|
(value2) => {
|
|
6358
6375
|
setList(value2);
|
|
6359
6376
|
},
|
|
6360
6377
|
[setList]
|
|
6361
6378
|
);
|
|
6362
|
-
const boundQuery = (0,
|
|
6363
|
-
const value = (0,
|
|
6379
|
+
const boundQuery = (0, import_react65.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
6380
|
+
const value = (0, import_react65.useMemo)(
|
|
6364
6381
|
() => ({
|
|
6365
6382
|
boundQuery,
|
|
6366
6383
|
onSetQuery,
|
|
@@ -6384,10 +6401,10 @@ var ObjectSearchProvider = ({
|
|
|
6384
6401
|
onSetList
|
|
6385
6402
|
]
|
|
6386
6403
|
);
|
|
6387
|
-
return /* @__PURE__ */ (0,
|
|
6404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
6388
6405
|
};
|
|
6389
6406
|
function useObjectSearchContext() {
|
|
6390
|
-
return (0,
|
|
6407
|
+
return (0, import_react65.useContext)(ObjectSearchContext);
|
|
6391
6408
|
}
|
|
6392
6409
|
function bindQuery(query, inputs) {
|
|
6393
6410
|
const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
|
|
@@ -6405,9 +6422,9 @@ function bindQuery(query, inputs) {
|
|
|
6405
6422
|
var import_design_system34 = require("@uniformdev/design-system");
|
|
6406
6423
|
|
|
6407
6424
|
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6408
|
-
var
|
|
6425
|
+
var import_react66 = require("@emotion/react");
|
|
6409
6426
|
var import_design_system33 = require("@uniformdev/design-system");
|
|
6410
|
-
var ObjectListItemContainer =
|
|
6427
|
+
var ObjectListItemContainer = import_react66.css`
|
|
6411
6428
|
align-items: center;
|
|
6412
6429
|
border: 1px solid var(--gray-300);
|
|
6413
6430
|
border-radius: var(--rounded-base);
|
|
@@ -6416,11 +6433,11 @@ var ObjectListItemContainer = import_react65.css`
|
|
|
6416
6433
|
grid-template-columns: 1fr auto;
|
|
6417
6434
|
padding: var(--spacing-sm);
|
|
6418
6435
|
`;
|
|
6419
|
-
var ObjectListItemContainerDisabled =
|
|
6436
|
+
var ObjectListItemContainerDisabled = import_react66.css`
|
|
6420
6437
|
opacity: var(--opacity-50);
|
|
6421
6438
|
pointer-events: none;
|
|
6422
6439
|
`;
|
|
6423
|
-
var ObjectListItemLoading =
|
|
6440
|
+
var ObjectListItemLoading = import_react66.css`
|
|
6424
6441
|
animation: ${import_design_system33.skeletonLoading} 1s linear infinite alternate;
|
|
6425
6442
|
border-color: transparent;
|
|
6426
6443
|
min-height: 42px;
|
|
@@ -6444,42 +6461,42 @@ var ObjectListItemLoading = import_react65.css`
|
|
|
6444
6461
|
width: 1rem;
|
|
6445
6462
|
}
|
|
6446
6463
|
`;
|
|
6447
|
-
var ObjectListItemHeadingGroup =
|
|
6464
|
+
var ObjectListItemHeadingGroup = import_react66.css`
|
|
6448
6465
|
align-items: center;
|
|
6449
6466
|
display: grid;
|
|
6450
6467
|
`;
|
|
6451
|
-
var ObjectListItemThumbnail =
|
|
6468
|
+
var ObjectListItemThumbnail = import_react66.css`
|
|
6452
6469
|
width: 30px;
|
|
6453
6470
|
object-fit: contain;
|
|
6454
6471
|
`;
|
|
6455
|
-
var ObjectListItemTitle =
|
|
6472
|
+
var ObjectListItemTitle = import_react66.css`
|
|
6456
6473
|
color: var(--typography-base);
|
|
6457
6474
|
display: block;
|
|
6458
6475
|
font-size: var(--fs-sm);
|
|
6459
6476
|
`;
|
|
6460
|
-
var ObjectListItemSubtitle =
|
|
6477
|
+
var ObjectListItemSubtitle = import_react66.css`
|
|
6461
6478
|
color: var(--gray-500);
|
|
6462
6479
|
display: block;
|
|
6463
6480
|
font-size: var(--fs-xs);
|
|
6464
6481
|
line-height: 1;
|
|
6465
6482
|
`;
|
|
6466
|
-
var ObjectListItemInfoContainer =
|
|
6483
|
+
var ObjectListItemInfoContainer = import_react66.css`
|
|
6467
6484
|
align-items: center;
|
|
6468
6485
|
display: flex;
|
|
6469
6486
|
gap: var(--spacing-sm);
|
|
6470
6487
|
justify-content: center;
|
|
6471
6488
|
`;
|
|
6472
|
-
var ObjectListItemControlledContent =
|
|
6489
|
+
var ObjectListItemControlledContent = import_react66.css`
|
|
6473
6490
|
display: flex;
|
|
6474
6491
|
gap: var(--spacing-sm);
|
|
6475
6492
|
`;
|
|
6476
|
-
var ObjectListItemUnControlledContent =
|
|
6493
|
+
var ObjectListItemUnControlledContent = import_react66.css`
|
|
6477
6494
|
margin-top: var(--spacing-sm);
|
|
6478
6495
|
grid-column: 1 / -1;
|
|
6479
6496
|
`;
|
|
6480
6497
|
|
|
6481
6498
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6482
|
-
var
|
|
6499
|
+
var import_jsx_runtime60 = require("@emotion/react/jsx-runtime");
|
|
6483
6500
|
var ObjectSearchListItem = ({
|
|
6484
6501
|
id,
|
|
6485
6502
|
title,
|
|
@@ -6504,14 +6521,14 @@ var ObjectSearchListItem = ({
|
|
|
6504
6521
|
return onSelectItem([selectedItem]);
|
|
6505
6522
|
};
|
|
6506
6523
|
const selected = selectedListItems.some((item) => item.id === id);
|
|
6507
|
-
return /* @__PURE__ */ (0,
|
|
6524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
6508
6525
|
"div",
|
|
6509
6526
|
{
|
|
6510
6527
|
role: "listitem",
|
|
6511
6528
|
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6512
6529
|
"data-testid": "list-item",
|
|
6513
6530
|
children: [
|
|
6514
|
-
/* @__PURE__ */ (0,
|
|
6531
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
6515
6532
|
"div",
|
|
6516
6533
|
{
|
|
6517
6534
|
role: "button",
|
|
@@ -6519,30 +6536,30 @@ var ObjectSearchListItem = ({
|
|
|
6519
6536
|
css: ObjectListItemControlledContent,
|
|
6520
6537
|
"aria-disabled": disabled,
|
|
6521
6538
|
children: [
|
|
6522
|
-
!imageUrl ? null : /* @__PURE__ */ (0,
|
|
6523
|
-
!image || imageUrl ? null : /* @__PURE__ */ (0,
|
|
6524
|
-
/* @__PURE__ */ (0,
|
|
6525
|
-
!contentType ? null : /* @__PURE__ */ (0,
|
|
6526
|
-
/* @__PURE__ */ (0,
|
|
6539
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6540
|
+
!image || imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6542
|
+
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6543
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6527
6544
|
] })
|
|
6528
6545
|
]
|
|
6529
6546
|
}
|
|
6530
6547
|
),
|
|
6531
|
-
/* @__PURE__ */ (0,
|
|
6532
|
-
selected ? /* @__PURE__ */ (0,
|
|
6533
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
6548
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
6549
|
+
selected ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system34.Chip, { text: "selected", size: "xs" }) : null,
|
|
6550
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system34.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6534
6551
|
] }),
|
|
6535
|
-
!children ? null : /* @__PURE__ */ (0,
|
|
6552
|
+
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6536
6553
|
]
|
|
6537
6554
|
}
|
|
6538
6555
|
);
|
|
6539
6556
|
};
|
|
6540
6557
|
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6541
|
-
return /* @__PURE__ */ (0,
|
|
6558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6542
6559
|
};
|
|
6543
6560
|
|
|
6544
6561
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6545
|
-
var
|
|
6562
|
+
var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
|
|
6546
6563
|
var ObjectSearchContainer = ({
|
|
6547
6564
|
label,
|
|
6548
6565
|
enableDynamicInputToResultId,
|
|
@@ -6554,20 +6571,20 @@ var ObjectSearchContainer = ({
|
|
|
6554
6571
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6555
6572
|
const { flatVariables } = useVariables(true);
|
|
6556
6573
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6557
|
-
const listItems = resultList != null ? resultList : /* @__PURE__ */ (0,
|
|
6574
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6558
6575
|
import_design_system35.ScrollableList,
|
|
6559
6576
|
{
|
|
6560
6577
|
role: "list",
|
|
6561
|
-
css:
|
|
6578
|
+
css: import_react67.css`
|
|
6562
6579
|
> div {
|
|
6563
6580
|
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6564
6581
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6565
6582
|
}
|
|
6566
6583
|
`,
|
|
6567
|
-
children: /* @__PURE__ */ (0,
|
|
6584
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DefaultResultList, {})
|
|
6568
6585
|
}
|
|
6569
6586
|
);
|
|
6570
|
-
const body = /* @__PURE__ */ (0,
|
|
6587
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6571
6588
|
searchFilters,
|
|
6572
6589
|
listItems
|
|
6573
6590
|
] });
|
|
@@ -6598,8 +6615,8 @@ var ObjectSearchContainer = ({
|
|
|
6598
6615
|
}
|
|
6599
6616
|
]);
|
|
6600
6617
|
};
|
|
6601
|
-
return /* @__PURE__ */ (0,
|
|
6602
|
-
/* @__PURE__ */ (0,
|
|
6618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6603
6620
|
InputVariables,
|
|
6604
6621
|
{
|
|
6605
6622
|
label,
|
|
@@ -6621,21 +6638,21 @@ var DefaultResultList = () => {
|
|
|
6621
6638
|
var _a;
|
|
6622
6639
|
const { list } = useObjectSearchContext();
|
|
6623
6640
|
if (!list.items) {
|
|
6624
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0,
|
|
6641
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6625
6642
|
}
|
|
6626
6643
|
if (list.items.length === 0) {
|
|
6627
|
-
return /* @__PURE__ */ (0,
|
|
6644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Callout, { type: "info", children: "No results were found" });
|
|
6628
6645
|
}
|
|
6629
|
-
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0,
|
|
6646
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItem, { ...item }, item.id));
|
|
6630
6647
|
};
|
|
6631
6648
|
|
|
6632
6649
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6633
6650
|
var import_design_system36 = require("@uniformdev/design-system");
|
|
6634
|
-
var
|
|
6651
|
+
var import_react69 = require("react");
|
|
6635
6652
|
|
|
6636
6653
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6637
|
-
var
|
|
6638
|
-
var ObjectSearchFilterContainerLabel =
|
|
6654
|
+
var import_react68 = require("@emotion/react");
|
|
6655
|
+
var ObjectSearchFilterContainerLabel = import_react68.css`
|
|
6639
6656
|
align-items: center;
|
|
6640
6657
|
display: flex;
|
|
6641
6658
|
font-size: var(--fs-sm);
|
|
@@ -6643,18 +6660,18 @@ var ObjectSearchFilterContainerLabel = import_react67.css`
|
|
|
6643
6660
|
line-height: 1rem;
|
|
6644
6661
|
margin-bottom: var(--spacing-sm);
|
|
6645
6662
|
`;
|
|
6646
|
-
var ObjectSearchFilterContainer =
|
|
6663
|
+
var ObjectSearchFilterContainer = import_react68.css`
|
|
6647
6664
|
display: grid;
|
|
6648
6665
|
gap: var(--spacing-base);
|
|
6649
6666
|
`;
|
|
6650
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6667
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react68.css`
|
|
6651
6668
|
display: grid;
|
|
6652
6669
|
grid-template-columns: ${gridColumns};
|
|
6653
6670
|
gap: var(--spacing-base);
|
|
6654
6671
|
`;
|
|
6655
6672
|
|
|
6656
6673
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6657
|
-
var
|
|
6674
|
+
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6658
6675
|
var ObjectSearchFilter = ({
|
|
6659
6676
|
requireContentType,
|
|
6660
6677
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6665,7 +6682,7 @@ var ObjectSearchFilter = ({
|
|
|
6665
6682
|
}) => {
|
|
6666
6683
|
var _a, _b;
|
|
6667
6684
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6668
|
-
const [searchState, setSearchState] = (0,
|
|
6685
|
+
const [searchState, setSearchState] = (0, import_react69.useState)({
|
|
6669
6686
|
contentType: (_a = query.contentType) != null ? _a : "",
|
|
6670
6687
|
keyword: (_b = query.keyword) != null ? _b : ""
|
|
6671
6688
|
});
|
|
@@ -6675,7 +6692,7 @@ var ObjectSearchFilter = ({
|
|
|
6675
6692
|
});
|
|
6676
6693
|
onSetQuery({ ...query, ...value });
|
|
6677
6694
|
};
|
|
6678
|
-
const memoizedSelectOptions = (0,
|
|
6695
|
+
const memoizedSelectOptions = (0, import_react69.useMemo)(() => {
|
|
6679
6696
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6680
6697
|
return [];
|
|
6681
6698
|
}
|
|
@@ -6685,7 +6702,7 @@ var ObjectSearchFilter = ({
|
|
|
6685
6702
|
];
|
|
6686
6703
|
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6687
6704
|
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6688
|
-
return /* @__PURE__ */ (0,
|
|
6705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6689
6706
|
"fieldset",
|
|
6690
6707
|
{
|
|
6691
6708
|
css: [
|
|
@@ -6693,7 +6710,7 @@ var ObjectSearchFilter = ({
|
|
|
6693
6710
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6694
6711
|
],
|
|
6695
6712
|
children: [
|
|
6696
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ (0,
|
|
6713
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6697
6714
|
import_design_system36.InputSelect,
|
|
6698
6715
|
{
|
|
6699
6716
|
label: selectLabel,
|
|
@@ -6703,7 +6720,7 @@ var ObjectSearchFilter = ({
|
|
|
6703
6720
|
value: query.contentType
|
|
6704
6721
|
}
|
|
6705
6722
|
) : null,
|
|
6706
|
-
/* @__PURE__ */ (0,
|
|
6723
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6707
6724
|
import_design_system36.InputKeywordSearch,
|
|
6708
6725
|
{
|
|
6709
6726
|
inputFieldName: searchInputName,
|
|
@@ -6720,11 +6737,11 @@ var ObjectSearchFilter = ({
|
|
|
6720
6737
|
};
|
|
6721
6738
|
|
|
6722
6739
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6723
|
-
var
|
|
6740
|
+
var import_jsx_runtime63 = require("@emotion/react/jsx-runtime");
|
|
6724
6741
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6725
|
-
return /* @__PURE__ */ (0,
|
|
6726
|
-
label ? /* @__PURE__ */ (0,
|
|
6727
|
-
/* @__PURE__ */ (0,
|
|
6742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { children: [
|
|
6743
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6744
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6728
6745
|
] });
|
|
6729
6746
|
};
|
|
6730
6747
|
|
|
@@ -6733,9 +6750,9 @@ var import_design_system38 = require("@uniformdev/design-system");
|
|
|
6733
6750
|
var import_timeago3 = require("timeago.js");
|
|
6734
6751
|
|
|
6735
6752
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6736
|
-
var
|
|
6753
|
+
var import_react70 = require("@emotion/react");
|
|
6737
6754
|
var import_design_system37 = require("@uniformdev/design-system");
|
|
6738
|
-
var ButtonStyles =
|
|
6755
|
+
var ButtonStyles = import_react70.css`
|
|
6739
6756
|
${import_design_system37.button}
|
|
6740
6757
|
background: transparent;
|
|
6741
6758
|
border: 1px solid var(--typography-base);
|
|
@@ -6762,20 +6779,20 @@ var ButtonStyles = import_react69.css`
|
|
|
6762
6779
|
text-decoration: none;
|
|
6763
6780
|
}
|
|
6764
6781
|
`;
|
|
6765
|
-
var ButtonIcon =
|
|
6782
|
+
var ButtonIcon = import_react70.css`
|
|
6766
6783
|
width: 1rem;
|
|
6767
6784
|
height: 1rem;
|
|
6768
6785
|
`;
|
|
6769
6786
|
|
|
6770
6787
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6771
|
-
var
|
|
6788
|
+
var import_jsx_runtime64 = require("@emotion/react/jsx-runtime");
|
|
6772
6789
|
var ObjectSearchResultItemButton = ({
|
|
6773
6790
|
text,
|
|
6774
6791
|
icon,
|
|
6775
6792
|
...props
|
|
6776
6793
|
}) => {
|
|
6777
|
-
return /* @__PURE__ */ (0,
|
|
6778
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
6795
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6779
6796
|
text
|
|
6780
6797
|
] });
|
|
6781
6798
|
};
|
|
@@ -6784,15 +6801,15 @@ var LinkButton = ({
|
|
|
6784
6801
|
icon,
|
|
6785
6802
|
...props
|
|
6786
6803
|
}) => {
|
|
6787
|
-
return /* @__PURE__ */ (0,
|
|
6788
|
-
!icon ? null : /* @__PURE__ */ (0,
|
|
6804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6805
|
+
!icon ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Image, { src: icon, css: ButtonIcon }),
|
|
6789
6806
|
text
|
|
6790
6807
|
] });
|
|
6791
6808
|
};
|
|
6792
6809
|
|
|
6793
6810
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6794
|
-
var
|
|
6795
|
-
var ObjectSearchResultItemContainer =
|
|
6811
|
+
var import_react71 = require("@emotion/react");
|
|
6812
|
+
var ObjectSearchResultItemContainer = import_react71.css`
|
|
6796
6813
|
align-items: center;
|
|
6797
6814
|
border: 1px solid var(--gray-300);
|
|
6798
6815
|
border-radius: var(--rounded-base);
|
|
@@ -6808,7 +6825,7 @@ var ObjectSearchResultItemContainer = import_react70.css`
|
|
|
6808
6825
|
}
|
|
6809
6826
|
}
|
|
6810
6827
|
`;
|
|
6811
|
-
var ObjectSearchDragHandle =
|
|
6828
|
+
var ObjectSearchDragHandle = import_react71.css`
|
|
6812
6829
|
border-left: 2px dotted var(--gray-300);
|
|
6813
6830
|
border-right: 2px dotted var(--gray-300);
|
|
6814
6831
|
position: absolute;
|
|
@@ -6817,41 +6834,41 @@ var ObjectSearchDragHandle = import_react70.css`
|
|
|
6817
6834
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6818
6835
|
opacity: 0;
|
|
6819
6836
|
`;
|
|
6820
|
-
var ObjectSearchResultItemSubtitle =
|
|
6837
|
+
var ObjectSearchResultItemSubtitle = import_react71.css`
|
|
6821
6838
|
color: var(--gray-500);
|
|
6822
6839
|
display: block;
|
|
6823
6840
|
font-size: var(--fs-xs);
|
|
6824
6841
|
line-height: 1;
|
|
6825
6842
|
`;
|
|
6826
|
-
var ObjectSearchResultItemTitle =
|
|
6843
|
+
var ObjectSearchResultItemTitle = import_react71.css`
|
|
6827
6844
|
align-items: center;
|
|
6828
6845
|
color: var(--typography-base);
|
|
6829
6846
|
display: flex;
|
|
6830
6847
|
gap: var(--spacing-xs);
|
|
6831
6848
|
`;
|
|
6832
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6849
|
+
var ObjectSearchResultItemTimeStamp = import_react71.css`
|
|
6833
6850
|
color: var(--gray-500);
|
|
6834
6851
|
font-size: var(--fs-xs);
|
|
6835
6852
|
`;
|
|
6836
|
-
var ObjectSearchAuthorStateGroup =
|
|
6853
|
+
var ObjectSearchAuthorStateGroup = import_react71.css`
|
|
6837
6854
|
align-items: center;
|
|
6838
6855
|
display: flex;
|
|
6839
6856
|
gap: var(--spacing-sm);
|
|
6840
6857
|
`;
|
|
6841
|
-
var ObjectSearchUpdateGroup =
|
|
6858
|
+
var ObjectSearchUpdateGroup = import_react71.css`
|
|
6842
6859
|
display: grid;
|
|
6843
6860
|
`;
|
|
6844
|
-
var ObjectSearchContentContainer =
|
|
6861
|
+
var ObjectSearchContentContainer = import_react71.css`
|
|
6845
6862
|
display: flex;
|
|
6846
6863
|
gap: var(--spacing-base);
|
|
6847
6864
|
`;
|
|
6848
|
-
var ObjectSearchImage =
|
|
6865
|
+
var ObjectSearchImage = import_react71.css`
|
|
6849
6866
|
width: 56px;
|
|
6850
6867
|
object-fit: contain;
|
|
6851
6868
|
`;
|
|
6852
6869
|
|
|
6853
6870
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6854
|
-
var
|
|
6871
|
+
var import_jsx_runtime65 = require("@emotion/react/jsx-runtime");
|
|
6855
6872
|
var ObjectSearchResultItem = ({
|
|
6856
6873
|
id,
|
|
6857
6874
|
title,
|
|
@@ -6875,79 +6892,80 @@ var ObjectSearchResultItem = ({
|
|
|
6875
6892
|
onSelectItem({ id, title: id });
|
|
6876
6893
|
onRemove == null ? void 0 : onRemove();
|
|
6877
6894
|
};
|
|
6878
|
-
return /* @__PURE__ */ (0,
|
|
6879
|
-
disableDnD ? null : /* @__PURE__ */ (0,
|
|
6880
|
-
/* @__PURE__ */ (0,
|
|
6881
|
-
!imageUrl ? null : /* @__PURE__ */ (0,
|
|
6882
|
-
/* @__PURE__ */ (0,
|
|
6883
|
-
/* @__PURE__ */ (0,
|
|
6884
|
-
/* @__PURE__ */ (0,
|
|
6895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
|
|
6896
|
+
disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
6897
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchContentContainer, children: [
|
|
6898
|
+
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
6899
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { children: [
|
|
6900
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
6901
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
6885
6902
|
title != null ? title : name,
|
|
6886
|
-
!popoverData ? null : /* @__PURE__ */ (0,
|
|
6903
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6887
6904
|
] }),
|
|
6888
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0,
|
|
6889
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0,
|
|
6890
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0,
|
|
6891
|
-
!createdAt ? null : /* @__PURE__ */ (0,
|
|
6892
|
-
/* @__PURE__ */ (0,
|
|
6905
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6906
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
6907
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
|
|
6908
|
+
!createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6909
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("strong", { children: "Last updated: " }),
|
|
6893
6910
|
(0, import_timeago3.format)(createdAt)
|
|
6894
6911
|
] }),
|
|
6895
|
-
!publishedAt ? null : /* @__PURE__ */ (0,
|
|
6896
|
-
/* @__PURE__ */ (0,
|
|
6912
|
+
!publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6913
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("strong", { children: "Last published: " }),
|
|
6897
6914
|
(0, import_timeago3.format)(publishedAt)
|
|
6898
6915
|
] })
|
|
6899
6916
|
] })
|
|
6900
6917
|
] }),
|
|
6901
|
-
/* @__PURE__ */ (0,
|
|
6918
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children })
|
|
6902
6919
|
] })
|
|
6903
6920
|
] }) }),
|
|
6904
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6905
|
-
!editLink ? null : /* @__PURE__ */ (0,
|
|
6906
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6921
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6922
|
+
!editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
6923
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
6907
6924
|
] })
|
|
6908
6925
|
] });
|
|
6909
6926
|
};
|
|
6910
6927
|
|
|
6911
6928
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6912
6929
|
var import_design_system39 = require("@uniformdev/design-system");
|
|
6913
|
-
var
|
|
6930
|
+
var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
|
|
6914
6931
|
|
|
6915
6932
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6916
|
-
var
|
|
6917
|
-
var ObjectSearchResultListContainer =
|
|
6933
|
+
var import_react72 = require("@emotion/react");
|
|
6934
|
+
var ObjectSearchResultListContainer = import_react72.css`
|
|
6918
6935
|
align-items: center;
|
|
6919
6936
|
display: flex;
|
|
6920
6937
|
gap: var(--spacing-sm);
|
|
6921
6938
|
justify-content: space-between;
|
|
6922
6939
|
`;
|
|
6923
|
-
var ObjectSearchDragContainer =
|
|
6940
|
+
var ObjectSearchDragContainer = import_react72.css`
|
|
6924
6941
|
margin: 0 0 var(--spacing-sm);
|
|
6925
6942
|
`;
|
|
6926
|
-
var ObjectSearchContainerDragging =
|
|
6943
|
+
var ObjectSearchContainerDragging = import_react72.css`
|
|
6927
6944
|
box-shadow: var(--shadow-base);
|
|
6928
6945
|
opacity: var(--opacity-50);
|
|
6929
6946
|
`;
|
|
6930
|
-
var ObjectSearchResultListCounterContainer =
|
|
6947
|
+
var ObjectSearchResultListCounterContainer = import_react72.css`
|
|
6931
6948
|
align-items: center;
|
|
6932
6949
|
display: flex;
|
|
6933
6950
|
gap: var(--spacing-sm);
|
|
6934
6951
|
`;
|
|
6935
|
-
var ObjectSearchResultListTitle =
|
|
6952
|
+
var ObjectSearchResultListTitle = import_react72.css`
|
|
6936
6953
|
font-weight: var(--fw-bold);
|
|
6937
6954
|
line-height: 1;
|
|
6938
6955
|
`;
|
|
6939
6956
|
|
|
6940
6957
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6941
|
-
var
|
|
6958
|
+
var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
|
|
6942
6959
|
function ObjectSearchResultList({
|
|
6943
6960
|
resultLabelText = "Selected",
|
|
6944
6961
|
removeButtonText = "Remove all",
|
|
6945
6962
|
onRemoveAllSelected,
|
|
6946
6963
|
hideRemoveButton = false,
|
|
6947
6964
|
additionalButtons,
|
|
6948
|
-
renderResultComponent = (value) => /* @__PURE__ */ (0,
|
|
6965
|
+
renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ObjectSearchResultItem, { ...value }),
|
|
6949
6966
|
multiSelectId,
|
|
6950
6967
|
disableDnD = false,
|
|
6968
|
+
getContainerForDnDReparenting,
|
|
6951
6969
|
whenNothingSelected = null
|
|
6952
6970
|
}) {
|
|
6953
6971
|
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useObjectSearchContext();
|
|
@@ -6965,16 +6983,37 @@ function ObjectSearchResultList({
|
|
|
6965
6983
|
return result;
|
|
6966
6984
|
}
|
|
6967
6985
|
};
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6986
|
+
const getDraggableItem = (provided, snapshot, rubric) => {
|
|
6987
|
+
const item = selectedListItems.find((i) => i.id === rubric.draggableId);
|
|
6988
|
+
const renderListItem = renderResultComponent({
|
|
6989
|
+
...item,
|
|
6990
|
+
disableDnD: selectedListItems.length === 1 || disableDnD
|
|
6991
|
+
});
|
|
6992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6993
|
+
"div",
|
|
6994
|
+
{
|
|
6995
|
+
css: [
|
|
6996
|
+
ObjectSearchDragContainer,
|
|
6997
|
+
snapshot.isDragging ? ObjectSearchContainerDragging : void 0
|
|
6998
|
+
],
|
|
6999
|
+
ref: provided.innerRef,
|
|
7000
|
+
"data-dragging": snapshot.isDragging,
|
|
7001
|
+
...provided.draggableProps,
|
|
7002
|
+
...provided.dragHandleProps,
|
|
7003
|
+
children: renderListItem
|
|
7004
|
+
}
|
|
7005
|
+
);
|
|
7006
|
+
};
|
|
7007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
7008
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
7009
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
7010
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
6972
7011
|
" ",
|
|
6973
|
-
!selectedListItems.length ? null : /* @__PURE__ */ (0,
|
|
7012
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_design_system39.Counter, { count: selectedListItems.length })
|
|
6974
7013
|
] }),
|
|
6975
|
-
/* @__PURE__ */ (0,
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
6976
7015
|
additionalButtons,
|
|
6977
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
7016
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6978
7017
|
import_design_system39.Button,
|
|
6979
7018
|
{
|
|
6980
7019
|
buttonType: "ghostDestructive",
|
|
@@ -6986,43 +7025,36 @@ function ObjectSearchResultList({
|
|
|
6986
7025
|
)
|
|
6987
7026
|
] })
|
|
6988
7027
|
] }),
|
|
6989
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0,
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7000
|
-
"div",
|
|
7028
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7029
|
+
import_react_beautiful_dnd4.Droppable,
|
|
7030
|
+
{
|
|
7031
|
+
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
7032
|
+
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
7033
|
+
getContainerForClone: getContainerForDnDReparenting,
|
|
7034
|
+
children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
7035
|
+
selectedListItems.map((item, i) => {
|
|
7036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7037
|
+
import_react_beautiful_dnd4.Draggable,
|
|
7001
7038
|
{
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
item.id
|
|
7015
|
-
);
|
|
7016
|
-
}),
|
|
7017
|
-
provided.placeholder
|
|
7018
|
-
] }) }) })
|
|
7039
|
+
draggableId: item.id,
|
|
7040
|
+
index: i,
|
|
7041
|
+
isDragDisabled: selectedListItems.length === 1 || disableDnD,
|
|
7042
|
+
children: getDraggableItem
|
|
7043
|
+
},
|
|
7044
|
+
item.id
|
|
7045
|
+
);
|
|
7046
|
+
}),
|
|
7047
|
+
provided.placeholder
|
|
7048
|
+
] })
|
|
7049
|
+
}
|
|
7050
|
+
) })
|
|
7019
7051
|
] });
|
|
7020
7052
|
}
|
|
7021
7053
|
|
|
7022
7054
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7023
7055
|
var import_design_system40 = require("@uniformdev/design-system");
|
|
7024
|
-
var
|
|
7025
|
-
var
|
|
7056
|
+
var import_react73 = require("react");
|
|
7057
|
+
var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
|
|
7026
7058
|
var QueryFilter = ({
|
|
7027
7059
|
requireContentType,
|
|
7028
7060
|
queryFilterTitle = "Configure Query",
|
|
@@ -7053,7 +7085,7 @@ var QueryFilter = ({
|
|
|
7053
7085
|
}) => {
|
|
7054
7086
|
var _a, _b, _c, _d, _e, _f;
|
|
7055
7087
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
7056
|
-
const [queryState, setQueryState] = (0,
|
|
7088
|
+
const [queryState, setQueryState] = (0, import_react73.useState)({
|
|
7057
7089
|
contentType: (_a = query.contentType) != null ? _a : "",
|
|
7058
7090
|
keyword: (_b = query.contentType) != null ? _b : "",
|
|
7059
7091
|
count: countValue != null ? countValue : 5,
|
|
@@ -7064,13 +7096,13 @@ var QueryFilter = ({
|
|
|
7064
7096
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7065
7097
|
onSetQuery({ ...query, ...value });
|
|
7066
7098
|
};
|
|
7067
|
-
(0,
|
|
7099
|
+
(0, import_react73.useEffect)(() => {
|
|
7068
7100
|
onSetQuery(queryState);
|
|
7069
7101
|
}, [onSetQuery, queryState]);
|
|
7070
|
-
return /* @__PURE__ */ (0,
|
|
7071
|
-
/* @__PURE__ */ (0,
|
|
7072
|
-
/* @__PURE__ */ (0,
|
|
7073
|
-
/* @__PURE__ */ (0,
|
|
7102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("fieldset", { children: [
|
|
7103
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
7104
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_design_system40.VerticalRhythm, { children: [
|
|
7105
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7074
7106
|
InputVariables,
|
|
7075
7107
|
{
|
|
7076
7108
|
label: searchInputLabel,
|
|
@@ -7078,7 +7110,7 @@ var QueryFilter = ({
|
|
|
7078
7110
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
7079
7111
|
disableInlineMenu: true,
|
|
7080
7112
|
id: "qf_searchText",
|
|
7081
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7113
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7082
7114
|
import_design_system40.InputKeywordSearch,
|
|
7083
7115
|
{
|
|
7084
7116
|
id: "qf_searchText",
|
|
@@ -7092,8 +7124,8 @@ var QueryFilter = ({
|
|
|
7092
7124
|
)
|
|
7093
7125
|
}
|
|
7094
7126
|
),
|
|
7095
|
-
/* @__PURE__ */ (0,
|
|
7096
|
-
/* @__PURE__ */ (0,
|
|
7127
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
7128
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7097
7129
|
InputVariables,
|
|
7098
7130
|
{
|
|
7099
7131
|
label: contentTypeLabel,
|
|
@@ -7101,7 +7133,7 @@ var QueryFilter = ({
|
|
|
7101
7133
|
value: (_f = queryState.contentType) != null ? _f : "",
|
|
7102
7134
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
7103
7135
|
disableInlineMenu: true,
|
|
7104
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7136
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7105
7137
|
import_design_system40.InputSelect,
|
|
7106
7138
|
{
|
|
7107
7139
|
id: "qf_contentType",
|
|
@@ -7120,7 +7152,7 @@ var QueryFilter = ({
|
|
|
7120
7152
|
)
|
|
7121
7153
|
}
|
|
7122
7154
|
),
|
|
7123
|
-
/* @__PURE__ */ (0,
|
|
7155
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7124
7156
|
InputVariables,
|
|
7125
7157
|
{
|
|
7126
7158
|
label: countLabel,
|
|
@@ -7128,7 +7160,7 @@ var QueryFilter = ({
|
|
|
7128
7160
|
value: queryState.count.toString(10),
|
|
7129
7161
|
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
7130
7162
|
disableInlineMenu: true,
|
|
7131
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7163
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7132
7164
|
import_design_system40.Input,
|
|
7133
7165
|
{
|
|
7134
7166
|
id: "qf_count",
|
|
@@ -7143,8 +7175,8 @@ var QueryFilter = ({
|
|
|
7143
7175
|
}
|
|
7144
7176
|
)
|
|
7145
7177
|
] }),
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7147
|
-
/* @__PURE__ */ (0,
|
|
7178
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
7179
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7148
7180
|
InputVariables,
|
|
7149
7181
|
{
|
|
7150
7182
|
id: "qf_sortBy",
|
|
@@ -7152,7 +7184,7 @@ var QueryFilter = ({
|
|
|
7152
7184
|
value: queryState.sortBy,
|
|
7153
7185
|
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
7154
7186
|
disableInlineMenu: true,
|
|
7155
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7187
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7156
7188
|
import_design_system40.InputSelect,
|
|
7157
7189
|
{
|
|
7158
7190
|
label: sortLabel,
|
|
@@ -7174,7 +7206,7 @@ var QueryFilter = ({
|
|
|
7174
7206
|
)
|
|
7175
7207
|
}
|
|
7176
7208
|
),
|
|
7177
|
-
/* @__PURE__ */ (0,
|
|
7209
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7178
7210
|
InputVariables,
|
|
7179
7211
|
{
|
|
7180
7212
|
label: sortOrderLabel,
|
|
@@ -7182,7 +7214,7 @@ var QueryFilter = ({
|
|
|
7182
7214
|
value: queryState.sortOrder,
|
|
7183
7215
|
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
7184
7216
|
disableInlineMenu: true,
|
|
7185
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7217
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7186
7218
|
import_design_system40.InputSelect,
|
|
7187
7219
|
{
|
|
7188
7220
|
label: sortOrderLabel,
|
|
@@ -7207,8 +7239,8 @@ var QueryFilter = ({
|
|
|
7207
7239
|
};
|
|
7208
7240
|
|
|
7209
7241
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
7210
|
-
var
|
|
7211
|
-
var
|
|
7242
|
+
var import_react74 = require("react");
|
|
7243
|
+
var import_jsx_runtime68 = require("@emotion/react/jsx-runtime");
|
|
7212
7244
|
function ParamTypeDynamicDataProvider(props) {
|
|
7213
7245
|
const { children } = props;
|
|
7214
7246
|
const {
|
|
@@ -7216,11 +7248,11 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
7216
7248
|
} = useMeshLocation("paramType");
|
|
7217
7249
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
7218
7250
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
7219
|
-
const variables = (0,
|
|
7251
|
+
const variables = (0, import_react74.useMemo)(
|
|
7220
7252
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
7221
7253
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
7222
7254
|
);
|
|
7223
|
-
return /* @__PURE__ */ (0,
|
|
7255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(VariablesProvider, { value: variables, onChange: () => {
|
|
7224
7256
|
}, editVariableComponent: JsonMeshVariableEditor, children });
|
|
7225
7257
|
}
|
|
7226
7258
|
var JsonMeshVariableEditor = ({
|
|
@@ -7229,9 +7261,9 @@ var JsonMeshVariableEditor = ({
|
|
|
7229
7261
|
variable,
|
|
7230
7262
|
context
|
|
7231
7263
|
}) => {
|
|
7232
|
-
const sillyRef = (0,
|
|
7264
|
+
const sillyRef = (0, import_react74.useRef)(false);
|
|
7233
7265
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
7234
|
-
(0,
|
|
7266
|
+
(0, import_react74.useEffect)(() => {
|
|
7235
7267
|
if (sillyRef.current) {
|
|
7236
7268
|
return;
|
|
7237
7269
|
}
|
|
@@ -7269,19 +7301,19 @@ function createLocationValidator(setValue, validate) {
|
|
|
7269
7301
|
|
|
7270
7302
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7271
7303
|
var import_canvas10 = require("@uniformdev/canvas");
|
|
7272
|
-
var
|
|
7304
|
+
var import_react75 = require("react");
|
|
7273
7305
|
function useContentDataResourceLocaleInfo({
|
|
7274
7306
|
locale,
|
|
7275
7307
|
setLocale,
|
|
7276
7308
|
dynamicInputs
|
|
7277
7309
|
}) {
|
|
7278
7310
|
var _a;
|
|
7279
|
-
const setLocaleRef = (0,
|
|
7311
|
+
const setLocaleRef = (0, import_react75.useRef)(setLocale);
|
|
7280
7312
|
setLocaleRef.current = setLocale;
|
|
7281
7313
|
const { flatVariables } = useVariables();
|
|
7282
7314
|
const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
|
|
7283
7315
|
const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7284
|
-
(0,
|
|
7316
|
+
(0, import_react75.useEffect)(() => {
|
|
7285
7317
|
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7286
7318
|
setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
|
|
7287
7319
|
}
|