@uniformdev/mesh-sdk-react 19.79.1-alpha.11 → 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 +58 -27
- package/dist/index.d.ts +58 -27
- package/dist/index.esm.js +634 -554
- package/dist/index.js +976 -895
- package/dist/index.mjs +634 -554
- 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,16 +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 inputDisabled =
|
|
4285
|
+
var inputDisabled = import_react42.css`
|
|
4265
4286
|
cursor: not-allowed;
|
|
4266
4287
|
opacity: var(--opacity-50);
|
|
4267
4288
|
`;
|
|
4268
|
-
var placeholderCaption =
|
|
4289
|
+
var placeholderCaption = import_react42.css`
|
|
4269
4290
|
position: absolute;
|
|
4270
4291
|
color: var(--gray-400);
|
|
4271
4292
|
inset: var(--spacing-base) var(--spacing-lg) var(--spacing-base) var(--spacing-base);
|
|
@@ -4274,19 +4295,19 @@ var placeholderCaption = import_react41.css`
|
|
|
4274
4295
|
white-space: nowrap;
|
|
4275
4296
|
pointer-events: none;
|
|
4276
4297
|
`;
|
|
4277
|
-
var placeholderCompact =
|
|
4298
|
+
var placeholderCompact = import_react42.css`
|
|
4278
4299
|
inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
4279
4300
|
`;
|
|
4280
4301
|
|
|
4281
4302
|
// src/components/Variables/toolbox/InputVariablesProvider.tsx
|
|
4282
4303
|
var React10 = __toESM(require("react"));
|
|
4283
|
-
var
|
|
4304
|
+
var import_react43 = require("react");
|
|
4284
4305
|
|
|
4285
4306
|
// src/components/Variables/util/hasReferencedVariables.ts
|
|
4286
|
-
var
|
|
4307
|
+
var import_canvas5 = require("@uniformdev/canvas");
|
|
4287
4308
|
function hasReferencedVariables(value) {
|
|
4288
4309
|
let result = false;
|
|
4289
|
-
(0,
|
|
4310
|
+
(0, import_canvas5.parseVariableExpression)(value, (token, type) => {
|
|
4290
4311
|
if (type === "variable") {
|
|
4291
4312
|
result = true;
|
|
4292
4313
|
return false;
|
|
@@ -4325,7 +4346,7 @@ function useInputVariablesState({
|
|
|
4325
4346
|
const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
|
|
4326
4347
|
const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
|
|
4327
4348
|
const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
|
|
4328
|
-
const sharedMenuProps = (0,
|
|
4349
|
+
const sharedMenuProps = (0, import_react43.useMemo)(
|
|
4329
4350
|
() => ({
|
|
4330
4351
|
menuTooltip,
|
|
4331
4352
|
showAddVariableMenuOption,
|
|
@@ -4356,15 +4377,15 @@ function useInputVariablesState({
|
|
|
4356
4377
|
}
|
|
4357
4378
|
|
|
4358
4379
|
// src/components/Variables/toolbox/VariableField.styles.ts
|
|
4359
|
-
var
|
|
4360
|
-
var labelText =
|
|
4380
|
+
var import_react44 = require("@emotion/react");
|
|
4381
|
+
var labelText = import_react44.css`
|
|
4361
4382
|
align-items: center;
|
|
4362
4383
|
display: flex;
|
|
4363
4384
|
gap: var(--spacing-xs);
|
|
4364
4385
|
font-weight: var(--fw-regular);
|
|
4365
4386
|
margin: 0 0 var(--spacing-xs);
|
|
4366
4387
|
`;
|
|
4367
|
-
var variableBindButton =
|
|
4388
|
+
var variableBindButton = import_react44.css`
|
|
4368
4389
|
align-items: center;
|
|
4369
4390
|
border: none;
|
|
4370
4391
|
border-radius: var(--rounded-base);
|
|
@@ -4396,8 +4417,8 @@ var import_lexical6 = require("lexical");
|
|
|
4396
4417
|
var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
|
|
4397
4418
|
var import_CgUsbC = require("@react-icons/all-files/cg/CgUsbC");
|
|
4398
4419
|
var import_design_system19 = require("@uniformdev/design-system");
|
|
4399
|
-
var
|
|
4400
|
-
var
|
|
4420
|
+
var import_react45 = require("react");
|
|
4421
|
+
var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
|
|
4401
4422
|
function SelectVariableMenu({
|
|
4402
4423
|
onSelectVariable,
|
|
4403
4424
|
onResetVariables,
|
|
@@ -4410,7 +4431,7 @@ function SelectVariableMenu({
|
|
|
4410
4431
|
filterVariable
|
|
4411
4432
|
}) {
|
|
4412
4433
|
const { variables, canDispatch, readOnly } = useVariables(true);
|
|
4413
|
-
const btnRef = (0,
|
|
4434
|
+
const btnRef = (0, import_react45.useRef)(null);
|
|
4414
4435
|
const { editVariable } = useVariableEditor();
|
|
4415
4436
|
const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
|
|
4416
4437
|
const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
|
|
@@ -4418,12 +4439,12 @@ function SelectVariableMenu({
|
|
|
4418
4439
|
if (!showAddVariableMenuOptionForReals && !menuHasVariableOptions) {
|
|
4419
4440
|
return null;
|
|
4420
4441
|
}
|
|
4421
|
-
return /* @__PURE__ */ (0,
|
|
4442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4422
4443
|
import_design_system19.Menu,
|
|
4423
4444
|
{
|
|
4424
4445
|
placement: "bottom-start",
|
|
4425
4446
|
withoutPortal: true,
|
|
4426
|
-
menuTrigger: /* @__PURE__ */ (0,
|
|
4447
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4427
4448
|
"button",
|
|
4428
4449
|
{
|
|
4429
4450
|
...buttonProps,
|
|
@@ -4432,12 +4453,12 @@ function SelectVariableMenu({
|
|
|
4432
4453
|
css: [menuBtn, buttonCss],
|
|
4433
4454
|
type: "button",
|
|
4434
4455
|
"data-testid": "insert-variable",
|
|
4435
|
-
children: /* @__PURE__ */ (0,
|
|
4456
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_CgUsbC.CgUsbC, { size: "1.4rem" })
|
|
4436
4457
|
}
|
|
4437
4458
|
),
|
|
4438
4459
|
menuLabel: menuTooltip,
|
|
4439
4460
|
children: [
|
|
4440
|
-
showAddVariableMenuOptionForReals ? /* @__PURE__ */ (0,
|
|
4461
|
+
showAddVariableMenuOptionForReals ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4441
4462
|
import_design_system19.MenuItem,
|
|
4442
4463
|
{
|
|
4443
4464
|
onClick: async () => {
|
|
@@ -4448,43 +4469,43 @@ function SelectVariableMenu({
|
|
|
4448
4469
|
onSelectVariable == null ? void 0 : onSelectVariable(result.selectedVariable);
|
|
4449
4470
|
},
|
|
4450
4471
|
"data-testid": "add-variable-button",
|
|
4451
|
-
children: /* @__PURE__ */ (0,
|
|
4452
|
-
/* @__PURE__ */ (0,
|
|
4453
|
-
/* @__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" }) })
|
|
4454
4475
|
] })
|
|
4455
4476
|
}
|
|
4456
4477
|
) : null,
|
|
4457
|
-
showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0,
|
|
4478
|
+
showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItemSeparator, {}) : null,
|
|
4458
4479
|
variablesGroups.map((group) => {
|
|
4459
4480
|
var _a;
|
|
4460
|
-
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) => {
|
|
4461
4482
|
const { name, displayName, helpText } = variable;
|
|
4462
|
-
return /* @__PURE__ */ (0,
|
|
4483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
4463
4484
|
import_design_system19.MenuItem,
|
|
4464
4485
|
{
|
|
4465
4486
|
id: name,
|
|
4466
4487
|
css: menuItemTextGroup,
|
|
4467
4488
|
onClick: () => onSelectVariable == null ? void 0 : onSelectVariable(variable),
|
|
4468
4489
|
children: [
|
|
4469
|
-
/* @__PURE__ */ (0,
|
|
4470
|
-
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
|
|
4471
4492
|
]
|
|
4472
4493
|
},
|
|
4473
4494
|
name
|
|
4474
4495
|
);
|
|
4475
4496
|
}) }, group.name);
|
|
4476
4497
|
}),
|
|
4477
|
-
menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0,
|
|
4478
|
-
onResetVariables ? /* @__PURE__ */ (0,
|
|
4479
|
-
tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0,
|
|
4480
|
-
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
|
|
4481
4502
|
]
|
|
4482
4503
|
}
|
|
4483
4504
|
);
|
|
4484
4505
|
}
|
|
4485
4506
|
|
|
4486
4507
|
// src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
|
|
4487
|
-
var
|
|
4508
|
+
var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
|
|
4488
4509
|
function VariablesComposerVariableMenu(props) {
|
|
4489
4510
|
const [editor] = (0, import_LexicalComposerContext6.useLexicalComposerContext)();
|
|
4490
4511
|
const onSelectVariable = (selectedVariable) => {
|
|
@@ -4500,7 +4521,7 @@ function VariablesComposerVariableMenu(props) {
|
|
|
4500
4521
|
editor.dispatchCommand(import_lexical6.CLEAR_EDITOR_COMMAND, void 0);
|
|
4501
4522
|
(_a = props.onResetVariables) == null ? void 0 : _a.call(props);
|
|
4502
4523
|
};
|
|
4503
|
-
return /* @__PURE__ */ (0,
|
|
4524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4504
4525
|
SelectVariableMenu,
|
|
4505
4526
|
{
|
|
4506
4527
|
...props,
|
|
@@ -4511,7 +4532,7 @@ function VariablesComposerVariableMenu(props) {
|
|
|
4511
4532
|
}
|
|
4512
4533
|
|
|
4513
4534
|
// src/components/Variables/toolbox/VariableField.tsx
|
|
4514
|
-
var
|
|
4535
|
+
var import_jsx_runtime37 = require("@emotion/react/jsx-runtime");
|
|
4515
4536
|
function VariableField({
|
|
4516
4537
|
label,
|
|
4517
4538
|
selectVariableMenuOptions,
|
|
@@ -4522,7 +4543,7 @@ function VariableField({
|
|
|
4522
4543
|
}) {
|
|
4523
4544
|
const { variables } = useVariables(true);
|
|
4524
4545
|
const varCount = Object.keys(variables).length;
|
|
4525
|
-
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)(
|
|
4526
4547
|
VariablesComposerVariableMenu,
|
|
4527
4548
|
{
|
|
4528
4549
|
...selectVariableMenuOptions,
|
|
@@ -4530,10 +4551,10 @@ function VariableField({
|
|
|
4530
4551
|
buttonProps: isActive ? { "aria-pressed": "true" } : void 0
|
|
4531
4552
|
}
|
|
4532
4553
|
) : null;
|
|
4533
|
-
return /* @__PURE__ */ (0,
|
|
4534
|
-
/* @__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: [
|
|
4535
4556
|
variableSelector,
|
|
4536
|
-
/* @__PURE__ */ (0,
|
|
4557
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { children: label })
|
|
4537
4558
|
] }),
|
|
4538
4559
|
children
|
|
4539
4560
|
] });
|
|
@@ -4544,14 +4565,14 @@ var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlug
|
|
|
4544
4565
|
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
4545
4566
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
4546
4567
|
var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
|
|
4547
|
-
var
|
|
4568
|
+
var import_react48 = require("react");
|
|
4548
4569
|
|
|
4549
4570
|
// src/components/Variables/composer/DisablePlugin.tsx
|
|
4550
4571
|
var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
|
|
4551
|
-
var
|
|
4572
|
+
var import_react46 = require("react");
|
|
4552
4573
|
function DisablePlugin({ disabled }) {
|
|
4553
4574
|
const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
|
|
4554
|
-
(0,
|
|
4575
|
+
(0, import_react46.useEffect)(() => {
|
|
4555
4576
|
editor.setEditable(!disabled);
|
|
4556
4577
|
}, [editor, disabled]);
|
|
4557
4578
|
return null;
|
|
@@ -4560,10 +4581,10 @@ function DisablePlugin({ disabled }) {
|
|
|
4560
4581
|
// src/components/Variables/composer/SingleLineTextPlugin.tsx
|
|
4561
4582
|
var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
|
|
4562
4583
|
var import_lexical7 = require("lexical");
|
|
4563
|
-
var
|
|
4584
|
+
var import_react47 = require("react");
|
|
4564
4585
|
function SingleLineTextPlugin() {
|
|
4565
4586
|
const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
|
|
4566
|
-
(0,
|
|
4587
|
+
(0, import_react47.useEffect)(() => {
|
|
4567
4588
|
editor.registerNodeTransform(import_lexical7.LineBreakNode, (node) => {
|
|
4568
4589
|
node.remove();
|
|
4569
4590
|
});
|
|
@@ -4572,7 +4593,7 @@ function SingleLineTextPlugin() {
|
|
|
4572
4593
|
}
|
|
4573
4594
|
|
|
4574
4595
|
// src/components/Variables/util/serializeVariablesEditorState.ts
|
|
4575
|
-
var
|
|
4596
|
+
var import_canvas6 = require("@uniformdev/canvas");
|
|
4576
4597
|
var import_lexical8 = require("lexical");
|
|
4577
4598
|
|
|
4578
4599
|
// src/components/Variables/util/variableExpression.ts
|
|
@@ -4591,7 +4612,7 @@ function serializeRecursive(node, buffer) {
|
|
|
4591
4612
|
buffer.push(node.text.replace(variablePrefix, "\\${"));
|
|
4592
4613
|
}
|
|
4593
4614
|
if (node.type === VariableNode.getType()) {
|
|
4594
|
-
buffer.push((0,
|
|
4615
|
+
buffer.push((0, import_canvas6.createVariableReference)(node.reference));
|
|
4595
4616
|
}
|
|
4596
4617
|
if (node.type === import_lexical8.LineBreakNode.getType()) {
|
|
4597
4618
|
buffer.push("\n");
|
|
@@ -4604,7 +4625,7 @@ function serializeRecursive(node, buffer) {
|
|
|
4604
4625
|
}
|
|
4605
4626
|
|
|
4606
4627
|
// src/components/Variables/toolbox/VariablesComposer.tsx
|
|
4607
|
-
var
|
|
4628
|
+
var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
|
|
4608
4629
|
function VariablesComposer(props) {
|
|
4609
4630
|
const {
|
|
4610
4631
|
value,
|
|
@@ -4616,8 +4637,8 @@ function VariablesComposer(props) {
|
|
|
4616
4637
|
autoFocus,
|
|
4617
4638
|
...variablesPluginProps
|
|
4618
4639
|
} = props;
|
|
4619
|
-
const [lastEmittedValue, setLastEmittedValue] = (0,
|
|
4620
|
-
const editorConfig = (0,
|
|
4640
|
+
const [lastEmittedValue, setLastEmittedValue] = (0, import_react48.useState)(value);
|
|
4641
|
+
const editorConfig = (0, import_react48.useMemo)(
|
|
4621
4642
|
() => ({
|
|
4622
4643
|
namespace: "uniform",
|
|
4623
4644
|
onError(error) {
|
|
@@ -4629,14 +4650,15 @@ function VariablesComposer(props) {
|
|
|
4629
4650
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4630
4651
|
[]
|
|
4631
4652
|
);
|
|
4632
|
-
const editorState = (0,
|
|
4633
|
-
const updateTimeout = (0,
|
|
4653
|
+
const editorState = (0, import_react48.useRef)();
|
|
4654
|
+
const updateTimeout = (0, import_react48.useRef)();
|
|
4634
4655
|
if (typeof document === "undefined")
|
|
4635
4656
|
return null;
|
|
4636
|
-
return /* @__PURE__ */ (0,
|
|
4637
|
-
/* @__PURE__ */ (0,
|
|
4657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
|
|
4658
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4638
4659
|
import_LexicalOnChangePlugin.OnChangePlugin,
|
|
4639
4660
|
{
|
|
4661
|
+
ignoreSelectionChange: true,
|
|
4640
4662
|
onChange: (state) => {
|
|
4641
4663
|
editorState.current = state;
|
|
4642
4664
|
if (updateTimeout.current) {
|
|
@@ -4654,12 +4676,12 @@ function VariablesComposer(props) {
|
|
|
4654
4676
|
}
|
|
4655
4677
|
}
|
|
4656
4678
|
),
|
|
4657
|
-
/* @__PURE__ */ (0,
|
|
4658
|
-
/* @__PURE__ */ (0,
|
|
4659
|
-
/* @__PURE__ */ (0,
|
|
4660
|
-
/* @__PURE__ */ (0,
|
|
4661
|
-
/* @__PURE__ */ (0,
|
|
4662
|
-
/* @__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 })
|
|
4663
4685
|
] });
|
|
4664
4686
|
}
|
|
4665
4687
|
|
|
@@ -4672,29 +4694,29 @@ var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin")
|
|
|
4672
4694
|
var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
|
|
4673
4695
|
var import_utils4 = require("@lexical/utils");
|
|
4674
4696
|
var import_lexical9 = require("lexical");
|
|
4675
|
-
var
|
|
4676
|
-
var
|
|
4697
|
+
var import_react49 = require("react");
|
|
4698
|
+
var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
|
|
4677
4699
|
function VariablesComposerInput({
|
|
4678
4700
|
css: css37,
|
|
4679
4701
|
placeholder,
|
|
4680
4702
|
...contentEditableProps
|
|
4681
4703
|
}) {
|
|
4682
|
-
return /* @__PURE__ */ (0,
|
|
4683
|
-
/* @__PURE__ */ (0,
|
|
4704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { children: [
|
|
4705
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4684
4706
|
import_LexicalPlainTextPlugin.PlainTextPlugin,
|
|
4685
4707
|
{
|
|
4686
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
4687
|
-
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,
|
|
4688
4710
|
ErrorBoundary: import_LexicalErrorBoundary.default
|
|
4689
4711
|
}
|
|
4690
4712
|
),
|
|
4691
|
-
/* @__PURE__ */ (0,
|
|
4692
|
-
/* @__PURE__ */ (0,
|
|
4713
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(RichishCopyAndPastePlugin, {}),
|
|
4714
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_LexicalHistoryPlugin.HistoryPlugin, {})
|
|
4693
4715
|
] });
|
|
4694
4716
|
}
|
|
4695
4717
|
function RichishCopyAndPastePlugin() {
|
|
4696
4718
|
const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
|
|
4697
|
-
(0,
|
|
4719
|
+
(0, import_react49.useEffect)(() => {
|
|
4698
4720
|
return (0, import_utils4.mergeRegister)(
|
|
4699
4721
|
editor.registerCommand(
|
|
4700
4722
|
import_lexical9.COPY_COMMAND,
|
|
@@ -4769,7 +4791,7 @@ function RichishCopyAndPastePlugin() {
|
|
|
4769
4791
|
}
|
|
4770
4792
|
|
|
4771
4793
|
// src/components/Variables/InputVariables.tsx
|
|
4772
|
-
var
|
|
4794
|
+
var import_jsx_runtime40 = require("@emotion/react/jsx-runtime");
|
|
4773
4795
|
function InputVariables(props) {
|
|
4774
4796
|
const {
|
|
4775
4797
|
id,
|
|
@@ -4796,11 +4818,11 @@ function InputVariables(props) {
|
|
|
4796
4818
|
filterVariable,
|
|
4797
4819
|
styleVariant = "default"
|
|
4798
4820
|
} = props;
|
|
4799
|
-
const [finalId] = (0,
|
|
4821
|
+
const [finalId] = (0, import_react50.useState)(id != null ? id : () => (0, import_uuid2.v4)());
|
|
4800
4822
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
4801
4823
|
const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps } = useInputVariablesState(props);
|
|
4802
4824
|
const useInputWithNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
|
|
4803
|
-
const input3 = /* @__PURE__ */ (0,
|
|
4825
|
+
const input3 = /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4804
4826
|
"div",
|
|
4805
4827
|
{
|
|
4806
4828
|
onKeyDown: () => {
|
|
@@ -4810,14 +4832,14 @@ function InputVariables(props) {
|
|
|
4810
4832
|
},
|
|
4811
4833
|
css: disabled ? inputDisabled : "",
|
|
4812
4834
|
children: [
|
|
4813
|
-
useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0,
|
|
4835
|
+
useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4814
4836
|
InputVariablesOverlayMenu,
|
|
4815
4837
|
{
|
|
4816
4838
|
...sharedMenuProps,
|
|
4817
4839
|
disabled: disableVariablesForReals || disableInlineMenu === true || disableInlineMenu === "by-input",
|
|
4818
4840
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
4819
4841
|
useInputWhenNoVariables: useInputWithNoVariables,
|
|
4820
|
-
children: /* @__PURE__ */ (0,
|
|
4842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4821
4843
|
VariablesComposerInput,
|
|
4822
4844
|
{
|
|
4823
4845
|
id: finalId,
|
|
@@ -4825,7 +4847,7 @@ function InputVariables(props) {
|
|
|
4825
4847
|
"data-testid": dataTestId ? dataTestId : "input-container",
|
|
4826
4848
|
"data-text-value": value,
|
|
4827
4849
|
css: [input, styleVariant === "compact" ? inputCompact : null],
|
|
4828
|
-
placeholder: placeholder ? /* @__PURE__ */ (0,
|
|
4850
|
+
placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4829
4851
|
import_design_system20.Caption,
|
|
4830
4852
|
{
|
|
4831
4853
|
css: [
|
|
@@ -4839,16 +4861,16 @@ function InputVariables(props) {
|
|
|
4839
4861
|
)
|
|
4840
4862
|
}
|
|
4841
4863
|
),
|
|
4842
|
-
caption ? /* @__PURE__ */ (0,
|
|
4843
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
4844
|
-
warningMessage ? /* @__PURE__ */ (0,
|
|
4845
|
-
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
|
|
4846
4868
|
]
|
|
4847
4869
|
}
|
|
4848
4870
|
);
|
|
4849
4871
|
let body = input3;
|
|
4850
4872
|
if (label) {
|
|
4851
|
-
body = /* @__PURE__ */ (0,
|
|
4873
|
+
body = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4852
4874
|
VariableField,
|
|
4853
4875
|
{
|
|
4854
4876
|
label,
|
|
@@ -4863,7 +4885,7 @@ function InputVariables(props) {
|
|
|
4863
4885
|
}
|
|
4864
4886
|
);
|
|
4865
4887
|
}
|
|
4866
|
-
return /* @__PURE__ */ (0,
|
|
4888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4867
4889
|
VariablesComposer,
|
|
4868
4890
|
{
|
|
4869
4891
|
onChange,
|
|
@@ -4878,9 +4900,9 @@ function InputVariables(props) {
|
|
|
4878
4900
|
autoFocus,
|
|
4879
4901
|
filterVariable,
|
|
4880
4902
|
children: [
|
|
4881
|
-
/* @__PURE__ */ (0,
|
|
4882
|
-
/* @__PURE__ */ (0,
|
|
4883
|
-
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,
|
|
4884
4906
|
body
|
|
4885
4907
|
]
|
|
4886
4908
|
}
|
|
@@ -4893,11 +4915,11 @@ function InputVariablesOverlayMenu({
|
|
|
4893
4915
|
...props
|
|
4894
4916
|
}) {
|
|
4895
4917
|
if (disabled) {
|
|
4896
|
-
return /* @__PURE__ */ (0,
|
|
4918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
|
4897
4919
|
}
|
|
4898
|
-
return /* @__PURE__ */ (0,
|
|
4920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { css: menuContainer, children: [
|
|
4899
4921
|
children,
|
|
4900
|
-
/* @__PURE__ */ (0,
|
|
4922
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4901
4923
|
VariablesComposerVariableMenu,
|
|
4902
4924
|
{
|
|
4903
4925
|
...props,
|
|
@@ -4910,14 +4932,14 @@ function InputVariablesOverlayMenu({
|
|
|
4910
4932
|
|
|
4911
4933
|
// src/components/Variables/ParameterConnectionIndicator.tsx
|
|
4912
4934
|
var import_CgUsbC2 = require("@react-icons/all-files/cg/CgUsbC");
|
|
4913
|
-
var
|
|
4935
|
+
var import_canvas7 = require("@uniformdev/canvas");
|
|
4914
4936
|
var import_design_system22 = require("@uniformdev/design-system");
|
|
4915
|
-
var
|
|
4937
|
+
var import_react52 = require("react");
|
|
4916
4938
|
|
|
4917
4939
|
// src/components/Variables/styles/ParameterVariables.styles.ts
|
|
4918
|
-
var
|
|
4940
|
+
var import_react51 = require("@emotion/react");
|
|
4919
4941
|
var import_design_system21 = require("@uniformdev/design-system");
|
|
4920
|
-
var variableBindButton2 =
|
|
4942
|
+
var variableBindButton2 = import_react51.css`
|
|
4921
4943
|
align-items: center;
|
|
4922
4944
|
border: none;
|
|
4923
4945
|
border-radius: var(--rounded-base);
|
|
@@ -4946,12 +4968,12 @@ var variableBindButton2 = import_react50.css`
|
|
|
4946
4968
|
max-height: unset;
|
|
4947
4969
|
}
|
|
4948
4970
|
`;
|
|
4949
|
-
var input2 =
|
|
4971
|
+
var input2 = import_react51.css`
|
|
4950
4972
|
display: block;
|
|
4951
4973
|
appearance: none;
|
|
4952
4974
|
box-sizing: border-box;
|
|
4953
4975
|
background: var(--white);
|
|
4954
|
-
border: 1px solid var(--
|
|
4976
|
+
border: 1px solid var(--gray-200);
|
|
4955
4977
|
border-radius: var(--rounded-sm);
|
|
4956
4978
|
color: var(--gray-700);
|
|
4957
4979
|
font-size: var(--fs-sm);
|
|
@@ -4971,16 +4993,19 @@ var input2 = import_react50.css`
|
|
|
4971
4993
|
|
|
4972
4994
|
&:focus,
|
|
4973
4995
|
&:focus-within {
|
|
4974
|
-
border-radius: var(--rounded-
|
|
4975
|
-
box-shadow:
|
|
4976
|
-
border: 1px solid var(--
|
|
4996
|
+
border-radius: var(--rounded-sm);
|
|
4997
|
+
box-shadow: var(--elevation-100);
|
|
4998
|
+
border: 1px solid var(--accent-dark-active);
|
|
4977
4999
|
outline: none;
|
|
4978
5000
|
}
|
|
5001
|
+
&:hover {
|
|
5002
|
+
border: 1px solid var(--accent-dark-hover);
|
|
5003
|
+
}
|
|
4979
5004
|
|
|
4980
5005
|
&:disabled,
|
|
4981
5006
|
&:disabled::placeholder,
|
|
4982
5007
|
&:disabled:hover {
|
|
4983
|
-
border-radius: var(--rounded-
|
|
5008
|
+
border-radius: var(--rounded-sm);
|
|
4984
5009
|
cursor: not-allowed;
|
|
4985
5010
|
color: var(--gray-400);
|
|
4986
5011
|
}
|
|
@@ -4995,7 +5020,7 @@ var input2 = import_react50.css`
|
|
|
4995
5020
|
margin: 0;
|
|
4996
5021
|
}
|
|
4997
5022
|
`;
|
|
4998
|
-
var inputMultiLine = (lines) =>
|
|
5023
|
+
var inputMultiLine = (lines) => import_react51.css`
|
|
4999
5024
|
${import_design_system21.scrollbarStyles}
|
|
5000
5025
|
// 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
|
|
5001
5026
|
// as the text looked to close to the bottom of the input
|
|
@@ -5005,7 +5030,7 @@ var inputMultiLine = (lines) => import_react50.css`
|
|
|
5005
5030
|
`;
|
|
5006
5031
|
|
|
5007
5032
|
// src/components/Variables/ParameterConnectionIndicator.tsx
|
|
5008
|
-
var
|
|
5033
|
+
var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
|
|
5009
5034
|
function ParameterConnectionIndicator({
|
|
5010
5035
|
children,
|
|
5011
5036
|
value,
|
|
@@ -5013,9 +5038,9 @@ function ParameterConnectionIndicator({
|
|
|
5013
5038
|
disabled,
|
|
5014
5039
|
menuTooltip = "Insert variable"
|
|
5015
5040
|
}) {
|
|
5016
|
-
const hasVariablesInValue = (0,
|
|
5041
|
+
const hasVariablesInValue = (0, import_react52.useMemo)(() => {
|
|
5017
5042
|
let result = false;
|
|
5018
|
-
(0,
|
|
5043
|
+
(0, import_canvas7.bindVariablesToObject)({
|
|
5019
5044
|
value,
|
|
5020
5045
|
variables: {},
|
|
5021
5046
|
handleBinding: () => {
|
|
@@ -5024,21 +5049,21 @@ function ParameterConnectionIndicator({
|
|
|
5024
5049
|
});
|
|
5025
5050
|
return result;
|
|
5026
5051
|
}, [value]);
|
|
5027
|
-
return /* @__PURE__ */ (0,
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5029
|
-
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)(
|
|
5030
5055
|
import_design_system22.Menu,
|
|
5031
5056
|
{
|
|
5032
5057
|
placement: "bottom-start",
|
|
5033
5058
|
withoutPortal: true,
|
|
5034
|
-
menuTrigger: /* @__PURE__ */ (0,
|
|
5059
|
+
menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5035
5060
|
"button",
|
|
5036
5061
|
{
|
|
5037
5062
|
title: menuTooltip,
|
|
5038
5063
|
"aria-pressed": hasVariablesInValue,
|
|
5039
5064
|
css: [menuBtn, variableBindButton2],
|
|
5040
5065
|
type: "button",
|
|
5041
|
-
children: /* @__PURE__ */ (0,
|
|
5066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_CgUsbC2.CgUsbC, { size: "1.4rem" })
|
|
5042
5067
|
}
|
|
5043
5068
|
),
|
|
5044
5069
|
menuLabel: menuTooltip,
|
|
@@ -5050,21 +5075,21 @@ function ParameterConnectionIndicator({
|
|
|
5050
5075
|
|
|
5051
5076
|
// src/components/Variables/ParameterOrSingleVariable.tsx
|
|
5052
5077
|
var import_design_system23 = require("@uniformdev/design-system");
|
|
5053
|
-
var
|
|
5078
|
+
var import_react54 = require("react");
|
|
5054
5079
|
|
|
5055
5080
|
// src/components/Variables/composer/OnDisconnectPlugin.tsx
|
|
5056
5081
|
var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
|
|
5057
5082
|
var import_utils5 = require("@lexical/utils");
|
|
5058
5083
|
var import_lexical10 = require("lexical");
|
|
5059
|
-
var
|
|
5084
|
+
var import_react53 = require("react");
|
|
5060
5085
|
function OnDisconnectPlugin({
|
|
5061
5086
|
onDisconnect
|
|
5062
5087
|
}) {
|
|
5063
5088
|
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
5064
5089
|
const { variables } = useVariables(true);
|
|
5065
|
-
const variablesRef = (0,
|
|
5090
|
+
const variablesRef = (0, import_react53.useRef)(variables);
|
|
5066
5091
|
variablesRef.current = variables;
|
|
5067
|
-
(0,
|
|
5092
|
+
(0, import_react53.useEffect)(() => {
|
|
5068
5093
|
return (0, import_utils5.mergeRegister)(
|
|
5069
5094
|
editor.registerCommand(
|
|
5070
5095
|
DISCONNECT_VARIABLE_COMMAND,
|
|
@@ -5090,7 +5115,7 @@ function OnDisconnectPlugin({
|
|
|
5090
5115
|
}
|
|
5091
5116
|
|
|
5092
5117
|
// src/components/Variables/ParameterOrSingleVariable.tsx
|
|
5093
|
-
var
|
|
5118
|
+
var import_jsx_runtime42 = require("@emotion/react/jsx-runtime");
|
|
5094
5119
|
function ParameterOrSingleVariable(props) {
|
|
5095
5120
|
const {
|
|
5096
5121
|
value,
|
|
@@ -5109,7 +5134,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5109
5134
|
hasVariablesInValue,
|
|
5110
5135
|
setHadVariablesInValue
|
|
5111
5136
|
} = useInputVariablesState(props);
|
|
5112
|
-
const handleDisconnect = (0,
|
|
5137
|
+
const handleDisconnect = (0, import_react54.useCallback)(
|
|
5113
5138
|
(variable) => {
|
|
5114
5139
|
setHadVariablesInValue(false);
|
|
5115
5140
|
if (onDisconnect) {
|
|
@@ -5121,7 +5146,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5121
5146
|
return (
|
|
5122
5147
|
// we use a "fauxical" lexical here to render the vars the same as other editors do,
|
|
5123
5148
|
// and also to enable us to dispatch the same editor commands as other editors do
|
|
5124
|
-
/* @__PURE__ */ (0,
|
|
5149
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5125
5150
|
VariablesComposer,
|
|
5126
5151
|
{
|
|
5127
5152
|
onChange,
|
|
@@ -5132,11 +5157,11 @@ function ParameterOrSingleVariable(props) {
|
|
|
5132
5157
|
replaceValueOnVariableInsert: true,
|
|
5133
5158
|
disabled: true,
|
|
5134
5159
|
children: [
|
|
5135
|
-
/* @__PURE__ */ (0,
|
|
5136
|
-
editorRef ? /* @__PURE__ */ (0,
|
|
5137
|
-
/* @__PURE__ */ (0,
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5139
|
-
/* @__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)(
|
|
5140
5165
|
VariablesComposerInput,
|
|
5141
5166
|
{
|
|
5142
5167
|
"data-text-value": value,
|
|
@@ -5144,7 +5169,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5144
5169
|
css: input2
|
|
5145
5170
|
}
|
|
5146
5171
|
) }),
|
|
5147
|
-
disableVariablesForReals ? null : /* @__PURE__ */ (0,
|
|
5172
|
+
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5148
5173
|
VariablesComposerVariableMenu,
|
|
5149
5174
|
{
|
|
5150
5175
|
...sharedMenuProps,
|
|
@@ -5162,9 +5187,9 @@ function ParameterOrSingleVariable(props) {
|
|
|
5162
5187
|
}
|
|
5163
5188
|
|
|
5164
5189
|
// src/components/Variables/ParameterVariables.tsx
|
|
5165
|
-
var
|
|
5190
|
+
var import_react55 = require("@emotion/react");
|
|
5166
5191
|
var import_design_system24 = require("@uniformdev/design-system");
|
|
5167
|
-
var
|
|
5192
|
+
var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
|
|
5168
5193
|
function ParameterVariables(props) {
|
|
5169
5194
|
const {
|
|
5170
5195
|
value,
|
|
@@ -5184,7 +5209,7 @@ function ParameterVariables(props) {
|
|
|
5184
5209
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
5185
5210
|
const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps, hasVariablesInValue } = useInputVariablesState(props);
|
|
5186
5211
|
const useInputWhenNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
|
|
5187
|
-
return /* @__PURE__ */ (0,
|
|
5212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
5188
5213
|
VariablesComposer,
|
|
5189
5214
|
{
|
|
5190
5215
|
onChange,
|
|
@@ -5199,9 +5224,9 @@ function ParameterVariables(props) {
|
|
|
5199
5224
|
autoFocus,
|
|
5200
5225
|
filterVariable,
|
|
5201
5226
|
children: [
|
|
5202
|
-
editorRef ? /* @__PURE__ */ (0,
|
|
5203
|
-
/* @__PURE__ */ (0,
|
|
5204
|
-
/* @__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)(
|
|
5205
5230
|
import_design_system24.HorizontalRhythm,
|
|
5206
5231
|
{
|
|
5207
5232
|
align: "center",
|
|
@@ -5213,7 +5238,7 @@ function ParameterVariables(props) {
|
|
|
5213
5238
|
}
|
|
5214
5239
|
},
|
|
5215
5240
|
children: [
|
|
5216
|
-
/* @__PURE__ */ (0,
|
|
5241
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5217
5242
|
VariablesComposerInput,
|
|
5218
5243
|
{
|
|
5219
5244
|
"aria-label": ariaLabel,
|
|
@@ -5221,12 +5246,12 @@ function ParameterVariables(props) {
|
|
|
5221
5246
|
"data-text-value": value,
|
|
5222
5247
|
css: [
|
|
5223
5248
|
input2,
|
|
5224
|
-
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) :
|
|
5225
|
-
inputCss != null ? inputCss :
|
|
5249
|
+
typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) : import_react55.css``,
|
|
5250
|
+
inputCss != null ? inputCss : import_react55.css``
|
|
5226
5251
|
]
|
|
5227
5252
|
}
|
|
5228
5253
|
) }),
|
|
5229
|
-
disableVariablesForReals ? null : /* @__PURE__ */ (0,
|
|
5254
|
+
disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5230
5255
|
VariablesComposerVariableMenu,
|
|
5231
5256
|
{
|
|
5232
5257
|
...sharedMenuProps,
|
|
@@ -5258,13 +5283,13 @@ ${prettifyBindExpression(bindExpression)}`
|
|
|
5258
5283
|
}
|
|
5259
5284
|
|
|
5260
5285
|
// src/components/Variables/VariablesList.tsx
|
|
5261
|
-
var
|
|
5286
|
+
var import_react57 = require("@emotion/react");
|
|
5262
5287
|
var import_design_system25 = require("@uniformdev/design-system");
|
|
5263
|
-
var
|
|
5288
|
+
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
|
5264
5289
|
|
|
5265
5290
|
// src/components/Variables/styles/VariablesList.styles.ts
|
|
5266
|
-
var
|
|
5267
|
-
var tableRow = (isDragging) =>
|
|
5291
|
+
var import_react56 = require("@emotion/react");
|
|
5292
|
+
var tableRow = (isDragging) => import_react56.css`
|
|
5268
5293
|
position: relative;
|
|
5269
5294
|
${isDragging ? `
|
|
5270
5295
|
display: table;
|
|
@@ -5272,7 +5297,7 @@ var tableRow = (isDragging) => import_react55.css`
|
|
|
5272
5297
|
top: auto !important;
|
|
5273
5298
|
` : void 0}
|
|
5274
5299
|
`;
|
|
5275
|
-
var tableCellDragIcon =
|
|
5300
|
+
var tableCellDragIcon = import_react56.css`
|
|
5276
5301
|
&::after {
|
|
5277
5302
|
content: '';
|
|
5278
5303
|
display: block;
|
|
@@ -5290,9 +5315,8 @@ var tableCellDragIcon = import_react55.css`
|
|
|
5290
5315
|
opacity: 1;
|
|
5291
5316
|
}
|
|
5292
5317
|
`;
|
|
5293
|
-
var variableName =
|
|
5318
|
+
var variableName = import_react56.css`
|
|
5294
5319
|
border: none;
|
|
5295
|
-
color: var(--brand-secondary-5);
|
|
5296
5320
|
font-weight: var(--fw-medium);
|
|
5297
5321
|
padding: 0;
|
|
5298
5322
|
background: none;
|
|
@@ -5301,7 +5325,7 @@ var variableName = import_react55.css`
|
|
|
5301
5325
|
white-space: nowrap;
|
|
5302
5326
|
max-width: 20ch;
|
|
5303
5327
|
`;
|
|
5304
|
-
var variableValue =
|
|
5328
|
+
var variableValue = import_react56.css`
|
|
5305
5329
|
overflow: hidden;
|
|
5306
5330
|
text-overflow: ellipsis;
|
|
5307
5331
|
white-space: nowrap;
|
|
@@ -5309,7 +5333,7 @@ var variableValue = import_react55.css`
|
|
|
5309
5333
|
`;
|
|
5310
5334
|
|
|
5311
5335
|
// src/components/Variables/VariablesList.tsx
|
|
5312
|
-
var
|
|
5336
|
+
var import_jsx_runtime44 = require("@emotion/react/jsx-runtime");
|
|
5313
5337
|
function VariablesList() {
|
|
5314
5338
|
const { variables, dispatch, readOnly } = useVariables();
|
|
5315
5339
|
const sorted = variablesToList(variables).filter((variable) => !variable.system);
|
|
@@ -5330,24 +5354,24 @@ function VariablesList() {
|
|
|
5330
5354
|
return result;
|
|
5331
5355
|
}
|
|
5332
5356
|
};
|
|
5333
|
-
return /* @__PURE__ */ (0,
|
|
5334
|
-
/* @__PURE__ */ (0,
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
5336
|
-
/* @__PURE__ */ (0,
|
|
5337
|
-
/* @__PURE__ */ (0,
|
|
5338
|
-
/* @__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, {})
|
|
5339
5363
|
] }) }),
|
|
5340
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_design_system25.TableBody, { children: [
|
|
5341
5365
|
sorted.map(({ name, displayName, default: defaultValue }, index) => {
|
|
5342
5366
|
const text = displayName != null ? displayName : name;
|
|
5343
5367
|
const textValue = variableDefaultTextValue(defaultValue);
|
|
5344
|
-
return /* @__PURE__ */ (0,
|
|
5345
|
-
|
|
5368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5369
|
+
import_react_beautiful_dnd3.Draggable,
|
|
5346
5370
|
{
|
|
5347
5371
|
draggableId: name,
|
|
5348
5372
|
index,
|
|
5349
5373
|
isDragDisabled: sorted.length === 1,
|
|
5350
|
-
children: (provided2, snapshot) => /* @__PURE__ */ (0,
|
|
5374
|
+
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
5351
5375
|
import_design_system25.TableRow,
|
|
5352
5376
|
{
|
|
5353
5377
|
ref: provided2.innerRef,
|
|
@@ -5357,7 +5381,7 @@ function VariablesList() {
|
|
|
5357
5381
|
css: tableRow(snapshot.isDragging),
|
|
5358
5382
|
"data-dragging": snapshot.isDragging,
|
|
5359
5383
|
children: [
|
|
5360
|
-
/* @__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)(
|
|
5361
5385
|
"button",
|
|
5362
5386
|
{
|
|
5363
5387
|
css: variableName,
|
|
@@ -5370,21 +5394,21 @@ function VariablesList() {
|
|
|
5370
5394
|
children: text
|
|
5371
5395
|
}
|
|
5372
5396
|
) }),
|
|
5373
|
-
/* @__PURE__ */ (0,
|
|
5374
|
-
/* @__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)(
|
|
5375
5399
|
"button",
|
|
5376
5400
|
{
|
|
5377
5401
|
type: "button",
|
|
5378
5402
|
title: `delete ${text}`,
|
|
5379
5403
|
css: [
|
|
5380
5404
|
import_design_system25.button,
|
|
5381
|
-
|
|
5405
|
+
import_react57.css`
|
|
5382
5406
|
background: transparent;
|
|
5383
5407
|
`
|
|
5384
5408
|
],
|
|
5385
5409
|
"aria-controls": text,
|
|
5386
5410
|
onClick: () => dispatch({ type: "remove", variable: name }),
|
|
5387
|
-
children: /* @__PURE__ */ (0,
|
|
5411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.Icon, { icon: "trash", iconColor: "red" })
|
|
5388
5412
|
}
|
|
5389
5413
|
) })
|
|
5390
5414
|
]
|
|
@@ -5397,12 +5421,12 @@ function VariablesList() {
|
|
|
5397
5421
|
provided.placeholder
|
|
5398
5422
|
] })
|
|
5399
5423
|
] }) }) }),
|
|
5400
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
5424
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5401
5425
|
import_design_system25.AddListButton,
|
|
5402
5426
|
{
|
|
5403
5427
|
onButtonClick: () => dispatch({ type: "edit", variable: "" }),
|
|
5404
5428
|
"aria-label": "Add variable",
|
|
5405
|
-
buttonText: "
|
|
5429
|
+
buttonText: "Add variable",
|
|
5406
5430
|
icon: "math-plus",
|
|
5407
5431
|
css: { marginLeft: "var(--spacing-md)" }
|
|
5408
5432
|
}
|
|
@@ -5411,37 +5435,37 @@ function VariablesList() {
|
|
|
5411
5435
|
}
|
|
5412
5436
|
|
|
5413
5437
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
5414
|
-
var
|
|
5438
|
+
var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
|
|
5415
5439
|
function DataResourceDynamicInputProvider(props) {
|
|
5416
5440
|
const { children, dynamicInputs } = props;
|
|
5417
5441
|
if (dynamicInputs) {
|
|
5418
|
-
return /* @__PURE__ */ (0,
|
|
5442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceDynamicInputProviderRenderer, { ...props, children });
|
|
5419
5443
|
}
|
|
5420
|
-
return /* @__PURE__ */ (0,
|
|
5444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceDynamicInputProviderContextShim, { children });
|
|
5421
5445
|
}
|
|
5422
5446
|
function DataResourceDynamicInputProviderContextShim(props) {
|
|
5423
5447
|
const {
|
|
5424
5448
|
metadata: { dynamicInputs }
|
|
5425
5449
|
} = useMeshLocation("dataResource");
|
|
5426
|
-
return /* @__PURE__ */ (0,
|
|
5450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceDynamicInputProviderRenderer, { ...props, dynamicInputs });
|
|
5427
5451
|
}
|
|
5428
5452
|
function DataResourceDynamicInputProviderRenderer({
|
|
5429
5453
|
children,
|
|
5430
5454
|
dynamicInputs
|
|
5431
5455
|
}) {
|
|
5432
5456
|
const variables = useDynamicInputsAsVariables(dynamicInputs);
|
|
5433
|
-
return /* @__PURE__ */ (0,
|
|
5457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(VariablesProvider, { value: variables, readOnly: true, children });
|
|
5434
5458
|
}
|
|
5435
5459
|
|
|
5436
5460
|
// src/components/DataResourceVariablesList.tsx
|
|
5437
5461
|
var import_design_system26 = require("@uniformdev/design-system");
|
|
5438
|
-
var
|
|
5462
|
+
var import_jsx_runtime46 = require("@emotion/react/jsx-runtime");
|
|
5439
5463
|
function DataResourceVariablesList(props) {
|
|
5440
5464
|
const {
|
|
5441
5465
|
value,
|
|
5442
5466
|
metadata: { dataType, dynamicInputs }
|
|
5443
5467
|
} = useMeshLocation("dataResource");
|
|
5444
|
-
return /* @__PURE__ */ (0,
|
|
5468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5445
5469
|
DataResourceVariablesListExplicit,
|
|
5446
5470
|
{
|
|
5447
5471
|
...props,
|
|
@@ -5462,14 +5486,14 @@ function DataResourceVariablesListExplicit({
|
|
|
5462
5486
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
5463
5487
|
if (variableDefinitions.length === 0) {
|
|
5464
5488
|
if (NoVariablesComponent) {
|
|
5465
|
-
return /* @__PURE__ */ (0,
|
|
5489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(NoVariablesComponent, {});
|
|
5466
5490
|
}
|
|
5467
|
-
return /* @__PURE__ */ (0,
|
|
5491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system26.Callout, { type: "note", children: "No settings are required." });
|
|
5468
5492
|
}
|
|
5469
|
-
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) => {
|
|
5470
5494
|
var _a, _b, _c;
|
|
5471
5495
|
const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
|
|
5472
|
-
return /* @__PURE__ */ (0,
|
|
5496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5473
5497
|
VariableRenderer,
|
|
5474
5498
|
{
|
|
5475
5499
|
definition: variableDefinition,
|
|
@@ -5494,7 +5518,7 @@ function DataResourceVariablesListExplicit({
|
|
|
5494
5518
|
}
|
|
5495
5519
|
function TextVariableRenderer({ definition, value, setValue }) {
|
|
5496
5520
|
var _a;
|
|
5497
|
-
return /* @__PURE__ */ (0,
|
|
5521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { "data-testid": "variable-input-container", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5498
5522
|
InputVariables,
|
|
5499
5523
|
{
|
|
5500
5524
|
label: definition.displayName || definition.name,
|
|
@@ -5507,13 +5531,13 @@ function TextVariableRenderer({ definition, value, setValue }) {
|
|
|
5507
5531
|
}
|
|
5508
5532
|
|
|
5509
5533
|
// src/components/Request/RequestBody.tsx
|
|
5510
|
-
var
|
|
5534
|
+
var import_react59 = require("@emotion/react");
|
|
5511
5535
|
var import_design_system27 = require("@uniformdev/design-system");
|
|
5512
|
-
var
|
|
5536
|
+
var import_react60 = require("react");
|
|
5513
5537
|
|
|
5514
5538
|
// src/components/Request/RequestProvider.tsx
|
|
5515
5539
|
var React11 = __toESM(require("react"));
|
|
5516
|
-
var
|
|
5540
|
+
var import_jsx_runtime47 = require("@emotion/react/jsx-runtime");
|
|
5517
5541
|
var RequestContext = React11.createContext(null);
|
|
5518
5542
|
function RequestProvider({ value, onChange, children }) {
|
|
5519
5543
|
const contextValue = React11.useMemo(() => {
|
|
@@ -5582,7 +5606,7 @@ function RequestProvider({ value, onChange, children }) {
|
|
|
5582
5606
|
request: value
|
|
5583
5607
|
};
|
|
5584
5608
|
}, [onChange, value]);
|
|
5585
|
-
return /* @__PURE__ */ (0,
|
|
5609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RequestContext.Provider, { value: contextValue, children });
|
|
5586
5610
|
}
|
|
5587
5611
|
function useRequest() {
|
|
5588
5612
|
const context = React11.useContext(RequestContext);
|
|
@@ -5593,11 +5617,11 @@ function useRequest() {
|
|
|
5593
5617
|
}
|
|
5594
5618
|
|
|
5595
5619
|
// src/components/Request/styles/Request.styles.ts
|
|
5596
|
-
var
|
|
5597
|
-
var innerContentStyles =
|
|
5620
|
+
var import_react58 = require("@emotion/react");
|
|
5621
|
+
var innerContentStyles = import_react58.css`
|
|
5598
5622
|
background: var(--white);
|
|
5599
5623
|
`;
|
|
5600
|
-
var requestTypeContainer = (bgColor) =>
|
|
5624
|
+
var requestTypeContainer = (bgColor) => import_react58.css`
|
|
5601
5625
|
align-items: start;
|
|
5602
5626
|
background: ${bgColor};
|
|
5603
5627
|
display: grid;
|
|
@@ -5606,17 +5630,17 @@ var requestTypeContainer = (bgColor) => import_react57.css`
|
|
|
5606
5630
|
`;
|
|
5607
5631
|
|
|
5608
5632
|
// src/components/Request/RequestTypeContainer.tsx
|
|
5609
|
-
var
|
|
5633
|
+
var import_jsx_runtime48 = require("@emotion/react/jsx-runtime");
|
|
5610
5634
|
var RequestTypeContainer = ({
|
|
5611
5635
|
bgColor = "transparent",
|
|
5612
5636
|
children,
|
|
5613
5637
|
...props
|
|
5614
5638
|
}) => {
|
|
5615
|
-
return /* @__PURE__ */ (0,
|
|
5639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { css: requestTypeContainer(bgColor), ...props, children });
|
|
5616
5640
|
};
|
|
5617
5641
|
|
|
5618
5642
|
// src/components/Request/RequestBody.tsx
|
|
5619
|
-
var
|
|
5643
|
+
var import_jsx_runtime49 = require("@emotion/react/jsx-runtime");
|
|
5620
5644
|
var LANGUAGE_OPTIONS = [
|
|
5621
5645
|
{ label: "Text", value: "plaintext" },
|
|
5622
5646
|
{ label: "JSON", value: "json" },
|
|
@@ -5635,22 +5659,22 @@ var LANGUAGE_TO_CONTENT_TYPE = {
|
|
|
5635
5659
|
};
|
|
5636
5660
|
function RequestBody() {
|
|
5637
5661
|
const { request, dispatch } = useRequest();
|
|
5638
|
-
const [language, setLanguage] = (0,
|
|
5639
|
-
return /* @__PURE__ */ (0,
|
|
5662
|
+
const [language, setLanguage] = (0, import_react60.useState)("json");
|
|
5663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5640
5664
|
"div",
|
|
5641
5665
|
{
|
|
5642
|
-
css:
|
|
5666
|
+
css: import_react59.css`
|
|
5643
5667
|
background: var(--white);
|
|
5644
5668
|
`,
|
|
5645
5669
|
children: [
|
|
5646
|
-
/* @__PURE__ */ (0,
|
|
5670
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5647
5671
|
RequestTypeContainer,
|
|
5648
5672
|
{
|
|
5649
5673
|
bgColor: "var(--gray-100)",
|
|
5650
|
-
css:
|
|
5674
|
+
css: import_react59.css`
|
|
5651
5675
|
padding: var(--spacing-sm) var(--spacing-base);
|
|
5652
5676
|
`,
|
|
5653
|
-
children: /* @__PURE__ */ (0,
|
|
5677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5654
5678
|
import_design_system27.InputSelect,
|
|
5655
5679
|
{
|
|
5656
5680
|
label: "Language",
|
|
@@ -5673,7 +5697,7 @@ function RequestBody() {
|
|
|
5673
5697
|
)
|
|
5674
5698
|
}
|
|
5675
5699
|
),
|
|
5676
|
-
/* @__PURE__ */ (0,
|
|
5700
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5677
5701
|
import_design_system27.JsonEditor,
|
|
5678
5702
|
{
|
|
5679
5703
|
height: 200,
|
|
@@ -5692,7 +5716,7 @@ function RequestBody() {
|
|
|
5692
5716
|
|
|
5693
5717
|
// src/components/Request/RequestHeaders.tsx
|
|
5694
5718
|
var import_design_system28 = require("@uniformdev/design-system");
|
|
5695
|
-
var
|
|
5719
|
+
var import_jsx_runtime50 = require("@emotion/react/jsx-runtime");
|
|
5696
5720
|
function RequestHeaders({
|
|
5697
5721
|
disableVariables,
|
|
5698
5722
|
addOmitIfEmpty
|
|
@@ -5711,29 +5735,29 @@ function RequestHeaders({
|
|
|
5711
5735
|
index
|
|
5712
5736
|
});
|
|
5713
5737
|
};
|
|
5714
|
-
return /* @__PURE__ */ (0,
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
5716
|
-
/* @__PURE__ */ (0,
|
|
5717
|
-
/* @__PURE__ */ (0,
|
|
5718
|
-
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
|
|
5719
5743
|
] }) }),
|
|
5720
|
-
/* @__PURE__ */ (0,
|
|
5744
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system28.TableBody, { children: [
|
|
5721
5745
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.headers) == null ? void 0 : _b.map((baseHeader) => {
|
|
5722
|
-
return /* @__PURE__ */ (0,
|
|
5723
|
-
/* @__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: [
|
|
5724
5748
|
baseHeader.key,
|
|
5725
|
-
/* @__PURE__ */ (0,
|
|
5726
|
-
/* @__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" }) })
|
|
5727
5751
|
] }),
|
|
5728
|
-
/* @__PURE__ */ (0,
|
|
5729
|
-
/* @__PURE__ */ (0,
|
|
5730
|
-
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
|
|
5731
5755
|
] })
|
|
5732
5756
|
] }, baseHeader.key);
|
|
5733
5757
|
}),
|
|
5734
5758
|
deezHeaders.map((header, index) => {
|
|
5735
|
-
return /* @__PURE__ */ (0,
|
|
5736
|
-
/* @__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)(
|
|
5737
5761
|
import_design_system28.Input,
|
|
5738
5762
|
{
|
|
5739
5763
|
label: header.key,
|
|
@@ -5753,7 +5777,7 @@ function RequestHeaders({
|
|
|
5753
5777
|
"data-testid": "header-key"
|
|
5754
5778
|
}
|
|
5755
5779
|
) }),
|
|
5756
|
-
/* @__PURE__ */ (0,
|
|
5780
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5757
5781
|
InputVariables,
|
|
5758
5782
|
{
|
|
5759
5783
|
value: header.value,
|
|
@@ -5764,7 +5788,7 @@ function RequestHeaders({
|
|
|
5764
5788
|
"data-testid": "header-value"
|
|
5765
5789
|
}
|
|
5766
5790
|
) : null }),
|
|
5767
|
-
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)(
|
|
5768
5792
|
import_design_system28.Input,
|
|
5769
5793
|
{
|
|
5770
5794
|
type: "checkbox",
|
|
@@ -5789,11 +5813,11 @@ function RequestHeaders({
|
|
|
5789
5813
|
|
|
5790
5814
|
// src/components/Request/RequestMethodSelect.tsx
|
|
5791
5815
|
var import_design_system29 = require("@uniformdev/design-system");
|
|
5792
|
-
var
|
|
5816
|
+
var import_jsx_runtime51 = require("@emotion/react/jsx-runtime");
|
|
5793
5817
|
function RequestMethodSelect(props) {
|
|
5794
5818
|
var _a;
|
|
5795
5819
|
const { request, dispatch } = useRequest();
|
|
5796
|
-
return /* @__PURE__ */ (0,
|
|
5820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5797
5821
|
import_design_system29.InputSelect,
|
|
5798
5822
|
{
|
|
5799
5823
|
...props,
|
|
@@ -5810,7 +5834,7 @@ function RequestMethodSelect(props) {
|
|
|
5810
5834
|
|
|
5811
5835
|
// src/components/Request/RequestParameters.tsx
|
|
5812
5836
|
var import_design_system30 = require("@uniformdev/design-system");
|
|
5813
|
-
var
|
|
5837
|
+
var import_jsx_runtime52 = require("@emotion/react/jsx-runtime");
|
|
5814
5838
|
function RequestParameters({
|
|
5815
5839
|
disableVariables,
|
|
5816
5840
|
addOmitIfEmpty
|
|
@@ -5830,29 +5854,29 @@ function RequestParameters({
|
|
|
5830
5854
|
index
|
|
5831
5855
|
});
|
|
5832
5856
|
};
|
|
5833
|
-
return /* @__PURE__ */ (0,
|
|
5834
|
-
/* @__PURE__ */ (0,
|
|
5835
|
-
/* @__PURE__ */ (0,
|
|
5836
|
-
/* @__PURE__ */ (0,
|
|
5837
|
-
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
|
|
5838
5862
|
] }) }),
|
|
5839
|
-
/* @__PURE__ */ (0,
|
|
5863
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system30.TableBody, { children: [
|
|
5840
5864
|
(_b = (_a = request.baseRequest) == null ? void 0 : _a.parameters) == null ? void 0 : _b.map((baseParameter) => {
|
|
5841
|
-
return /* @__PURE__ */ (0,
|
|
5842
|
-
/* @__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: [
|
|
5843
5867
|
baseParameter.key,
|
|
5844
|
-
/* @__PURE__ */ (0,
|
|
5845
|
-
/* @__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" }) })
|
|
5846
5870
|
] }),
|
|
5847
|
-
/* @__PURE__ */ (0,
|
|
5848
|
-
/* @__PURE__ */ (0,
|
|
5849
|
-
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
|
|
5850
5874
|
] })
|
|
5851
5875
|
] }, baseParameter.key);
|
|
5852
5876
|
}),
|
|
5853
5877
|
deezParameters.map((parameter, index) => {
|
|
5854
|
-
return /* @__PURE__ */ (0,
|
|
5855
|
-
/* @__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)(
|
|
5856
5880
|
import_design_system30.Input,
|
|
5857
5881
|
{
|
|
5858
5882
|
label: parameter.key,
|
|
@@ -5876,7 +5900,7 @@ function RequestParameters({
|
|
|
5876
5900
|
"data-testid": "parameter-key"
|
|
5877
5901
|
}
|
|
5878
5902
|
) }),
|
|
5879
|
-
/* @__PURE__ */ (0,
|
|
5903
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5880
5904
|
InputVariables,
|
|
5881
5905
|
{
|
|
5882
5906
|
value: parameter.value,
|
|
@@ -5892,7 +5916,7 @@ function RequestParameters({
|
|
|
5892
5916
|
enableEditingVariables: true
|
|
5893
5917
|
}
|
|
5894
5918
|
) : null }),
|
|
5895
|
-
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)(
|
|
5896
5920
|
import_design_system30.Input,
|
|
5897
5921
|
{
|
|
5898
5922
|
type: "checkbox",
|
|
@@ -5918,8 +5942,8 @@ function RequestParameters({
|
|
|
5918
5942
|
}
|
|
5919
5943
|
|
|
5920
5944
|
// src/components/Request/RequestUrl.tsx
|
|
5921
|
-
var
|
|
5922
|
-
var
|
|
5945
|
+
var import_react61 = require("@emotion/react");
|
|
5946
|
+
var import_react62 = require("react");
|
|
5923
5947
|
|
|
5924
5948
|
// src/components/Request/urlEncodeRequestParameter.ts
|
|
5925
5949
|
function urlEncodeRequestUrl(url, varValues) {
|
|
@@ -5940,35 +5964,35 @@ function decodeVariablesInUrlEncodedString(string, varValues) {
|
|
|
5940
5964
|
}
|
|
5941
5965
|
|
|
5942
5966
|
// src/components/Request/RequestUrl.tsx
|
|
5943
|
-
var
|
|
5967
|
+
var import_jsx_runtime53 = require("@emotion/react/jsx-runtime");
|
|
5944
5968
|
function RequestUrl() {
|
|
5945
5969
|
var _a, _b;
|
|
5946
5970
|
const { variables } = useVariables();
|
|
5947
5971
|
const { request } = useRequest();
|
|
5948
|
-
const mergedParameters = (0,
|
|
5972
|
+
const mergedParameters = (0, import_react62.useMemo)(() => {
|
|
5949
5973
|
var _a2;
|
|
5950
5974
|
if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
|
|
5951
5975
|
return request.parameters;
|
|
5952
5976
|
}
|
|
5953
5977
|
return request.baseRequest.parameters.filter((baseParam) => !request.parameters.find((p) => p.key === baseParam.key)).concat(request.parameters);
|
|
5954
5978
|
}, [(_a = request.baseRequest) == null ? void 0 : _a.parameters, request.parameters]);
|
|
5955
|
-
return /* @__PURE__ */ (0,
|
|
5979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
5956
5980
|
"small",
|
|
5957
5981
|
{
|
|
5958
|
-
css:
|
|
5982
|
+
css: import_react61.css`
|
|
5959
5983
|
display: inline-block;
|
|
5960
5984
|
margin-bottom: var(--spacing-xs);
|
|
5961
5985
|
word-break: break-word;
|
|
5962
5986
|
`,
|
|
5963
5987
|
children: [
|
|
5964
|
-
request.baseRequest ? /* @__PURE__ */ (0,
|
|
5965
|
-
/* @__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: [
|
|
5966
5990
|
urlEncodeRequestUrl(request.relativeUrl, variables),
|
|
5967
|
-
mergedParameters.length > 0 ? /* @__PURE__ */ (0,
|
|
5991
|
+
mergedParameters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
5968
5992
|
"?",
|
|
5969
5993
|
mergedParameters.map((param, index) => {
|
|
5970
5994
|
const encoded = urlEncodeRequestParameter(param, variables);
|
|
5971
|
-
return /* @__PURE__ */ (0,
|
|
5995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { children: [
|
|
5972
5996
|
index > 0 ? "&" : null,
|
|
5973
5997
|
encoded.key,
|
|
5974
5998
|
"=",
|
|
@@ -6007,10 +6031,10 @@ function transformPastedUrl(value, currentRequest, dispatch) {
|
|
|
6007
6031
|
}
|
|
6008
6032
|
|
|
6009
6033
|
// src/components/Request/RequestUrlInput.tsx
|
|
6010
|
-
var
|
|
6034
|
+
var import_jsx_runtime54 = require("@emotion/react/jsx-runtime");
|
|
6011
6035
|
function RequestUrlInput(props) {
|
|
6012
6036
|
const { request, dispatch } = useRequest();
|
|
6013
|
-
return /* @__PURE__ */ (0,
|
|
6037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6014
6038
|
InputVariables,
|
|
6015
6039
|
{
|
|
6016
6040
|
...props,
|
|
@@ -6060,12 +6084,12 @@ function useRequestParameter(paramName) {
|
|
|
6060
6084
|
}
|
|
6061
6085
|
|
|
6062
6086
|
// src/components/DataSourceEditor.tsx
|
|
6063
|
-
var
|
|
6087
|
+
var import_jsx_runtime55 = require("@emotion/react/jsx-runtime");
|
|
6064
6088
|
function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
6065
6089
|
var _a;
|
|
6066
6090
|
const { value } = useMeshLocation("dataSource");
|
|
6067
6091
|
const currentRequestValue = convertDataSourceToRequestData(value);
|
|
6068
|
-
return /* @__PURE__ */ (0,
|
|
6092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6069
6093
|
VariablesProvider,
|
|
6070
6094
|
{
|
|
6071
6095
|
value: (_a = value.variables) != null ? _a : {},
|
|
@@ -6081,7 +6105,7 @@ function DataSourceEditor({ onChange, children, editVariableComponent }) {
|
|
|
6081
6105
|
},
|
|
6082
6106
|
editVariableComponent,
|
|
6083
6107
|
readOnly: true,
|
|
6084
|
-
children: /* @__PURE__ */ (0,
|
|
6108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
6085
6109
|
RequestProvider,
|
|
6086
6110
|
{
|
|
6087
6111
|
value: currentRequestValue,
|
|
@@ -6118,7 +6142,7 @@ function convertRequestDataToDataSource(dataSource, requestData) {
|
|
|
6118
6142
|
}
|
|
6119
6143
|
|
|
6120
6144
|
// src/components/DataTypeEditor.tsx
|
|
6121
|
-
var
|
|
6145
|
+
var import_jsx_runtime56 = require("@emotion/react/jsx-runtime");
|
|
6122
6146
|
function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
6123
6147
|
var _a;
|
|
6124
6148
|
const {
|
|
@@ -6127,7 +6151,7 @@ function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
|
6127
6151
|
isReadOnly
|
|
6128
6152
|
} = useMeshLocation("dataType");
|
|
6129
6153
|
const currentRequestValue = convertDataTypeToRequestData(value, dataSource);
|
|
6130
|
-
return /* @__PURE__ */ (0,
|
|
6154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6131
6155
|
VariablesProvider,
|
|
6132
6156
|
{
|
|
6133
6157
|
value: (_a = value.variables) != null ? _a : {},
|
|
@@ -6143,7 +6167,7 @@ function DataTypeEditor({ onChange, children, editVariableComponent }) {
|
|
|
6143
6167
|
},
|
|
6144
6168
|
editVariableComponent,
|
|
6145
6169
|
readOnly: isReadOnly,
|
|
6146
|
-
children: /* @__PURE__ */ (0,
|
|
6170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6147
6171
|
RequestProvider,
|
|
6148
6172
|
{
|
|
6149
6173
|
value: currentRequestValue,
|
|
@@ -6193,12 +6217,12 @@ var import_design_system31 = require("@uniformdev/design-system");
|
|
|
6193
6217
|
|
|
6194
6218
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
6195
6219
|
var import_mesh_sdk = require("@uniformdev/mesh-sdk");
|
|
6196
|
-
var
|
|
6220
|
+
var import_react63 = require("react");
|
|
6197
6221
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
6198
|
-
const [error, setError] = (0,
|
|
6199
|
-
const [sdk, setSdk] = (0,
|
|
6200
|
-
const initializationInProgress = (0,
|
|
6201
|
-
(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)(
|
|
6202
6226
|
() => {
|
|
6203
6227
|
if (typeof window === "undefined" || sdk) {
|
|
6204
6228
|
return;
|
|
@@ -6231,7 +6255,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
6231
6255
|
};
|
|
6232
6256
|
|
|
6233
6257
|
// src/components/MeshApp.tsx
|
|
6234
|
-
var
|
|
6258
|
+
var import_jsx_runtime57 = require("@emotion/react/jsx-runtime");
|
|
6235
6259
|
var MeshApp = ({
|
|
6236
6260
|
children,
|
|
6237
6261
|
loadingComponent,
|
|
@@ -6240,36 +6264,36 @@ var MeshApp = ({
|
|
|
6240
6264
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
6241
6265
|
if (initializing || !sdk) {
|
|
6242
6266
|
const LoadingComponent = loadingComponent;
|
|
6243
|
-
return LoadingComponent ? /* @__PURE__ */ (0,
|
|
6267
|
+
return LoadingComponent ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(LoadingComponent, {}) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_design_system31.LoadingIndicator, {});
|
|
6244
6268
|
}
|
|
6245
6269
|
if (error) {
|
|
6246
6270
|
const ErrorComponent = errorComponent;
|
|
6247
6271
|
if (ErrorComponent) {
|
|
6248
|
-
return /* @__PURE__ */ (0,
|
|
6272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ErrorComponent, { error });
|
|
6249
6273
|
}
|
|
6250
6274
|
throw error;
|
|
6251
6275
|
}
|
|
6252
|
-
return /* @__PURE__ */ (0,
|
|
6253
|
-
/* @__PURE__ */ (0,
|
|
6254
|
-
/* @__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 })
|
|
6255
6279
|
] });
|
|
6256
6280
|
};
|
|
6257
6281
|
|
|
6258
6282
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
6259
|
-
var
|
|
6283
|
+
var import_react64 = require("@emotion/react");
|
|
6260
6284
|
var import_design_system32 = require("@uniformdev/design-system");
|
|
6261
|
-
var
|
|
6285
|
+
var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
|
|
6262
6286
|
var DataRefreshButton = ({
|
|
6263
6287
|
buttonText,
|
|
6264
6288
|
isLoading,
|
|
6265
6289
|
onRefreshData,
|
|
6266
6290
|
...props
|
|
6267
6291
|
}) => {
|
|
6268
|
-
return /* @__PURE__ */ (0,
|
|
6269
|
-
!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)(
|
|
6270
6294
|
import_design_system32.LoadingIndicator,
|
|
6271
6295
|
{
|
|
6272
|
-
css:
|
|
6296
|
+
css: import_react64.css`
|
|
6273
6297
|
${isLoading ? "opacity: 0.2;" : void 0}
|
|
6274
6298
|
`
|
|
6275
6299
|
}
|
|
@@ -6279,15 +6303,15 @@ var DataRefreshButton = ({
|
|
|
6279
6303
|
};
|
|
6280
6304
|
|
|
6281
6305
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6282
|
-
var
|
|
6283
|
-
var
|
|
6284
|
-
var
|
|
6306
|
+
var import_react67 = require("@emotion/react");
|
|
6307
|
+
var import_canvas9 = require("@uniformdev/canvas");
|
|
6308
|
+
var import_design_system35 = require("@uniformdev/design-system");
|
|
6285
6309
|
|
|
6286
6310
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6287
|
-
var
|
|
6288
|
-
var
|
|
6289
|
-
var
|
|
6290
|
-
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)({
|
|
6291
6315
|
onSetQuery: () => {
|
|
6292
6316
|
},
|
|
6293
6317
|
onSelectItem: () => {
|
|
@@ -6299,18 +6323,25 @@ var ObjectSearchContext = (0, import_react64.createContext)({
|
|
|
6299
6323
|
},
|
|
6300
6324
|
selectedListItems: [],
|
|
6301
6325
|
onRemoveAllSelectedItems: () => {
|
|
6302
|
-
}
|
|
6326
|
+
},
|
|
6327
|
+
isMulti: false
|
|
6303
6328
|
});
|
|
6304
|
-
var ObjectSearchProvider = ({
|
|
6305
|
-
|
|
6329
|
+
var ObjectSearchProvider = ({
|
|
6330
|
+
currentlySelectedItems,
|
|
6331
|
+
isMulti = false,
|
|
6332
|
+
children,
|
|
6333
|
+
defaultQuery
|
|
6334
|
+
}) => {
|
|
6335
|
+
const [query, setQuery] = (0, import_react65.useState)({
|
|
6306
6336
|
contentType: "",
|
|
6307
|
-
keyword: ""
|
|
6337
|
+
keyword: "",
|
|
6338
|
+
...defaultQuery
|
|
6308
6339
|
});
|
|
6309
6340
|
const { flatVariables } = useVariables(true);
|
|
6310
|
-
const querySearchDeferred = (0,
|
|
6311
|
-
const [selectedItems, setSelectedItems] = (0,
|
|
6312
|
-
const [list, setList] = (0,
|
|
6313
|
-
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)(
|
|
6314
6345
|
(value2) => {
|
|
6315
6346
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
6316
6347
|
return setQuery({
|
|
@@ -6322,7 +6353,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6322
6353
|
},
|
|
6323
6354
|
[setQuery]
|
|
6324
6355
|
);
|
|
6325
|
-
const onSelectItem = (0,
|
|
6356
|
+
const onSelectItem = (0, import_react65.useCallback)(
|
|
6326
6357
|
(selectedResult) => {
|
|
6327
6358
|
if (Array.isArray(selectedResult)) {
|
|
6328
6359
|
setSelectedItems(selectedResult);
|
|
@@ -6336,17 +6367,17 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6336
6367
|
},
|
|
6337
6368
|
[setSelectedItems, selectedItems]
|
|
6338
6369
|
);
|
|
6339
|
-
const onRemoveAllSelectedItems = (0,
|
|
6370
|
+
const onRemoveAllSelectedItems = (0, import_react65.useCallback)(() => {
|
|
6340
6371
|
setSelectedItems([]);
|
|
6341
6372
|
}, [setSelectedItems]);
|
|
6342
|
-
const onSetList = (0,
|
|
6373
|
+
const onSetList = (0, import_react65.useCallback)(
|
|
6343
6374
|
(value2) => {
|
|
6344
6375
|
setList(value2);
|
|
6345
6376
|
},
|
|
6346
6377
|
[setList]
|
|
6347
6378
|
);
|
|
6348
|
-
const boundQuery = (0,
|
|
6349
|
-
const value = (0,
|
|
6379
|
+
const boundQuery = (0, import_react65.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
6380
|
+
const value = (0, import_react65.useMemo)(
|
|
6350
6381
|
() => ({
|
|
6351
6382
|
boundQuery,
|
|
6352
6383
|
onSetQuery,
|
|
@@ -6355,6 +6386,7 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6355
6386
|
selectedListItems: selectedItems,
|
|
6356
6387
|
onRemoveAllSelectedItems,
|
|
6357
6388
|
list,
|
|
6389
|
+
isMulti,
|
|
6358
6390
|
onSetList
|
|
6359
6391
|
}),
|
|
6360
6392
|
[
|
|
@@ -6365,16 +6397,17 @@ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
|
|
|
6365
6397
|
selectedItems,
|
|
6366
6398
|
onRemoveAllSelectedItems,
|
|
6367
6399
|
list,
|
|
6400
|
+
isMulti,
|
|
6368
6401
|
onSetList
|
|
6369
6402
|
]
|
|
6370
6403
|
);
|
|
6371
|
-
return /* @__PURE__ */ (0,
|
|
6404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ObjectSearchContext.Provider, { value, children });
|
|
6372
6405
|
};
|
|
6373
6406
|
function useObjectSearchContext() {
|
|
6374
|
-
return (0,
|
|
6407
|
+
return (0, import_react65.useContext)(ObjectSearchContext);
|
|
6375
6408
|
}
|
|
6376
6409
|
function bindQuery(query, inputs) {
|
|
6377
|
-
const { result, errors } = (0,
|
|
6410
|
+
const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
|
|
6378
6411
|
value: query,
|
|
6379
6412
|
variables: inputs,
|
|
6380
6413
|
errorPrefix: "Dynamic input"
|
|
@@ -6385,8 +6418,148 @@ function bindQuery(query, inputs) {
|
|
|
6385
6418
|
return result;
|
|
6386
6419
|
}
|
|
6387
6420
|
|
|
6421
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6422
|
+
var import_design_system34 = require("@uniformdev/design-system");
|
|
6423
|
+
|
|
6424
|
+
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6425
|
+
var import_react66 = require("@emotion/react");
|
|
6426
|
+
var import_design_system33 = require("@uniformdev/design-system");
|
|
6427
|
+
var ObjectListItemContainer = import_react66.css`
|
|
6428
|
+
align-items: center;
|
|
6429
|
+
border: 1px solid var(--gray-300);
|
|
6430
|
+
border-radius: var(--rounded-base);
|
|
6431
|
+
background: var(--white);
|
|
6432
|
+
display: grid;
|
|
6433
|
+
grid-template-columns: 1fr auto;
|
|
6434
|
+
padding: var(--spacing-sm);
|
|
6435
|
+
`;
|
|
6436
|
+
var ObjectListItemContainerDisabled = import_react66.css`
|
|
6437
|
+
opacity: var(--opacity-50);
|
|
6438
|
+
pointer-events: none;
|
|
6439
|
+
`;
|
|
6440
|
+
var ObjectListItemLoading = import_react66.css`
|
|
6441
|
+
animation: ${import_design_system33.skeletonLoading} 1s linear infinite alternate;
|
|
6442
|
+
border-color: transparent;
|
|
6443
|
+
min-height: 42px;
|
|
6444
|
+
position: relative;
|
|
6445
|
+
|
|
6446
|
+
&:before,
|
|
6447
|
+
&:after {
|
|
6448
|
+
background: var(--gray-200);
|
|
6449
|
+
content: '';
|
|
6450
|
+
display: block;
|
|
6451
|
+
height: 1rem;
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6454
|
+
&:before {
|
|
6455
|
+
border-radius: var(--rounded-base);
|
|
6456
|
+
width: 10rem;
|
|
6457
|
+
}
|
|
6458
|
+
|
|
6459
|
+
&:after {
|
|
6460
|
+
border-radius: var(--rounded-full);
|
|
6461
|
+
width: 1rem;
|
|
6462
|
+
}
|
|
6463
|
+
`;
|
|
6464
|
+
var ObjectListItemHeadingGroup = import_react66.css`
|
|
6465
|
+
align-items: center;
|
|
6466
|
+
display: grid;
|
|
6467
|
+
`;
|
|
6468
|
+
var ObjectListItemThumbnail = import_react66.css`
|
|
6469
|
+
width: 30px;
|
|
6470
|
+
object-fit: contain;
|
|
6471
|
+
`;
|
|
6472
|
+
var ObjectListItemTitle = import_react66.css`
|
|
6473
|
+
color: var(--typography-base);
|
|
6474
|
+
display: block;
|
|
6475
|
+
font-size: var(--fs-sm);
|
|
6476
|
+
`;
|
|
6477
|
+
var ObjectListItemSubtitle = import_react66.css`
|
|
6478
|
+
color: var(--gray-500);
|
|
6479
|
+
display: block;
|
|
6480
|
+
font-size: var(--fs-xs);
|
|
6481
|
+
line-height: 1;
|
|
6482
|
+
`;
|
|
6483
|
+
var ObjectListItemInfoContainer = import_react66.css`
|
|
6484
|
+
align-items: center;
|
|
6485
|
+
display: flex;
|
|
6486
|
+
gap: var(--spacing-sm);
|
|
6487
|
+
justify-content: center;
|
|
6488
|
+
`;
|
|
6489
|
+
var ObjectListItemControlledContent = import_react66.css`
|
|
6490
|
+
display: flex;
|
|
6491
|
+
gap: var(--spacing-sm);
|
|
6492
|
+
`;
|
|
6493
|
+
var ObjectListItemUnControlledContent = import_react66.css`
|
|
6494
|
+
margin-top: var(--spacing-sm);
|
|
6495
|
+
grid-column: 1 / -1;
|
|
6496
|
+
`;
|
|
6497
|
+
|
|
6498
|
+
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6499
|
+
var import_jsx_runtime60 = require("@emotion/react/jsx-runtime");
|
|
6500
|
+
var ObjectSearchListItem = ({
|
|
6501
|
+
id,
|
|
6502
|
+
title,
|
|
6503
|
+
contentType,
|
|
6504
|
+
image,
|
|
6505
|
+
imageUrl,
|
|
6506
|
+
popoverData,
|
|
6507
|
+
onSelect,
|
|
6508
|
+
isMulti,
|
|
6509
|
+
disabled,
|
|
6510
|
+
children
|
|
6511
|
+
}) => {
|
|
6512
|
+
const { onSelectItem, selectedListItems, isMulti: globalIsMulti } = useObjectSearchContext();
|
|
6513
|
+
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6514
|
+
const handleSelectItem = () => {
|
|
6515
|
+
var _a;
|
|
6516
|
+
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6517
|
+
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6518
|
+
if (isMulti === true || globalIsMulti) {
|
|
6519
|
+
return onSelectItem(selectedItem);
|
|
6520
|
+
}
|
|
6521
|
+
return onSelectItem([selectedItem]);
|
|
6522
|
+
};
|
|
6523
|
+
const selected = selectedListItems.some((item) => item.id === id);
|
|
6524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
6525
|
+
"div",
|
|
6526
|
+
{
|
|
6527
|
+
role: "listitem",
|
|
6528
|
+
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6529
|
+
"data-testid": "list-item",
|
|
6530
|
+
children: [
|
|
6531
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
6532
|
+
"div",
|
|
6533
|
+
{
|
|
6534
|
+
role: "button",
|
|
6535
|
+
onClick: handleSelectItem,
|
|
6536
|
+
css: ObjectListItemControlledContent,
|
|
6537
|
+
"aria-disabled": disabled,
|
|
6538
|
+
children: [
|
|
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 })
|
|
6544
|
+
] })
|
|
6545
|
+
]
|
|
6546
|
+
}
|
|
6547
|
+
),
|
|
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 })
|
|
6551
|
+
] }),
|
|
6552
|
+
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6553
|
+
]
|
|
6554
|
+
}
|
|
6555
|
+
);
|
|
6556
|
+
};
|
|
6557
|
+
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6559
|
+
};
|
|
6560
|
+
|
|
6388
6561
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6389
|
-
var
|
|
6562
|
+
var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
|
|
6390
6563
|
var ObjectSearchContainer = ({
|
|
6391
6564
|
label,
|
|
6392
6565
|
enableDynamicInputToResultId,
|
|
@@ -6398,21 +6571,22 @@ var ObjectSearchContainer = ({
|
|
|
6398
6571
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6399
6572
|
const { flatVariables } = useVariables(true);
|
|
6400
6573
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6401
|
-
const
|
|
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: [
|
|
6402
6588
|
searchFilters,
|
|
6403
|
-
|
|
6404
|
-
import_design_system33.ScrollableList,
|
|
6405
|
-
{
|
|
6406
|
-
role: "list",
|
|
6407
|
-
css: import_react65.css`
|
|
6408
|
-
> div {
|
|
6409
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6410
|
-
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6411
|
-
}
|
|
6412
|
-
`,
|
|
6413
|
-
children: resultList
|
|
6414
|
-
}
|
|
6415
|
-
)
|
|
6589
|
+
listItems
|
|
6416
6590
|
] });
|
|
6417
6591
|
const handleSelectedVariableChange = (selectedValue) => {
|
|
6418
6592
|
var _a2;
|
|
@@ -6420,7 +6594,7 @@ var ObjectSearchContainer = ({
|
|
|
6420
6594
|
onSelectItem([]);
|
|
6421
6595
|
return;
|
|
6422
6596
|
}
|
|
6423
|
-
const { result, errors } = (0,
|
|
6597
|
+
const { result, errors } = (0, import_canvas9.bindVariables)({
|
|
6424
6598
|
value: selectedValue,
|
|
6425
6599
|
variables: flatVariables,
|
|
6426
6600
|
errorPrefix: "Dynamic input"
|
|
@@ -6441,8 +6615,8 @@ var ObjectSearchContainer = ({
|
|
|
6441
6615
|
}
|
|
6442
6616
|
]);
|
|
6443
6617
|
};
|
|
6444
|
-
return /* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6446
6620
|
InputVariables,
|
|
6447
6621
|
{
|
|
6448
6622
|
label,
|
|
@@ -6460,14 +6634,25 @@ var ObjectSearchContainer = ({
|
|
|
6460
6634
|
children
|
|
6461
6635
|
] }) });
|
|
6462
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
|
+
};
|
|
6463
6648
|
|
|
6464
6649
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6465
|
-
var
|
|
6466
|
-
var
|
|
6650
|
+
var import_design_system36 = require("@uniformdev/design-system");
|
|
6651
|
+
var import_react69 = require("react");
|
|
6467
6652
|
|
|
6468
6653
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6469
|
-
var
|
|
6470
|
-
var ObjectSearchFilterContainerLabel =
|
|
6654
|
+
var import_react68 = require("@emotion/react");
|
|
6655
|
+
var ObjectSearchFilterContainerLabel = import_react68.css`
|
|
6471
6656
|
align-items: center;
|
|
6472
6657
|
display: flex;
|
|
6473
6658
|
font-size: var(--fs-sm);
|
|
@@ -6475,18 +6660,18 @@ var ObjectSearchFilterContainerLabel = import_react66.css`
|
|
|
6475
6660
|
line-height: 1rem;
|
|
6476
6661
|
margin-bottom: var(--spacing-sm);
|
|
6477
6662
|
`;
|
|
6478
|
-
var ObjectSearchFilterContainer =
|
|
6663
|
+
var ObjectSearchFilterContainer = import_react68.css`
|
|
6479
6664
|
display: grid;
|
|
6480
6665
|
gap: var(--spacing-base);
|
|
6481
6666
|
`;
|
|
6482
|
-
var ObjectSearchFilterGrid = (gridColumns) =>
|
|
6667
|
+
var ObjectSearchFilterGrid = (gridColumns) => import_react68.css`
|
|
6483
6668
|
display: grid;
|
|
6484
6669
|
grid-template-columns: ${gridColumns};
|
|
6485
6670
|
gap: var(--spacing-base);
|
|
6486
6671
|
`;
|
|
6487
6672
|
|
|
6488
6673
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6489
|
-
var
|
|
6674
|
+
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6490
6675
|
var ObjectSearchFilter = ({
|
|
6491
6676
|
requireContentType,
|
|
6492
6677
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -6495,10 +6680,11 @@ var ObjectSearchFilter = ({
|
|
|
6495
6680
|
selectLabel = "Content Type Select",
|
|
6496
6681
|
selectOptions
|
|
6497
6682
|
}) => {
|
|
6683
|
+
var _a, _b;
|
|
6498
6684
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
6499
|
-
const [searchState, setSearchState] = (0,
|
|
6500
|
-
contentType: "",
|
|
6501
|
-
keyword: ""
|
|
6685
|
+
const [searchState, setSearchState] = (0, import_react69.useState)({
|
|
6686
|
+
contentType: (_a = query.contentType) != null ? _a : "",
|
|
6687
|
+
keyword: (_b = query.keyword) != null ? _b : ""
|
|
6502
6688
|
});
|
|
6503
6689
|
const handleFilterChange = (value) => {
|
|
6504
6690
|
setSearchState((prev) => {
|
|
@@ -6506,20 +6692,17 @@ var ObjectSearchFilter = ({
|
|
|
6506
6692
|
});
|
|
6507
6693
|
onSetQuery({ ...query, ...value });
|
|
6508
6694
|
};
|
|
6509
|
-
const memoizedSelectOptions = (0,
|
|
6695
|
+
const memoizedSelectOptions = (0, import_react69.useMemo)(() => {
|
|
6510
6696
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6511
6697
|
return [];
|
|
6512
6698
|
}
|
|
6513
6699
|
return [
|
|
6514
6700
|
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
6515
|
-
...selectOptions ? selectOptions
|
|
6516
|
-
var _a;
|
|
6517
|
-
return { name: option == null ? void 0 : option.name, label: (_a = option.label) != null ? _a : option == null ? void 0 : option.name, id: option.id };
|
|
6518
|
-
}) : []
|
|
6701
|
+
...selectOptions != null ? selectOptions : []
|
|
6519
6702
|
];
|
|
6520
6703
|
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6521
6704
|
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6522
|
-
return /* @__PURE__ */ (0,
|
|
6705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6523
6706
|
"fieldset",
|
|
6524
6707
|
{
|
|
6525
6708
|
css: [
|
|
@@ -6527,8 +6710,8 @@ var ObjectSearchFilter = ({
|
|
|
6527
6710
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6528
6711
|
],
|
|
6529
6712
|
children: [
|
|
6530
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ (0,
|
|
6531
|
-
|
|
6713
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6714
|
+
import_design_system36.InputSelect,
|
|
6532
6715
|
{
|
|
6533
6716
|
label: selectLabel,
|
|
6534
6717
|
showLabel: false,
|
|
@@ -6537,8 +6720,8 @@ var ObjectSearchFilter = ({
|
|
|
6537
6720
|
value: query.contentType
|
|
6538
6721
|
}
|
|
6539
6722
|
) : null,
|
|
6540
|
-
/* @__PURE__ */ (0,
|
|
6541
|
-
|
|
6723
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6724
|
+
import_design_system36.InputKeywordSearch,
|
|
6542
6725
|
{
|
|
6543
6726
|
inputFieldName: searchInputName,
|
|
6544
6727
|
placeholder: searchInputPlaceholderText,
|
|
@@ -6554,166 +6737,26 @@ var ObjectSearchFilter = ({
|
|
|
6554
6737
|
};
|
|
6555
6738
|
|
|
6556
6739
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6557
|
-
var
|
|
6740
|
+
var import_jsx_runtime63 = require("@emotion/react/jsx-runtime");
|
|
6558
6741
|
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6559
|
-
return /* @__PURE__ */ (0,
|
|
6560
|
-
label ? /* @__PURE__ */ (0,
|
|
6561
|
-
/* @__PURE__ */ (0,
|
|
6742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { children: [
|
|
6743
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6744
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { css: ObjectSearchFilterContainer, children })
|
|
6562
6745
|
] });
|
|
6563
6746
|
};
|
|
6564
6747
|
|
|
6565
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6566
|
-
var import_design_system36 = require("@uniformdev/design-system");
|
|
6567
|
-
|
|
6568
|
-
// src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
|
|
6569
|
-
var import_react68 = require("@emotion/react");
|
|
6570
|
-
var import_design_system35 = require("@uniformdev/design-system");
|
|
6571
|
-
var ObjectListItemContainer = import_react68.css`
|
|
6572
|
-
align-items: center;
|
|
6573
|
-
border: 1px solid var(--gray-300);
|
|
6574
|
-
border-radius: var(--rounded-base);
|
|
6575
|
-
background: var(--white);
|
|
6576
|
-
display: grid;
|
|
6577
|
-
grid-template-columns: 1fr auto;
|
|
6578
|
-
padding: var(--spacing-sm);
|
|
6579
|
-
`;
|
|
6580
|
-
var ObjectListItemContainerDisabled = import_react68.css`
|
|
6581
|
-
opacity: var(--opacity-50);
|
|
6582
|
-
pointer-events: none;
|
|
6583
|
-
`;
|
|
6584
|
-
var ObjectListItemLoading = import_react68.css`
|
|
6585
|
-
animation: ${import_design_system35.skeletonLoading} 1s linear infinite alternate;
|
|
6586
|
-
border-color: transparent;
|
|
6587
|
-
min-height: 42px;
|
|
6588
|
-
position: relative;
|
|
6589
|
-
|
|
6590
|
-
&:before,
|
|
6591
|
-
&:after {
|
|
6592
|
-
background: var(--gray-200);
|
|
6593
|
-
content: '';
|
|
6594
|
-
display: block;
|
|
6595
|
-
height: 1rem;
|
|
6596
|
-
}
|
|
6597
|
-
|
|
6598
|
-
&:before {
|
|
6599
|
-
border-radius: var(--rounded-base);
|
|
6600
|
-
width: 10rem;
|
|
6601
|
-
}
|
|
6602
|
-
|
|
6603
|
-
&:after {
|
|
6604
|
-
border-radius: var(--rounded-full);
|
|
6605
|
-
width: 1rem;
|
|
6606
|
-
}
|
|
6607
|
-
`;
|
|
6608
|
-
var ObjectListItemHeadingGroup = import_react68.css`
|
|
6609
|
-
align-items: center;
|
|
6610
|
-
display: grid;
|
|
6611
|
-
`;
|
|
6612
|
-
var ObjectListItemThumbnail = import_react68.css`
|
|
6613
|
-
width: 30px;
|
|
6614
|
-
object-fit: contain;
|
|
6615
|
-
`;
|
|
6616
|
-
var ObjectListItemTitle = import_react68.css`
|
|
6617
|
-
color: var(--brand-secondary-1);
|
|
6618
|
-
display: block;
|
|
6619
|
-
font-size: var(--fs-sm);
|
|
6620
|
-
`;
|
|
6621
|
-
var ObjectListItemSubtitle = import_react68.css`
|
|
6622
|
-
color: var(--gray-500);
|
|
6623
|
-
display: block;
|
|
6624
|
-
font-size: var(--fs-xs);
|
|
6625
|
-
line-height: 1;
|
|
6626
|
-
`;
|
|
6627
|
-
var ObjectListItemInfoContainer = import_react68.css`
|
|
6628
|
-
align-items: center;
|
|
6629
|
-
display: flex;
|
|
6630
|
-
gap: var(--spacing-sm);
|
|
6631
|
-
justify-content: center;
|
|
6632
|
-
`;
|
|
6633
|
-
var ObjectListItemControlledContent = import_react68.css`
|
|
6634
|
-
display: flex;
|
|
6635
|
-
gap: var(--spacing-sm);
|
|
6636
|
-
`;
|
|
6637
|
-
var ObjectListItemUnControlledContent = import_react68.css`
|
|
6638
|
-
margin-top: var(--spacing-sm);
|
|
6639
|
-
grid-column: 1 / -1;
|
|
6640
|
-
`;
|
|
6641
|
-
|
|
6642
|
-
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
6643
|
-
var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
|
|
6644
|
-
var ObjectSearchListItem = ({
|
|
6645
|
-
id,
|
|
6646
|
-
title,
|
|
6647
|
-
contentType,
|
|
6648
|
-
image,
|
|
6649
|
-
imageUrl,
|
|
6650
|
-
popoverData,
|
|
6651
|
-
onSelect,
|
|
6652
|
-
isMulti = false,
|
|
6653
|
-
disabled,
|
|
6654
|
-
children
|
|
6655
|
-
}) => {
|
|
6656
|
-
const { onSelectItem, selectedListItems } = useObjectSearchContext();
|
|
6657
|
-
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
6658
|
-
const handleSelectItem = () => {
|
|
6659
|
-
var _a;
|
|
6660
|
-
const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
|
|
6661
|
-
const selectedItem = { id, title, contentType, imageUrl, image, popoverData, ...extraData };
|
|
6662
|
-
if (isMulti) {
|
|
6663
|
-
return onSelectItem(selectedItem);
|
|
6664
|
-
}
|
|
6665
|
-
return onSelectItem([selectedItem]);
|
|
6666
|
-
};
|
|
6667
|
-
const selected = selectedListItems.some((item) => item.id === id);
|
|
6668
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6669
|
-
"div",
|
|
6670
|
-
{
|
|
6671
|
-
role: "listitem",
|
|
6672
|
-
css: [ObjectListItemContainer, disabled ? ObjectListItemContainerDisabled : void 0],
|
|
6673
|
-
"data-testid": "list-item",
|
|
6674
|
-
children: [
|
|
6675
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6676
|
-
"div",
|
|
6677
|
-
{
|
|
6678
|
-
role: "button",
|
|
6679
|
-
onClick: handleSelectItem,
|
|
6680
|
-
css: ObjectListItemControlledContent,
|
|
6681
|
-
"aria-disabled": disabled,
|
|
6682
|
-
children: [
|
|
6683
|
-
!imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectListItemThumbnail }),
|
|
6684
|
-
!image || imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
|
|
6685
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
6686
|
-
!contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
6687
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
6688
|
-
] })
|
|
6689
|
-
]
|
|
6690
|
-
}
|
|
6691
|
-
),
|
|
6692
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
6693
|
-
selected ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Chip, { text: "selected", size: "xs" }) : null,
|
|
6694
|
-
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
|
|
6695
|
-
] }),
|
|
6696
|
-
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
6697
|
-
]
|
|
6698
|
-
}
|
|
6699
|
-
);
|
|
6700
|
-
};
|
|
6701
|
-
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
6702
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6703
|
-
};
|
|
6704
|
-
|
|
6705
6748
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6706
6749
|
var import_design_system38 = require("@uniformdev/design-system");
|
|
6707
6750
|
var import_timeago3 = require("timeago.js");
|
|
6708
6751
|
|
|
6709
6752
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6710
|
-
var
|
|
6753
|
+
var import_react70 = require("@emotion/react");
|
|
6711
6754
|
var import_design_system37 = require("@uniformdev/design-system");
|
|
6712
|
-
var ButtonStyles =
|
|
6755
|
+
var ButtonStyles = import_react70.css`
|
|
6713
6756
|
${import_design_system37.button}
|
|
6714
6757
|
background: transparent;
|
|
6715
|
-
border: 1px solid var(--
|
|
6716
|
-
color: var(--
|
|
6758
|
+
border: 1px solid var(--typography-base);
|
|
6759
|
+
color: var(--typography-base);
|
|
6717
6760
|
padding: var(--spacing-sm);
|
|
6718
6761
|
font-size: var(--fs-sm);
|
|
6719
6762
|
line-height: 1;
|
|
@@ -6736,20 +6779,20 @@ var ButtonStyles = import_react69.css`
|
|
|
6736
6779
|
text-decoration: none;
|
|
6737
6780
|
}
|
|
6738
6781
|
`;
|
|
6739
|
-
var ButtonIcon =
|
|
6782
|
+
var ButtonIcon = import_react70.css`
|
|
6740
6783
|
width: 1rem;
|
|
6741
6784
|
height: 1rem;
|
|
6742
6785
|
`;
|
|
6743
6786
|
|
|
6744
6787
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6745
|
-
var
|
|
6788
|
+
var import_jsx_runtime64 = require("@emotion/react/jsx-runtime");
|
|
6746
6789
|
var ObjectSearchResultItemButton = ({
|
|
6747
6790
|
text,
|
|
6748
6791
|
icon,
|
|
6749
6792
|
...props
|
|
6750
6793
|
}) => {
|
|
6751
|
-
return /* @__PURE__ */ (0,
|
|
6752
|
-
!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 }),
|
|
6753
6796
|
text
|
|
6754
6797
|
] });
|
|
6755
6798
|
};
|
|
@@ -6758,15 +6801,15 @@ var LinkButton = ({
|
|
|
6758
6801
|
icon,
|
|
6759
6802
|
...props
|
|
6760
6803
|
}) => {
|
|
6761
|
-
return /* @__PURE__ */ (0,
|
|
6762
|
-
!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 }),
|
|
6763
6806
|
text
|
|
6764
6807
|
] });
|
|
6765
6808
|
};
|
|
6766
6809
|
|
|
6767
6810
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6768
|
-
var
|
|
6769
|
-
var ObjectSearchResultItemContainer =
|
|
6811
|
+
var import_react71 = require("@emotion/react");
|
|
6812
|
+
var ObjectSearchResultItemContainer = import_react71.css`
|
|
6770
6813
|
align-items: center;
|
|
6771
6814
|
border: 1px solid var(--gray-300);
|
|
6772
6815
|
border-radius: var(--rounded-base);
|
|
@@ -6782,7 +6825,7 @@ var ObjectSearchResultItemContainer = import_react70.css`
|
|
|
6782
6825
|
}
|
|
6783
6826
|
}
|
|
6784
6827
|
`;
|
|
6785
|
-
var ObjectSearchDragHandle =
|
|
6828
|
+
var ObjectSearchDragHandle = import_react71.css`
|
|
6786
6829
|
border-left: 2px dotted var(--gray-300);
|
|
6787
6830
|
border-right: 2px dotted var(--gray-300);
|
|
6788
6831
|
position: absolute;
|
|
@@ -6791,41 +6834,41 @@ var ObjectSearchDragHandle = import_react70.css`
|
|
|
6791
6834
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6792
6835
|
opacity: 0;
|
|
6793
6836
|
`;
|
|
6794
|
-
var ObjectSearchResultItemSubtitle =
|
|
6837
|
+
var ObjectSearchResultItemSubtitle = import_react71.css`
|
|
6795
6838
|
color: var(--gray-500);
|
|
6796
6839
|
display: block;
|
|
6797
6840
|
font-size: var(--fs-xs);
|
|
6798
6841
|
line-height: 1;
|
|
6799
6842
|
`;
|
|
6800
|
-
var ObjectSearchResultItemTitle =
|
|
6843
|
+
var ObjectSearchResultItemTitle = import_react71.css`
|
|
6801
6844
|
align-items: center;
|
|
6802
|
-
color: var(--
|
|
6845
|
+
color: var(--typography-base);
|
|
6803
6846
|
display: flex;
|
|
6804
6847
|
gap: var(--spacing-xs);
|
|
6805
6848
|
`;
|
|
6806
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6849
|
+
var ObjectSearchResultItemTimeStamp = import_react71.css`
|
|
6807
6850
|
color: var(--gray-500);
|
|
6808
6851
|
font-size: var(--fs-xs);
|
|
6809
6852
|
`;
|
|
6810
|
-
var ObjectSearchAuthorStateGroup =
|
|
6853
|
+
var ObjectSearchAuthorStateGroup = import_react71.css`
|
|
6811
6854
|
align-items: center;
|
|
6812
6855
|
display: flex;
|
|
6813
6856
|
gap: var(--spacing-sm);
|
|
6814
6857
|
`;
|
|
6815
|
-
var ObjectSearchUpdateGroup =
|
|
6858
|
+
var ObjectSearchUpdateGroup = import_react71.css`
|
|
6816
6859
|
display: grid;
|
|
6817
6860
|
`;
|
|
6818
|
-
var ObjectSearchContentContainer =
|
|
6861
|
+
var ObjectSearchContentContainer = import_react71.css`
|
|
6819
6862
|
display: flex;
|
|
6820
6863
|
gap: var(--spacing-base);
|
|
6821
6864
|
`;
|
|
6822
|
-
var ObjectSearchImage =
|
|
6865
|
+
var ObjectSearchImage = import_react71.css`
|
|
6823
6866
|
width: 56px;
|
|
6824
6867
|
object-fit: contain;
|
|
6825
6868
|
`;
|
|
6826
6869
|
|
|
6827
6870
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6828
|
-
var
|
|
6871
|
+
var import_jsx_runtime65 = require("@emotion/react/jsx-runtime");
|
|
6829
6872
|
var ObjectSearchResultItem = ({
|
|
6830
6873
|
id,
|
|
6831
6874
|
title,
|
|
@@ -6849,79 +6892,80 @@ var ObjectSearchResultItem = ({
|
|
|
6849
6892
|
onSelectItem({ id, title: id });
|
|
6850
6893
|
onRemove == null ? void 0 : onRemove();
|
|
6851
6894
|
};
|
|
6852
|
-
return /* @__PURE__ */ (0,
|
|
6853
|
-
disableDnD ? null : /* @__PURE__ */ (0,
|
|
6854
|
-
/* @__PURE__ */ (0,
|
|
6855
|
-
!imageUrl ? null : /* @__PURE__ */ (0,
|
|
6856
|
-
/* @__PURE__ */ (0,
|
|
6857
|
-
/* @__PURE__ */ (0,
|
|
6858
|
-
/* @__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: [
|
|
6859
6902
|
title != null ? title : name,
|
|
6860
|
-
!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 })
|
|
6861
6904
|
] }),
|
|
6862
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */ (0,
|
|
6863
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0,
|
|
6864
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */ (0,
|
|
6865
|
-
!createdAt ? null : /* @__PURE__ */ (0,
|
|
6866
|
-
/* @__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: " }),
|
|
6867
6910
|
(0, import_timeago3.format)(createdAt)
|
|
6868
6911
|
] }),
|
|
6869
|
-
!publishedAt ? null : /* @__PURE__ */ (0,
|
|
6870
|
-
/* @__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: " }),
|
|
6871
6914
|
(0, import_timeago3.format)(publishedAt)
|
|
6872
6915
|
] })
|
|
6873
6916
|
] })
|
|
6874
6917
|
] }),
|
|
6875
|
-
/* @__PURE__ */ (0,
|
|
6918
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children })
|
|
6876
6919
|
] })
|
|
6877
6920
|
] }) }),
|
|
6878
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
6879
|
-
!editLink ? null : /* @__PURE__ */ (0,
|
|
6880
|
-
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" })
|
|
6881
6924
|
] })
|
|
6882
6925
|
] });
|
|
6883
6926
|
};
|
|
6884
6927
|
|
|
6885
6928
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6886
6929
|
var import_design_system39 = require("@uniformdev/design-system");
|
|
6887
|
-
var
|
|
6930
|
+
var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
|
|
6888
6931
|
|
|
6889
6932
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6890
|
-
var
|
|
6891
|
-
var ObjectSearchResultListContainer =
|
|
6933
|
+
var import_react72 = require("@emotion/react");
|
|
6934
|
+
var ObjectSearchResultListContainer = import_react72.css`
|
|
6892
6935
|
align-items: center;
|
|
6893
6936
|
display: flex;
|
|
6894
6937
|
gap: var(--spacing-sm);
|
|
6895
6938
|
justify-content: space-between;
|
|
6896
6939
|
`;
|
|
6897
|
-
var ObjectSearchDragContainer =
|
|
6940
|
+
var ObjectSearchDragContainer = import_react72.css`
|
|
6898
6941
|
margin: 0 0 var(--spacing-sm);
|
|
6899
6942
|
`;
|
|
6900
|
-
var ObjectSearchContainerDragging =
|
|
6943
|
+
var ObjectSearchContainerDragging = import_react72.css`
|
|
6901
6944
|
box-shadow: var(--shadow-base);
|
|
6902
6945
|
opacity: var(--opacity-50);
|
|
6903
6946
|
`;
|
|
6904
|
-
var ObjectSearchResultListCounterContainer =
|
|
6947
|
+
var ObjectSearchResultListCounterContainer = import_react72.css`
|
|
6905
6948
|
align-items: center;
|
|
6906
6949
|
display: flex;
|
|
6907
6950
|
gap: var(--spacing-sm);
|
|
6908
6951
|
`;
|
|
6909
|
-
var ObjectSearchResultListTitle =
|
|
6952
|
+
var ObjectSearchResultListTitle = import_react72.css`
|
|
6910
6953
|
font-weight: var(--fw-bold);
|
|
6911
6954
|
line-height: 1;
|
|
6912
6955
|
`;
|
|
6913
6956
|
|
|
6914
6957
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6915
|
-
var
|
|
6958
|
+
var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
|
|
6916
6959
|
function ObjectSearchResultList({
|
|
6917
6960
|
resultLabelText = "Selected",
|
|
6918
6961
|
removeButtonText = "Remove all",
|
|
6919
6962
|
onRemoveAllSelected,
|
|
6920
6963
|
hideRemoveButton = false,
|
|
6921
6964
|
additionalButtons,
|
|
6922
|
-
renderResultComponent = (value) => /* @__PURE__ */ (0,
|
|
6965
|
+
renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ObjectSearchResultItem, { ...value }),
|
|
6923
6966
|
multiSelectId,
|
|
6924
6967
|
disableDnD = false,
|
|
6968
|
+
getContainerForDnDReparenting,
|
|
6925
6969
|
whenNothingSelected = null
|
|
6926
6970
|
}) {
|
|
6927
6971
|
const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useObjectSearchContext();
|
|
@@ -6939,16 +6983,37 @@ function ObjectSearchResultList({
|
|
|
6939
6983
|
return result;
|
|
6940
6984
|
}
|
|
6941
6985
|
};
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
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 }),
|
|
6946
7011
|
" ",
|
|
6947
|
-
!selectedListItems.length ? null : /* @__PURE__ */ (0,
|
|
7012
|
+
!selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_design_system39.Counter, { count: selectedListItems.length })
|
|
6948
7013
|
] }),
|
|
6949
|
-
/* @__PURE__ */ (0,
|
|
7014
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
6950
7015
|
additionalButtons,
|
|
6951
|
-
hideRemoveButton ? null : /* @__PURE__ */ (0,
|
|
7016
|
+
hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6952
7017
|
import_design_system39.Button,
|
|
6953
7018
|
{
|
|
6954
7019
|
buttonType: "ghostDestructive",
|
|
@@ -6960,43 +7025,36 @@ function ObjectSearchResultList({
|
|
|
6960
7025
|
)
|
|
6961
7026
|
] })
|
|
6962
7027
|
] }),
|
|
6963
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0,
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
6974
|
-
"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,
|
|
6975
7038
|
{
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
item.id
|
|
6989
|
-
);
|
|
6990
|
-
}),
|
|
6991
|
-
provided.placeholder
|
|
6992
|
-
] }) }) })
|
|
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
|
+
) })
|
|
6993
7051
|
] });
|
|
6994
7052
|
}
|
|
6995
7053
|
|
|
6996
7054
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
6997
7055
|
var import_design_system40 = require("@uniformdev/design-system");
|
|
6998
|
-
var
|
|
6999
|
-
var
|
|
7056
|
+
var import_react73 = require("react");
|
|
7057
|
+
var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
|
|
7000
7058
|
var QueryFilter = ({
|
|
7001
7059
|
requireContentType,
|
|
7002
7060
|
queryFilterTitle = "Configure Query",
|
|
@@ -7025,34 +7083,34 @@ var QueryFilter = ({
|
|
|
7025
7083
|
],
|
|
7026
7084
|
children
|
|
7027
7085
|
}) => {
|
|
7028
|
-
var _a, _b, _c, _d;
|
|
7086
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7029
7087
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
7030
|
-
const [queryState, setQueryState] = (0,
|
|
7031
|
-
contentType: "",
|
|
7032
|
-
keyword: "",
|
|
7088
|
+
const [queryState, setQueryState] = (0, import_react73.useState)({
|
|
7089
|
+
contentType: (_a = query.contentType) != null ? _a : "",
|
|
7090
|
+
keyword: (_b = query.contentType) != null ? _b : "",
|
|
7033
7091
|
count: countValue != null ? countValue : 5,
|
|
7034
|
-
sortBy: (
|
|
7035
|
-
sortOrder: (
|
|
7092
|
+
sortBy: (_c = sortOptions[0].id) != null ? _c : "",
|
|
7093
|
+
sortOrder: (_d = sortOrderOptions[0].id) != null ? _d : ""
|
|
7036
7094
|
});
|
|
7037
7095
|
const handleFilterChange = (value) => {
|
|
7038
7096
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7039
7097
|
onSetQuery({ ...query, ...value });
|
|
7040
7098
|
};
|
|
7041
|
-
(0,
|
|
7099
|
+
(0, import_react73.useEffect)(() => {
|
|
7042
7100
|
onSetQuery(queryState);
|
|
7043
7101
|
}, [onSetQuery, queryState]);
|
|
7044
|
-
return /* @__PURE__ */ (0,
|
|
7045
|
-
/* @__PURE__ */ (0,
|
|
7046
|
-
/* @__PURE__ */ (0,
|
|
7047
|
-
/* @__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)(
|
|
7048
7106
|
InputVariables,
|
|
7049
7107
|
{
|
|
7050
7108
|
label: searchInputLabel,
|
|
7051
|
-
value: (
|
|
7109
|
+
value: (_e = queryState.keyword) != null ? _e : "",
|
|
7052
7110
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
7053
7111
|
disableInlineMenu: true,
|
|
7054
7112
|
id: "qf_searchText",
|
|
7055
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7113
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7056
7114
|
import_design_system40.InputKeywordSearch,
|
|
7057
7115
|
{
|
|
7058
7116
|
id: "qf_searchText",
|
|
@@ -7066,16 +7124,16 @@ var QueryFilter = ({
|
|
|
7066
7124
|
)
|
|
7067
7125
|
}
|
|
7068
7126
|
),
|
|
7069
|
-
/* @__PURE__ */ (0,
|
|
7070
|
-
/* @__PURE__ */ (0,
|
|
7127
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
7128
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7071
7129
|
InputVariables,
|
|
7072
7130
|
{
|
|
7073
7131
|
label: contentTypeLabel,
|
|
7074
7132
|
id: "qf_contentType",
|
|
7075
|
-
value: (
|
|
7133
|
+
value: (_f = queryState.contentType) != null ? _f : "",
|
|
7076
7134
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
7077
7135
|
disableInlineMenu: true,
|
|
7078
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7136
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7079
7137
|
import_design_system40.InputSelect,
|
|
7080
7138
|
{
|
|
7081
7139
|
id: "qf_contentType",
|
|
@@ -7094,7 +7152,7 @@ var QueryFilter = ({
|
|
|
7094
7152
|
)
|
|
7095
7153
|
}
|
|
7096
7154
|
),
|
|
7097
|
-
/* @__PURE__ */ (0,
|
|
7155
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7098
7156
|
InputVariables,
|
|
7099
7157
|
{
|
|
7100
7158
|
label: countLabel,
|
|
@@ -7102,7 +7160,7 @@ var QueryFilter = ({
|
|
|
7102
7160
|
value: queryState.count.toString(10),
|
|
7103
7161
|
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
7104
7162
|
disableInlineMenu: true,
|
|
7105
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7163
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7106
7164
|
import_design_system40.Input,
|
|
7107
7165
|
{
|
|
7108
7166
|
id: "qf_count",
|
|
@@ -7117,8 +7175,8 @@ var QueryFilter = ({
|
|
|
7117
7175
|
}
|
|
7118
7176
|
)
|
|
7119
7177
|
] }),
|
|
7120
|
-
/* @__PURE__ */ (0,
|
|
7121
|
-
/* @__PURE__ */ (0,
|
|
7178
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
7179
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7122
7180
|
InputVariables,
|
|
7123
7181
|
{
|
|
7124
7182
|
id: "qf_sortBy",
|
|
@@ -7126,7 +7184,7 @@ var QueryFilter = ({
|
|
|
7126
7184
|
value: queryState.sortBy,
|
|
7127
7185
|
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
7128
7186
|
disableInlineMenu: true,
|
|
7129
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7187
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7130
7188
|
import_design_system40.InputSelect,
|
|
7131
7189
|
{
|
|
7132
7190
|
label: sortLabel,
|
|
@@ -7148,7 +7206,7 @@ var QueryFilter = ({
|
|
|
7148
7206
|
)
|
|
7149
7207
|
}
|
|
7150
7208
|
),
|
|
7151
|
-
/* @__PURE__ */ (0,
|
|
7209
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7152
7210
|
InputVariables,
|
|
7153
7211
|
{
|
|
7154
7212
|
label: sortOrderLabel,
|
|
@@ -7156,7 +7214,7 @@ var QueryFilter = ({
|
|
|
7156
7214
|
value: queryState.sortOrder,
|
|
7157
7215
|
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
7158
7216
|
disableInlineMenu: true,
|
|
7159
|
-
inputWhenNoVariables: /* @__PURE__ */ (0,
|
|
7217
|
+
inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7160
7218
|
import_design_system40.InputSelect,
|
|
7161
7219
|
{
|
|
7162
7220
|
label: sortOrderLabel,
|
|
@@ -7181,8 +7239,8 @@ var QueryFilter = ({
|
|
|
7181
7239
|
};
|
|
7182
7240
|
|
|
7183
7241
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
7184
|
-
var
|
|
7185
|
-
var
|
|
7242
|
+
var import_react74 = require("react");
|
|
7243
|
+
var import_jsx_runtime68 = require("@emotion/react/jsx-runtime");
|
|
7186
7244
|
function ParamTypeDynamicDataProvider(props) {
|
|
7187
7245
|
const { children } = props;
|
|
7188
7246
|
const {
|
|
@@ -7190,11 +7248,11 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
7190
7248
|
} = useMeshLocation("paramType");
|
|
7191
7249
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
7192
7250
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
7193
|
-
const variables = (0,
|
|
7251
|
+
const variables = (0, import_react74.useMemo)(
|
|
7194
7252
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
7195
7253
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
7196
7254
|
);
|
|
7197
|
-
return /* @__PURE__ */ (0,
|
|
7255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(VariablesProvider, { value: variables, onChange: () => {
|
|
7198
7256
|
}, editVariableComponent: JsonMeshVariableEditor, children });
|
|
7199
7257
|
}
|
|
7200
7258
|
var JsonMeshVariableEditor = ({
|
|
@@ -7203,9 +7261,9 @@ var JsonMeshVariableEditor = ({
|
|
|
7203
7261
|
variable,
|
|
7204
7262
|
context
|
|
7205
7263
|
}) => {
|
|
7206
|
-
const sillyRef = (0,
|
|
7264
|
+
const sillyRef = (0, import_react74.useRef)(false);
|
|
7207
7265
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
7208
|
-
(0,
|
|
7266
|
+
(0, import_react74.useEffect)(() => {
|
|
7209
7267
|
if (sillyRef.current) {
|
|
7210
7268
|
return;
|
|
7211
7269
|
}
|
|
@@ -7241,6 +7299,28 @@ function createLocationValidator(setValue, validate) {
|
|
|
7241
7299
|
});
|
|
7242
7300
|
}
|
|
7243
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
|
+
|
|
7244
7324
|
// src/index.ts
|
|
7245
7325
|
var import_design_system41 = require("@uniformdev/design-system");
|
|
7246
7326
|
__reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
@@ -7410,6 +7490,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
7410
7490
|
urlEncodeRequestParameter,
|
|
7411
7491
|
urlEncodeRequestUrl,
|
|
7412
7492
|
useConnectedDataAsVariables,
|
|
7493
|
+
useContentDataResourceLocaleInfo,
|
|
7413
7494
|
useDynamicInputsAsVariables,
|
|
7414
7495
|
useMeshLocation,
|
|
7415
7496
|
useObjectSearchContext,
|