@uniformdev/mesh-sdk-react 19.136.1-alpha.4 → 19.138.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +51 -107
- package/dist/index.d.ts +51 -107
- package/dist/index.esm.js +305 -463
- package/dist/index.js +388 -552
- package/dist/index.mjs +305 -463
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -2652,9 +2652,6 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2652
2652
|
] }) : null;
|
|
2653
2653
|
}
|
|
2654
2654
|
|
|
2655
|
-
// src/components/DataResourceDynamicInputProvider.tsx
|
|
2656
|
-
import { createContext as createContext4, useContext as useContext6 } from "react";
|
|
2657
|
-
|
|
2658
2655
|
// src/hooks/useConnectedDataAsVariables.tsx
|
|
2659
2656
|
import { useMemo as useMemo3 } from "react";
|
|
2660
2657
|
function useConnectedDataAsVariables(connectedData) {
|
|
@@ -4904,7 +4901,7 @@ function InputVariables(props) {
|
|
|
4904
4901
|
},
|
|
4905
4902
|
id: finalId,
|
|
4906
4903
|
isActive: hadVariablesInValue,
|
|
4907
|
-
disableVariables: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu ===
|
|
4904
|
+
disableVariables: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu === "by-label",
|
|
4908
4905
|
children: input3
|
|
4909
4906
|
}
|
|
4910
4907
|
);
|
|
@@ -5377,10 +5374,6 @@ function VariablesList() {
|
|
|
5377
5374
|
|
|
5378
5375
|
// src/components/DataResourceDynamicInputProvider.tsx
|
|
5379
5376
|
import { jsx as jsx45 } from "@emotion/react/jsx-runtime";
|
|
5380
|
-
var DataResourceInputContext = createContext4(void 0);
|
|
5381
|
-
var useDataResourceDynamicInputs = () => {
|
|
5382
|
-
return useContext6(DataResourceInputContext);
|
|
5383
|
-
};
|
|
5384
5377
|
function DataResourceDynamicInputProvider(props) {
|
|
5385
5378
|
const { children, dynamicInputs } = props;
|
|
5386
5379
|
if (dynamicInputs) {
|
|
@@ -5399,7 +5392,7 @@ function DataResourceDynamicInputProviderRenderer({
|
|
|
5399
5392
|
dynamicInputs
|
|
5400
5393
|
}) {
|
|
5401
5394
|
const variables = useDynamicInputsAsVariables(dynamicInputs);
|
|
5402
|
-
return /* @__PURE__ */ jsx45(
|
|
5395
|
+
return /* @__PURE__ */ jsx45(VariablesProvider, { value: variables, readOnly: true, children });
|
|
5403
5396
|
}
|
|
5404
5397
|
|
|
5405
5398
|
// src/components/DataResourceVariablesList.tsx
|
|
@@ -6266,23 +6259,22 @@ var DataRefreshButton = ({
|
|
|
6266
6259
|
};
|
|
6267
6260
|
|
|
6268
6261
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6269
|
-
import { css as
|
|
6262
|
+
import { css as css33 } from "@emotion/react";
|
|
6270
6263
|
import { bindVariables } from "@uniformdev/canvas";
|
|
6271
6264
|
import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
|
|
6272
|
-
import React12 from "react";
|
|
6273
6265
|
|
|
6274
6266
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
6275
6267
|
import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
|
|
6276
6268
|
import {
|
|
6277
|
-
createContext as
|
|
6269
|
+
createContext as createContext5,
|
|
6278
6270
|
useCallback as useCallback5,
|
|
6279
|
-
useContext as
|
|
6271
|
+
useContext as useContext7,
|
|
6280
6272
|
useDeferredValue,
|
|
6281
6273
|
useMemo as useMemo14,
|
|
6282
6274
|
useState as useState16
|
|
6283
6275
|
} from "react";
|
|
6284
6276
|
import { jsx as jsx59 } from "@emotion/react/jsx-runtime";
|
|
6285
|
-
var ObjectSearchContext =
|
|
6277
|
+
var ObjectSearchContext = createContext5({
|
|
6286
6278
|
onSetQuery: () => {
|
|
6287
6279
|
},
|
|
6288
6280
|
onSelectItem: () => {
|
|
@@ -6290,6 +6282,8 @@ var ObjectSearchContext = createContext6({
|
|
|
6290
6282
|
query: {},
|
|
6291
6283
|
boundQuery: {},
|
|
6292
6284
|
list: {},
|
|
6285
|
+
onSetList: () => {
|
|
6286
|
+
},
|
|
6293
6287
|
selectedListItems: [],
|
|
6294
6288
|
onRemoveAllSelectedItems: () => {
|
|
6295
6289
|
},
|
|
@@ -6373,7 +6367,7 @@ var ObjectSearchProvider = ({
|
|
|
6373
6367
|
return /* @__PURE__ */ jsx59(ObjectSearchContext.Provider, { value, children });
|
|
6374
6368
|
};
|
|
6375
6369
|
function useObjectSearchContext() {
|
|
6376
|
-
return
|
|
6370
|
+
return useContext7(ObjectSearchContext);
|
|
6377
6371
|
}
|
|
6378
6372
|
function bindQuery(query, inputs) {
|
|
6379
6373
|
const { result, errors } = bindVariablesToObject2({
|
|
@@ -6529,18 +6523,201 @@ var ObjectSearchListItemLoadingSkeleton = () => {
|
|
|
6529
6523
|
return /* @__PURE__ */ jsx60("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
6530
6524
|
};
|
|
6531
6525
|
|
|
6532
|
-
// src/components/ObjectSearch/
|
|
6533
|
-
import {
|
|
6534
|
-
|
|
6526
|
+
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6527
|
+
import { jsx as jsx61, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
|
|
6528
|
+
var ObjectSearchContainer = ({
|
|
6529
|
+
label,
|
|
6530
|
+
enableDynamicInputToResultId,
|
|
6531
|
+
searchFilters,
|
|
6532
|
+
resultList,
|
|
6533
|
+
children
|
|
6534
|
+
}) => {
|
|
6535
|
+
var _a, _b;
|
|
6536
|
+
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
6537
|
+
const { flatVariables } = useVariables(true);
|
|
6538
|
+
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6539
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx61(
|
|
6540
|
+
ScrollableList,
|
|
6541
|
+
{
|
|
6542
|
+
role: "list",
|
|
6543
|
+
css: css33`
|
|
6544
|
+
> div {
|
|
6545
|
+
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6546
|
+
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6547
|
+
}
|
|
6548
|
+
`,
|
|
6549
|
+
children: /* @__PURE__ */ jsx61(DefaultResultList, {})
|
|
6550
|
+
}
|
|
6551
|
+
);
|
|
6552
|
+
const body = /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
|
|
6553
|
+
searchFilters,
|
|
6554
|
+
listItems
|
|
6555
|
+
] });
|
|
6556
|
+
const handleSelectedVariableChange = (selectedValue) => {
|
|
6557
|
+
var _a2;
|
|
6558
|
+
if (!selectedValue) {
|
|
6559
|
+
onSelectItem([]);
|
|
6560
|
+
return;
|
|
6561
|
+
}
|
|
6562
|
+
const { result, errors } = bindVariables({
|
|
6563
|
+
value: selectedValue,
|
|
6564
|
+
variables: flatVariables,
|
|
6565
|
+
errorPrefix: "Dynamic input"
|
|
6566
|
+
});
|
|
6567
|
+
if (!result) {
|
|
6568
|
+
onSelectItem([]);
|
|
6569
|
+
return;
|
|
6570
|
+
}
|
|
6571
|
+
const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
|
|
6572
|
+
onSelectItem([
|
|
6573
|
+
{
|
|
6574
|
+
title: selectedValue,
|
|
6575
|
+
contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
|
|
6576
|
+
// spread any matched list item, overriding the above default props
|
|
6577
|
+
...item,
|
|
6578
|
+
// we want to make sure the ID is our dynamic value
|
|
6579
|
+
id: selectedValue
|
|
6580
|
+
}
|
|
6581
|
+
]);
|
|
6582
|
+
};
|
|
6583
|
+
return /* @__PURE__ */ jsx61(IconsProvider, { children: /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
|
|
6584
|
+
/* @__PURE__ */ jsx61(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx61(
|
|
6585
|
+
InputVariables,
|
|
6586
|
+
{
|
|
6587
|
+
label,
|
|
6588
|
+
value: inputValue,
|
|
6589
|
+
onChange: (value) => {
|
|
6590
|
+
if (value === inputValue) {
|
|
6591
|
+
return;
|
|
6592
|
+
}
|
|
6593
|
+
handleSelectedVariableChange(value);
|
|
6594
|
+
},
|
|
6595
|
+
inputWhenNoVariables: body,
|
|
6596
|
+
disableVariables: !enableDynamicInputToResultId
|
|
6597
|
+
}
|
|
6598
|
+
) : body }),
|
|
6599
|
+
children
|
|
6600
|
+
] }) });
|
|
6601
|
+
};
|
|
6602
|
+
var DefaultResultList = () => {
|
|
6603
|
+
var _a;
|
|
6604
|
+
const { list } = useObjectSearchContext();
|
|
6605
|
+
if (!list.items) {
|
|
6606
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx61(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6607
|
+
}
|
|
6608
|
+
if (list.items.length === 0) {
|
|
6609
|
+
return /* @__PURE__ */ jsx61(Callout5, { type: "info", children: "No results were found" });
|
|
6610
|
+
}
|
|
6611
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx61(ObjectSearchListItem, { ...item }, item.id));
|
|
6612
|
+
};
|
|
6613
|
+
|
|
6614
|
+
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6615
|
+
import { DebouncedInputKeywordSearch, InputSelect as InputSelect6 } from "@uniformdev/design-system";
|
|
6616
|
+
import { useMemo as useMemo15, useState as useState17 } from "react";
|
|
6617
|
+
|
|
6618
|
+
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6619
|
+
import { css as css34 } from "@emotion/react";
|
|
6620
|
+
var ObjectSearchFilterContainerLabel = css34`
|
|
6621
|
+
align-items: center;
|
|
6622
|
+
display: flex;
|
|
6623
|
+
font-size: var(--fs-sm);
|
|
6624
|
+
font-weight: var(--fw-bold);
|
|
6625
|
+
line-height: 1rem;
|
|
6626
|
+
margin-bottom: var(--spacing-sm);
|
|
6627
|
+
`;
|
|
6628
|
+
var ObjectSearchFilterContainer = css34`
|
|
6629
|
+
display: grid;
|
|
6630
|
+
gap: var(--spacing-base);
|
|
6631
|
+
`;
|
|
6632
|
+
var ObjectSearchFilterGrid = (gridColumns) => css34`
|
|
6633
|
+
display: grid;
|
|
6634
|
+
grid-template-columns: ${gridColumns};
|
|
6635
|
+
gap: var(--spacing-base);
|
|
6636
|
+
`;
|
|
6637
|
+
|
|
6638
|
+
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6639
|
+
import { jsx as jsx62, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
|
|
6640
|
+
var ObjectSearchFilter = ({
|
|
6641
|
+
requireContentType,
|
|
6642
|
+
typeSelectorAllTypesOptionText = "All content types",
|
|
6643
|
+
searchInputName = "searchText",
|
|
6644
|
+
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
6645
|
+
selectLabel = "Content Type Select",
|
|
6646
|
+
selectOptions
|
|
6647
|
+
}) => {
|
|
6648
|
+
var _a, _b;
|
|
6649
|
+
const { query, onSetQuery } = useObjectSearchContext();
|
|
6650
|
+
const [searchState, setSearchState] = useState17({
|
|
6651
|
+
contentType: (_a = query.contentType) != null ? _a : "",
|
|
6652
|
+
keyword: (_b = query.keyword) != null ? _b : ""
|
|
6653
|
+
});
|
|
6654
|
+
const handleFilterChange = (value) => {
|
|
6655
|
+
setSearchState((prev) => {
|
|
6656
|
+
return { ...prev, ...value };
|
|
6657
|
+
});
|
|
6658
|
+
onSetQuery({ ...query, ...value });
|
|
6659
|
+
};
|
|
6660
|
+
const memoizedSelectOptions = useMemo15(() => {
|
|
6661
|
+
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
6662
|
+
return [];
|
|
6663
|
+
}
|
|
6664
|
+
return [
|
|
6665
|
+
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
6666
|
+
...selectOptions != null ? selectOptions : []
|
|
6667
|
+
];
|
|
6668
|
+
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
6669
|
+
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
6670
|
+
return /* @__PURE__ */ jsxs36(
|
|
6671
|
+
"fieldset",
|
|
6672
|
+
{
|
|
6673
|
+
css: [
|
|
6674
|
+
ObjectSearchFilterContainer,
|
|
6675
|
+
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
6676
|
+
],
|
|
6677
|
+
children: [
|
|
6678
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ jsx62(
|
|
6679
|
+
InputSelect6,
|
|
6680
|
+
{
|
|
6681
|
+
label: selectLabel,
|
|
6682
|
+
showLabel: false,
|
|
6683
|
+
onChange: (e) => handleFilterChange({ contentType: e.target.value }),
|
|
6684
|
+
options: memoizedSelectOptions,
|
|
6685
|
+
value: query.contentType
|
|
6686
|
+
}
|
|
6687
|
+
) : null,
|
|
6688
|
+
/* @__PURE__ */ jsx62(
|
|
6689
|
+
DebouncedInputKeywordSearch,
|
|
6690
|
+
{
|
|
6691
|
+
inputFieldName: searchInputName,
|
|
6692
|
+
placeholder: searchInputPlaceholderText,
|
|
6693
|
+
onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
|
|
6694
|
+
disabledFieldSubmission: true,
|
|
6695
|
+
defaultValue: searchState.keyword,
|
|
6696
|
+
delay: 300
|
|
6697
|
+
}
|
|
6698
|
+
)
|
|
6699
|
+
]
|
|
6700
|
+
}
|
|
6701
|
+
);
|
|
6702
|
+
};
|
|
6703
|
+
|
|
6704
|
+
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
6705
|
+
import { jsx as jsx63, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
|
|
6706
|
+
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
6707
|
+
return /* @__PURE__ */ jsxs37("div", { children: [
|
|
6708
|
+
label ? /* @__PURE__ */ jsx63("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
6709
|
+
/* @__PURE__ */ jsx63("div", { css: ObjectSearchFilterContainer, children })
|
|
6710
|
+
] });
|
|
6711
|
+
};
|
|
6535
6712
|
|
|
6536
6713
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6537
6714
|
import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/design-system";
|
|
6538
6715
|
import { format as timeagoFormat } from "timeago.js";
|
|
6539
6716
|
|
|
6540
6717
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
6541
|
-
import { css as
|
|
6718
|
+
import { css as css35 } from "@emotion/react";
|
|
6542
6719
|
import { button as button2 } from "@uniformdev/design-system";
|
|
6543
|
-
var ButtonStyles =
|
|
6720
|
+
var ButtonStyles = css35`
|
|
6544
6721
|
${button2}
|
|
6545
6722
|
background: transparent;
|
|
6546
6723
|
border: 1px solid var(--typography-base);
|
|
@@ -6567,20 +6744,20 @@ var ButtonStyles = css33`
|
|
|
6567
6744
|
text-decoration: none;
|
|
6568
6745
|
}
|
|
6569
6746
|
`;
|
|
6570
|
-
var ButtonIcon =
|
|
6747
|
+
var ButtonIcon = css35`
|
|
6571
6748
|
width: 1rem;
|
|
6572
6749
|
height: 1rem;
|
|
6573
6750
|
`;
|
|
6574
6751
|
|
|
6575
6752
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
6576
|
-
import { jsx as
|
|
6753
|
+
import { jsx as jsx64, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
|
|
6577
6754
|
var ObjectSearchResultItemButton = ({
|
|
6578
6755
|
text,
|
|
6579
6756
|
icon,
|
|
6580
6757
|
...props
|
|
6581
6758
|
}) => {
|
|
6582
|
-
return /* @__PURE__ */
|
|
6583
|
-
!icon ? null : /* @__PURE__ */
|
|
6759
|
+
return /* @__PURE__ */ jsxs38("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
6760
|
+
!icon ? null : /* @__PURE__ */ jsx64(Image, { src: icon, css: ButtonIcon }),
|
|
6584
6761
|
text
|
|
6585
6762
|
] });
|
|
6586
6763
|
};
|
|
@@ -6589,15 +6766,15 @@ var LinkButton = ({
|
|
|
6589
6766
|
icon,
|
|
6590
6767
|
...props
|
|
6591
6768
|
}) => {
|
|
6592
|
-
return /* @__PURE__ */
|
|
6593
|
-
!icon ? null : /* @__PURE__ */
|
|
6769
|
+
return /* @__PURE__ */ jsxs38("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
6770
|
+
!icon ? null : /* @__PURE__ */ jsx64(Image, { src: icon, css: ButtonIcon }),
|
|
6594
6771
|
text
|
|
6595
6772
|
] });
|
|
6596
6773
|
};
|
|
6597
6774
|
|
|
6598
6775
|
// src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
|
|
6599
|
-
import { css as
|
|
6600
|
-
var ObjectSearchResultItemContainer =
|
|
6776
|
+
import { css as css36 } from "@emotion/react";
|
|
6777
|
+
var ObjectSearchResultItemContainer = css36`
|
|
6601
6778
|
align-items: center;
|
|
6602
6779
|
border: 1px solid var(--gray-300);
|
|
6603
6780
|
border-radius: var(--rounded-base);
|
|
@@ -6613,7 +6790,7 @@ var ObjectSearchResultItemContainer = css34`
|
|
|
6613
6790
|
}
|
|
6614
6791
|
}
|
|
6615
6792
|
`;
|
|
6616
|
-
var ObjectSearchDragHandle =
|
|
6793
|
+
var ObjectSearchDragHandle = css36`
|
|
6617
6794
|
border-left: 2px dotted var(--gray-300);
|
|
6618
6795
|
border-right: 2px dotted var(--gray-300);
|
|
6619
6796
|
position: absolute;
|
|
@@ -6622,41 +6799,41 @@ var ObjectSearchDragHandle = css34`
|
|
|
6622
6799
|
transition: opacity var(--duration-fast) var(--timing-ease-out);
|
|
6623
6800
|
opacity: 0;
|
|
6624
6801
|
`;
|
|
6625
|
-
var ObjectSearchResultItemSubtitle =
|
|
6802
|
+
var ObjectSearchResultItemSubtitle = css36`
|
|
6626
6803
|
color: var(--gray-500);
|
|
6627
6804
|
display: block;
|
|
6628
6805
|
font-size: var(--fs-xs);
|
|
6629
6806
|
line-height: 1;
|
|
6630
6807
|
`;
|
|
6631
|
-
var ObjectSearchResultItemTitle =
|
|
6808
|
+
var ObjectSearchResultItemTitle = css36`
|
|
6632
6809
|
align-items: center;
|
|
6633
6810
|
color: var(--typography-base);
|
|
6634
6811
|
display: flex;
|
|
6635
6812
|
gap: var(--spacing-xs);
|
|
6636
6813
|
`;
|
|
6637
|
-
var ObjectSearchResultItemTimeStamp =
|
|
6814
|
+
var ObjectSearchResultItemTimeStamp = css36`
|
|
6638
6815
|
color: var(--gray-500);
|
|
6639
6816
|
font-size: var(--fs-xs);
|
|
6640
6817
|
`;
|
|
6641
|
-
var ObjectSearchAuthorStateGroup =
|
|
6818
|
+
var ObjectSearchAuthorStateGroup = css36`
|
|
6642
6819
|
align-items: center;
|
|
6643
6820
|
display: flex;
|
|
6644
6821
|
gap: var(--spacing-sm);
|
|
6645
6822
|
`;
|
|
6646
|
-
var ObjectSearchUpdateGroup =
|
|
6823
|
+
var ObjectSearchUpdateGroup = css36`
|
|
6647
6824
|
display: grid;
|
|
6648
6825
|
`;
|
|
6649
|
-
var ObjectSearchContentContainer =
|
|
6826
|
+
var ObjectSearchContentContainer = css36`
|
|
6650
6827
|
display: flex;
|
|
6651
6828
|
gap: var(--spacing-base);
|
|
6652
6829
|
`;
|
|
6653
|
-
var ObjectSearchImage =
|
|
6830
|
+
var ObjectSearchImage = css36`
|
|
6654
6831
|
width: 56px;
|
|
6655
6832
|
object-fit: contain;
|
|
6656
6833
|
`;
|
|
6657
6834
|
|
|
6658
6835
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
6659
|
-
import { jsx as
|
|
6836
|
+
import { jsx as jsx65, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
|
|
6660
6837
|
var ObjectSearchResultItem = ({
|
|
6661
6838
|
id,
|
|
6662
6839
|
title,
|
|
@@ -6680,66 +6857,70 @@ var ObjectSearchResultItem = ({
|
|
|
6680
6857
|
onSelectItem({ id, title: id });
|
|
6681
6858
|
onRemove == null ? void 0 : onRemove();
|
|
6682
6859
|
};
|
|
6683
|
-
return /* @__PURE__ */
|
|
6684
|
-
disableDnD ? null : /* @__PURE__ */
|
|
6685
|
-
/* @__PURE__ */
|
|
6686
|
-
!imageUrl ? null : /* @__PURE__ */
|
|
6687
|
-
/* @__PURE__ */
|
|
6688
|
-
/* @__PURE__ */
|
|
6689
|
-
/* @__PURE__ */
|
|
6860
|
+
return /* @__PURE__ */ jsxs39("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
|
|
6861
|
+
disableDnD ? null : /* @__PURE__ */ jsx65("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
6862
|
+
/* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsxs39("div", { css: ObjectSearchContentContainer, children: [
|
|
6863
|
+
!imageUrl ? null : /* @__PURE__ */ jsx65("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
|
|
6864
|
+
/* @__PURE__ */ jsxs39("div", { children: [
|
|
6865
|
+
/* @__PURE__ */ jsx65("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
6866
|
+
/* @__PURE__ */ jsxs39("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
6690
6867
|
title != null ? title : name,
|
|
6691
|
-
!popoverData ? null : /* @__PURE__ */
|
|
6868
|
+
!popoverData ? null : /* @__PURE__ */ jsx65(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
6692
6869
|
] }),
|
|
6693
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */
|
|
6694
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */
|
|
6695
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */
|
|
6696
|
-
!createdAt ? null : /* @__PURE__ */
|
|
6697
|
-
/* @__PURE__ */
|
|
6870
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6871
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx65(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
|
|
6872
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchUpdateGroup, children: [
|
|
6873
|
+
!createdAt ? null : /* @__PURE__ */ jsxs39("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6874
|
+
/* @__PURE__ */ jsx65("strong", { children: "Last updated: " }),
|
|
6698
6875
|
timeagoFormat(createdAt)
|
|
6699
6876
|
] }),
|
|
6700
|
-
!publishedAt ? null : /* @__PURE__ */
|
|
6701
|
-
/* @__PURE__ */
|
|
6877
|
+
!publishedAt ? null : /* @__PURE__ */ jsxs39("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
6878
|
+
/* @__PURE__ */ jsx65("strong", { children: "Last published: " }),
|
|
6702
6879
|
timeagoFormat(publishedAt)
|
|
6703
6880
|
] })
|
|
6704
6881
|
] })
|
|
6705
6882
|
] }),
|
|
6706
|
-
/* @__PURE__ */
|
|
6883
|
+
/* @__PURE__ */ jsx65("div", { children })
|
|
6707
6884
|
] })
|
|
6708
6885
|
] }) }),
|
|
6709
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */
|
|
6710
|
-
!editLink ? null : /* @__PURE__ */
|
|
6711
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
6886
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
6887
|
+
!editLink ? null : /* @__PURE__ */ jsx65(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
6888
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx65(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
6712
6889
|
] })
|
|
6713
6890
|
] });
|
|
6714
6891
|
};
|
|
6715
6892
|
|
|
6893
|
+
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6894
|
+
import { Button as Button5, Counter } from "@uniformdev/design-system";
|
|
6895
|
+
import { Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
|
|
6896
|
+
|
|
6716
6897
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
6717
|
-
import { css as
|
|
6718
|
-
var ObjectSearchResultListContainer =
|
|
6898
|
+
import { css as css37 } from "@emotion/react";
|
|
6899
|
+
var ObjectSearchResultListContainer = css37`
|
|
6719
6900
|
align-items: center;
|
|
6720
6901
|
display: flex;
|
|
6721
6902
|
gap: var(--spacing-sm);
|
|
6722
6903
|
justify-content: space-between;
|
|
6723
6904
|
`;
|
|
6724
|
-
var ObjectSearchDragContainer =
|
|
6905
|
+
var ObjectSearchDragContainer = css37`
|
|
6725
6906
|
margin: 0 0 var(--spacing-sm);
|
|
6726
6907
|
`;
|
|
6727
|
-
var ObjectSearchContainerDragging =
|
|
6908
|
+
var ObjectSearchContainerDragging = css37`
|
|
6728
6909
|
box-shadow: var(--shadow-base);
|
|
6729
6910
|
opacity: var(--opacity-50);
|
|
6730
6911
|
`;
|
|
6731
|
-
var ObjectSearchResultListCounterContainer =
|
|
6912
|
+
var ObjectSearchResultListCounterContainer = css37`
|
|
6732
6913
|
align-items: center;
|
|
6733
6914
|
display: flex;
|
|
6734
6915
|
gap: var(--spacing-sm);
|
|
6735
6916
|
`;
|
|
6736
|
-
var ObjectSearchResultListTitle =
|
|
6917
|
+
var ObjectSearchResultListTitle = css37`
|
|
6737
6918
|
font-weight: var(--fw-bold);
|
|
6738
6919
|
line-height: 1;
|
|
6739
6920
|
`;
|
|
6740
6921
|
|
|
6741
6922
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
6742
|
-
import { Fragment as Fragment13, jsx as
|
|
6923
|
+
import { Fragment as Fragment13, jsx as jsx66, jsxs as jsxs40 } from "@emotion/react/jsx-runtime";
|
|
6743
6924
|
function ObjectSearchResultList({
|
|
6744
6925
|
resultLabelText = "Selected",
|
|
6745
6926
|
removeButtonText = "Remove all",
|
|
@@ -6747,7 +6928,7 @@ function ObjectSearchResultList({
|
|
|
6747
6928
|
hideRemoveButton = false,
|
|
6748
6929
|
resultLabelOverride,
|
|
6749
6930
|
additionalButtons,
|
|
6750
|
-
renderResultComponent = (value) => /* @__PURE__ */
|
|
6931
|
+
renderResultComponent = (value) => /* @__PURE__ */ jsx66(ObjectSearchResultItem, { ...value }),
|
|
6751
6932
|
multiSelectId,
|
|
6752
6933
|
disableDnD = false,
|
|
6753
6934
|
getContainerForDnDReparenting,
|
|
@@ -6774,7 +6955,7 @@ function ObjectSearchResultList({
|
|
|
6774
6955
|
...item,
|
|
6775
6956
|
disableDnD: selectedListItems.length === 1 || disableDnD
|
|
6776
6957
|
});
|
|
6777
|
-
return /* @__PURE__ */
|
|
6958
|
+
return /* @__PURE__ */ jsx66(
|
|
6778
6959
|
"div",
|
|
6779
6960
|
{
|
|
6780
6961
|
css: [
|
|
@@ -6789,16 +6970,16 @@ function ObjectSearchResultList({
|
|
|
6789
6970
|
}
|
|
6790
6971
|
);
|
|
6791
6972
|
};
|
|
6792
|
-
return /* @__PURE__ */
|
|
6793
|
-
/* @__PURE__ */
|
|
6794
|
-
!resultLabelOverride ? /* @__PURE__ */
|
|
6795
|
-
/* @__PURE__ */
|
|
6973
|
+
return /* @__PURE__ */ jsxs40(Fragment13, { children: [
|
|
6974
|
+
/* @__PURE__ */ jsxs40("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
6975
|
+
!resultLabelOverride ? /* @__PURE__ */ jsxs40("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
6976
|
+
/* @__PURE__ */ jsx66("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
6796
6977
|
" ",
|
|
6797
|
-
!selectedListItems.length ? null : /* @__PURE__ */
|
|
6978
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx66(Counter, { count: selectedListItems.length })
|
|
6798
6979
|
] }) : resultLabelOverride,
|
|
6799
|
-
/* @__PURE__ */
|
|
6980
|
+
/* @__PURE__ */ jsxs40("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
6800
6981
|
additionalButtons,
|
|
6801
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
6982
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx66(
|
|
6802
6983
|
Button5,
|
|
6803
6984
|
{
|
|
6804
6985
|
buttonType: "ghostDestructive",
|
|
@@ -6810,15 +6991,15 @@ function ObjectSearchResultList({
|
|
|
6810
6991
|
)
|
|
6811
6992
|
] })
|
|
6812
6993
|
] }),
|
|
6813
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */
|
|
6994
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx66(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx66(
|
|
6814
6995
|
Droppable3,
|
|
6815
6996
|
{
|
|
6816
6997
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
6817
6998
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
6818
6999
|
getContainerForClone: getContainerForDnDReparenting,
|
|
6819
|
-
children: (provided) => /* @__PURE__ */
|
|
7000
|
+
children: (provided) => /* @__PURE__ */ jsxs40("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
6820
7001
|
selectedListItems.map((item, i) => {
|
|
6821
|
-
return /* @__PURE__ */
|
|
7002
|
+
return /* @__PURE__ */ jsx66(
|
|
6822
7003
|
Draggable3,
|
|
6823
7004
|
{
|
|
6824
7005
|
draggableId: item.id,
|
|
@@ -6836,273 +7017,9 @@ function ObjectSearchResultList({
|
|
|
6836
7017
|
] });
|
|
6837
7018
|
}
|
|
6838
7019
|
|
|
6839
|
-
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
6840
|
-
import { Fragment as Fragment14, jsx as jsx64, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
|
|
6841
|
-
var ObjectSearchContainer = ({
|
|
6842
|
-
label,
|
|
6843
|
-
enableDynamicInputToResultId,
|
|
6844
|
-
searchFilters,
|
|
6845
|
-
resultList,
|
|
6846
|
-
children = /* @__PURE__ */ jsx64(ObjectSearchResultList, {})
|
|
6847
|
-
}) => {
|
|
6848
|
-
var _a, _b;
|
|
6849
|
-
const { onSelectItem, selectedListItems, list, dynamicEntryId, onSetQuery, query } = useObjectSearchContext();
|
|
6850
|
-
const { flatVariables } = useVariables(true);
|
|
6851
|
-
const inputValue = (_b = dynamicEntryId != null ? dynamicEntryId : (_a = selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
6852
|
-
const isDynamicEntryIdAvailable = React12.useMemo(
|
|
6853
|
-
() => Boolean(inputValue && hasReferencedVariables(inputValue)),
|
|
6854
|
-
[inputValue]
|
|
6855
|
-
);
|
|
6856
|
-
const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx64(
|
|
6857
|
-
ScrollableList,
|
|
6858
|
-
{
|
|
6859
|
-
role: "list",
|
|
6860
|
-
css: css36`
|
|
6861
|
-
> div {
|
|
6862
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
6863
|
-
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
6864
|
-
}
|
|
6865
|
-
`,
|
|
6866
|
-
children: /* @__PURE__ */ jsx64(DefaultResultList, {})
|
|
6867
|
-
}
|
|
6868
|
-
);
|
|
6869
|
-
const handleSelectedVariableChange = (selectedValue) => {
|
|
6870
|
-
var _a2;
|
|
6871
|
-
if (!selectedValue) {
|
|
6872
|
-
onSelectItem([]);
|
|
6873
|
-
return;
|
|
6874
|
-
}
|
|
6875
|
-
const { result, errors } = bindVariables({
|
|
6876
|
-
value: selectedValue,
|
|
6877
|
-
variables: flatVariables,
|
|
6878
|
-
errorPrefix: "Dynamic input"
|
|
6879
|
-
});
|
|
6880
|
-
if (!result) {
|
|
6881
|
-
onSelectItem([]);
|
|
6882
|
-
return;
|
|
6883
|
-
}
|
|
6884
|
-
const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
|
|
6885
|
-
onSelectItem([
|
|
6886
|
-
{
|
|
6887
|
-
title: selectedValue,
|
|
6888
|
-
contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
|
|
6889
|
-
// spread any matched list item, overriding the above default props
|
|
6890
|
-
...item,
|
|
6891
|
-
// we want to make sure the ID is our dynamic value
|
|
6892
|
-
id: selectedValue
|
|
6893
|
-
}
|
|
6894
|
-
]);
|
|
6895
|
-
if (hasReferencedVariables(selectedValue)) {
|
|
6896
|
-
onSetQuery({ ...query, dynamicEntryId: selectedValue });
|
|
6897
|
-
}
|
|
6898
|
-
};
|
|
6899
|
-
const showSearchList = !label || !isDynamicEntryIdAvailable || !enableDynamicInputToResultId;
|
|
6900
|
-
return /* @__PURE__ */ jsx64(IconsProvider, { children: /* @__PURE__ */ jsxs38(VerticalRhythm2, { children: [
|
|
6901
|
-
/* @__PURE__ */ jsx64(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ jsxs38(VerticalRhythm2, { children: [
|
|
6902
|
-
label ? /* @__PURE__ */ jsx64(
|
|
6903
|
-
InputVariables,
|
|
6904
|
-
{
|
|
6905
|
-
id: "entryId",
|
|
6906
|
-
label,
|
|
6907
|
-
value: inputValue,
|
|
6908
|
-
onChange: (value) => {
|
|
6909
|
-
if (value === inputValue) {
|
|
6910
|
-
return;
|
|
6911
|
-
}
|
|
6912
|
-
handleSelectedVariableChange(value);
|
|
6913
|
-
},
|
|
6914
|
-
inputWhenNoVariables: /* @__PURE__ */ jsx64(Fragment14, { children: searchFilters }),
|
|
6915
|
-
disableVariables: !enableDynamicInputToResultId
|
|
6916
|
-
}
|
|
6917
|
-
) : searchFilters,
|
|
6918
|
-
showSearchList ? listItems : null
|
|
6919
|
-
] }) }),
|
|
6920
|
-
children
|
|
6921
|
-
] }) });
|
|
6922
|
-
};
|
|
6923
|
-
var DefaultResultList = () => {
|
|
6924
|
-
var _a, _b;
|
|
6925
|
-
const { list, isListLoading } = useObjectSearchContext();
|
|
6926
|
-
if (isListLoading || !list.items) {
|
|
6927
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx64(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
6928
|
-
}
|
|
6929
|
-
if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
|
|
6930
|
-
return /* @__PURE__ */ jsx64(Callout5, { type: "info", children: "No results were found" });
|
|
6931
|
-
}
|
|
6932
|
-
return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ jsx64(ObjectSearchListItem, { ...item }, item.id));
|
|
6933
|
-
};
|
|
6934
|
-
|
|
6935
|
-
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6936
|
-
import { DebouncedInputKeywordSearch, InputSelect as InputSelect6, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
|
|
6937
|
-
import { useMemo as useMemo15, useState as useState17 } from "react";
|
|
6938
|
-
import { useDebounce as useDebounce4 } from "react-use";
|
|
6939
|
-
|
|
6940
|
-
// src/utils/createLocationValidator.ts
|
|
6941
|
-
function createLocationValidator(setValue, validate) {
|
|
6942
|
-
return (dispatch) => setValue((previous) => {
|
|
6943
|
-
const { newValue, options } = dispatch(previous);
|
|
6944
|
-
return { newValue, options: validate(newValue, options) };
|
|
6945
|
-
});
|
|
6946
|
-
}
|
|
6947
|
-
|
|
6948
|
-
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
6949
|
-
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
6950
|
-
import { useEffect as useEffect16, useRef as useRef15 } from "react";
|
|
6951
|
-
function useContentDataResourceLocaleInfo({
|
|
6952
|
-
locale,
|
|
6953
|
-
setLocale,
|
|
6954
|
-
dynamicInputs
|
|
6955
|
-
}) {
|
|
6956
|
-
var _a;
|
|
6957
|
-
const setLocaleRef = useRef15(setLocale);
|
|
6958
|
-
setLocaleRef.current = setLocale;
|
|
6959
|
-
const { flatVariables } = useVariables();
|
|
6960
|
-
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
|
|
6961
|
-
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
6962
|
-
useEffect16(() => {
|
|
6963
|
-
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
6964
|
-
setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
|
|
6965
|
-
}
|
|
6966
|
-
}, [locale, effectiveLocale]);
|
|
6967
|
-
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
6968
|
-
}
|
|
6969
|
-
|
|
6970
|
-
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
6971
|
-
import { css as css37 } from "@emotion/react";
|
|
6972
|
-
var ObjectSearchFilterContainerLabel = css37`
|
|
6973
|
-
align-items: center;
|
|
6974
|
-
display: flex;
|
|
6975
|
-
font-size: var(--fs-sm);
|
|
6976
|
-
font-weight: var(--fw-bold);
|
|
6977
|
-
line-height: 1rem;
|
|
6978
|
-
margin-bottom: var(--spacing-sm);
|
|
6979
|
-
`;
|
|
6980
|
-
var ObjectSearchFilterContainer = css37`
|
|
6981
|
-
display: grid;
|
|
6982
|
-
gap: var(--spacing-base);
|
|
6983
|
-
`;
|
|
6984
|
-
var ObjectSearchFilterGrid = (gridColumns) => css37`
|
|
6985
|
-
display: grid;
|
|
6986
|
-
grid-template-columns: ${gridColumns};
|
|
6987
|
-
gap: var(--spacing-base);
|
|
6988
|
-
`;
|
|
6989
|
-
|
|
6990
|
-
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
6991
|
-
import { jsx as jsx65, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
|
|
6992
|
-
var ObjectSearchFilter = ({
|
|
6993
|
-
requireContentType,
|
|
6994
|
-
typeSelectorAllTypesOptionText = "All content types",
|
|
6995
|
-
searchInputName = "searchText",
|
|
6996
|
-
searchInputPlaceholderText = "Enter keyword to narrow your results",
|
|
6997
|
-
selectLabel = "Content Type Select",
|
|
6998
|
-
localeFilterLabel = "Filter by locale",
|
|
6999
|
-
selectOptions
|
|
7000
|
-
}) => {
|
|
7001
|
-
var _a, _b, _c;
|
|
7002
|
-
const { query, onSetQuery, localeOptions, enableFilterByLocale } = useObjectSearchContext();
|
|
7003
|
-
const dynamicInputs = useDataResourceDynamicInputs();
|
|
7004
|
-
const { boundLocale = "", effectiveLocale } = useContentDataResourceLocaleInfo({
|
|
7005
|
-
locale: query.locale,
|
|
7006
|
-
dynamicInputs: dynamicInputs != null ? dynamicInputs : {},
|
|
7007
|
-
setLocale: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" })
|
|
7008
|
-
});
|
|
7009
|
-
const [searchState, setSearchState] = useState17({
|
|
7010
|
-
keyword: (_a = query.keyword) != null ? _a : "",
|
|
7011
|
-
contentType: (_b = query.contentType) != null ? _b : "",
|
|
7012
|
-
locale: (_c = query.locale) != null ? _c : ""
|
|
7013
|
-
});
|
|
7014
|
-
const handleFilterChange = (value) => {
|
|
7015
|
-
setSearchState((prev) => {
|
|
7016
|
-
return { ...prev, ...value };
|
|
7017
|
-
});
|
|
7018
|
-
};
|
|
7019
|
-
useDebounce4(
|
|
7020
|
-
() => {
|
|
7021
|
-
onSetQuery({ ...query, ...searchState });
|
|
7022
|
-
},
|
|
7023
|
-
500,
|
|
7024
|
-
[searchState]
|
|
7025
|
-
);
|
|
7026
|
-
const memoizedSelectOptions = useMemo15(() => {
|
|
7027
|
-
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
7028
|
-
return [];
|
|
7029
|
-
}
|
|
7030
|
-
return [
|
|
7031
|
-
...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
|
|
7032
|
-
...selectOptions != null ? selectOptions : []
|
|
7033
|
-
];
|
|
7034
|
-
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
7035
|
-
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
7036
|
-
return /* @__PURE__ */ jsxs39(VerticalRhythm3, { gap: "base", children: [
|
|
7037
|
-
/* @__PURE__ */ jsxs39(
|
|
7038
|
-
"fieldset",
|
|
7039
|
-
{
|
|
7040
|
-
css: [
|
|
7041
|
-
ObjectSearchFilterContainer,
|
|
7042
|
-
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
7043
|
-
],
|
|
7044
|
-
children: [
|
|
7045
|
-
memoizedSelectOptions.length ? /* @__PURE__ */ jsx65(
|
|
7046
|
-
InputSelect6,
|
|
7047
|
-
{
|
|
7048
|
-
label: selectLabel,
|
|
7049
|
-
showLabel: false,
|
|
7050
|
-
onChange: (e) => handleFilterChange({ contentType: e.target.value }),
|
|
7051
|
-
options: memoizedSelectOptions,
|
|
7052
|
-
value: query.contentType,
|
|
7053
|
-
"data-testid": "select-entry"
|
|
7054
|
-
}
|
|
7055
|
-
) : null,
|
|
7056
|
-
/* @__PURE__ */ jsx65(
|
|
7057
|
-
DebouncedInputKeywordSearch,
|
|
7058
|
-
{
|
|
7059
|
-
inputFieldName: searchInputName,
|
|
7060
|
-
placeholder: searchInputPlaceholderText,
|
|
7061
|
-
onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
|
|
7062
|
-
disabledFieldSubmission: true,
|
|
7063
|
-
defaultValue: searchState.keyword,
|
|
7064
|
-
delay: 300
|
|
7065
|
-
}
|
|
7066
|
-
)
|
|
7067
|
-
]
|
|
7068
|
-
}
|
|
7069
|
-
),
|
|
7070
|
-
enableFilterByLocale && (localeOptions == null ? void 0 : localeOptions.length) && /* @__PURE__ */ jsx65(
|
|
7071
|
-
InputVariables,
|
|
7072
|
-
{
|
|
7073
|
-
label: localeFilterLabel,
|
|
7074
|
-
id: "locale",
|
|
7075
|
-
value: effectiveLocale,
|
|
7076
|
-
onChange: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" }),
|
|
7077
|
-
disableInlineMenu: true,
|
|
7078
|
-
inputWhenNoVariables: /* @__PURE__ */ jsx65(
|
|
7079
|
-
InputSelect6,
|
|
7080
|
-
{
|
|
7081
|
-
id: "locale",
|
|
7082
|
-
options: localeOptions,
|
|
7083
|
-
name: "locale",
|
|
7084
|
-
label: "",
|
|
7085
|
-
value: boundLocale,
|
|
7086
|
-
onChange: (e) => handleFilterChange({ locale: e.target.value })
|
|
7087
|
-
}
|
|
7088
|
-
)
|
|
7089
|
-
}
|
|
7090
|
-
)
|
|
7091
|
-
] });
|
|
7092
|
-
};
|
|
7093
|
-
|
|
7094
|
-
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
7095
|
-
import { jsx as jsx66, jsxs as jsxs40 } from "@emotion/react/jsx-runtime";
|
|
7096
|
-
var ObjectSearchFilterContainer2 = ({ label, children }) => {
|
|
7097
|
-
return /* @__PURE__ */ jsxs40("div", { children: [
|
|
7098
|
-
label ? /* @__PURE__ */ jsx66("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
|
|
7099
|
-
/* @__PURE__ */ jsx66("div", { css: ObjectSearchFilterContainer, children })
|
|
7100
|
-
] });
|
|
7101
|
-
};
|
|
7102
|
-
|
|
7103
7020
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
7104
|
-
import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as
|
|
7105
|
-
import { useEffect as
|
|
7021
|
+
import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
|
|
7022
|
+
import { useEffect as useEffect16, useState as useState18 } from "react";
|
|
7106
7023
|
import { jsx as jsx67, jsxs as jsxs41 } from "@emotion/react/jsx-runtime";
|
|
7107
7024
|
var QueryFilter = ({
|
|
7108
7025
|
requireContentType,
|
|
@@ -7143,12 +7060,12 @@ var QueryFilter = ({
|
|
|
7143
7060
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
7144
7061
|
onSetQuery({ ...query, ...value });
|
|
7145
7062
|
};
|
|
7146
|
-
|
|
7063
|
+
useEffect16(() => {
|
|
7147
7064
|
onSetQuery(queryState);
|
|
7148
7065
|
}, []);
|
|
7149
7066
|
return /* @__PURE__ */ jsxs41("fieldset", { children: [
|
|
7150
7067
|
/* @__PURE__ */ jsx67("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
7151
|
-
/* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(
|
|
7068
|
+
/* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(VerticalRhythm3, { children: [
|
|
7152
7069
|
/* @__PURE__ */ jsx67(
|
|
7153
7070
|
InputVariables,
|
|
7154
7071
|
{
|
|
@@ -7268,108 +7185,9 @@ var QueryFilter = ({
|
|
|
7268
7185
|
] });
|
|
7269
7186
|
};
|
|
7270
7187
|
|
|
7271
|
-
// src/components/ObjectSearch/ObjectSearchListOfSearchResults.tsx
|
|
7272
|
-
import { Callout as Callout6 } from "@uniformdev/design-system";
|
|
7273
|
-
import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
|
|
7274
|
-
function ObjectSearchListOfSearchResults() {
|
|
7275
|
-
var _a, _b;
|
|
7276
|
-
const { list, isListLoading } = useObjectSearchContext();
|
|
7277
|
-
if (isListLoading) {
|
|
7278
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx68(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
7279
|
-
}
|
|
7280
|
-
if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
|
|
7281
|
-
return /* @__PURE__ */ jsx68(Callout6, { type: "info", children: "No results were found" });
|
|
7282
|
-
}
|
|
7283
|
-
return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ jsx68(ObjectSearchListItem, { ...item }, item.id));
|
|
7284
|
-
}
|
|
7285
|
-
|
|
7286
|
-
// src/components/ObjectSearch/hooks/ControlledObjectSearchProvider.tsx
|
|
7287
|
-
import { useCallback as useCallback6, useDeferredValue as useDeferredValue2, useMemo as useMemo16 } from "react";
|
|
7288
|
-
import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
|
|
7289
|
-
var ControlledObjectSearchProvider = ({
|
|
7290
|
-
selectedItems,
|
|
7291
|
-
searchResultItems,
|
|
7292
|
-
selectedItemsLoading,
|
|
7293
|
-
searchResultListLoading,
|
|
7294
|
-
searchResultItemsLoading,
|
|
7295
|
-
onQueryChange,
|
|
7296
|
-
onSelectItemsChange,
|
|
7297
|
-
isMulti = false,
|
|
7298
|
-
children,
|
|
7299
|
-
query,
|
|
7300
|
-
enableFilterByLocale,
|
|
7301
|
-
localeOptions,
|
|
7302
|
-
dynamicEntryId
|
|
7303
|
-
}) => {
|
|
7304
|
-
const { flatVariables } = useVariables(true);
|
|
7305
|
-
const querySearchDeferred = useDeferredValue2(query);
|
|
7306
|
-
const onSetQuery = useCallback6(
|
|
7307
|
-
(value2) => {
|
|
7308
|
-
const newQuery = { ...query, ...value2 };
|
|
7309
|
-
onQueryChange(newQuery);
|
|
7310
|
-
},
|
|
7311
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7312
|
-
[onQueryChange]
|
|
7313
|
-
);
|
|
7314
|
-
const onSelectItem = useCallback6(
|
|
7315
|
-
(selectedResult) => {
|
|
7316
|
-
if (Array.isArray(selectedResult)) {
|
|
7317
|
-
onSelectItemsChange(selectedResult);
|
|
7318
|
-
} else {
|
|
7319
|
-
if (selectedItems == null ? void 0 : selectedItems.some((item) => item.id === selectedResult.id)) {
|
|
7320
|
-
onSelectItemsChange(selectedItems.filter((item) => item.id !== selectedResult.id));
|
|
7321
|
-
} else {
|
|
7322
|
-
onSelectItemsChange([...selectedItems != null ? selectedItems : [], selectedResult]);
|
|
7323
|
-
}
|
|
7324
|
-
}
|
|
7325
|
-
},
|
|
7326
|
-
[onSelectItemsChange, selectedItems]
|
|
7327
|
-
);
|
|
7328
|
-
const onRemoveAllSelectedItems = useCallback6(() => {
|
|
7329
|
-
onSelectItemsChange([]);
|
|
7330
|
-
}, [onSelectItemsChange]);
|
|
7331
|
-
const list = useMemo16(() => ({ items: searchResultItems }), [searchResultItems]);
|
|
7332
|
-
const boundQuery = useMemo16(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
7333
|
-
const value = useMemo16(
|
|
7334
|
-
() => ({
|
|
7335
|
-
boundQuery,
|
|
7336
|
-
onSetQuery,
|
|
7337
|
-
query: querySearchDeferred,
|
|
7338
|
-
onSelectItem,
|
|
7339
|
-
selectedListItems: selectedItems != null ? selectedItems : [],
|
|
7340
|
-
onRemoveAllSelectedItems,
|
|
7341
|
-
list,
|
|
7342
|
-
selectedItemsLoading,
|
|
7343
|
-
searchResultItemsLoading,
|
|
7344
|
-
searchResultListLoading,
|
|
7345
|
-
isMulti,
|
|
7346
|
-
localeOptions,
|
|
7347
|
-
enableFilterByLocale,
|
|
7348
|
-
dynamicEntryId
|
|
7349
|
-
}),
|
|
7350
|
-
[
|
|
7351
|
-
boundQuery,
|
|
7352
|
-
onSetQuery,
|
|
7353
|
-
querySearchDeferred,
|
|
7354
|
-
onSelectItem,
|
|
7355
|
-
selectedItems,
|
|
7356
|
-
selectedItemsLoading,
|
|
7357
|
-
searchResultItemsLoading,
|
|
7358
|
-
onRemoveAllSelectedItems,
|
|
7359
|
-
searchResultListLoading,
|
|
7360
|
-
list,
|
|
7361
|
-
isMulti,
|
|
7362
|
-
localeOptions,
|
|
7363
|
-
enableFilterByLocale,
|
|
7364
|
-
dynamicEntryId
|
|
7365
|
-
]
|
|
7366
|
-
);
|
|
7367
|
-
return /* @__PURE__ */ jsx69(ObjectSearchContext.Provider, { value, children });
|
|
7368
|
-
};
|
|
7369
|
-
|
|
7370
7188
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
7371
|
-
import { useEffect as
|
|
7372
|
-
import { jsx as
|
|
7189
|
+
import { useEffect as useEffect17, useMemo as useMemo16, useRef as useRef15 } from "react";
|
|
7190
|
+
import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
|
|
7373
7191
|
function ParamTypeDynamicDataProvider(props) {
|
|
7374
7192
|
const { children } = props;
|
|
7375
7193
|
const {
|
|
@@ -7377,11 +7195,11 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
7377
7195
|
} = useMeshLocation("paramType");
|
|
7378
7196
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
7379
7197
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
7380
|
-
const variables =
|
|
7198
|
+
const variables = useMemo16(
|
|
7381
7199
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
7382
7200
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
7383
7201
|
);
|
|
7384
|
-
return /* @__PURE__ */
|
|
7202
|
+
return /* @__PURE__ */ jsx68(VariablesProvider, { value: variables, onChange: () => {
|
|
7385
7203
|
}, editVariableComponent: JsonMeshVariableEditor, children });
|
|
7386
7204
|
}
|
|
7387
7205
|
var JsonMeshVariableEditor = ({
|
|
@@ -7390,9 +7208,9 @@ var JsonMeshVariableEditor = ({
|
|
|
7390
7208
|
variable,
|
|
7391
7209
|
context
|
|
7392
7210
|
}) => {
|
|
7393
|
-
const sillyRef =
|
|
7211
|
+
const sillyRef = useRef15(false);
|
|
7394
7212
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
7395
|
-
|
|
7213
|
+
useEffect17(() => {
|
|
7396
7214
|
if (sillyRef.current) {
|
|
7397
7215
|
return;
|
|
7398
7216
|
}
|
|
@@ -7426,13 +7244,13 @@ import {
|
|
|
7426
7244
|
FilterMultiChoiceEditor
|
|
7427
7245
|
} from "@uniformdev/design-system";
|
|
7428
7246
|
import { DateEditor, FilterSingleChoiceEditor, NumberEditor, TextEditor } from "@uniformdev/design-system";
|
|
7429
|
-
import { jsx as
|
|
7247
|
+
import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
|
|
7430
7248
|
function withInputVariables(WrappedComponent) {
|
|
7431
7249
|
const WithInputVariables = (props) => {
|
|
7432
7250
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
7433
|
-
return /* @__PURE__ */
|
|
7251
|
+
return /* @__PURE__ */ jsx69(WrappedComponent, { ...props });
|
|
7434
7252
|
}
|
|
7435
|
-
return /* @__PURE__ */
|
|
7253
|
+
return /* @__PURE__ */ jsx69(
|
|
7436
7254
|
InputVariables,
|
|
7437
7255
|
{
|
|
7438
7256
|
disableInlineMenu: true,
|
|
@@ -7440,7 +7258,7 @@ function withInputVariables(WrappedComponent) {
|
|
|
7440
7258
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
7441
7259
|
value: props.value,
|
|
7442
7260
|
disabled: props.disabled,
|
|
7443
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7261
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx69(WrappedComponent, { ...props })
|
|
7444
7262
|
}
|
|
7445
7263
|
);
|
|
7446
7264
|
};
|
|
@@ -7450,16 +7268,16 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
7450
7268
|
const WithInputVariables = (props) => {
|
|
7451
7269
|
var _a;
|
|
7452
7270
|
if (!props.bindable || props.disabled || props.readOnly) {
|
|
7453
|
-
return /* @__PURE__ */
|
|
7271
|
+
return /* @__PURE__ */ jsx69(WrappedComponent, { ...props });
|
|
7454
7272
|
}
|
|
7455
|
-
return /* @__PURE__ */
|
|
7273
|
+
return /* @__PURE__ */ jsx69(
|
|
7456
7274
|
InputVariables,
|
|
7457
7275
|
{
|
|
7458
7276
|
disableInlineMenu: true,
|
|
7459
7277
|
showMenuPosition: "inline-right",
|
|
7460
7278
|
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
7461
7279
|
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
7462
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7280
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx69(WrappedComponent, { ...props })
|
|
7463
7281
|
}
|
|
7464
7282
|
);
|
|
7465
7283
|
};
|
|
@@ -7474,11 +7292,41 @@ var bindableFiltersMapper = {
|
|
|
7474
7292
|
number: withInputVariables(NumberEditor)
|
|
7475
7293
|
};
|
|
7476
7294
|
|
|
7295
|
+
// src/utils/createLocationValidator.ts
|
|
7296
|
+
function createLocationValidator(setValue, validate) {
|
|
7297
|
+
return (dispatch) => setValue((previous) => {
|
|
7298
|
+
const { newValue, options } = dispatch(previous);
|
|
7299
|
+
return { newValue, options: validate(newValue, options) };
|
|
7300
|
+
});
|
|
7301
|
+
}
|
|
7302
|
+
|
|
7303
|
+
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7304
|
+
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
7305
|
+
import { useEffect as useEffect18, useRef as useRef16 } from "react";
|
|
7306
|
+
function useContentDataResourceLocaleInfo({
|
|
7307
|
+
locale,
|
|
7308
|
+
setLocale,
|
|
7309
|
+
dynamicInputs
|
|
7310
|
+
}) {
|
|
7311
|
+
var _a;
|
|
7312
|
+
const setLocaleRef = useRef16(setLocale);
|
|
7313
|
+
setLocaleRef.current = setLocale;
|
|
7314
|
+
const { flatVariables } = useVariables();
|
|
7315
|
+
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
|
|
7316
|
+
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7317
|
+
useEffect18(() => {
|
|
7318
|
+
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7319
|
+
setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
|
|
7320
|
+
}
|
|
7321
|
+
}, [locale, effectiveLocale]);
|
|
7322
|
+
return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
|
|
7323
|
+
}
|
|
7324
|
+
|
|
7477
7325
|
// src/index.ts
|
|
7478
7326
|
import {
|
|
7479
7327
|
AddListButton as AddListButton2,
|
|
7480
7328
|
Button as Button6,
|
|
7481
|
-
Callout as
|
|
7329
|
+
Callout as Callout6,
|
|
7482
7330
|
DrawerContent,
|
|
7483
7331
|
Heading,
|
|
7484
7332
|
Input as Input6,
|
|
@@ -7517,14 +7365,12 @@ export {
|
|
|
7517
7365
|
$isVariableNode,
|
|
7518
7366
|
AddListButton2 as AddListButton,
|
|
7519
7367
|
Button6 as Button,
|
|
7520
|
-
|
|
7521
|
-
ControlledObjectSearchProvider,
|
|
7368
|
+
Callout6 as Callout,
|
|
7522
7369
|
ControlledValuePlugin,
|
|
7523
7370
|
DISCONNECT_VARIABLE_COMMAND,
|
|
7524
7371
|
DamSelectedItem,
|
|
7525
7372
|
DataRefreshButton,
|
|
7526
7373
|
DataResourceDynamicInputProvider,
|
|
7527
|
-
DataResourceInputContext,
|
|
7528
7374
|
DataResourceVariablesList,
|
|
7529
7375
|
DataResourceVariablesListExplicit,
|
|
7530
7376
|
DataSourceEditor,
|
|
@@ -7552,12 +7398,10 @@ export {
|
|
|
7552
7398
|
MeshApp,
|
|
7553
7399
|
OPEN_INSERT_VARIABLE_COMMAND,
|
|
7554
7400
|
ObjectSearchContainer,
|
|
7555
|
-
ObjectSearchContext,
|
|
7556
7401
|
ObjectSearchFilter,
|
|
7557
7402
|
ObjectSearchFilterContainer2 as ObjectSearchFilterContainer,
|
|
7558
7403
|
ObjectSearchListItem,
|
|
7559
7404
|
ObjectSearchListItemLoadingSkeleton,
|
|
7560
|
-
ObjectSearchListOfSearchResults,
|
|
7561
7405
|
ObjectSearchProvider,
|
|
7562
7406
|
ObjectSearchResultItem,
|
|
7563
7407
|
ObjectSearchResultItemButton,
|
|
@@ -7611,7 +7455,6 @@ export {
|
|
|
7611
7455
|
VariablesPlugin,
|
|
7612
7456
|
VariablesProvider,
|
|
7613
7457
|
badgeIcon,
|
|
7614
|
-
bindQuery,
|
|
7615
7458
|
bindableFiltersMapper,
|
|
7616
7459
|
convertConnectedDataToVariable,
|
|
7617
7460
|
createLocationValidator,
|
|
@@ -7684,7 +7527,6 @@ export {
|
|
|
7684
7527
|
urlEncodeRequestUrl,
|
|
7685
7528
|
useConnectedDataAsVariables,
|
|
7686
7529
|
useContentDataResourceLocaleInfo,
|
|
7687
|
-
useDataResourceDynamicInputs,
|
|
7688
7530
|
useDynamicInputsAsVariables,
|
|
7689
7531
|
useMeshLocation,
|
|
7690
7532
|
useObjectSearchContext,
|