@uniformdev/mesh-sdk-react 18.33.1-alpha.7 → 18.34.1-alpha.57

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
@@ -955,12 +955,12 @@ import { Callout as Callout2 } from "@uniformdev/design-system";
955
955
  import React6, { useContext as useContext2, useMemo as useMemo2, useRef as useRef5 } from "react";
956
956
  import { useAsync, useAsyncFn as useAsyncFn2 } from "react-use";
957
957
 
958
- // src/components/EntrySearch/DefaultSearchRow.tsx
958
+ // src/components/legacy/EntrySearch/DefaultSearchRow.tsx
959
959
  import { css as css7 } from "@emotion/react";
960
960
  import { useOutsideClick } from "@uniformdev/design-system";
961
961
  import { useRef, useState } from "react";
962
962
 
963
- // src/components/EntrySearch/styles/DefaultSearchRow.styles.ts
963
+ // src/components/legacy/EntrySearch/styles/DefaultSearchRow.styles.ts
964
964
  import { css as css6 } from "@emotion/react";
965
965
  var searchRowContainer = css6`
966
966
  cursor: pointer;
@@ -1001,7 +1001,7 @@ var searchRowBtn = css6`
1001
1001
  inset: 0 var(--spacing-sm) 0 auto;
1002
1002
  `;
1003
1003
 
1004
- // src/components/EntrySearch/DefaultSearchRow.tsx
1004
+ // src/components/legacy/EntrySearch/DefaultSearchRow.tsx
1005
1005
  import { jsx as jsx19, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
1006
1006
  var DefaultSearchRow = ({ result, isSelected, triggerSelection }) => {
1007
1007
  const popoverRef = useRef(null);
@@ -1075,7 +1075,7 @@ var DefaultSearchRow = ({ result, isSelected, triggerSelection }) => {
1075
1075
  );
1076
1076
  };
1077
1077
 
1078
- // src/components/EntrySearch/DefaultSelectedItem.tsx
1078
+ // src/components/legacy/EntrySearch/DefaultSelectedItem.tsx
1079
1079
  import { css as css9 } from "@emotion/react";
1080
1080
  import { Icon as Icon2, useOutsideClick as useOutsideClick2 } from "@uniformdev/design-system";
1081
1081
  import { useEffect, useRef as useRef2, useState as useState2 } from "react";
@@ -1093,7 +1093,7 @@ function openWindowWithCloseCallback(href, callback) {
1093
1093
  }, 500);
1094
1094
  }
1095
1095
 
1096
- // src/components/EntrySearch/styles/DefaultSelectedItem.styles.ts
1096
+ // src/components/legacy/EntrySearch/styles/DefaultSelectedItem.styles.ts
1097
1097
  import { css as css8 } from "@emotion/react";
1098
1098
  import { mq as mq2 } from "@uniformdev/design-system";
1099
1099
  var selectedItemContainer = css8`
@@ -1177,7 +1177,7 @@ var selectItemLinkBtn = css8`
1177
1177
  }
1178
1178
  `;
1179
1179
 
1180
- // src/components/EntrySearch/DefaultSelectedItem.tsx
1180
+ // src/components/legacy/EntrySearch/DefaultSelectedItem.tsx
1181
1181
  import { jsx as jsx20, jsxs as jsxs9 } from "@emotion/react/jsx-runtime";
1182
1182
  var DefaultSelectedItem = ({
1183
1183
  selectedItem,
@@ -1360,7 +1360,7 @@ var DefaultSelectedItem = ({
1360
1360
  ] }) }, selectedItem.id);
1361
1361
  };
1362
1362
 
1363
- // src/components/EntrySearch/EntrySearch.tsx
1363
+ // src/components/legacy/EntrySearch/EntrySearch.tsx
1364
1364
  import { css as css11 } from "@emotion/react";
1365
1365
  import {
1366
1366
  Button,
@@ -1411,7 +1411,7 @@ function useLoadingDelay(loading, { delay = 500, minDuration = 200 } = {
1411
1411
  return state === "DISPLAY" || state === "EXPIRE";
1412
1412
  }
1413
1413
 
1414
- // src/components/EntrySearch/styles/EntrySearch.styles.ts
1414
+ // src/components/legacy/EntrySearch/styles/EntrySearch.styles.ts
1415
1415
  import { css as css10 } from "@emotion/react";
1416
1416
  var entrySearchWrapper = css10`
1417
1417
  background: var(--white);
@@ -1522,7 +1522,7 @@ var badgeIcon = css10`
1522
1522
  height: calc(var(--spacing-lg) + var(--spacing-xs));
1523
1523
  `;
1524
1524
 
1525
- // src/components/EntrySearch/EntrySearch.tsx
1525
+ // src/components/legacy/EntrySearch/EntrySearch.tsx
1526
1526
  import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs10 } from "@emotion/react/jsx-runtime";
1527
1527
  var DefaultNoResults = ({ searchText, selectedContentType }) => {
1528
1528
  let message = "No content found";
@@ -2655,6 +2655,18 @@ import { Theme } from "@uniformdev/design-system";
2655
2655
  import { createContext, useContext as useContext3 } from "react";
2656
2656
  import { jsx as jsx26, jsxs as jsxs15 } from "@emotion/react/jsx-runtime";
2657
2657
  var UniformMeshSdkContext = createContext(void 0);
2658
+ var UniformMeshSdkContextProvider = ({ children }) => {
2659
+ let value = void 0;
2660
+ if (typeof window !== "undefined" && typeof window.UniformMeshSDK !== "undefined") {
2661
+ value = {
2662
+ sdk: window.UniformMeshSDK
2663
+ };
2664
+ }
2665
+ return /* @__PURE__ */ jsxs15(UniformMeshSdkContext.Provider, { value, children: [
2666
+ /* @__PURE__ */ jsx26(Theme, {}),
2667
+ /* @__PURE__ */ jsx26(UniformMeshLocationContextProvider, { children })
2668
+ ] });
2669
+ };
2658
2670
  var useUniformMeshSdkContext = () => {
2659
2671
  const context = useContext3(UniformMeshSdkContext);
2660
2672
  if (!context) {
@@ -2671,7 +2683,9 @@ function useUniformMeshSdk() {
2671
2683
 
2672
2684
  // src/components/UniformMeshLocationContext.tsx
2673
2685
  import { jsx as jsx27 } from "@emotion/react/jsx-runtime";
2674
- var UniformMeshLocationContext = createContext2(void 0);
2686
+ var UniformMeshLocationContext = createContext2(
2687
+ void 0
2688
+ );
2675
2689
  var UniformMeshLocationContextProvider = ({
2676
2690
  children
2677
2691
  }) => {
@@ -2702,9 +2716,20 @@ var useUniformMeshLocationContext = () => {
2702
2716
  };
2703
2717
 
2704
2718
  // src/hooks/useMeshLocation.ts
2719
+ var legacyWarned = false;
2705
2720
  function useMeshLocation(expectedLocation) {
2706
2721
  const { location } = useUniformMeshLocationContext();
2707
- if (expectedLocation && location.type !== expectedLocation) {
2722
+ let effectiveExpected = expectedLocation;
2723
+ if (expectedLocation === "dataTypeInstance") {
2724
+ effectiveExpected = "dataResource";
2725
+ if (!legacyWarned) {
2726
+ console.warn(
2727
+ "`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."
2728
+ );
2729
+ legacyWarned = true;
2730
+ }
2731
+ }
2732
+ if (effectiveExpected && location.type !== effectiveExpected) {
2708
2733
  throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
2709
2734
  }
2710
2735
  const backdoorLocation = useRef7(location);
@@ -3191,7 +3216,7 @@ function DataResourceVariablesList({
3191
3216
  const {
3192
3217
  value,
3193
3218
  metadata: { dataType }
3194
- } = useMeshLocation("dataResource");
3219
+ } = useMeshLocation("dataTypeInstance");
3195
3220
  const variableDefinitions = variablesToList(dataType.variables);
3196
3221
  if (variableDefinitions.length === 0) {
3197
3222
  if (NoVariablesComponent) {
@@ -3937,6 +3962,737 @@ var MeshApp = ({
3937
3962
  ] });
3938
3963
  };
3939
3964
 
3965
+ // src/components/ObjectSearch/DataRefreshButton.tsx
3966
+ import { css as css25 } from "@emotion/react";
3967
+ import { Button as Button3, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
3968
+ import { jsx as jsx45, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
3969
+ var DataRefreshButton = ({
3970
+ buttonText,
3971
+ isLoading,
3972
+ onRefreshData,
3973
+ ...props
3974
+ }) => {
3975
+ return /* @__PURE__ */ jsxs26(Button3, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
3976
+ !isLoading ? null : /* @__PURE__ */ jsx45(
3977
+ LoadingIndicator3,
3978
+ {
3979
+ css: css25`
3980
+ ${isLoading ? "opacity: 0.2;" : void 0}
3981
+ `
3982
+ }
3983
+ ),
3984
+ buttonText
3985
+ ] });
3986
+ };
3987
+
3988
+ // src/components/ObjectSearch/ObjectSearchContainer.tsx
3989
+ import { Container, IconsProvider, ScrollableList, VerticalRhythm } from "@uniformdev/design-system";
3990
+ import { jsx as jsx46, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
3991
+ var ObjectSearchContainer = ({
3992
+ searchFilters,
3993
+ resultList,
3994
+ children
3995
+ }) => {
3996
+ return /* @__PURE__ */ jsx46(IconsProvider, { children: /* @__PURE__ */ jsxs27(VerticalRhythm, { children: [
3997
+ /* @__PURE__ */ jsx46(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ jsxs27(VerticalRhythm, { children: [
3998
+ searchFilters,
3999
+ !resultList ? null : /* @__PURE__ */ jsx46(ScrollableList, { role: "list", children: resultList })
4000
+ ] }) }),
4001
+ children
4002
+ ] }) });
4003
+ };
4004
+
4005
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
4006
+ import { InputKeywordSearch as InputKeywordSearch2, InputSelect as InputSelect6 } from "@uniformdev/design-system";
4007
+ import { useState as useState11 } from "react";
4008
+
4009
+ // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
4010
+ import { createContext as createContext5, useCallback, useContext as useContext7, useDeferredValue, useState as useState10 } from "react";
4011
+ import { jsx as jsx47 } from "@emotion/react/jsx-runtime";
4012
+ var ObjectSearchContext = createContext5({
4013
+ onSetQuery: () => {
4014
+ },
4015
+ onSelectItem: () => {
4016
+ },
4017
+ query: {
4018
+ contentType: "",
4019
+ keyword: ""
4020
+ },
4021
+ list: {},
4022
+ onSetList: () => {
4023
+ },
4024
+ selectedListItems: [],
4025
+ onRemoveAllSelectedItems: () => {
4026
+ }
4027
+ });
4028
+ var ObjectSearchProvider = ({ currentlySelectedItems, children }) => {
4029
+ const [query, setQuery] = useState10({
4030
+ contentType: "",
4031
+ keyword: ""
4032
+ });
4033
+ const querySearchDeferred = useDeferredValue(query);
4034
+ const [selectedItems, setSelectedItems] = useState10(currentlySelectedItems != null ? currentlySelectedItems : []);
4035
+ const [list, setList] = useState10({});
4036
+ const onSetQuery = useCallback(
4037
+ (value) => {
4038
+ if (Array.isArray(value.contentType) && value.contentType.length > 0) {
4039
+ return setQuery({
4040
+ ...value,
4041
+ contentType: value.contentType[0].id
4042
+ });
4043
+ }
4044
+ return setQuery(value);
4045
+ },
4046
+ [setQuery]
4047
+ );
4048
+ const onSelectItem = useCallback(
4049
+ (selectedResult) => {
4050
+ if (Array.isArray(selectedResult)) {
4051
+ setSelectedItems(selectedResult);
4052
+ } else {
4053
+ if (selectedItems.some((item) => item.id === selectedResult.id)) {
4054
+ setSelectedItems((prev) => prev.filter((item) => item.id !== selectedResult.id));
4055
+ } else {
4056
+ setSelectedItems((prev) => [...prev, selectedResult]);
4057
+ }
4058
+ }
4059
+ },
4060
+ [setSelectedItems, selectedItems]
4061
+ );
4062
+ const onRemoveAllSelectedItems = useCallback(() => {
4063
+ setSelectedItems([]);
4064
+ }, [setSelectedItems]);
4065
+ const onSetList = useCallback(
4066
+ (value) => {
4067
+ setList(value);
4068
+ },
4069
+ [setList]
4070
+ );
4071
+ return /* @__PURE__ */ jsx47(
4072
+ ObjectSearchContext.Provider,
4073
+ {
4074
+ value: {
4075
+ onSetQuery,
4076
+ query: querySearchDeferred,
4077
+ onSelectItem,
4078
+ selectedListItems: selectedItems,
4079
+ onRemoveAllSelectedItems,
4080
+ list,
4081
+ onSetList
4082
+ },
4083
+ children
4084
+ }
4085
+ );
4086
+ };
4087
+ var useObjectSearchContext = () => {
4088
+ const contextValues = useContext7(ObjectSearchContext);
4089
+ return { ...contextValues };
4090
+ };
4091
+
4092
+ // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
4093
+ import { css as css26 } from "@emotion/react";
4094
+ var ObjectSearchFilterContainerLabel = css26`
4095
+ align-items: center;
4096
+ display: flex;
4097
+ font-size: var(--fs-sm);
4098
+ font-weight: var(--fw-bold);
4099
+ line-height: 1rem;
4100
+ margin-bottom: var(--spacing-sm);
4101
+ `;
4102
+ var ObjectSearchFilterContainer = css26`
4103
+ display: grid;
4104
+ gap: var(--spacing-base);
4105
+ `;
4106
+ var ObjectSearchFilterDropdownAndTextSearch = css26`
4107
+ grid-template-columns: 0.5fr 1fr;
4108
+ `;
4109
+ var ObjectSearchFilterGrid = (gridColumns) => css26`
4110
+ display: grid;
4111
+ grid-template-columns: ${gridColumns};
4112
+ gap: var(--spacing-base);
4113
+ `;
4114
+
4115
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
4116
+ import { jsx as jsx48, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
4117
+ var ObjectSearchFilter = ({
4118
+ requireContentType,
4119
+ typeSelectorAllTypesOptionText = "All content types",
4120
+ searchInputName = "searchText",
4121
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
4122
+ selectLabel = "Content Type Select",
4123
+ selectOptions
4124
+ }) => {
4125
+ const { query, onSetQuery } = useObjectSearchContext();
4126
+ const [searchState, setSearchState] = useState11({
4127
+ contentType: "",
4128
+ keyword: ""
4129
+ });
4130
+ const handleFilterChange = (value) => {
4131
+ setSearchState((prev) => {
4132
+ return { ...prev, ...value };
4133
+ });
4134
+ onSetQuery({ ...query, ...value });
4135
+ };
4136
+ return /* @__PURE__ */ jsxs28("fieldset", { css: [ObjectSearchFilterContainer, ObjectSearchFilterDropdownAndTextSearch], children: [
4137
+ /* @__PURE__ */ jsx48(
4138
+ InputSelect6,
4139
+ {
4140
+ label: selectLabel,
4141
+ showLabel: false,
4142
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
4143
+ options: [
4144
+ ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
4145
+ ...selectOptions ? selectOptions.map((option) => {
4146
+ var _a;
4147
+ return { name: option == null ? void 0 : option.name, label: (_a = option.label) != null ? _a : option == null ? void 0 : option.name, id: option.id };
4148
+ }) : []
4149
+ ],
4150
+ value: query.contentType
4151
+ }
4152
+ ),
4153
+ /* @__PURE__ */ jsx48(
4154
+ InputKeywordSearch2,
4155
+ {
4156
+ inputFieldName: searchInputName,
4157
+ placeholder: searchInputPlaceholderText,
4158
+ onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
4159
+ disabledFieldSubmission: true,
4160
+ onClear: () => handleFilterChange({ keyword: "" }),
4161
+ value: searchState.keyword
4162
+ }
4163
+ )
4164
+ ] });
4165
+ };
4166
+
4167
+ // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
4168
+ import { jsx as jsx49, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
4169
+ var ObjectSearchFilterContainer2 = ({ label, children }) => {
4170
+ return /* @__PURE__ */ jsxs29("div", { children: [
4171
+ /* @__PURE__ */ jsx49("span", { css: ObjectSearchFilterContainerLabel, children: label }),
4172
+ /* @__PURE__ */ jsx49("div", { css: ObjectSearchFilterContainer, children })
4173
+ ] });
4174
+ };
4175
+
4176
+ // src/components/ObjectSearch/ObjectSearchListItem.tsx
4177
+ import { Popover } from "@uniformdev/design-system";
4178
+
4179
+ // src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
4180
+ import { css as css27 } from "@emotion/react";
4181
+ import { skeletonLoading } from "@uniformdev/design-system";
4182
+ var ObjectListItemContainer = css27`
4183
+ align-items: center;
4184
+ border: 1px solid var(--gray-300);
4185
+ border-radius: var(--rounded-base);
4186
+ background: var(--white);
4187
+ display: grid;
4188
+ grid-template-columns: 1fr 32px;
4189
+ padding: var(--spacing-sm);
4190
+
4191
+ &[hidden] {
4192
+ display: none;
4193
+ }
4194
+ `;
4195
+ var ObjectListItemLoading = css27`
4196
+ animation: ${skeletonLoading} 1s linear infinite alternate;
4197
+ border-color: transparent;
4198
+ min-height: 42px;
4199
+ position: relative;
4200
+
4201
+ &:before,
4202
+ &:after {
4203
+ background: var(--gray-200);
4204
+ content: '';
4205
+ display: block;
4206
+ height: 1rem;
4207
+ }
4208
+
4209
+ &:before {
4210
+ border-radius: var(--rounded-base);
4211
+ width: 10rem;
4212
+ }
4213
+
4214
+ &:after {
4215
+ border-radius: var(--rounded-full);
4216
+ width: 1rem;
4217
+ }
4218
+ `;
4219
+ var ObjectListItemHeadingGroup = css27`
4220
+ align-items: center;
4221
+ display: grid;
4222
+ `;
4223
+ var ObjectListItemTitle = css27`
4224
+ color: var(--brand-secondary-1);
4225
+ display: block;
4226
+ font-size: var(--fs-sm);
4227
+ `;
4228
+ var ObjectListItemSubtitle = css27`
4229
+ color: var(--gray-500);
4230
+ display: block;
4231
+ font-size: var(--fs-xs);
4232
+ line-height: 1;
4233
+ `;
4234
+ var ObjectListItemInfoContainer = css27`
4235
+ align-items: center;
4236
+ display: flex;
4237
+ justify-content: center;
4238
+ `;
4239
+ var ObjectListItemControlledContent = css27`
4240
+ display: flex;
4241
+ gap: var(--spacing-sm);
4242
+ `;
4243
+ var ObjectListItemUnControlledContent = css27`
4244
+ margin-top: var(--spacing-sm);
4245
+ grid-column: 1 / -1;
4246
+ `;
4247
+
4248
+ // src/components/ObjectSearch/ObjectSearchListItem.tsx
4249
+ import { jsx as jsx50, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
4250
+ var ObjectSearchListItem = ({
4251
+ id,
4252
+ title,
4253
+ contentType,
4254
+ image,
4255
+ popoverData,
4256
+ onSelect,
4257
+ isMulti = false,
4258
+ children,
4259
+ ...props
4260
+ }) => {
4261
+ const { onSelectItem, selectedListItems } = useObjectSearchContext();
4262
+ const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
4263
+ const handleSelectItem = () => {
4264
+ var _a;
4265
+ const extraData = (_a = onSelect == null ? void 0 : onSelect()) != null ? _a : {};
4266
+ const selectedItem = { id, title, contentType, image, popoverData, ...extraData };
4267
+ if (isMulti) {
4268
+ return onSelectItem(selectedItem);
4269
+ }
4270
+ return onSelectItem([selectedItem]);
4271
+ };
4272
+ const hideWhenInSelectedList = selectedListItems.some((item) => item.id === id);
4273
+ return /* @__PURE__ */ jsxs30("div", { role: "listitem", hidden: hideWhenInSelectedList, css: ObjectListItemContainer, ...props, children: [
4274
+ /* @__PURE__ */ jsxs30("div", { role: "button", onClick: handleSelectItem, css: ObjectListItemControlledContent, children: [
4275
+ !image ? null : /* @__PURE__ */ jsx50("img", { ...image, loading: (image == null ? void 0 : image.width) && image.height ? "lazy" : "eager" }),
4276
+ /* @__PURE__ */ jsxs30("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
4277
+ !contentType ? null : /* @__PURE__ */ jsx50("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
4278
+ /* @__PURE__ */ jsx50("span", { css: ObjectListItemTitle, children: title })
4279
+ ] })
4280
+ ] }),
4281
+ !popoverData ? null : /* @__PURE__ */ jsx50("div", { css: ObjectListItemInfoContainer, children: /* @__PURE__ */ jsx50(Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData }) }),
4282
+ !children ? null : /* @__PURE__ */ jsx50("div", { css: ObjectListItemUnControlledContent, children })
4283
+ ] });
4284
+ };
4285
+ var ObjectSearchListItemLoadingSkeleton = () => {
4286
+ return /* @__PURE__ */ jsx50("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
4287
+ };
4288
+
4289
+ // src/components/ObjectSearch/ObjectSearchResultItem.tsx
4290
+ import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/design-system";
4291
+ import { format as timeagoFormat } from "timeago.js";
4292
+
4293
+ // src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
4294
+ import { css as css28 } from "@emotion/react";
4295
+ import { button as button2 } from "@uniformdev/design-system";
4296
+ var ButtonStyles = css28`
4297
+ ${button2}
4298
+ background: transparent;
4299
+ border: 1px solid var(--brand-secondary-1);
4300
+ color: var(--brand-secondary-1);
4301
+ padding: var(--spacing-sm);
4302
+ font-size: var(--fs-sm);
4303
+ line-height: 1;
4304
+ gap: var(--spacing-xs);
4305
+ transition: border-color var(--duration-fast) var(--timing-ease-out),
4306
+ background-color var(--duration-fast) var(--timing-ease-out);
4307
+
4308
+ &:hover {
4309
+ background: var(--gray-100);
4310
+ border-color: var(--gray-300);
4311
+ }
4312
+
4313
+ &:disabled {
4314
+ background: var(--gray-300);
4315
+ border-color: var(--gray-200);
4316
+ color: var(--gray-500);
4317
+ }
4318
+
4319
+ &:link {
4320
+ text-decoration: none;
4321
+ }
4322
+ `;
4323
+ var ButtonIcon = css28`
4324
+ width: 1rem;
4325
+ height: 1rem;
4326
+ `;
4327
+
4328
+ // src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
4329
+ import { jsx as jsx51, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
4330
+ var ObjectSearchResultItemButton = ({
4331
+ text,
4332
+ icon,
4333
+ ...props
4334
+ }) => {
4335
+ return /* @__PURE__ */ jsxs31("button", { type: "button", css: ButtonStyles, ...props, children: [
4336
+ !icon ? null : /* @__PURE__ */ jsx51(Image, { src: icon, css: ButtonIcon }),
4337
+ text
4338
+ ] });
4339
+ };
4340
+ var LinkButton = ({
4341
+ text,
4342
+ icon,
4343
+ ...props
4344
+ }) => {
4345
+ return /* @__PURE__ */ jsxs31("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
4346
+ !icon ? null : /* @__PURE__ */ jsx51(Image, { src: icon, css: ButtonIcon }),
4347
+ text
4348
+ ] });
4349
+ };
4350
+
4351
+ // src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
4352
+ import { css as css29 } from "@emotion/react";
4353
+ var ObjectSearchResultItemContainer = css29`
4354
+ align-items: center;
4355
+ border: 1px solid var(--gray-300);
4356
+ border-radius: var(--rounded-base);
4357
+ background: var(--gray-50);
4358
+ display: grid;
4359
+ grid-template-columns: 1fr auto;
4360
+ padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) var(--spacing-md);
4361
+ position: relative;
4362
+
4363
+ &:hover {
4364
+ .drag-handle {
4365
+ opacity: 1;
4366
+ }
4367
+ }
4368
+ `;
4369
+ var ObjectSearchDragHandle = css29`
4370
+ border-left: 2px dotted var(--gray-300);
4371
+ border-right: 2px dotted var(--gray-300);
4372
+ position: absolute;
4373
+ inset: var(--spacing-sm) auto var(--spacing-sm) var(--spacing-sm);
4374
+ width: 5px;
4375
+ transition: opacity var(--duration-fast) var(--timing-ease-out);
4376
+ opacity: 0;
4377
+ `;
4378
+ var ObjectSearchResultItemSubtitle = css29`
4379
+ color: var(--gray-500);
4380
+ display: block;
4381
+ font-size: var(--fs-xs);
4382
+ line-height: 1;
4383
+ `;
4384
+ var ObjectSearchResultItemTitle = css29`
4385
+ align-items: center;
4386
+ color: var(--brand-secondary-1);
4387
+ display: flex;
4388
+ gap: var(--spacing-xs);
4389
+ `;
4390
+ var ObjectSearchResultItemTimeStamp = css29`
4391
+ color: var(--gray-500);
4392
+ font-size: var(--fs-xs);
4393
+ `;
4394
+ var ObjectSearchAuthorStateGroup = css29`
4395
+ align-items: center;
4396
+ display: flex;
4397
+ gap: var(--spacing-sm);
4398
+ `;
4399
+ var ObjectSearchUpdateGroup = css29`
4400
+ display: grid;
4401
+ `;
4402
+ var ObjectSearchContentContainer = css29`
4403
+ display: flex;
4404
+ gap: var(--spacing-base);
4405
+ `;
4406
+ var ObjectSearchImage = css29`
4407
+ width: 56px;
4408
+ object-fit: contain;
4409
+ `;
4410
+
4411
+ // src/components/ObjectSearch/ObjectSearchResultItem.tsx
4412
+ import { jsx as jsx52, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
4413
+ var ObjectSearchResultItem = ({
4414
+ id,
4415
+ title,
4416
+ name,
4417
+ contentType,
4418
+ popoverData,
4419
+ publishStatus,
4420
+ editLinkIcon,
4421
+ editLink,
4422
+ imageUrl,
4423
+ onRemove,
4424
+ createdAt,
4425
+ publishedAt,
4426
+ hideRemoveButton = false,
4427
+ disableDnD = false,
4428
+ children
4429
+ }) => {
4430
+ const { onSelectItem } = useObjectSearchContext();
4431
+ const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
4432
+ const onRemoveItem = () => {
4433
+ onSelectItem({ id });
4434
+ onRemove == null ? void 0 : onRemove();
4435
+ };
4436
+ return /* @__PURE__ */ jsxs32("div", { css: ObjectSearchResultItemContainer, children: [
4437
+ disableDnD ? null : /* @__PURE__ */ jsx52("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
4438
+ /* @__PURE__ */ jsx52("div", { children: /* @__PURE__ */ jsxs32("div", { css: ObjectSearchContentContainer, children: [
4439
+ !imageUrl ? null : /* @__PURE__ */ jsx52("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
4440
+ /* @__PURE__ */ jsxs32("div", { children: [
4441
+ /* @__PURE__ */ jsx52("span", { css: ObjectSearchResultItemSubtitle, children: formatedContentType }),
4442
+ /* @__PURE__ */ jsxs32("span", { role: "heading", css: ObjectSearchResultItemTitle, children: [
4443
+ title != null ? title : name,
4444
+ !popoverData ? null : /* @__PURE__ */ jsx52(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
4445
+ ] }),
4446
+ !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs32("div", { css: ObjectSearchAuthorStateGroup, children: [
4447
+ !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx52(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
4448
+ !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs32("div", { css: ObjectSearchUpdateGroup, children: [
4449
+ !createdAt ? null : /* @__PURE__ */ jsxs32("small", { css: ObjectSearchResultItemTimeStamp, children: [
4450
+ /* @__PURE__ */ jsx52("strong", { children: "Last updated: " }),
4451
+ timeagoFormat(createdAt)
4452
+ ] }),
4453
+ !publishedAt ? null : /* @__PURE__ */ jsxs32("small", { css: ObjectSearchResultItemTimeStamp, children: [
4454
+ /* @__PURE__ */ jsx52("strong", { children: "Last published: " }),
4455
+ timeagoFormat(publishedAt)
4456
+ ] })
4457
+ ] })
4458
+ ] }),
4459
+ /* @__PURE__ */ jsx52("div", { children })
4460
+ ] })
4461
+ ] }) }),
4462
+ !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs32("div", { css: ObjectSearchAuthorStateGroup, children: [
4463
+ !editLink ? null : /* @__PURE__ */ jsx52(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
4464
+ hideRemoveButton ? null : /* @__PURE__ */ jsx52(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
4465
+ ] })
4466
+ ] });
4467
+ };
4468
+
4469
+ // src/components/ObjectSearch/ObjectSearchResultList.tsx
4470
+ import { Button as Button5, Counter } from "@uniformdev/design-system";
4471
+ import { DragDropContext as DragDropContext3, Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
4472
+
4473
+ // src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
4474
+ import { css as css30 } from "@emotion/react";
4475
+ var ObjectSearchResultListContainer = css30`
4476
+ align-items: center;
4477
+ display: flex;
4478
+ gap: var(--spacing-sm);
4479
+ justify-content: space-between;
4480
+ `;
4481
+ var ObjectSearchDragContainer = css30`
4482
+ margin: 0 0 var(--spacing-sm);
4483
+ `;
4484
+ var ObjectSearchResultListCounterContainer = css30`
4485
+ align-items: center;
4486
+ display: flex;
4487
+ gap: var(--spacing-sm);
4488
+ `;
4489
+ var ObjectSearchResultListTitle = css30`
4490
+ font-weight: var(--fw-bold);
4491
+ line-height: 1;
4492
+ `;
4493
+
4494
+ // src/components/ObjectSearch/ObjectSearchResultList.tsx
4495
+ import { Fragment as Fragment7, jsx as jsx53, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
4496
+ var ObjectSearchResultList = ({
4497
+ resultLabelText = "Selected",
4498
+ removeButtonText = "Remove all",
4499
+ onRemoveAllSelected,
4500
+ hideRemoveButton = false,
4501
+ additionalButtons,
4502
+ renderResultComponent = (value) => /* @__PURE__ */ jsx53(ObjectSearchResultItem, { ...value, disableDnD }),
4503
+ multiSelectId,
4504
+ disableDnD = false
4505
+ }) => {
4506
+ const { selectedListItems, onRemoveAllSelectedItems, onSelectItem } = useObjectSearchContext();
4507
+ const handleRemoveAllSelectedItems = () => {
4508
+ onRemoveAllSelectedItems();
4509
+ onRemoveAllSelected == null ? void 0 : onRemoveAllSelected();
4510
+ };
4511
+ const onDragEnd = (res) => {
4512
+ var _a, _b;
4513
+ if (res.destination && res.source.droppableId === ((_a = res.destination) == null ? void 0 : _a.droppableId)) {
4514
+ const result = [...selectedListItems || []];
4515
+ const [removed] = (_b = result == null ? void 0 : result.splice(res.source.index, 1)) != null ? _b : [];
4516
+ result == null ? void 0 : result.splice(res.destination.index, 0, removed);
4517
+ onSelectItem(result);
4518
+ return result;
4519
+ }
4520
+ };
4521
+ return /* @__PURE__ */ jsxs33(Fragment7, { children: [
4522
+ /* @__PURE__ */ jsxs33("div", { role: "group", css: ObjectSearchResultListContainer, children: [
4523
+ /* @__PURE__ */ jsxs33("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
4524
+ /* @__PURE__ */ jsx53("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
4525
+ " ",
4526
+ !selectedListItems.length ? null : /* @__PURE__ */ jsx53(Counter, { count: selectedListItems.length })
4527
+ ] }),
4528
+ /* @__PURE__ */ jsxs33("div", { css: ObjectSearchResultListCounterContainer, children: [
4529
+ additionalButtons,
4530
+ hideRemoveButton ? null : /* @__PURE__ */ jsx53(
4531
+ Button5,
4532
+ {
4533
+ buttonType: "ghostDestructive",
4534
+ size: "xs",
4535
+ disabled: selectedListItems.length === 0,
4536
+ onClick: handleRemoveAllSelectedItems,
4537
+ children: removeButtonText
4538
+ }
4539
+ )
4540
+ ] })
4541
+ ] }),
4542
+ !selectedListItems.length ? null : /* @__PURE__ */ jsx53(DragDropContext3, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx53(Droppable3, { droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select", children: (provided) => /* @__PURE__ */ jsxs33("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
4543
+ selectedListItems.map((item, i) => {
4544
+ const renderListItem = renderResultComponent(item);
4545
+ return /* @__PURE__ */ jsx53(Draggable3, { draggableId: item.id, index: i, isDragDisabled: disableDnD, children: (provided2, snapshot) => /* @__PURE__ */ jsx53(
4546
+ "div",
4547
+ {
4548
+ css: ObjectSearchDragContainer,
4549
+ ref: provided2.innerRef,
4550
+ "data-dragging": snapshot.isDragging,
4551
+ ...provided2.draggableProps,
4552
+ ...provided2.dragHandleProps,
4553
+ children: renderListItem
4554
+ }
4555
+ ) }, item.id);
4556
+ }),
4557
+ provided.placeholder
4558
+ ] }) }) })
4559
+ ] });
4560
+ };
4561
+
4562
+ // src/components/ObjectSearch/QueryFilter.tsx
4563
+ import { Input as Input7, InputKeywordSearch as InputKeywordSearch3, InputSelect as InputSelect7 } from "@uniformdev/design-system";
4564
+ import { useEffect as useEffect8, useState as useState12 } from "react";
4565
+ import { jsx as jsx54, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
4566
+ var QueryFilter = ({
4567
+ requireContentType,
4568
+ queryFilterTitle = "Configure Query",
4569
+ contentTypeLabel = "Filter by content type",
4570
+ typeSelectorAllTypesOptionText = "All content types",
4571
+ contentTypeOptions,
4572
+ searchInputName = "searchText",
4573
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
4574
+ countLabel = "Count",
4575
+ countValue = 5,
4576
+ sortLabel = "Sort",
4577
+ sortOptions,
4578
+ sortOrderLabel = "Sort Order",
4579
+ sortOrderOptions = [
4580
+ {
4581
+ name: "Ascending",
4582
+ id: "asc",
4583
+ label: "Ascending"
4584
+ },
4585
+ {
4586
+ name: "Descending",
4587
+ id: "desc",
4588
+ label: "Descending"
4589
+ }
4590
+ ],
4591
+ children
4592
+ }) => {
4593
+ var _a, _b;
4594
+ const { query, onSetQuery } = useObjectSearchContext();
4595
+ const [queryState, setQueryState] = useState12({
4596
+ contentType: "",
4597
+ keyword: "",
4598
+ count: countValue != null ? countValue : 5,
4599
+ sortBy: (_a = sortOptions[0].id) != null ? _a : "",
4600
+ sortOrder: (_b = sortOrderOptions[0].id) != null ? _b : ""
4601
+ });
4602
+ const handleFilterChange = (value) => {
4603
+ setQueryState((prev) => ({ ...prev, ...value }));
4604
+ onSetQuery({ ...query, ...value });
4605
+ };
4606
+ useEffect8(() => {
4607
+ onSetQuery(queryState);
4608
+ }, [onSetQuery, queryState]);
4609
+ return /* @__PURE__ */ jsxs34("fieldset", { children: [
4610
+ /* @__PURE__ */ jsx54("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
4611
+ /* @__PURE__ */ jsxs34("div", { css: ObjectSearchFilterContainer, children: [
4612
+ /* @__PURE__ */ jsxs34("div", { css: ObjectSearchFilterGrid("0.5fr 1fr"), children: [
4613
+ /* @__PURE__ */ jsx54(
4614
+ InputSelect7,
4615
+ {
4616
+ label: contentTypeLabel,
4617
+ showLabel: false,
4618
+ options: [
4619
+ ...!requireContentType ? [{ id: "", label: typeSelectorAllTypesOptionText }] : [],
4620
+ ...contentTypeOptions ? contentTypeOptions.map((option) => {
4621
+ var _a2;
4622
+ return { id: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
4623
+ }) : []
4624
+ ],
4625
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
4626
+ value: queryState.contentType
4627
+ }
4628
+ ),
4629
+ /* @__PURE__ */ jsx54(
4630
+ InputKeywordSearch3,
4631
+ {
4632
+ inputFieldName: searchInputName,
4633
+ placeholder: searchInputPlaceholderText,
4634
+ onSearchTextChanged: (e) => handleFilterChange({ keyword: e }),
4635
+ disabledFieldSubmission: true,
4636
+ onClear: () => handleFilterChange({ keyword: "" }),
4637
+ value: queryState.keyword
4638
+ }
4639
+ )
4640
+ ] }),
4641
+ /* @__PURE__ */ jsxs34("div", { css: ObjectSearchFilterGrid("repeat(2, 1fr) 0.5fr"), children: [
4642
+ /* @__PURE__ */ jsx54(
4643
+ InputSelect7,
4644
+ {
4645
+ label: sortLabel,
4646
+ options: [
4647
+ {
4648
+ label: "Select a sort",
4649
+ id: ""
4650
+ },
4651
+ ...sortOptions ? sortOptions.map((option) => {
4652
+ var _a2;
4653
+ return { id: option.id, name: option.name, label: (_a2 = option.label) != null ? _a2 : option.name };
4654
+ }) : []
4655
+ ],
4656
+ onChange: (e) => handleFilterChange({ sortBy: e.target.value }),
4657
+ value: queryState.sortBy
4658
+ }
4659
+ ),
4660
+ /* @__PURE__ */ jsx54(
4661
+ InputSelect7,
4662
+ {
4663
+ label: sortOrderLabel,
4664
+ options: [
4665
+ ...sortOrderOptions ? sortOrderOptions.map((option) => {
4666
+ var _a2;
4667
+ return { value: option.id, label: (_a2 = option.label) != null ? _a2 : option.name, name: option.name };
4668
+ }) : []
4669
+ ],
4670
+ onChange: (e) => handleFilterChange({ sortOrder: e.target.value }),
4671
+ value: queryState.sortOrder
4672
+ }
4673
+ ),
4674
+ /* @__PURE__ */ jsx54(
4675
+ Input7,
4676
+ {
4677
+ label: countLabel,
4678
+ type: "number",
4679
+ onChange: (e) => handleFilterChange({ count: e.target.value }),
4680
+ defaultValue: countValue,
4681
+ value: queryState.count
4682
+ }
4683
+ )
4684
+ ] }),
4685
+ children
4686
+ ] })
4687
+ ] });
4688
+ };
4689
+
4690
+ // src/hooks/useUniformMeshLocation.ts
4691
+ function useUniformMeshLocation() {
4692
+ const { location } = useUniformMeshLocationContext();
4693
+ return location;
4694
+ }
4695
+
3940
4696
  // src/hooks/index.ts
3941
4697
  import { ParameterShellContext, useParameterShell } from "@uniformdev/design-system";
3942
4698
 
@@ -3951,16 +4707,17 @@ function createLocationValidator(setValue, validate) {
3951
4707
  // src/index.ts
3952
4708
  import {
3953
4709
  AddListButton as AddListButton2,
3954
- Button as Button3,
4710
+ Button as Button6,
3955
4711
  Callout as Callout4,
3956
4712
  Heading,
3957
- Input as Input7,
4713
+ Input as Input8,
3958
4714
  InputComboBox,
3959
- InputKeywordSearch as InputKeywordSearch2,
3960
- InputSelect as InputSelect6,
4715
+ InputKeywordSearch as InputKeywordSearch4,
4716
+ InputSelect as InputSelect8,
3961
4717
  InputToggle,
4718
+ InputKeywordSearch as InputKeywordSearch5,
3962
4719
  Label,
3963
- LoadingIndicator as LoadingIndicator3,
4720
+ LoadingIndicator as LoadingIndicator4,
3964
4721
  LoadingOverlay as LoadingOverlay2,
3965
4722
  Menu as Menu3,
3966
4723
  MenuItem as MenuItem3,
@@ -3978,7 +4735,7 @@ import {
3978
4735
  ParameterTextareaInner,
3979
4736
  ParameterToggle,
3980
4737
  ParameterToggleInner,
3981
- ScrollableList,
4738
+ ScrollableList as ScrollableList2,
3982
4739
  ScrollableListItem,
3983
4740
  Switch,
3984
4741
  Textarea,
@@ -3987,9 +4744,10 @@ import {
3987
4744
  export * from "@uniformdev/mesh-sdk";
3988
4745
  export {
3989
4746
  AddListButton2 as AddListButton,
3990
- Button3 as Button,
4747
+ Button6 as Button,
3991
4748
  Callout4 as Callout,
3992
4749
  DamSelectedItem,
4750
+ DataRefreshButton,
3993
4751
  DataResourceVariablesList,
3994
4752
  DataSourceEditor,
3995
4753
  DataTypeEditor,
@@ -3998,18 +4756,29 @@ export {
3998
4756
  EntrySearch,
3999
4757
  Heading,
4000
4758
  icons_exports as Icons,
4001
- Input7 as Input,
4759
+ Input8 as Input,
4002
4760
  InputComboBox,
4003
- InputKeywordSearch2 as InputKeywordSearch,
4004
- InputSelect6 as InputSelect,
4761
+ InputKeywordSearch4 as InputKeywordSearch,
4762
+ InputSelect8 as InputSelect,
4005
4763
  InputToggle,
4006
4764
  InputVariables,
4765
+ InputKeywordSearch5 as KeywordSearchInput,
4007
4766
  Label,
4008
- LoadingIndicator3 as LoadingIndicator,
4767
+ LinkButton,
4768
+ LoadingIndicator4 as LoadingIndicator,
4009
4769
  LoadingOverlay2 as LoadingOverlay,
4010
4770
  Menu3 as Menu,
4011
4771
  MenuItem3 as MenuItem,
4012
4772
  MeshApp,
4773
+ ObjectSearchContainer,
4774
+ ObjectSearchFilter,
4775
+ ObjectSearchFilterContainer2 as ObjectSearchFilterContainer,
4776
+ ObjectSearchListItem,
4777
+ ObjectSearchListItemLoadingSkeleton,
4778
+ ObjectSearchProvider,
4779
+ ObjectSearchResultItem,
4780
+ ObjectSearchResultItemButton,
4781
+ ObjectSearchResultList,
4013
4782
  ParameterGroup,
4014
4783
  ParameterImage,
4015
4784
  ParameterImageInner,
@@ -4032,6 +4801,7 @@ export {
4032
4801
  ProductSearchContext,
4033
4802
  ProductSearchRow,
4034
4803
  ProductSelectedItem,
4804
+ QueryFilter,
4035
4805
  RequestBody,
4036
4806
  RequestHeaders,
4037
4807
  RequestMethodSelect,
@@ -4041,13 +4811,17 @@ export {
4041
4811
  RequestUrl,
4042
4812
  RequestUrlInput,
4043
4813
  ResolvableLoadingValue,
4044
- ScrollableList,
4814
+ ScrollableList2 as ScrollableList,
4045
4815
  ScrollableListItem,
4046
4816
  SelectionField,
4047
4817
  Switch,
4048
4818
  TextVariableRenderer,
4049
4819
  Textarea,
4050
4820
  Theme3 as Theme,
4821
+ UniformMeshLocationContext,
4822
+ UniformMeshLocationContextProvider,
4823
+ UniformMeshSdkContext,
4824
+ UniformMeshSdkContextProvider,
4051
4825
  VariableEditor,
4052
4826
  VariablesList,
4053
4827
  VariablesProvider,
@@ -4116,14 +4890,19 @@ export {
4116
4890
  selectedItemTitle,
4117
4891
  urlEncodeRequestParameter,
4118
4892
  urlEncodeRequestUrl,
4893
+ useInitializeUniformMeshSdk,
4119
4894
  useMeshLocation,
4895
+ useObjectSearchContext,
4120
4896
  useParameterShell,
4121
4897
  useProductQueryContext,
4122
4898
  useProductSearchContext,
4123
4899
  useRequest,
4124
4900
  useRequestHeader,
4125
4901
  useRequestParameter,
4902
+ useUniformMeshLocation,
4903
+ useUniformMeshLocationContext,
4126
4904
  useUniformMeshSdk,
4905
+ useUniformMeshSdkContext,
4127
4906
  useVariables,
4128
4907
  variablesToList
4129
4908
  };