@uniformdev/mesh-sdk-react 18.34.0 → 18.35.1-alpha.12

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.js CHANGED
@@ -31,46 +31,56 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/index.ts
32
32
  var src_exports = {};
33
33
  __export(src_exports, {
34
- AddListButton: () => import_design_system25.AddListButton,
35
- Button: () => import_design_system25.Button,
36
- Callout: () => import_design_system25.Callout,
34
+ AddListButton: () => import_design_system34.AddListButton,
35
+ Button: () => import_design_system34.Button,
36
+ Callout: () => import_design_system34.Callout,
37
37
  DamSelectedItem: () => DamSelectedItem,
38
+ DataRefreshButton: () => DataRefreshButton,
38
39
  DataResourceVariablesList: () => DataResourceVariablesList,
39
40
  DataSourceEditor: () => DataSourceEditor,
40
41
  DataTypeEditor: () => DataTypeEditor,
41
42
  DefaultSearchRow: () => DefaultSearchRow,
42
43
  DefaultSelectedItem: () => DefaultSelectedItem,
43
44
  EntrySearch: () => EntrySearch,
44
- Heading: () => import_design_system25.Heading,
45
+ Heading: () => import_design_system34.Heading,
45
46
  Icons: () => icons_exports,
46
- Input: () => import_design_system25.Input,
47
- InputComboBox: () => import_design_system25.InputComboBox,
48
- InputKeywordSearch: () => import_design_system25.InputKeywordSearch,
49
- InputSelect: () => import_design_system25.InputSelect,
50
- InputToggle: () => import_design_system25.InputToggle,
47
+ Input: () => import_design_system34.Input,
48
+ InputComboBox: () => import_design_system34.InputComboBox,
49
+ InputKeywordSearch: () => import_design_system34.InputKeywordSearch,
50
+ InputSelect: () => import_design_system34.InputSelect,
51
+ InputToggle: () => import_design_system34.InputToggle,
51
52
  InputVariables: () => InputVariables,
52
- KeywordSearchInput: () => import_design_system25.InputKeywordSearch,
53
- Label: () => import_design_system25.Label,
54
- LoadingIndicator: () => import_design_system25.LoadingIndicator,
55
- LoadingOverlay: () => import_design_system25.LoadingOverlay,
56
- Menu: () => import_design_system25.Menu,
57
- MenuItem: () => import_design_system25.MenuItem,
53
+ Label: () => import_design_system34.Label,
54
+ LinkButton: () => LinkButton,
55
+ LoadingIndicator: () => import_design_system34.LoadingIndicator,
56
+ LoadingOverlay: () => import_design_system34.LoadingOverlay,
57
+ Menu: () => import_design_system34.Menu,
58
+ MenuItem: () => import_design_system34.MenuItem,
58
59
  MeshApp: () => MeshApp,
59
- ParameterGroup: () => import_design_system25.ParameterGroup,
60
- ParameterImage: () => import_design_system25.ParameterImage,
61
- ParameterImageInner: () => import_design_system25.ParameterImageInner,
62
- ParameterInput: () => import_design_system25.ParameterInput,
63
- ParameterInputInner: () => import_design_system25.ParameterInputInner,
64
- ParameterLabel: () => import_design_system25.ParameterLabel,
65
- ParameterMenuButton: () => import_design_system25.ParameterMenuButton,
66
- ParameterSelect: () => import_design_system25.ParameterSelect,
67
- ParameterSelectInner: () => import_design_system25.ParameterSelectInner,
68
- ParameterShell: () => import_design_system25.ParameterShell,
69
- ParameterShellContext: () => import_design_system24.ParameterShellContext,
70
- ParameterTextarea: () => import_design_system25.ParameterTextarea,
71
- ParameterTextareaInner: () => import_design_system25.ParameterTextareaInner,
72
- ParameterToggle: () => import_design_system25.ParameterToggle,
73
- ParameterToggleInner: () => import_design_system25.ParameterToggleInner,
60
+ ObjectSearchContainer: () => ObjectSearchContainer,
61
+ ObjectSearchFilter: () => ObjectSearchFilter,
62
+ ObjectSearchFilterContainer: () => ObjectSearchFilterContainer2,
63
+ ObjectSearchListItem: () => ObjectSearchListItem,
64
+ ObjectSearchListItemLoadingSkeleton: () => ObjectSearchListItemLoadingSkeleton,
65
+ ObjectSearchProvider: () => ObjectSearchProvider,
66
+ ObjectSearchResultItem: () => ObjectSearchResultItem,
67
+ ObjectSearchResultItemButton: () => ObjectSearchResultItemButton,
68
+ ObjectSearchResultList: () => ObjectSearchResultList,
69
+ ParameterGroup: () => import_design_system34.ParameterGroup,
70
+ ParameterImage: () => import_design_system34.ParameterImage,
71
+ ParameterImageInner: () => import_design_system34.ParameterImageInner,
72
+ ParameterInput: () => import_design_system34.ParameterInput,
73
+ ParameterInputInner: () => import_design_system34.ParameterInputInner,
74
+ ParameterLabel: () => import_design_system34.ParameterLabel,
75
+ ParameterMenuButton: () => import_design_system34.ParameterMenuButton,
76
+ ParameterSelect: () => import_design_system34.ParameterSelect,
77
+ ParameterSelectInner: () => import_design_system34.ParameterSelectInner,
78
+ ParameterShell: () => import_design_system34.ParameterShell,
79
+ ParameterShellContext: () => import_design_system33.ParameterShellContext,
80
+ ParameterTextarea: () => import_design_system34.ParameterTextarea,
81
+ ParameterTextareaInner: () => import_design_system34.ParameterTextareaInner,
82
+ ParameterToggle: () => import_design_system34.ParameterToggle,
83
+ ParameterToggleInner: () => import_design_system34.ParameterToggleInner,
74
84
  ProductPreviewList: () => ProductPreviewList,
75
85
  ProductQuery: () => ProductQuery,
76
86
  ProductQueryContext: () => ProductQueryContext,
@@ -78,6 +88,7 @@ __export(src_exports, {
78
88
  ProductSearchContext: () => ProductSearchContext,
79
89
  ProductSearchRow: () => ProductSearchRow,
80
90
  ProductSelectedItem: () => ProductSelectedItem,
91
+ QueryFilter: () => QueryFilter,
81
92
  RequestBody: () => RequestBody,
82
93
  RequestHeaders: () => RequestHeaders,
83
94
  RequestMethodSelect: () => RequestMethodSelect,
@@ -87,17 +98,13 @@ __export(src_exports, {
87
98
  RequestUrl: () => RequestUrl,
88
99
  RequestUrlInput: () => RequestUrlInput,
89
100
  ResolvableLoadingValue: () => ResolvableLoadingValue,
90
- ScrollableList: () => import_design_system25.ScrollableList,
91
- ScrollableListItem: () => import_design_system25.ScrollableListItem,
101
+ ScrollableList: () => import_design_system34.ScrollableList,
102
+ ScrollableListItem: () => import_design_system34.ScrollableListItem,
92
103
  SelectionField: () => SelectionField,
93
- Switch: () => import_design_system25.Switch,
104
+ Switch: () => import_design_system34.Switch,
94
105
  TextVariableRenderer: () => TextVariableRenderer,
95
- Textarea: () => import_design_system25.Textarea,
96
- Theme: () => import_design_system25.Theme,
97
- UniformMeshLocationContext: () => UniformMeshLocationContext,
98
- UniformMeshLocationContextProvider: () => UniformMeshLocationContextProvider,
99
- UniformMeshSdkContext: () => UniformMeshSdkContext,
100
- UniformMeshSdkContextProvider: () => UniformMeshSdkContextProvider,
106
+ Textarea: () => import_design_system34.Textarea,
107
+ Theme: () => import_design_system34.Theme,
101
108
  VariableEditor: () => VariableEditor,
102
109
  VariablesList: () => VariablesList,
103
110
  VariablesProvider: () => VariablesProvider,
@@ -166,18 +173,15 @@ __export(src_exports, {
166
173
  selectedItemTitle: () => selectedItemTitle,
167
174
  urlEncodeRequestParameter: () => urlEncodeRequestParameter,
168
175
  urlEncodeRequestUrl: () => urlEncodeRequestUrl,
169
- useInitializeUniformMeshSdk: () => useInitializeUniformMeshSdk,
170
176
  useMeshLocation: () => useMeshLocation,
171
- useParameterShell: () => import_design_system24.useParameterShell,
177
+ useObjectSearchContext: () => useObjectSearchContext,
178
+ useParameterShell: () => import_design_system33.useParameterShell,
172
179
  useProductQueryContext: () => useProductQueryContext,
173
180
  useProductSearchContext: () => useProductSearchContext,
174
181
  useRequest: () => useRequest,
175
182
  useRequestHeader: () => useRequestHeader,
176
183
  useRequestParameter: () => useRequestParameter,
177
- useUniformMeshLocation: () => useUniformMeshLocation,
178
- useUniformMeshLocationContext: () => useUniformMeshLocationContext,
179
184
  useUniformMeshSdk: () => useUniformMeshSdk,
180
- useUniformMeshSdkContext: () => useUniformMeshSdkContext,
181
185
  useVariables: () => useVariables,
182
186
  variablesToList: () => variablesToList
183
187
  });
@@ -1072,7 +1076,7 @@ var ProductPreviewList = ({
1072
1076
  import_design_system3.scrollbarStyles
1073
1077
  ],
1074
1078
  children: products == null ? void 0 : products.map((product, index) => {
1075
- var _a, _b;
1079
+ var _a;
1076
1080
  const [category] = (product == null ? void 0 : product.categories) || [];
1077
1081
  const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
1078
1082
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { css: productPreviewListItem, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
@@ -1085,13 +1089,13 @@ var ProductPreviewList = ({
1085
1089
  "img",
1086
1090
  {
1087
1091
  src: product.thumbnailUrl,
1088
- alt: typeof product.title === "string" ? product.title : product.name || `Product ${index}`,
1092
+ alt: typeof product.title === "string" ? product.title : `Product ${index}`,
1089
1093
  css: productPreviewListImage,
1090
1094
  "data-test-id": "product-image"
1091
1095
  }
1092
1096
  ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { css: productPreviewListImageDefault }),
1093
1097
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h4", { css: productPreviewListTitle, "data-test-id": "product-name", children: [
1094
- product.title || product.name,
1098
+ product.title,
1095
1099
  categoryName && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { css: productPreviewListCategoryText, children: categoryName })
1096
1100
  ] }),
1097
1101
  product && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
@@ -1104,12 +1108,12 @@ var ProductPreviewList = ({
1104
1108
  "Price: ",
1105
1109
  product.price
1106
1110
  ] }) : null,
1107
- product.editLink || product.url ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1111
+ product.editLink ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1108
1112
  "a",
1109
1113
  {
1110
1114
  css: productPreviewListLinkBtn,
1111
- href: (_b = product.editLink) != null ? _b : product.url,
1112
- title: `Go to ${product.title || product.name}`,
1115
+ href: product.editLink,
1116
+ title: `Go to ${product.title}`,
1113
1117
  target: "_blank",
1114
1118
  rel: "noopener noreferrer",
1115
1119
  "data-test-id": "edit-product-button",
@@ -1134,12 +1138,12 @@ var import_design_system10 = require("@uniformdev/design-system");
1134
1138
  var import_react21 = __toESM(require("react"));
1135
1139
  var import_react_use3 = require("react-use");
1136
1140
 
1137
- // src/components/EntrySearch/DefaultSearchRow.tsx
1141
+ // src/components/legacy/EntrySearch/DefaultSearchRow.tsx
1138
1142
  var import_react9 = require("@emotion/react");
1139
1143
  var import_design_system4 = require("@uniformdev/design-system");
1140
1144
  var import_react10 = require("react");
1141
1145
 
1142
- // src/components/EntrySearch/styles/DefaultSearchRow.styles.ts
1146
+ // src/components/legacy/EntrySearch/styles/DefaultSearchRow.styles.ts
1143
1147
  var import_react8 = require("@emotion/react");
1144
1148
  var searchRowContainer = import_react8.css`
1145
1149
  cursor: pointer;
@@ -1180,7 +1184,7 @@ var searchRowBtn = import_react8.css`
1180
1184
  inset: 0 var(--spacing-sm) 0 auto;
1181
1185
  `;
1182
1186
 
1183
- // src/components/EntrySearch/DefaultSearchRow.tsx
1187
+ // src/components/legacy/EntrySearch/DefaultSearchRow.tsx
1184
1188
  var import_jsx_runtime19 = require("@emotion/react/jsx-runtime");
1185
1189
  var DefaultSearchRow = ({ result, isSelected, triggerSelection }) => {
1186
1190
  const popoverRef = (0, import_react10.useRef)(null);
@@ -1254,7 +1258,7 @@ var DefaultSearchRow = ({ result, isSelected, triggerSelection }) => {
1254
1258
  );
1255
1259
  };
1256
1260
 
1257
- // src/components/EntrySearch/DefaultSelectedItem.tsx
1261
+ // src/components/legacy/EntrySearch/DefaultSelectedItem.tsx
1258
1262
  var import_react12 = require("@emotion/react");
1259
1263
  var import_design_system6 = require("@uniformdev/design-system");
1260
1264
  var import_react13 = require("react");
@@ -1272,7 +1276,7 @@ function openWindowWithCloseCallback(href, callback) {
1272
1276
  }, 500);
1273
1277
  }
1274
1278
 
1275
- // src/components/EntrySearch/styles/DefaultSelectedItem.styles.ts
1279
+ // src/components/legacy/EntrySearch/styles/DefaultSelectedItem.styles.ts
1276
1280
  var import_react11 = require("@emotion/react");
1277
1281
  var import_design_system5 = require("@uniformdev/design-system");
1278
1282
  var selectedItemContainer = import_react11.css`
@@ -1356,7 +1360,7 @@ var selectItemLinkBtn = import_react11.css`
1356
1360
  }
1357
1361
  `;
1358
1362
 
1359
- // src/components/EntrySearch/DefaultSelectedItem.tsx
1363
+ // src/components/legacy/EntrySearch/DefaultSelectedItem.tsx
1360
1364
  var import_jsx_runtime20 = require("@emotion/react/jsx-runtime");
1361
1365
  var DefaultSelectedItem = ({
1362
1366
  selectedItem,
@@ -1539,7 +1543,7 @@ var DefaultSelectedItem = ({
1539
1543
  ] }) }, selectedItem.id);
1540
1544
  };
1541
1545
 
1542
- // src/components/EntrySearch/EntrySearch.tsx
1546
+ // src/components/legacy/EntrySearch/EntrySearch.tsx
1543
1547
  var import_react16 = require("@emotion/react");
1544
1548
  var import_design_system7 = require("@uniformdev/design-system");
1545
1549
  var React5 = __toESM(require("react"));
@@ -1580,7 +1584,7 @@ function useLoadingDelay(loading, { delay = 500, minDuration = 200 } = {
1580
1584
  return state === "DISPLAY" || state === "EXPIRE";
1581
1585
  }
1582
1586
 
1583
- // src/components/EntrySearch/styles/EntrySearch.styles.ts
1587
+ // src/components/legacy/EntrySearch/styles/EntrySearch.styles.ts
1584
1588
  var import_react15 = require("@emotion/react");
1585
1589
  var entrySearchWrapper = import_react15.css`
1586
1590
  background: var(--white);
@@ -1691,7 +1695,7 @@ var badgeIcon = import_react15.css`
1691
1695
  height: calc(var(--spacing-lg) + var(--spacing-xs));
1692
1696
  `;
1693
1697
 
1694
- // src/components/EntrySearch/EntrySearch.tsx
1698
+ // src/components/legacy/EntrySearch/EntrySearch.tsx
1695
1699
  var import_jsx_runtime21 = require("@emotion/react/jsx-runtime");
1696
1700
  var DefaultNoResults = ({ searchText, selectedContentType }) => {
1697
1701
  let message = "No content found";
@@ -2824,18 +2828,6 @@ var import_design_system13 = require("@uniformdev/design-system");
2824
2828
  var import_react25 = require("react");
2825
2829
  var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
2826
2830
  var UniformMeshSdkContext = (0, import_react25.createContext)(void 0);
2827
- var UniformMeshSdkContextProvider = ({ children }) => {
2828
- let value = void 0;
2829
- if (typeof window !== "undefined" && typeof window.UniformMeshSDK !== "undefined") {
2830
- value = {
2831
- sdk: window.UniformMeshSDK
2832
- };
2833
- }
2834
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(UniformMeshSdkContext.Provider, { value, children: [
2835
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system13.Theme, {}),
2836
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UniformMeshLocationContextProvider, { children })
2837
- ] });
2838
- };
2839
2831
  var useUniformMeshSdkContext = () => {
2840
2832
  const context = (0, import_react25.useContext)(UniformMeshSdkContext);
2841
2833
  if (!context) {
@@ -2852,9 +2844,7 @@ function useUniformMeshSdk() {
2852
2844
 
2853
2845
  // src/components/UniformMeshLocationContext.tsx
2854
2846
  var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
2855
- var UniformMeshLocationContext = (0, import_react26.createContext)(
2856
- void 0
2857
- );
2847
+ var UniformMeshLocationContext = (0, import_react26.createContext)(void 0);
2858
2848
  var UniformMeshLocationContextProvider = ({
2859
2849
  children
2860
2850
  }) => {
@@ -2885,20 +2875,9 @@ var useUniformMeshLocationContext = () => {
2885
2875
  };
2886
2876
 
2887
2877
  // src/hooks/useMeshLocation.ts
2888
- var legacyWarned = false;
2889
2878
  function useMeshLocation(expectedLocation) {
2890
2879
  const { location } = useUniformMeshLocationContext();
2891
- let effectiveExpected = expectedLocation;
2892
- if (expectedLocation === "dataTypeInstance") {
2893
- effectiveExpected = "dataResource";
2894
- if (!legacyWarned) {
2895
- console.warn(
2896
- "`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."
2897
- );
2898
- legacyWarned = true;
2899
- }
2900
- }
2901
- if (effectiveExpected && location.type !== effectiveExpected) {
2880
+ if (expectedLocation && location.type !== expectedLocation) {
2902
2881
  throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
2903
2882
  }
2904
2883
  const backdoorLocation = (0, import_react27.useRef)(location);
@@ -3375,7 +3354,7 @@ function DataResourceVariablesList({
3375
3354
  const {
3376
3355
  value,
3377
3356
  metadata: { dataType }
3378
- } = useMeshLocation("dataTypeInstance");
3357
+ } = useMeshLocation("dataResource");
3379
3358
  const variableDefinitions = variablesToList(dataType.variables);
3380
3359
  if (variableDefinitions.length === 0) {
3381
3360
  if (NoVariablesComponent) {
@@ -4103,14 +4082,733 @@ var MeshApp = ({
4103
4082
  ] });
4104
4083
  };
4105
4084
 
4106
- // src/hooks/useUniformMeshLocation.ts
4107
- function useUniformMeshLocation() {
4108
- const { location } = useUniformMeshLocationContext();
4109
- return location;
4110
- }
4085
+ // src/components/ObjectSearch/DataRefreshButton.tsx
4086
+ var import_react39 = require("@emotion/react");
4087
+ var import_design_system24 = require("@uniformdev/design-system");
4088
+ var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
4089
+ var DataRefreshButton = ({
4090
+ buttonText,
4091
+ isLoading,
4092
+ onRefreshData,
4093
+ ...props
4094
+ }) => {
4095
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_design_system24.Button, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
4096
+ !isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4097
+ import_design_system24.LoadingIndicator,
4098
+ {
4099
+ css: import_react39.css`
4100
+ ${isLoading ? "opacity: 0.2;" : void 0}
4101
+ `
4102
+ }
4103
+ ),
4104
+ buttonText
4105
+ ] });
4106
+ };
4107
+
4108
+ // src/components/ObjectSearch/ObjectSearchContainer.tsx
4109
+ var import_design_system25 = require("@uniformdev/design-system");
4110
+ var import_jsx_runtime46 = require("@emotion/react/jsx-runtime");
4111
+ var ObjectSearchContainer = ({
4112
+ searchFilters,
4113
+ resultList,
4114
+ children
4115
+ }) => {
4116
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system25.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_design_system25.VerticalRhythm, { children: [
4117
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system25.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_design_system25.VerticalRhythm, { children: [
4118
+ searchFilters,
4119
+ !resultList ? null : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system25.ScrollableList, { role: "list", children: resultList })
4120
+ ] }) }),
4121
+ children
4122
+ ] }) });
4123
+ };
4124
+
4125
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
4126
+ var import_design_system26 = require("@uniformdev/design-system");
4127
+ var import_react42 = require("react");
4128
+
4129
+ // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
4130
+ var import_react40 = require("react");
4131
+ var import_jsx_runtime47 = require("@emotion/react/jsx-runtime");
4132
+ var ObjectSearchContext = (0, import_react40.createContext)({
4133
+ onSetQuery: () => {
4134
+ },
4135
+ onSelectItem: () => {
4136
+ },
4137
+ query: {
4138
+ contentType: "",
4139
+ keyword: ""
4140
+ },
4141
+ list: {},
4142
+ onSetList: () => {
4143
+ },
4144
+ selectedListItems: [],
4145
+ onRemoveAllSelectedItems: () => {
4146
+ }
4147
+ });
4148
+ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
4149
+ const [query, setQuery] = (0, import_react40.useState)({
4150
+ contentType: "",
4151
+ keyword: ""
4152
+ });
4153
+ const querySearchDeferred = (0, import_react40.useDeferredValue)(query);
4154
+ const [selectedItems, setSelectedItems] = (0, import_react40.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
4155
+ const [list, setList] = (0, import_react40.useState)({});
4156
+ const onSetQuery = (0, import_react40.useCallback)(
4157
+ (value) => {
4158
+ if (Array.isArray(value.contentType) && value.contentType.length > 0) {
4159
+ return setQuery({
4160
+ ...value,
4161
+ contentType: value.contentType[0].id
4162
+ });
4163
+ }
4164
+ return setQuery(value);
4165
+ },
4166
+ [setQuery]
4167
+ );
4168
+ const onSelectItem = (0, import_react40.useCallback)(
4169
+ (selectedResult) => {
4170
+ if (Array.isArray(selectedResult)) {
4171
+ setSelectedItems(selectedResult);
4172
+ } else {
4173
+ if (selectedItems.some((item) => item.id === selectedResult.id)) {
4174
+ setSelectedItems((prev) => prev.filter((item) => item.id !== selectedResult.id));
4175
+ } else {
4176
+ setSelectedItems((prev) => [...prev, selectedResult]);
4177
+ }
4178
+ }
4179
+ },
4180
+ [setSelectedItems, selectedItems]
4181
+ );
4182
+ const onRemoveAllSelectedItems = (0, import_react40.useCallback)(() => {
4183
+ setSelectedItems([]);
4184
+ }, [setSelectedItems]);
4185
+ const onSetList = (0, import_react40.useCallback)(
4186
+ (value) => {
4187
+ setList(value);
4188
+ },
4189
+ [setList]
4190
+ );
4191
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
4192
+ ObjectSearchContext.Provider,
4193
+ {
4194
+ value: {
4195
+ onSetQuery,
4196
+ query: querySearchDeferred,
4197
+ onSelectItem,
4198
+ selectedListItems: selectedItems,
4199
+ onRemoveAllSelectedItems,
4200
+ list,
4201
+ onSetList
4202
+ },
4203
+ children
4204
+ }
4205
+ );
4206
+ };
4207
+ var useObjectSearchContext = () => {
4208
+ const contextValues = (0, import_react40.useContext)(ObjectSearchContext);
4209
+ return { ...contextValues };
4210
+ };
4211
+
4212
+ // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
4213
+ var import_react41 = require("@emotion/react");
4214
+ var ObjectSearchFilterContainerLabel = import_react41.css`
4215
+ align-items: center;
4216
+ display: flex;
4217
+ font-size: var(--fs-sm);
4218
+ font-weight: var(--fw-bold);
4219
+ line-height: 1rem;
4220
+ margin-bottom: var(--spacing-sm);
4221
+ `;
4222
+ var ObjectSearchFilterContainer = import_react41.css`
4223
+ display: grid;
4224
+ gap: var(--spacing-base);
4225
+ `;
4226
+ var ObjectSearchFilterDropdownAndTextSearch = import_react41.css`
4227
+ grid-template-columns: 0.5fr 1fr;
4228
+ `;
4229
+ var ObjectSearchFilterGrid = (gridColumns) => import_react41.css`
4230
+ display: grid;
4231
+ grid-template-columns: ${gridColumns};
4232
+ gap: var(--spacing-base);
4233
+ `;
4234
+
4235
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
4236
+ var import_jsx_runtime48 = require("@emotion/react/jsx-runtime");
4237
+ var ObjectSearchFilter = ({
4238
+ requireContentType,
4239
+ typeSelectorAllTypesOptionText = "All content types",
4240
+ searchInputName = "searchText",
4241
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
4242
+ selectLabel = "Content Type Select",
4243
+ selectOptions
4244
+ }) => {
4245
+ const { query, onSetQuery } = useObjectSearchContext();
4246
+ const [searchState, setSearchState] = (0, import_react42.useState)({
4247
+ contentType: "",
4248
+ keyword: ""
4249
+ });
4250
+ const handleFilterChange = (value) => {
4251
+ setSearchState((prev) => {
4252
+ return { ...prev, ...value };
4253
+ });
4254
+ onSetQuery({ ...query, ...value });
4255
+ };
4256
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
4257
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4258
+ import_design_system26.InputSelect,
4259
+ {
4260
+ label: selectLabel,
4261
+ showLabel: false,
4262
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
4263
+ options: [
4264
+ ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
4265
+ ...selectOptions ? selectOptions.map((option) => {
4266
+ var _a;
4267
+ return { name: option == null ? void 0 : option.name, label: (_a = option.label) != null ? _a : option == null ? void 0 : option.name, id: option.id };
4268
+ }) : []
4269
+ ],
4270
+ value: query.contentType
4271
+ }
4272
+ ),
4273
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
4274
+ import_design_system26.InputKeywordSearch,
4275
+ {
4276
+ inputFieldName: searchInputName,
4277
+ placeholder: searchInputPlaceholderText,
4278
+ onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
4279
+ disabledFieldSubmission: true,
4280
+ onClear: () => handleFilterChange({ keyword: "" }),
4281
+ value: searchState.keyword
4282
+ }
4283
+ )
4284
+ ] });
4285
+ };
4286
+
4287
+ // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
4288
+ var import_jsx_runtime49 = require("@emotion/react/jsx-runtime");
4289
+ var ObjectSearchFilterContainer2 = ({ label, children }) => {
4290
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
4291
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }),
4292
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { css: ObjectSearchFilterContainer, children })
4293
+ ] });
4294
+ };
4295
+
4296
+ // src/components/ObjectSearch/ObjectSearchListItem.tsx
4297
+ var import_design_system28 = require("@uniformdev/design-system");
4298
+
4299
+ // src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
4300
+ var import_react43 = require("@emotion/react");
4301
+ var import_design_system27 = require("@uniformdev/design-system");
4302
+ var ObjectListItemContainer = import_react43.css`
4303
+ align-items: center;
4304
+ border: 1px solid var(--gray-300);
4305
+ border-radius: var(--rounded-base);
4306
+ background: var(--white);
4307
+ display: grid;
4308
+ grid-template-columns: 1fr 32px;
4309
+ padding: var(--spacing-sm);
4310
+
4311
+ &[hidden] {
4312
+ display: none;
4313
+ }
4314
+ `;
4315
+ var ObjectListItemLoading = import_react43.css`
4316
+ animation: ${import_design_system27.skeletonLoading} 1s linear infinite alternate;
4317
+ border-color: transparent;
4318
+ min-height: 42px;
4319
+ position: relative;
4320
+
4321
+ &:before,
4322
+ &:after {
4323
+ background: var(--gray-200);
4324
+ content: '';
4325
+ display: block;
4326
+ height: 1rem;
4327
+ }
4328
+
4329
+ &:before {
4330
+ border-radius: var(--rounded-base);
4331
+ width: 10rem;
4332
+ }
4333
+
4334
+ &:after {
4335
+ border-radius: var(--rounded-full);
4336
+ width: 1rem;
4337
+ }
4338
+ `;
4339
+ var ObjectListItemHeadingGroup = import_react43.css`
4340
+ align-items: center;
4341
+ display: grid;
4342
+ `;
4343
+ var ObjectListItemTitle = import_react43.css`
4344
+ color: var(--brand-secondary-1);
4345
+ display: block;
4346
+ font-size: var(--fs-sm);
4347
+ `;
4348
+ var ObjectListItemSubtitle = import_react43.css`
4349
+ color: var(--gray-500);
4350
+ display: block;
4351
+ font-size: var(--fs-xs);
4352
+ line-height: 1;
4353
+ `;
4354
+ var ObjectListItemInfoContainer = import_react43.css`
4355
+ align-items: center;
4356
+ display: flex;
4357
+ justify-content: center;
4358
+ `;
4359
+ var ObjectListItemControlledContent = import_react43.css`
4360
+ display: flex;
4361
+ gap: var(--spacing-sm);
4362
+ `;
4363
+ var ObjectListItemUnControlledContent = import_react43.css`
4364
+ margin-top: var(--spacing-sm);
4365
+ grid-column: 1 / -1;
4366
+ `;
4367
+
4368
+ // src/components/ObjectSearch/ObjectSearchListItem.tsx
4369
+ var import_jsx_runtime50 = require("@emotion/react/jsx-runtime");
4370
+ var ObjectSearchListItem = ({
4371
+ id,
4372
+ title,
4373
+ contentType,
4374
+ image,
4375
+ popoverData,
4376
+ onSelect,
4377
+ isMulti = false,
4378
+ children,
4379
+ ...props
4380
+ }) => {
4381
+ const { onSelectItem, selectedListItems } = useObjectSearchContext();
4382
+ const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
4383
+ const handleSelectItem = () => {
4384
+ var _a;
4385
+ const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
4386
+ const selectedItem = { id, title, contentType, image, popoverData, ...extraData };
4387
+ if (isMulti) {
4388
+ return onSelectItem(selectedItem);
4389
+ }
4390
+ return onSelectItem([selectedItem]);
4391
+ };
4392
+ const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
4393
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, ...props, children: [
4394
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
4395
+ !image ? null : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
4396
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
4397
+ !contentType ? null : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
4398
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { css: ObjectListItemTitle, children: title })
4399
+ ] })
4400
+ ] }),
4401
+ !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
4402
+ !children ? null : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { css: ObjectListItemUnControlledContent, children })
4403
+ ] });
4404
+ };
4405
+ var ObjectSearchListItemLoadingSkeleton = () => {
4406
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
4407
+ };
4408
+
4409
+ // src/components/ObjectSearch/ObjectSearchResultItem.tsx
4410
+ var import_design_system30 = require("@uniformdev/design-system");
4411
+ var import_timeago3 = require("timeago.js");
4412
+
4413
+ // src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
4414
+ var import_react44 = require("@emotion/react");
4415
+ var import_design_system29 = require("@uniformdev/design-system");
4416
+ var ButtonStyles = import_react44.css`
4417
+ ${import_design_system29.button}
4418
+ background: transparent;
4419
+ border: 1px solid var(--brand-secondary-1);
4420
+ color: var(--brand-secondary-1);
4421
+ padding: var(--spacing-sm);
4422
+ font-size: var(--fs-sm);
4423
+ line-height: 1;
4424
+ gap: var(--spacing-xs);
4425
+ transition: border-color var(--duration-fast) var(--timing-ease-out),
4426
+ background-color var(--duration-fast) var(--timing-ease-out);
4427
+
4428
+ &:hover {
4429
+ background: var(--gray-100);
4430
+ border-color: var(--gray-300);
4431
+ }
4432
+
4433
+ &:disabled {
4434
+ background: var(--gray-300);
4435
+ border-color: var(--gray-200);
4436
+ color: var(--gray-500);
4437
+ }
4438
+
4439
+ &:link {
4440
+ text-decoration: none;
4441
+ }
4442
+ `;
4443
+ var ButtonIcon = import_react44.css`
4444
+ width: 1rem;
4445
+ height: 1rem;
4446
+ `;
4447
+
4448
+ // src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
4449
+ var import_jsx_runtime51 = require("@emotion/react/jsx-runtime");
4450
+ var ObjectSearchResultItemButton = ({
4451
+ text,
4452
+ icon,
4453
+ ...props
4454
+ }) => {
4455
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
4456
+ !icon ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Image, { src: icon, css: ButtonIcon }),
4457
+ text
4458
+ ] });
4459
+ };
4460
+ var LinkButton = ({
4461
+ text,
4462
+ icon,
4463
+ ...props
4464
+ }) => {
4465
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
4466
+ !icon ? null : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Image, { src: icon, css: ButtonIcon }),
4467
+ text
4468
+ ] });
4469
+ };
4470
+
4471
+ // src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
4472
+ var import_react45 = require("@emotion/react");
4473
+ var ObjectSearchResultItemContainer = import_react45.css`
4474
+ align-items: center;
4475
+ border: 1px solid var(--gray-300);
4476
+ border-radius: var(--rounded-base);
4477
+ background: var(--gray-50);
4478
+ display: grid;
4479
+ grid-template-columns: 1fr auto;
4480
+ padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) var(--spacing-md);
4481
+ position: relative;
4482
+
4483
+ &:hover {
4484
+ .drag-handle {
4485
+ opacity: 1;
4486
+ }
4487
+ }
4488
+ `;
4489
+ var ObjectSearchDragHandle = import_react45.css`
4490
+ border-left: 2px dotted var(--gray-300);
4491
+ border-right: 2px dotted var(--gray-300);
4492
+ position: absolute;
4493
+ inset: var(--spacing-sm) auto var(--spacing-sm) var(--spacing-sm);
4494
+ width: 5px;
4495
+ transition: opacity var(--duration-fast) var(--timing-ease-out);
4496
+ opacity: 0;
4497
+ `;
4498
+ var ObjectSearchResultItemSubtitle = import_react45.css`
4499
+ color: var(--gray-500);
4500
+ display: block;
4501
+ font-size: var(--fs-xs);
4502
+ line-height: 1;
4503
+ `;
4504
+ var ObjectSearchResultItemTitle = import_react45.css`
4505
+ align-items: center;
4506
+ color: var(--brand-secondary-1);
4507
+ display: flex;
4508
+ gap: var(--spacing-xs);
4509
+ `;
4510
+ var ObjectSearchResultItemTimeStamp = import_react45.css`
4511
+ color: var(--gray-500);
4512
+ font-size: var(--fs-xs);
4513
+ `;
4514
+ var ObjectSearchAuthorStateGroup = import_react45.css`
4515
+ align-items: center;
4516
+ display: flex;
4517
+ gap: var(--spacing-sm);
4518
+ `;
4519
+ var ObjectSearchUpdateGroup = import_react45.css`
4520
+ display: grid;
4521
+ `;
4522
+ var ObjectSearchContentContainer = import_react45.css`
4523
+ display: flex;
4524
+ gap: var(--spacing-base);
4525
+ `;
4526
+ var ObjectSearchImage = import_react45.css`
4527
+ width: 56px;
4528
+ object-fit: contain;
4529
+ `;
4530
+
4531
+ // src/components/ObjectSearch/ObjectSearchResultItem.tsx
4532
+ var import_jsx_runtime52 = require("@emotion/react/jsx-runtime");
4533
+ var ObjectSearchResultItem = ({
4534
+ id,
4535
+ title,
4536
+ name,
4537
+ contentType,
4538
+ popoverData,
4539
+ publishStatus,
4540
+ editLinkIcon,
4541
+ editLink,
4542
+ imageUrl,
4543
+ onRemove,
4544
+ createdAt,
4545
+ publishedAt,
4546
+ hideRemoveButton = false,
4547
+ disableDnD = false,
4548
+ children
4549
+ }) => {
4550
+ const { onSelectItem } = useObjectSearchContext();
4551
+ const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
4552
+ const onRemoveItem = () => {
4553
+ onSelectItem({ id });
4554
+ onRemove == null ? void 0 : onRemove();
4555
+ };
4556
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { css: ObjectSearchResultItemContainer, children: [
4557
+ disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
4558
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { css: ObjectSearchContentContainer, children: [
4559
+ !imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
4560
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { children: [
4561
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
4562
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
4563
+ title != null ? title : name,
4564
+ !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
4565
+ ] }),
4566
+ !createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
4567
+ !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
4568
+ !createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
4569
+ !createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
4570
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("strong", { children: "Last updated: " }),
4571
+ (0, import_timeago3.format)(createdAt)
4572
+ ] }),
4573
+ !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
4574
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("strong", { children: "Last published: " }),
4575
+ (0, import_timeago3.format)(publishedAt)
4576
+ ] })
4577
+ ] })
4578
+ ] }),
4579
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { children })
4580
+ ] })
4581
+ ] }) }),
4582
+ !editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
4583
+ !editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
4584
+ hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
4585
+ ] })
4586
+ ] });
4587
+ };
4588
+
4589
+ // src/components/ObjectSearch/ObjectSearchResultList.tsx
4590
+ var import_design_system31 = require("@uniformdev/design-system");
4591
+ var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
4592
+
4593
+ // src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
4594
+ var import_react46 = require("@emotion/react");
4595
+ var ObjectSearchResultListContainer = import_react46.css`
4596
+ align-items: center;
4597
+ display: flex;
4598
+ gap: var(--spacing-sm);
4599
+ justify-content: space-between;
4600
+ `;
4601
+ var ObjectSearchDragContainer = import_react46.css`
4602
+ margin: 0 0 var(--spacing-sm);
4603
+ `;
4604
+ var ObjectSearchResultListCounterContainer = import_react46.css`
4605
+ align-items: center;
4606
+ display: flex;
4607
+ gap: var(--spacing-sm);
4608
+ `;
4609
+ var ObjectSearchResultListTitle = import_react46.css`
4610
+ font-weight: var(--fw-bold);
4611
+ line-height: 1;
4612
+ `;
4613
+
4614
+ // src/components/ObjectSearch/ObjectSearchResultList.tsx
4615
+ var import_jsx_runtime53 = require("@emotion/react/jsx-runtime");
4616
+ var ObjectSearchResultList = ({
4617
+ resultLabelText = "Selected",
4618
+ removeButtonText = "Remove all",
4619
+ onRemoveAllSelected,
4620
+ hideRemoveButton = false,
4621
+ additionalButtons,
4622
+ renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ObjectSearchResultItem, { ...value, disableDnD }),
4623
+ multiSelectId,
4624
+ disableDnD = false
4625
+ }) => {
4626
+ const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useObjectSearchContext();
4627
+ const handleRemoveAllSelectedItems = () => {
4628
+ onRemoveAllSelectedItems();
4629
+ onRemoveAllSelected == null ? void 0 : onRemoveAllSelected();
4630
+ };
4631
+ const onDragEnd = (res) => {
4632
+ var _a, _b;
4633
+ if (res.destination && res.source.droppableId === ((_a = res.destination) == null ? void 0 : _a.droppableId)) {
4634
+ const result = [...selectedListItems || []];
4635
+ const [removed] = (_b = result == null ? void 0 : result.splice(res.source.index, 1)) != null ? _b : [];
4636
+ result == null ? void 0 : result.splice(res.destination.index, 0, removed);
4637
+ onSelectItem(result);
4638
+ return result;
4639
+ }
4640
+ };
4641
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
4642
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
4643
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
4644
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
4645
+ " ",
4646
+ !selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system31.Counter, { count: selectedListItems.length })
4647
+ ] }),
4648
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
4649
+ additionalButtons,
4650
+ hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
4651
+ import_design_system31.Button,
4652
+ {
4653
+ buttonType: "ghostDestructive",
4654
+ size: "xs",
4655
+ disabled: selectedListItems.length === 0,
4656
+ onClick: handleRemoveAllSelectedItems,
4657
+ children: removeButtonText
4658
+ }
4659
+ )
4660
+ ] })
4661
+ ] }),
4662
+ !selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_beautiful_dnd3.DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_beautiful_dnd3.Droppable, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
4663
+ selectedListItems.map((item, i) => {
4664
+ const renderListItem = renderResultComponent(item);
4665
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_beautiful_dnd3.Draggable, { draggableId: item.id, index: i, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
4666
+ "div",
4667
+ {
4668
+ css: ObjectSearchDragContainer,
4669
+ ref: provided2.innerRef,
4670
+ "data-dragging": snapshot.isDragging,
4671
+ ...provided2.draggableProps,
4672
+ ...provided2.dragHandleProps,
4673
+ children: renderListItem
4674
+ }
4675
+ ) }, item.id);
4676
+ }),
4677
+ provided.placeholder
4678
+ ] }) }) })
4679
+ ] });
4680
+ };
4681
+
4682
+ // src/components/ObjectSearch/QueryFilter.tsx
4683
+ var import_design_system32 = require("@uniformdev/design-system");
4684
+ var import_react47 = require("react");
4685
+ var import_jsx_runtime54 = require("@emotion/react/jsx-runtime");
4686
+ var QueryFilter = ({
4687
+ requireContentType,
4688
+ queryFilterTitle = "Configure Query",
4689
+ contentTypeLabel = "Filter by content type",
4690
+ typeSelectorAllTypesOptionText = "All content types",
4691
+ contentTypeOptions,
4692
+ searchInputName = "searchText",
4693
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
4694
+ countLabel = "Count",
4695
+ countValue = 5,
4696
+ sortLabel = "Sort",
4697
+ sortOptions,
4698
+ sortOrderLabel = "Sort Order",
4699
+ sortOrderOptions = [
4700
+ {
4701
+ name: "Ascending",
4702
+ id: "asc",
4703
+ label: "Ascending"
4704
+ },
4705
+ {
4706
+ name: "Descending",
4707
+ id: "desc",
4708
+ label: "Descending"
4709
+ }
4710
+ ],
4711
+ children
4712
+ }) => {
4713
+ var _a, _b;
4714
+ const { query, onSetQuery } = useObjectSearchContext();
4715
+ const [queryState, setQueryState] = (0, import_react47.useState)({
4716
+ contentType: "",
4717
+ keyword: "",
4718
+ count: countValue != null ? countValue : 5,
4719
+ sortBy: (_a = sortOptions[0].id) != null ? _a : "",
4720
+ sortOrder: (_b = sortOrderOptions[0].id) != null ? _b : ""
4721
+ });
4722
+ const handleFilterChange = (value) => {
4723
+ setQueryState((prev) => ({ ...prev, ...value }));
4724
+ onSetQuery({ ...query, ...value });
4725
+ };
4726
+ (0, import_react47.useEffect)(() => {
4727
+ onSetQuery(queryState);
4728
+ }, [onSetQuery, queryState]);
4729
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("fieldset", { children: [
4730
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
4731
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchFilterContainer, children: [
4732
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchFilterGrid("0.5fr 1fr"), children: [
4733
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
4734
+ import_design_system32.InputSelect,
4735
+ {
4736
+ label: contentTypeLabel,
4737
+ showLabel: false,
4738
+ options: [
4739
+ ...!requireContentType ? [{ id: "", label: typeSelectorAllTypesOptionText }] : [],
4740
+ ...contentTypeOptions ? contentTypeOptions.map((option) => {
4741
+ var _a2;
4742
+ return { id: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
4743
+ }) : []
4744
+ ],
4745
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
4746
+ value: queryState.contentType
4747
+ }
4748
+ ),
4749
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
4750
+ import_design_system32.InputKeywordSearch,
4751
+ {
4752
+ inputFieldName: searchInputName,
4753
+ placeholder: searchInputPlaceholderText,
4754
+ onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
4755
+ disabledFieldSubmission: true,
4756
+ onClear: () => handleFilterChange({ keyword: "" }),
4757
+ value: queryState.keyword
4758
+ }
4759
+ )
4760
+ ] }),
4761
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchFilterGrid("repeat(2, 1fr) 0.5fr"), children: [
4762
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
4763
+ import_design_system32.InputSelect,
4764
+ {
4765
+ label: sortLabel,
4766
+ options: [
4767
+ {
4768
+ label: "Select a sort",
4769
+ id: ""
4770
+ },
4771
+ ...sortOptions ? sortOptions.map((option) => {
4772
+ var _a2;
4773
+ return { id: option.id, name: option.name, label: (_a2 = option.label) != null ? _a2 : option.name };
4774
+ }) : []
4775
+ ],
4776
+ onChange: (e) => handleFilterChange({ sortBy: e.target.value }),
4777
+ value: queryState.sortBy
4778
+ }
4779
+ ),
4780
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
4781
+ import_design_system32.InputSelect,
4782
+ {
4783
+ label: sortOrderLabel,
4784
+ options: [
4785
+ ...sortOrderOptions ? sortOrderOptions.map((option) => {
4786
+ var _a2;
4787
+ return { value: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
4788
+ }) : []
4789
+ ],
4790
+ onChange: (e) => handleFilterChange({ sortOrder: e.target.value }),
4791
+ value: queryState.sortOrder
4792
+ }
4793
+ ),
4794
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
4795
+ import_design_system32.Input,
4796
+ {
4797
+ label: countLabel,
4798
+ type: "number",
4799
+ onChange: (e) => handleFilterChange({ count: e.target.value }),
4800
+ defaultValue: countValue,
4801
+ value: queryState.count
4802
+ }
4803
+ )
4804
+ ] }),
4805
+ children
4806
+ ] })
4807
+ ] });
4808
+ };
4111
4809
 
4112
4810
  // src/hooks/index.ts
4113
- var import_design_system24 = require("@uniformdev/design-system");
4811
+ var import_design_system33 = require("@uniformdev/design-system");
4114
4812
 
4115
4813
  // src/utils/createLocationValidator.ts
4116
4814
  function createLocationValidator(setValue, validate) {
@@ -4121,7 +4819,7 @@ function createLocationValidator(setValue, validate) {
4121
4819
  }
4122
4820
 
4123
4821
  // src/index.ts
4124
- var import_design_system25 = require("@uniformdev/design-system");
4822
+ var import_design_system34 = require("@uniformdev/design-system");
4125
4823
  __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
4126
4824
  // Annotate the CommonJS export names for ESM import in node:
4127
4825
  0 && (module.exports = {
@@ -4129,6 +4827,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
4129
4827
  Button,
4130
4828
  Callout,
4131
4829
  DamSelectedItem,
4830
+ DataRefreshButton,
4132
4831
  DataResourceVariablesList,
4133
4832
  DataSourceEditor,
4134
4833
  DataTypeEditor,
@@ -4143,13 +4842,22 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
4143
4842
  InputSelect,
4144
4843
  InputToggle,
4145
4844
  InputVariables,
4146
- KeywordSearchInput,
4147
4845
  Label,
4846
+ LinkButton,
4148
4847
  LoadingIndicator,
4149
4848
  LoadingOverlay,
4150
4849
  Menu,
4151
4850
  MenuItem,
4152
4851
  MeshApp,
4852
+ ObjectSearchContainer,
4853
+ ObjectSearchFilter,
4854
+ ObjectSearchFilterContainer,
4855
+ ObjectSearchListItem,
4856
+ ObjectSearchListItemLoadingSkeleton,
4857
+ ObjectSearchProvider,
4858
+ ObjectSearchResultItem,
4859
+ ObjectSearchResultItemButton,
4860
+ ObjectSearchResultList,
4153
4861
  ParameterGroup,
4154
4862
  ParameterImage,
4155
4863
  ParameterImageInner,
@@ -4172,6 +4880,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
4172
4880
  ProductSearchContext,
4173
4881
  ProductSearchRow,
4174
4882
  ProductSelectedItem,
4883
+ QueryFilter,
4175
4884
  RequestBody,
4176
4885
  RequestHeaders,
4177
4886
  RequestMethodSelect,
@@ -4188,10 +4897,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
4188
4897
  TextVariableRenderer,
4189
4898
  Textarea,
4190
4899
  Theme,
4191
- UniformMeshLocationContext,
4192
- UniformMeshLocationContextProvider,
4193
- UniformMeshSdkContext,
4194
- UniformMeshSdkContextProvider,
4195
4900
  VariableEditor,
4196
4901
  VariablesList,
4197
4902
  VariablesProvider,
@@ -4260,18 +4965,15 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
4260
4965
  selectedItemTitle,
4261
4966
  urlEncodeRequestParameter,
4262
4967
  urlEncodeRequestUrl,
4263
- useInitializeUniformMeshSdk,
4264
4968
  useMeshLocation,
4969
+ useObjectSearchContext,
4265
4970
  useParameterShell,
4266
4971
  useProductQueryContext,
4267
4972
  useProductSearchContext,
4268
4973
  useRequest,
4269
4974
  useRequestHeader,
4270
4975
  useRequestParameter,
4271
- useUniformMeshLocation,
4272
- useUniformMeshLocationContext,
4273
4976
  useUniformMeshSdk,
4274
- useUniformMeshSdkContext,
4275
4977
  useVariables,
4276
4978
  variablesToList
4277
4979
  });