@uniformdev/mesh-sdk-react 19.117.0 → 19.117.1-alpha.1

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.esm.js 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) {
@@ -5290,6 +5293,10 @@ function VariablesList() {
5290
5293
 
5291
5294
  // src/components/DataResourceDynamicInputProvider.tsx
5292
5295
  import { jsx as jsx45 } from "@emotion/react/jsx-runtime";
5296
+ var DataResourceInputContext = createContext4(void 0);
5297
+ var useDataResourceDynamicInputs = () => {
5298
+ return useContext6(DataResourceInputContext);
5299
+ };
5293
5300
  function DataResourceDynamicInputProvider(props) {
5294
5301
  const { children, dynamicInputs } = props;
5295
5302
  if (dynamicInputs) {
@@ -5308,7 +5315,7 @@ function DataResourceDynamicInputProviderRenderer({
5308
5315
  dynamicInputs
5309
5316
  }) {
5310
5317
  const variables = useDynamicInputsAsVariables(dynamicInputs);
5311
- return /* @__PURE__ */ jsx45(VariablesProvider, { value: variables, readOnly: true, children });
5318
+ return /* @__PURE__ */ jsx45(DataResourceInputContext.Provider, { value: dynamicInputs, children: /* @__PURE__ */ jsx45(VariablesProvider, { value: variables, readOnly: true, children }) });
5312
5319
  }
5313
5320
 
5314
5321
  // src/components/DataResourceVariablesList.tsx
@@ -6175,22 +6182,23 @@ var DataRefreshButton = ({
6175
6182
  };
6176
6183
 
6177
6184
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
6178
- import { css as css32 } from "@emotion/react";
6185
+ import { css as css35 } from "@emotion/react";
6179
6186
  import { bindVariables } from "@uniformdev/canvas";
6180
6187
  import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
6188
+ import React12 from "react";
6181
6189
 
6182
6190
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
6183
6191
  import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
6184
6192
  import {
6185
- createContext as createContext5,
6193
+ createContext as createContext6,
6186
6194
  useCallback as useCallback4,
6187
- useContext as useContext7,
6195
+ useContext as useContext8,
6188
6196
  useDeferredValue,
6189
6197
  useMemo as useMemo14,
6190
6198
  useState as useState16
6191
6199
  } from "react";
6192
6200
  import { jsx as jsx59 } from "@emotion/react/jsx-runtime";
6193
- var ObjectSearchContext = createContext5({
6201
+ var ObjectSearchContext = createContext6({
6194
6202
  onSetQuery: () => {
6195
6203
  },
6196
6204
  onSelectItem: () => {
@@ -6198,8 +6206,6 @@ var ObjectSearchContext = createContext5({
6198
6206
  query: {},
6199
6207
  boundQuery: {},
6200
6208
  list: {},
6201
- onSetList: () => {
6202
- },
6203
6209
  selectedListItems: [],
6204
6210
  onRemoveAllSelectedItems: () => {
6205
6211
  },
@@ -6283,7 +6289,7 @@ var ObjectSearchProvider = ({
6283
6289
  return /* @__PURE__ */ jsx59(ObjectSearchContext.Provider, { value, children });
6284
6290
  };
6285
6291
  function useObjectSearchContext() {
6286
- return useContext7(ObjectSearchContext);
6292
+ return useContext8(ObjectSearchContext);
6287
6293
  }
6288
6294
  function bindQuery(query, inputs) {
6289
6295
  const { result, errors } = bindVariablesToObject2({
@@ -6437,201 +6443,18 @@ var ObjectSearchListItemLoadingSkeleton = () => {
6437
6443
  return /* @__PURE__ */ jsx60("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
6438
6444
  };
6439
6445
 
6440
- // src/components/ObjectSearch/ObjectSearchContainer.tsx
6441
- import { jsx as jsx61, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
6442
- var ObjectSearchContainer = ({
6443
- label,
6444
- enableDynamicInputToResultId,
6445
- searchFilters,
6446
- resultList,
6447
- children
6448
- }) => {
6449
- var _a, _b;
6450
- const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
6451
- const { flatVariables } = useVariables(true);
6452
- const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
6453
- const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx61(
6454
- ScrollableList,
6455
- {
6456
- role: "list",
6457
- css: css32`
6458
- > div {
6459
- transition: max-height var(--duration-slow) var(--timing-ease-out);
6460
- max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
6461
- }
6462
- `,
6463
- children: /* @__PURE__ */ jsx61(DefaultResultList, {})
6464
- }
6465
- );
6466
- const body = /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
6467
- searchFilters,
6468
- listItems
6469
- ] });
6470
- const handleSelectedVariableChange = (selectedValue) => {
6471
- var _a2;
6472
- if (!selectedValue) {
6473
- onSelectItem([]);
6474
- return;
6475
- }
6476
- const { result, errors } = bindVariables({
6477
- value: selectedValue,
6478
- variables: flatVariables,
6479
- errorPrefix: "Dynamic input"
6480
- });
6481
- if (!result) {
6482
- onSelectItem([]);
6483
- return;
6484
- }
6485
- const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
6486
- onSelectItem([
6487
- {
6488
- title: selectedValue,
6489
- 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`,
6490
- // spread any matched list item, overriding the above default props
6491
- ...item,
6492
- // we want to make sure the ID is our dynamic value
6493
- id: selectedValue
6494
- }
6495
- ]);
6496
- };
6497
- return /* @__PURE__ */ jsx61(IconsProvider, { children: /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
6498
- /* @__PURE__ */ jsx61(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx61(
6499
- InputVariables,
6500
- {
6501
- label,
6502
- value: inputValue,
6503
- onChange: (value) => {
6504
- if (value === inputValue) {
6505
- return;
6506
- }
6507
- handleSelectedVariableChange(value);
6508
- },
6509
- inputWhenNoVariables: body,
6510
- disableVariables: !enableDynamicInputToResultId
6511
- }
6512
- ) : body }),
6513
- children
6514
- ] }) });
6515
- };
6516
- var DefaultResultList = () => {
6517
- var _a;
6518
- const { list } = useObjectSearchContext();
6519
- if (!list.items) {
6520
- return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx61(ObjectSearchListItemLoadingSkeleton, {}, i));
6521
- }
6522
- if (list.items.length === 0) {
6523
- return /* @__PURE__ */ jsx61(Callout5, { type: "info", children: "No results were found" });
6524
- }
6525
- return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx61(ObjectSearchListItem, { ...item }, item.id));
6526
- };
6527
-
6528
- // src/components/ObjectSearch/ObjectSearchFilter.tsx
6529
- import { DebouncedInputKeywordSearch, InputSelect as InputSelect6 } from "@uniformdev/design-system";
6530
- import { useMemo as useMemo15, useState as useState17 } from "react";
6531
-
6532
- // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
6533
- import { css as css33 } from "@emotion/react";
6534
- var ObjectSearchFilterContainerLabel = css33`
6535
- align-items: center;
6536
- display: flex;
6537
- font-size: var(--fs-sm);
6538
- font-weight: var(--fw-bold);
6539
- line-height: 1rem;
6540
- margin-bottom: var(--spacing-sm);
6541
- `;
6542
- var ObjectSearchFilterContainer = css33`
6543
- display: grid;
6544
- gap: var(--spacing-base);
6545
- `;
6546
- var ObjectSearchFilterGrid = (gridColumns) => css33`
6547
- display: grid;
6548
- grid-template-columns: ${gridColumns};
6549
- gap: var(--spacing-base);
6550
- `;
6551
-
6552
- // src/components/ObjectSearch/ObjectSearchFilter.tsx
6553
- import { jsx as jsx62, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
6554
- var ObjectSearchFilter = ({
6555
- requireContentType,
6556
- typeSelectorAllTypesOptionText = "All content types",
6557
- searchInputName = "searchText",
6558
- searchInputPlaceholderText = "Enter keyword to narrow your results",
6559
- selectLabel = "Content Type Select",
6560
- selectOptions
6561
- }) => {
6562
- var _a, _b;
6563
- const { query, onSetQuery } = useObjectSearchContext();
6564
- const [searchState, setSearchState] = useState17({
6565
- contentType: (_a = query.contentType) != null ? _a : "",
6566
- keyword: (_b = query.keyword) != null ? _b : ""
6567
- });
6568
- const handleFilterChange = (value) => {
6569
- setSearchState((prev) => {
6570
- return { ...prev, ...value };
6571
- });
6572
- onSetQuery({ ...query, ...value });
6573
- };
6574
- const memoizedSelectOptions = useMemo15(() => {
6575
- if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
6576
- return [];
6577
- }
6578
- return [
6579
- ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
6580
- ...selectOptions != null ? selectOptions : []
6581
- ];
6582
- }, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
6583
- const shouldRenderSelect = memoizedSelectOptions.length > 0;
6584
- return /* @__PURE__ */ jsxs36(
6585
- "fieldset",
6586
- {
6587
- css: [
6588
- ObjectSearchFilterContainer,
6589
- ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
6590
- ],
6591
- children: [
6592
- memoizedSelectOptions.length ? /* @__PURE__ */ jsx62(
6593
- InputSelect6,
6594
- {
6595
- label: selectLabel,
6596
- showLabel: false,
6597
- onChange: (e) => handleFilterChange({ contentType: e.target.value }),
6598
- options: memoizedSelectOptions,
6599
- value: query.contentType
6600
- }
6601
- ) : null,
6602
- /* @__PURE__ */ jsx62(
6603
- DebouncedInputKeywordSearch,
6604
- {
6605
- inputFieldName: searchInputName,
6606
- placeholder: searchInputPlaceholderText,
6607
- onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
6608
- disabledFieldSubmission: true,
6609
- defaultValue: searchState.keyword,
6610
- delay: 300
6611
- }
6612
- )
6613
- ]
6614
- }
6615
- );
6616
- };
6617
-
6618
- // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
6619
- import { jsx as jsx63, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
6620
- var ObjectSearchFilterContainer2 = ({ label, children }) => {
6621
- return /* @__PURE__ */ jsxs37("div", { children: [
6622
- label ? /* @__PURE__ */ jsx63("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
6623
- /* @__PURE__ */ jsx63("div", { css: ObjectSearchFilterContainer, children })
6624
- ] });
6625
- };
6446
+ // src/components/ObjectSearch/ObjectSearchResultList.tsx
6447
+ import { Button as Button5, Counter } from "@uniformdev/design-system";
6448
+ import { Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
6626
6449
 
6627
6450
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6628
6451
  import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/design-system";
6629
6452
  import { format as timeagoFormat } from "timeago.js";
6630
6453
 
6631
6454
  // src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
6632
- import { css as css34 } from "@emotion/react";
6455
+ import { css as css32 } from "@emotion/react";
6633
6456
  import { button as button2 } from "@uniformdev/design-system";
6634
- var ButtonStyles = css34`
6457
+ var ButtonStyles = css32`
6635
6458
  ${button2}
6636
6459
  background: transparent;
6637
6460
  border: 1px solid var(--typography-base);
@@ -6658,20 +6481,20 @@ var ButtonStyles = css34`
6658
6481
  text-decoration: none;
6659
6482
  }
6660
6483
  `;
6661
- var ButtonIcon = css34`
6484
+ var ButtonIcon = css32`
6662
6485
  width: 1rem;
6663
6486
  height: 1rem;
6664
6487
  `;
6665
6488
 
6666
6489
  // src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
6667
- import { jsx as jsx64, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
6490
+ import { jsx as jsx61, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
6668
6491
  var ObjectSearchResultItemButton = ({
6669
6492
  text,
6670
6493
  icon,
6671
6494
  ...props
6672
6495
  }) => {
6673
- return /* @__PURE__ */ jsxs38("button", { type: "button", css: ButtonStyles, ...props, children: [
6674
- !icon ? null : /* @__PURE__ */ jsx64(Image, { src: icon, css: ButtonIcon }),
6496
+ return /* @__PURE__ */ jsxs35("button", { type: "button", css: ButtonStyles, ...props, children: [
6497
+ !icon ? null : /* @__PURE__ */ jsx61(Image, { src: icon, css: ButtonIcon }),
6675
6498
  text
6676
6499
  ] });
6677
6500
  };
@@ -6680,15 +6503,15 @@ var LinkButton = ({
6680
6503
  icon,
6681
6504
  ...props
6682
6505
  }) => {
6683
- return /* @__PURE__ */ jsxs38("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6684
- !icon ? null : /* @__PURE__ */ jsx64(Image, { src: icon, css: ButtonIcon }),
6506
+ return /* @__PURE__ */ jsxs35("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6507
+ !icon ? null : /* @__PURE__ */ jsx61(Image, { src: icon, css: ButtonIcon }),
6685
6508
  text
6686
6509
  ] });
6687
6510
  };
6688
6511
 
6689
6512
  // src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
6690
- import { css as css35 } from "@emotion/react";
6691
- var ObjectSearchResultItemContainer = css35`
6513
+ import { css as css33 } from "@emotion/react";
6514
+ var ObjectSearchResultItemContainer = css33`
6692
6515
  align-items: center;
6693
6516
  border: 1px solid var(--gray-300);
6694
6517
  border-radius: var(--rounded-base);
@@ -6704,7 +6527,7 @@ var ObjectSearchResultItemContainer = css35`
6704
6527
  }
6705
6528
  }
6706
6529
  `;
6707
- var ObjectSearchDragHandle = css35`
6530
+ var ObjectSearchDragHandle = css33`
6708
6531
  border-left: 2px dotted var(--gray-300);
6709
6532
  border-right: 2px dotted var(--gray-300);
6710
6533
  position: absolute;
@@ -6713,41 +6536,41 @@ var ObjectSearchDragHandle = css35`
6713
6536
  transition: opacity var(--duration-fast) var(--timing-ease-out);
6714
6537
  opacity: 0;
6715
6538
  `;
6716
- var ObjectSearchResultItemSubtitle = css35`
6539
+ var ObjectSearchResultItemSubtitle = css33`
6717
6540
  color: var(--gray-500);
6718
6541
  display: block;
6719
6542
  font-size: var(--fs-xs);
6720
6543
  line-height: 1;
6721
6544
  `;
6722
- var ObjectSearchResultItemTitle = css35`
6545
+ var ObjectSearchResultItemTitle = css33`
6723
6546
  align-items: center;
6724
6547
  color: var(--typography-base);
6725
6548
  display: flex;
6726
6549
  gap: var(--spacing-xs);
6727
6550
  `;
6728
- var ObjectSearchResultItemTimeStamp = css35`
6551
+ var ObjectSearchResultItemTimeStamp = css33`
6729
6552
  color: var(--gray-500);
6730
6553
  font-size: var(--fs-xs);
6731
6554
  `;
6732
- var ObjectSearchAuthorStateGroup = css35`
6555
+ var ObjectSearchAuthorStateGroup = css33`
6733
6556
  align-items: center;
6734
6557
  display: flex;
6735
6558
  gap: var(--spacing-sm);
6736
6559
  `;
6737
- var ObjectSearchUpdateGroup = css35`
6560
+ var ObjectSearchUpdateGroup = css33`
6738
6561
  display: grid;
6739
6562
  `;
6740
- var ObjectSearchContentContainer = css35`
6563
+ var ObjectSearchContentContainer = css33`
6741
6564
  display: flex;
6742
6565
  gap: var(--spacing-base);
6743
6566
  `;
6744
- var ObjectSearchImage = css35`
6567
+ var ObjectSearchImage = css33`
6745
6568
  width: 56px;
6746
6569
  object-fit: contain;
6747
6570
  `;
6748
6571
 
6749
6572
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6750
- import { jsx as jsx65, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
6573
+ import { jsx as jsx62, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
6751
6574
  var ObjectSearchResultItem = ({
6752
6575
  id,
6753
6576
  title,
@@ -6771,77 +6594,73 @@ var ObjectSearchResultItem = ({
6771
6594
  onSelectItem({ id, title: id });
6772
6595
  onRemove == null ? void 0 : onRemove();
6773
6596
  };
6774
- return /* @__PURE__ */ jsxs39("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
6775
- disableDnD ? null : /* @__PURE__ */ jsx65("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6776
- /* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsxs39("div", { css: ObjectSearchContentContainer, children: [
6777
- !imageUrl ? null : /* @__PURE__ */ jsx65("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6778
- /* @__PURE__ */ jsxs39("div", { children: [
6779
- /* @__PURE__ */ jsx65("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
6780
- /* @__PURE__ */ jsxs39("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
6597
+ return /* @__PURE__ */ jsxs36("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
6598
+ disableDnD ? null : /* @__PURE__ */ jsx62("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6599
+ /* @__PURE__ */ jsx62("div", { children: /* @__PURE__ */ jsxs36("div", { css: ObjectSearchContentContainer, children: [
6600
+ !imageUrl ? null : /* @__PURE__ */ jsx62("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6601
+ /* @__PURE__ */ jsxs36("div", { children: [
6602
+ /* @__PURE__ */ jsx62("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
6603
+ /* @__PURE__ */ jsxs36("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
6781
6604
  title != null ? title : name,
6782
- !popoverData ? null : /* @__PURE__ */ jsx65(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6605
+ !popoverData ? null : /* @__PURE__ */ jsx62(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6783
6606
  ] }),
6784
- !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchAuthorStateGroup, children: [
6785
- !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx65(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6786
- !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchUpdateGroup, children: [
6787
- !createdAt ? null : /* @__PURE__ */ jsxs39("small", { css: ObjectSearchResultItemTimeStamp, children: [
6788
- /* @__PURE__ */ jsx65("strong", { children: "Last updated: " }),
6607
+ !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs36("div", { css: ObjectSearchAuthorStateGroup, children: [
6608
+ !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx62(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6609
+ !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs36("div", { css: ObjectSearchUpdateGroup, children: [
6610
+ !createdAt ? null : /* @__PURE__ */ jsxs36("small", { css: ObjectSearchResultItemTimeStamp, children: [
6611
+ /* @__PURE__ */ jsx62("strong", { children: "Last updated: " }),
6789
6612
  timeagoFormat(createdAt)
6790
6613
  ] }),
6791
- !publishedAt ? null : /* @__PURE__ */ jsxs39("small", { css: ObjectSearchResultItemTimeStamp, children: [
6792
- /* @__PURE__ */ jsx65("strong", { children: "Last published: " }),
6614
+ !publishedAt ? null : /* @__PURE__ */ jsxs36("small", { css: ObjectSearchResultItemTimeStamp, children: [
6615
+ /* @__PURE__ */ jsx62("strong", { children: "Last published: " }),
6793
6616
  timeagoFormat(publishedAt)
6794
6617
  ] })
6795
6618
  ] })
6796
6619
  ] }),
6797
- /* @__PURE__ */ jsx65("div", { children })
6620
+ /* @__PURE__ */ jsx62("div", { children })
6798
6621
  ] })
6799
6622
  ] }) }),
6800
- !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchAuthorStateGroup, children: [
6801
- !editLink ? null : /* @__PURE__ */ jsx65(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6802
- hideRemoveButton ? null : /* @__PURE__ */ jsx65(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6623
+ !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs36("div", { css: ObjectSearchAuthorStateGroup, children: [
6624
+ !editLink ? null : /* @__PURE__ */ jsx62(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6625
+ hideRemoveButton ? null : /* @__PURE__ */ jsx62(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6803
6626
  ] })
6804
6627
  ] });
6805
6628
  };
6806
6629
 
6807
- // src/components/ObjectSearch/ObjectSearchResultList.tsx
6808
- import { Button as Button5, Counter } from "@uniformdev/design-system";
6809
- import { Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
6810
-
6811
6630
  // src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
6812
- import { css as css36 } from "@emotion/react";
6813
- var ObjectSearchResultListContainer = css36`
6631
+ import { css as css34 } from "@emotion/react";
6632
+ var ObjectSearchResultListContainer = css34`
6814
6633
  align-items: center;
6815
6634
  display: flex;
6816
6635
  gap: var(--spacing-sm);
6817
6636
  justify-content: space-between;
6818
6637
  `;
6819
- var ObjectSearchDragContainer = css36`
6638
+ var ObjectSearchDragContainer = css34`
6820
6639
  margin: 0 0 var(--spacing-sm);
6821
6640
  `;
6822
- var ObjectSearchContainerDragging = css36`
6641
+ var ObjectSearchContainerDragging = css34`
6823
6642
  box-shadow: var(--shadow-base);
6824
6643
  opacity: var(--opacity-50);
6825
6644
  `;
6826
- var ObjectSearchResultListCounterContainer = css36`
6645
+ var ObjectSearchResultListCounterContainer = css34`
6827
6646
  align-items: center;
6828
6647
  display: flex;
6829
6648
  gap: var(--spacing-sm);
6830
6649
  `;
6831
- var ObjectSearchResultListTitle = css36`
6650
+ var ObjectSearchResultListTitle = css34`
6832
6651
  font-weight: var(--fw-bold);
6833
6652
  line-height: 1;
6834
6653
  `;
6835
6654
 
6836
6655
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
6837
- import { Fragment as Fragment13, jsx as jsx66, jsxs as jsxs40 } from "@emotion/react/jsx-runtime";
6656
+ import { Fragment as Fragment13, jsx as jsx63, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
6838
6657
  function ObjectSearchResultList({
6839
6658
  resultLabelText = "Selected",
6840
6659
  removeButtonText = "Remove all",
6841
6660
  onRemoveAllSelected,
6842
6661
  hideRemoveButton = false,
6843
6662
  additionalButtons,
6844
- renderResultComponent = (value) => /* @__PURE__ */ jsx66(ObjectSearchResultItem, { ...value }),
6663
+ renderResultComponent = (value) => /* @__PURE__ */ jsx63(ObjectSearchResultItem, { ...value }),
6845
6664
  multiSelectId,
6846
6665
  disableDnD = false,
6847
6666
  getContainerForDnDReparenting,
@@ -6868,7 +6687,7 @@ function ObjectSearchResultList({
6868
6687
  ...item,
6869
6688
  disableDnD: selectedListItems.length === 1 || disableDnD
6870
6689
  });
6871
- return /* @__PURE__ */ jsx66(
6690
+ return /* @__PURE__ */ jsx63(
6872
6691
  "div",
6873
6692
  {
6874
6693
  css: [
@@ -6883,16 +6702,16 @@ function ObjectSearchResultList({
6883
6702
  }
6884
6703
  );
6885
6704
  };
6886
- return /* @__PURE__ */ jsxs40(Fragment13, { children: [
6887
- /* @__PURE__ */ jsxs40("div", { role: "group", css: ObjectSearchResultListContainer, children: [
6888
- /* @__PURE__ */ jsxs40("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
6889
- /* @__PURE__ */ jsx66("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
6705
+ return /* @__PURE__ */ jsxs37(Fragment13, { children: [
6706
+ /* @__PURE__ */ jsxs37("div", { role: "group", css: ObjectSearchResultListContainer, children: [
6707
+ /* @__PURE__ */ jsxs37("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
6708
+ /* @__PURE__ */ jsx63("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
6890
6709
  " ",
6891
- !selectedListItems.length ? null : /* @__PURE__ */ jsx66(Counter, { count: selectedListItems.length })
6710
+ !selectedListItems.length ? null : /* @__PURE__ */ jsx63(Counter, { count: selectedListItems.length })
6892
6711
  ] }),
6893
- /* @__PURE__ */ jsxs40("div", { css: ObjectSearchResultListCounterContainer, children: [
6712
+ /* @__PURE__ */ jsxs37("div", { css: ObjectSearchResultListCounterContainer, children: [
6894
6713
  additionalButtons,
6895
- hideRemoveButton ? null : /* @__PURE__ */ jsx66(
6714
+ hideRemoveButton ? null : /* @__PURE__ */ jsx63(
6896
6715
  Button5,
6897
6716
  {
6898
6717
  buttonType: "ghostDestructive",
@@ -6904,15 +6723,15 @@ function ObjectSearchResultList({
6904
6723
  )
6905
6724
  ] })
6906
6725
  ] }),
6907
- !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx66(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx66(
6726
+ !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx63(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx63(
6908
6727
  Droppable3,
6909
6728
  {
6910
6729
  droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
6911
6730
  renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
6912
6731
  getContainerForClone: getContainerForDnDReparenting,
6913
- children: (provided) => /* @__PURE__ */ jsxs40("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
6732
+ children: (provided) => /* @__PURE__ */ jsxs37("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
6914
6733
  selectedListItems.map((item, i) => {
6915
- return /* @__PURE__ */ jsx66(
6734
+ return /* @__PURE__ */ jsx63(
6916
6735
  Draggable3,
6917
6736
  {
6918
6737
  draggableId: item.id,
@@ -6930,9 +6749,289 @@ function ObjectSearchResultList({
6930
6749
  ] });
6931
6750
  }
6932
6751
 
6752
+ // src/components/ObjectSearch/ObjectSearchContainer.tsx
6753
+ import { Fragment as Fragment14, jsx as jsx64, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
6754
+ var ObjectSearchContainer = ({
6755
+ label,
6756
+ enableDynamicInputToResultId,
6757
+ searchFilters,
6758
+ resultList,
6759
+ children = /* @__PURE__ */ jsx64(ObjectSearchResultList, {})
6760
+ }) => {
6761
+ var _a, _b;
6762
+ const { onSelectItem, selectedListItems, list, dynamicEntryId, onSetQuery, query } = useObjectSearchContext();
6763
+ const { flatVariables } = useVariables(true);
6764
+ const inputValue = (_b = dynamicEntryId != null ? dynamicEntryId : (_a = selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
6765
+ const isDynamicEntryIdAvailable = React12.useMemo(
6766
+ () => Boolean(inputValue && hasReferencedVariables(inputValue)),
6767
+ [inputValue]
6768
+ );
6769
+ const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx64(
6770
+ ScrollableList,
6771
+ {
6772
+ role: "list",
6773
+ css: css35`
6774
+ > div {
6775
+ transition: max-height var(--duration-slow) var(--timing-ease-out);
6776
+ max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
6777
+ }
6778
+ `,
6779
+ children: /* @__PURE__ */ jsx64(DefaultResultList, {})
6780
+ }
6781
+ );
6782
+ const handleSelectedVariableChange = (selectedValue) => {
6783
+ var _a2;
6784
+ if (!selectedValue) {
6785
+ onSelectItem([]);
6786
+ return;
6787
+ }
6788
+ const { result, errors } = bindVariables({
6789
+ value: selectedValue,
6790
+ variables: flatVariables,
6791
+ errorPrefix: "Dynamic input"
6792
+ });
6793
+ if (!result) {
6794
+ onSelectItem([]);
6795
+ return;
6796
+ }
6797
+ const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
6798
+ onSelectItem([
6799
+ {
6800
+ title: selectedValue,
6801
+ 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`,
6802
+ // spread any matched list item, overriding the above default props
6803
+ ...item,
6804
+ // we want to make sure the ID is our dynamic value
6805
+ id: selectedValue
6806
+ }
6807
+ ]);
6808
+ if (hasReferencedVariables(selectedValue)) {
6809
+ onSetQuery({ ...query, dynamicEntryId: selectedValue });
6810
+ }
6811
+ };
6812
+ const showSearchList = !label || !isDynamicEntryIdAvailable || !enableDynamicInputToResultId;
6813
+ return /* @__PURE__ */ jsx64(IconsProvider, { children: /* @__PURE__ */ jsxs38(VerticalRhythm2, { children: [
6814
+ /* @__PURE__ */ jsx64(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ jsxs38(VerticalRhythm2, { children: [
6815
+ label ? /* @__PURE__ */ jsx64(
6816
+ InputVariables,
6817
+ {
6818
+ id: "entryId",
6819
+ label,
6820
+ value: inputValue,
6821
+ onChange: (value) => {
6822
+ if (value === inputValue) {
6823
+ return;
6824
+ }
6825
+ handleSelectedVariableChange(value);
6826
+ },
6827
+ inputWhenNoVariables: /* @__PURE__ */ jsx64(Fragment14, { children: searchFilters }),
6828
+ disableVariables: !enableDynamicInputToResultId
6829
+ }
6830
+ ) : searchFilters,
6831
+ showSearchList ? listItems : null
6832
+ ] }) }),
6833
+ children
6834
+ ] }) });
6835
+ };
6836
+ var DefaultResultList = () => {
6837
+ var _a, _b;
6838
+ const { list, isListLoading } = useObjectSearchContext();
6839
+ if (isListLoading || !list.items) {
6840
+ return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx64(ObjectSearchListItemLoadingSkeleton, {}, i));
6841
+ }
6842
+ if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
6843
+ return /* @__PURE__ */ jsx64(Callout5, { type: "info", children: "No results were found" });
6844
+ }
6845
+ return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ jsx64(ObjectSearchListItem, { ...item }, item.id));
6846
+ };
6847
+
6848
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
6849
+ import {
6850
+ DebouncedInputKeywordSearch,
6851
+ InputKeywordSearch as InputKeywordSearch2,
6852
+ InputSelect as InputSelect6,
6853
+ VerticalRhythm as VerticalRhythm3
6854
+ } from "@uniformdev/design-system";
6855
+ import { useMemo as useMemo15, useState as useState17 } from "react";
6856
+ import { useDebounce as useDebounce4 } from "react-use";
6857
+
6858
+ // src/utils/createLocationValidator.ts
6859
+ function createLocationValidator(setValue, validate) {
6860
+ return (dispatch) => setValue((previous) => {
6861
+ const { newValue, options } = dispatch(previous);
6862
+ return { newValue, options: validate(newValue, options) };
6863
+ });
6864
+ }
6865
+
6866
+ // src/utils/useContentDataResourceLocaleInfo.ts
6867
+ import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
6868
+ import { useEffect as useEffect16, useRef as useRef15 } from "react";
6869
+ function useContentDataResourceLocaleInfo({
6870
+ locale,
6871
+ setLocale,
6872
+ dynamicInputs
6873
+ }) {
6874
+ var _a;
6875
+ const setLocaleRef = useRef15(setLocale);
6876
+ setLocaleRef.current = setLocale;
6877
+ const { flatVariables } = useVariables();
6878
+ const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
6879
+ const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
6880
+ useEffect16(() => {
6881
+ if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
6882
+ setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
6883
+ }
6884
+ }, [locale, effectiveLocale]);
6885
+ return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
6886
+ }
6887
+
6888
+ // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
6889
+ import { css as css36 } from "@emotion/react";
6890
+ var ObjectSearchFilterContainerLabel = css36`
6891
+ align-items: center;
6892
+ display: flex;
6893
+ font-size: var(--fs-sm);
6894
+ font-weight: var(--fw-bold);
6895
+ line-height: 1rem;
6896
+ margin-bottom: var(--spacing-sm);
6897
+ `;
6898
+ var ObjectSearchFilterContainer = css36`
6899
+ display: grid;
6900
+ gap: var(--spacing-base);
6901
+ `;
6902
+ var ObjectSearchFilterGrid = (gridColumns) => css36`
6903
+ display: grid;
6904
+ grid-template-columns: ${gridColumns};
6905
+ gap: var(--spacing-base);
6906
+ `;
6907
+
6908
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
6909
+ import { jsx as jsx65, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
6910
+ var ObjectSearchFilter = ({
6911
+ requireContentType,
6912
+ typeSelectorAllTypesOptionText = "All content types",
6913
+ searchInputName = "searchText",
6914
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
6915
+ selectLabel = "Content Type Select",
6916
+ localeFilterLabel = "Filter by locale",
6917
+ selectOptions
6918
+ }) => {
6919
+ var _a, _b, _c;
6920
+ const { query, onSetQuery, localeOptions, enableFilterByLocale } = useObjectSearchContext();
6921
+ const dynamicInputs = useDataResourceDynamicInputs();
6922
+ const { boundLocale = "", effectiveLocale } = useContentDataResourceLocaleInfo({
6923
+ locale: query.locale,
6924
+ dynamicInputs: dynamicInputs != null ? dynamicInputs : {},
6925
+ setLocale: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" })
6926
+ });
6927
+ const [searchState, setSearchState] = useState17({
6928
+ keyword: (_a = query.keyword) != null ? _a : "",
6929
+ contentType: (_b = query.contentType) != null ? _b : "",
6930
+ locale: (_c = query.locale) != null ? _c : ""
6931
+ });
6932
+ const handleFilterChange = (value) => {
6933
+ setSearchState((prev) => {
6934
+ return { ...prev, ...value };
6935
+ });
6936
+ };
6937
+ useDebounce4(
6938
+ () => {
6939
+ onSetQuery({ ...query, ...searchState });
6940
+ },
6941
+ 500,
6942
+ [searchState]
6943
+ );
6944
+ const memoizedSelectOptions = useMemo15(() => {
6945
+ if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
6946
+ return [];
6947
+ }
6948
+ return [
6949
+ ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
6950
+ ...selectOptions != null ? selectOptions : []
6951
+ ];
6952
+ }, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
6953
+ const shouldRenderSelect = memoizedSelectOptions.length > 0;
6954
+ return /* @__PURE__ */ jsxs39(VerticalRhythm3, { gap: "base", children: [
6955
+ /* @__PURE__ */ jsxs39(
6956
+ "fieldset",
6957
+ {
6958
+ css: [
6959
+ ObjectSearchFilterContainer,
6960
+ ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
6961
+ ],
6962
+ children: [
6963
+ memoizedSelectOptions.length ? /* @__PURE__ */ jsx65(
6964
+ InputSelect6,
6965
+ {
6966
+ label: selectLabel,
6967
+ showLabel: false,
6968
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
6969
+ options: memoizedSelectOptions,
6970
+ value: query.contentType,
6971
+ "data-testid": "select-entry"
6972
+ }
6973
+ ) : null,
6974
+ /* @__PURE__ */ jsx65(
6975
+ InputKeywordSearch2,
6976
+ {
6977
+ inputFieldName: searchInputName,
6978
+ placeholder: searchInputPlaceholderText,
6979
+ onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
6980
+ disabledFieldSubmission: true,
6981
+ onClear: () => handleFilterChange({ keyword: "" }),
6982
+ value: searchState.keyword
6983
+ }
6984
+ ),
6985
+ /* @__PURE__ */ jsx65(
6986
+ DebouncedInputKeywordSearch,
6987
+ {
6988
+ inputFieldName: searchInputName,
6989
+ placeholder: searchInputPlaceholderText,
6990
+ onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
6991
+ disabledFieldSubmission: true,
6992
+ defaultValue: searchState.keyword,
6993
+ delay: 300
6994
+ }
6995
+ )
6996
+ ]
6997
+ }
6998
+ ),
6999
+ enableFilterByLocale && (localeOptions == null ? void 0 : localeOptions.length) && /* @__PURE__ */ jsx65(
7000
+ InputVariables,
7001
+ {
7002
+ label: localeFilterLabel,
7003
+ id: "locale",
7004
+ value: effectiveLocale,
7005
+ onChange: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" }),
7006
+ disableInlineMenu: true,
7007
+ inputWhenNoVariables: /* @__PURE__ */ jsx65(
7008
+ InputSelect6,
7009
+ {
7010
+ id: "locale",
7011
+ options: localeOptions,
7012
+ name: "locale",
7013
+ label: "",
7014
+ value: boundLocale,
7015
+ onChange: (e) => handleFilterChange({ locale: e.target.value })
7016
+ }
7017
+ )
7018
+ }
7019
+ )
7020
+ ] });
7021
+ };
7022
+
7023
+ // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
7024
+ import { jsx as jsx66, jsxs as jsxs40 } from "@emotion/react/jsx-runtime";
7025
+ var ObjectSearchFilterContainer2 = ({ label, children }) => {
7026
+ return /* @__PURE__ */ jsxs40("div", { children: [
7027
+ label ? /* @__PURE__ */ jsx66("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
7028
+ /* @__PURE__ */ jsx66("div", { css: ObjectSearchFilterContainer, children })
7029
+ ] });
7030
+ };
7031
+
6933
7032
  // src/components/ObjectSearch/QueryFilter.tsx
6934
- import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
6935
- import { useEffect as useEffect16, useState as useState18 } from "react";
7033
+ import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm4 } from "@uniformdev/design-system";
7034
+ import { useEffect as useEffect17, useState as useState18 } from "react";
6936
7035
  import { jsx as jsx67, jsxs as jsxs41 } from "@emotion/react/jsx-runtime";
6937
7036
  var QueryFilter = ({
6938
7037
  requireContentType,
@@ -6973,12 +7072,12 @@ var QueryFilter = ({
6973
7072
  setQueryState((prev) => ({ ...prev, ...value }));
6974
7073
  onSetQuery({ ...query, ...value });
6975
7074
  };
6976
- useEffect16(() => {
7075
+ useEffect17(() => {
6977
7076
  onSetQuery(queryState);
6978
7077
  }, []);
6979
7078
  return /* @__PURE__ */ jsxs41("fieldset", { children: [
6980
7079
  /* @__PURE__ */ jsx67("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
6981
- /* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(VerticalRhythm3, { children: [
7080
+ /* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(VerticalRhythm4, { children: [
6982
7081
  /* @__PURE__ */ jsx67(
6983
7082
  InputVariables,
6984
7083
  {
@@ -7098,9 +7197,93 @@ var QueryFilter = ({
7098
7197
  ] });
7099
7198
  };
7100
7199
 
7101
- // src/components/ParamTypeDynamicDataProvider.tsx
7102
- import { useEffect as useEffect17, useMemo as useMemo16, useRef as useRef15 } from "react";
7200
+ // src/components/ObjectSearch/hooks/ControlledObjectSearchProvider.tsx
7201
+ import { useCallback as useCallback5, useDeferredValue as useDeferredValue2, useMemo as useMemo16 } from "react";
7103
7202
  import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
7203
+ var ControlledObjectSearchProvider = ({
7204
+ selectedItems,
7205
+ searchResultItems,
7206
+ selectedItemsLoading,
7207
+ searchResultListLoading,
7208
+ searchResultItemsLoading,
7209
+ onQueryChange,
7210
+ onSelectItemsChange,
7211
+ isMulti = false,
7212
+ children,
7213
+ query,
7214
+ enableFilterByLocale,
7215
+ localeOptions,
7216
+ dynamicEntryId
7217
+ }) => {
7218
+ const { flatVariables } = useVariables(true);
7219
+ const querySearchDeferred = useDeferredValue2(query);
7220
+ const onSetQuery = useCallback5(
7221
+ (value2) => {
7222
+ const newQuery = { ...query, ...value2 };
7223
+ onQueryChange(newQuery);
7224
+ },
7225
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7226
+ [onQueryChange]
7227
+ );
7228
+ const onSelectItem = useCallback5(
7229
+ (selectedResult) => {
7230
+ if (Array.isArray(selectedResult)) {
7231
+ onSelectItemsChange(selectedResult);
7232
+ } else {
7233
+ if (selectedItems == null ? void 0 : selectedItems.some((item) => item.id === selectedResult.id)) {
7234
+ onSelectItemsChange(selectedItems.filter((item) => item.id !== selectedResult.id));
7235
+ } else {
7236
+ onSelectItemsChange([...selectedItems != null ? selectedItems : [], selectedResult]);
7237
+ }
7238
+ }
7239
+ },
7240
+ [onSelectItemsChange, selectedItems]
7241
+ );
7242
+ const onRemoveAllSelectedItems = useCallback5(() => {
7243
+ onSelectItemsChange([]);
7244
+ }, [onSelectItemsChange]);
7245
+ const list = useMemo16(() => ({ items: searchResultItems }), [searchResultItems]);
7246
+ const boundQuery = useMemo16(() => bindQuery(query, flatVariables), [query, flatVariables]);
7247
+ const value = useMemo16(
7248
+ () => ({
7249
+ boundQuery,
7250
+ onSetQuery,
7251
+ query: querySearchDeferred,
7252
+ onSelectItem,
7253
+ selectedListItems: selectedItems != null ? selectedItems : [],
7254
+ onRemoveAllSelectedItems,
7255
+ list,
7256
+ selectedItemsLoading,
7257
+ searchResultItemsLoading,
7258
+ searchResultListLoading,
7259
+ isMulti,
7260
+ localeOptions,
7261
+ enableFilterByLocale,
7262
+ dynamicEntryId
7263
+ }),
7264
+ [
7265
+ boundQuery,
7266
+ onSetQuery,
7267
+ querySearchDeferred,
7268
+ onSelectItem,
7269
+ selectedItems,
7270
+ selectedItemsLoading,
7271
+ searchResultItemsLoading,
7272
+ onRemoveAllSelectedItems,
7273
+ searchResultListLoading,
7274
+ list,
7275
+ isMulti,
7276
+ localeOptions,
7277
+ enableFilterByLocale,
7278
+ dynamicEntryId
7279
+ ]
7280
+ );
7281
+ return /* @__PURE__ */ jsx68(ObjectSearchContext.Provider, { value, children });
7282
+ };
7283
+
7284
+ // src/components/ParamTypeDynamicDataProvider.tsx
7285
+ import { useEffect as useEffect18, useMemo as useMemo17, useRef as useRef16 } from "react";
7286
+ import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
7104
7287
  function ParamTypeDynamicDataProvider(props) {
7105
7288
  const { children } = props;
7106
7289
  const {
@@ -7108,11 +7291,11 @@ function ParamTypeDynamicDataProvider(props) {
7108
7291
  } = useMeshLocation("paramType");
7109
7292
  const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
7110
7293
  const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
7111
- const variables = useMemo16(
7294
+ const variables = useMemo17(
7112
7295
  () => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
7113
7296
  [dynamicInputsAsVariables, connectedDataAsVariables]
7114
7297
  );
7115
- return /* @__PURE__ */ jsx68(VariablesProvider, { value: variables, onChange: () => {
7298
+ return /* @__PURE__ */ jsx69(VariablesProvider, { value: variables, onChange: () => {
7116
7299
  }, editVariableComponent: JsonMeshVariableEditor, children });
7117
7300
  }
7118
7301
  var JsonMeshVariableEditor = ({
@@ -7121,9 +7304,9 @@ var JsonMeshVariableEditor = ({
7121
7304
  variable,
7122
7305
  context
7123
7306
  }) => {
7124
- const sillyRef = useRef15(false);
7307
+ const sillyRef = useRef16(false);
7125
7308
  const { editConnectedData } = useMeshLocation("paramType");
7126
- useEffect17(() => {
7309
+ useEffect18(() => {
7127
7310
  if (sillyRef.current) {
7128
7311
  return;
7129
7312
  }
@@ -7151,36 +7334,6 @@ var JsonMeshVariableEditor = ({
7151
7334
  return null;
7152
7335
  };
7153
7336
 
7154
- // src/utils/createLocationValidator.ts
7155
- function createLocationValidator(setValue, validate) {
7156
- return (dispatch) => setValue((previous) => {
7157
- const { newValue, options } = dispatch(previous);
7158
- return { newValue, options: validate(newValue, options) };
7159
- });
7160
- }
7161
-
7162
- // src/utils/useContentDataResourceLocaleInfo.ts
7163
- import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
7164
- import { useEffect as useEffect18, useRef as useRef16 } from "react";
7165
- function useContentDataResourceLocaleInfo({
7166
- locale,
7167
- setLocale,
7168
- dynamicInputs
7169
- }) {
7170
- var _a;
7171
- const setLocaleRef = useRef16(setLocale);
7172
- setLocaleRef.current = setLocale;
7173
- const { flatVariables } = useVariables();
7174
- const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
7175
- const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
7176
- useEffect18(() => {
7177
- if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
7178
- setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
7179
- }
7180
- }, [locale, effectiveLocale]);
7181
- return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
7182
- }
7183
-
7184
7337
  // src/index.ts
7185
7338
  import {
7186
7339
  AddListButton as AddListButton2,
@@ -7190,7 +7343,7 @@ import {
7190
7343
  Heading,
7191
7344
  Input as Input6,
7192
7345
  InputComboBox,
7193
- InputKeywordSearch as InputKeywordSearch2,
7346
+ InputKeywordSearch as InputKeywordSearch3,
7194
7347
  InputSelect as InputSelect8,
7195
7348
  InputToggle,
7196
7349
  Label,
@@ -7225,11 +7378,13 @@ export {
7225
7378
  AddListButton2 as AddListButton,
7226
7379
  Button6 as Button,
7227
7380
  Callout6 as Callout,
7381
+ ControlledObjectSearchProvider,
7228
7382
  ControlledValuePlugin,
7229
7383
  DISCONNECT_VARIABLE_COMMAND,
7230
7384
  DamSelectedItem,
7231
7385
  DataRefreshButton,
7232
7386
  DataResourceDynamicInputProvider,
7387
+ DataResourceInputContext,
7233
7388
  DataResourceVariablesList,
7234
7389
  DataResourceVariablesListExplicit,
7235
7390
  DataSourceEditor,
@@ -7244,7 +7399,7 @@ export {
7244
7399
  icons_exports as Icons,
7245
7400
  Input6 as Input,
7246
7401
  InputComboBox,
7247
- InputKeywordSearch2 as InputKeywordSearch,
7402
+ InputKeywordSearch3 as InputKeywordSearch,
7248
7403
  InputSelect8 as InputSelect,
7249
7404
  InputToggle,
7250
7405
  InputVariables,
@@ -7257,6 +7412,7 @@ export {
7257
7412
  MeshApp,
7258
7413
  OPEN_INSERT_VARIABLE_COMMAND,
7259
7414
  ObjectSearchContainer,
7415
+ ObjectSearchContext,
7260
7416
  ObjectSearchFilter,
7261
7417
  ObjectSearchFilterContainer2 as ObjectSearchFilterContainer,
7262
7418
  ObjectSearchListItem,
@@ -7314,6 +7470,7 @@ export {
7314
7470
  VariablesPlugin,
7315
7471
  VariablesProvider,
7316
7472
  badgeIcon,
7473
+ bindQuery,
7317
7474
  convertConnectedDataToVariable,
7318
7475
  createLocationValidator,
7319
7476
  damSelectItemImage,
@@ -7385,6 +7542,7 @@ export {
7385
7542
  urlEncodeRequestUrl,
7386
7543
  useConnectedDataAsVariables,
7387
7544
  useContentDataResourceLocaleInfo,
7545
+ useDataResourceDynamicInputs,
7388
7546
  useDynamicInputsAsVariables,
7389
7547
  useMeshLocation,
7390
7548
  useObjectSearchContext,