@uniformdev/mesh-sdk-react 19.139.0 → 19.141.1-alpha.5

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