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