@uniformdev/mesh-sdk-react 19.135.0 → 19.135.1-alpha.9

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
@@ -33,67 +33,87 @@ var src_exports = {};
33
33
  __export(src_exports, {
34
34
  $createVariableNode: () => $createVariableNode,
35
35
  $isVariableNode: () => $isVariableNode,
36
- AddListButton: () => import_design_system41.AddListButton,
37
- Button: () => import_design_system41.Button,
38
- Callout: () => import_design_system41.Callout,
36
+ AddListButton: () => import_design_system54.AddListButton,
37
+ Button: () => import_design_system54.Button,
38
+ CHECKBOX_OPERATORS: () => CHECKBOX_OPERATORS,
39
+ Callout: () => import_design_system54.Callout,
40
+ ControlledObjectSearchProvider: () => ControlledObjectSearchProvider,
39
41
  ControlledValuePlugin: () => ControlledValuePlugin,
42
+ DATE_OPERATORS: () => DATE_OPERATORS,
40
43
  DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
41
44
  DamSelectedItem: () => DamSelectedItem,
42
45
  DataRefreshButton: () => DataRefreshButton,
43
46
  DataResourceDynamicInputProvider: () => DataResourceDynamicInputProvider,
47
+ DataResourceInputContext: () => DataResourceInputContext,
44
48
  DataResourceVariablesList: () => DataResourceVariablesList,
45
49
  DataResourceVariablesListExplicit: () => DataResourceVariablesListExplicit,
46
50
  DataSourceEditor: () => DataSourceEditor,
47
51
  DataTypeEditor: () => DataTypeEditor,
52
+ DateEditor: () => DateEditor,
53
+ DateRangeEditor: () => DateRangeEditor,
48
54
  DefaultSearchRow: () => DefaultSearchRow,
49
55
  DefaultSelectedItem: () => DefaultSelectedItem,
50
- DrawerContent: () => import_design_system41.DrawerContent,
56
+ DrawerContent: () => import_design_system54.DrawerContent,
51
57
  EDIT_VARIABLE_COMMAND: () => EDIT_VARIABLE_COMMAND,
52
58
  EntrySearch: () => EntrySearch,
53
- Heading: () => import_design_system41.Heading,
59
+ FilterButton: () => FilterButton2,
60
+ FilterControls: () => FilterControls,
61
+ FilterEditorRenderer: () => FilterEditorRenderer,
62
+ FilterItem: () => FilterItem,
63
+ FilterItems: () => FilterItems,
64
+ FilterMenu: () => FilterMenu,
65
+ FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
66
+ FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
67
+ Heading: () => import_design_system54.Heading,
54
68
  INSERT_VARIABLE_COMMAND: () => INSERT_VARIABLE_COMMAND,
55
69
  Icons: () => icons_exports,
56
- Input: () => import_design_system41.Input,
57
- InputComboBox: () => import_design_system41.InputComboBox,
58
- InputKeywordSearch: () => import_design_system41.InputKeywordSearch,
59
- InputSelect: () => import_design_system41.InputSelect,
60
- InputToggle: () => import_design_system41.InputToggle,
70
+ Input: () => import_design_system54.Input,
71
+ InputComboBox: () => import_design_system54.InputComboBox,
72
+ InputKeywordSearch: () => import_design_system54.InputKeywordSearch,
73
+ InputSelect: () => import_design_system54.InputSelect,
74
+ InputToggle: () => import_design_system54.InputToggle,
61
75
  InputVariables: () => InputVariables,
62
- Label: () => import_design_system41.Label,
76
+ Label: () => import_design_system54.Label,
63
77
  LinkButton: () => LinkButton,
64
- LoadingIndicator: () => import_design_system41.LoadingIndicator,
65
- LoadingOverlay: () => import_design_system41.LoadingOverlay,
66
- Menu: () => import_design_system41.Menu,
67
- MenuItem: () => import_design_system41.MenuItem,
78
+ LoadingIndicator: () => import_design_system54.LoadingIndicator,
79
+ LoadingOverlay: () => import_design_system54.LoadingOverlay,
80
+ Menu: () => import_design_system54.Menu,
81
+ MenuItem: () => import_design_system54.MenuItem,
68
82
  MeshApp: () => MeshApp,
83
+ NUMBER_OPERATORS: () => NUMBER_OPERATORS,
84
+ NumberEditor: () => NumberEditor,
85
+ NumberRangeEditor: () => NumberRangeEditor,
69
86
  OPEN_INSERT_VARIABLE_COMMAND: () => OPEN_INSERT_VARIABLE_COMMAND,
70
87
  ObjectSearchContainer: () => ObjectSearchContainer,
88
+ ObjectSearchContext: () => ObjectSearchContext,
71
89
  ObjectSearchFilter: () => ObjectSearchFilter,
72
90
  ObjectSearchFilterContainer: () => ObjectSearchFilterContainer2,
73
91
  ObjectSearchListItem: () => ObjectSearchListItem,
74
92
  ObjectSearchListItemLoadingSkeleton: () => ObjectSearchListItemLoadingSkeleton,
93
+ ObjectSearchListOfSearchResults: () => ObjectSearchListOfSearchResults,
75
94
  ObjectSearchProvider: () => ObjectSearchProvider,
76
95
  ObjectSearchResultItem: () => ObjectSearchResultItem,
77
96
  ObjectSearchResultItemButton: () => ObjectSearchResultItemButton,
78
97
  ObjectSearchResultList: () => ObjectSearchResultList,
98
+ PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
79
99
  ParamTypeDynamicDataProvider: () => ParamTypeDynamicDataProvider,
80
100
  ParameterConnectionIndicator: () => ParameterConnectionIndicator,
81
- ParameterGroup: () => import_design_system41.ParameterGroup,
82
- ParameterImage: () => import_design_system41.ParameterImage,
83
- ParameterImageInner: () => import_design_system41.ParameterImageInner,
84
- ParameterInput: () => import_design_system41.ParameterInput,
85
- ParameterInputInner: () => import_design_system41.ParameterInputInner,
86
- ParameterLabel: () => import_design_system41.ParameterLabel,
87
- ParameterMenuButton: () => import_design_system41.ParameterMenuButton,
101
+ ParameterGroup: () => import_design_system54.ParameterGroup,
102
+ ParameterImage: () => import_design_system54.ParameterImage,
103
+ ParameterImageInner: () => import_design_system54.ParameterImageInner,
104
+ ParameterInput: () => import_design_system54.ParameterInput,
105
+ ParameterInputInner: () => import_design_system54.ParameterInputInner,
106
+ ParameterLabel: () => import_design_system54.ParameterLabel,
107
+ ParameterMenuButton: () => import_design_system54.ParameterMenuButton,
88
108
  ParameterOrSingleVariable: () => ParameterOrSingleVariable,
89
- ParameterSelect: () => import_design_system41.ParameterSelect,
90
- ParameterSelectInner: () => import_design_system41.ParameterSelectInner,
91
- ParameterShell: () => import_design_system41.ParameterShell,
109
+ ParameterSelect: () => import_design_system54.ParameterSelect,
110
+ ParameterSelectInner: () => import_design_system54.ParameterSelectInner,
111
+ ParameterShell: () => import_design_system54.ParameterShell,
92
112
  ParameterShellContext: () => import_design_system14.ParameterShellContext,
93
- ParameterTextarea: () => import_design_system41.ParameterTextarea,
94
- ParameterTextareaInner: () => import_design_system41.ParameterTextareaInner,
95
- ParameterToggle: () => import_design_system41.ParameterToggle,
96
- ParameterToggleInner: () => import_design_system41.ParameterToggleInner,
113
+ ParameterTextarea: () => import_design_system54.ParameterTextarea,
114
+ ParameterTextareaInner: () => import_design_system54.ParameterTextareaInner,
115
+ ParameterToggle: () => import_design_system54.ParameterToggle,
116
+ ParameterToggleInner: () => import_design_system54.ParameterToggleInner,
97
117
  ParameterVariables: () => ParameterVariables,
98
118
  ProductPreviewList: () => ProductPreviewList,
99
119
  ProductQuery: () => ProductQuery,
@@ -103,6 +123,7 @@ __export(src_exports, {
103
123
  ProductSearchRow: () => ProductSearchRow,
104
124
  ProductSelectedItem: () => ProductSelectedItem,
105
125
  QueryFilter: () => QueryFilter,
126
+ RICHTEXT_OPERATORS: () => RICHTEXT_OPERATORS,
106
127
  RequestBody: () => RequestBody,
107
128
  RequestHeaders: () => RequestHeaders,
108
129
  RequestMethodSelect: () => RequestMethodSelect,
@@ -112,19 +133,37 @@ __export(src_exports, {
112
133
  RequestUrl: () => RequestUrl,
113
134
  RequestUrlInput: () => RequestUrlInput,
114
135
  ResolvableLoadingValue: () => ResolvableLoadingValue,
115
- ScrollableList: () => import_design_system41.ScrollableList,
116
- ScrollableListItem: () => import_design_system41.ScrollableListItem,
136
+ SELECT_OPERATORS: () => SELECT_OPERATORS,
137
+ SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
138
+ SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
139
+ ScrollableList: () => import_design_system54.ScrollableList,
140
+ ScrollableListItem: () => import_design_system54.ScrollableListItem,
141
+ SearchAndFilter: () => SearchAndFilter,
142
+ SearchAndFilterContext: () => SearchAndFilterContext,
143
+ SearchAndFilterOptionsContainer: () => SearchAndFilterOptionsContainer2,
144
+ SearchAndFilterProvider: () => SearchAndFilterProvider,
145
+ SearchAndFilterResultContainer: () => SearchAndFilterResultContainer,
146
+ SearchOnlyContext: () => SearchOnlyContext,
147
+ SearchOnlyFilter: () => SearchOnlyFilter,
117
148
  SelectionField: () => SelectionField,
118
- Switch: () => import_design_system41.Switch,
149
+ SortItems: () => SortItems,
150
+ StatusMultiEditor: () => StatusMultiEditor,
151
+ StatusSingleEditor: () => StatusSingleEditor,
152
+ Switch: () => import_design_system54.Switch,
153
+ TEXTBOX_OPERATORS: () => TEXTBOX_OPERATORS,
154
+ TextEditor: () => TextEditor,
119
155
  TextVariableRenderer: () => TextVariableRenderer,
120
- Textarea: () => import_design_system41.Textarea,
121
- Theme: () => import_design_system41.Theme,
156
+ Textarea: () => import_design_system54.Textarea,
157
+ Theme: () => import_design_system54.Theme,
158
+ USER_OPERATORS: () => USER_OPERATORS,
122
159
  VariableEditor: () => VariableEditor,
123
160
  VariableNode: () => VariableNode,
124
161
  VariablesList: () => VariablesList,
125
162
  VariablesPlugin: () => VariablesPlugin,
126
163
  VariablesProvider: () => VariablesProvider,
127
164
  badgeIcon: () => badgeIcon,
165
+ bindQuery: () => bindQuery,
166
+ bindableFiltersMapper: () => bindableFiltersMapper,
128
167
  convertConnectedDataToVariable: () => convertConnectedDataToVariable,
129
168
  createLocationValidator: () => createLocationValidator,
130
169
  damSelectItemImage: () => damSelectItemImage,
@@ -155,6 +194,7 @@ __export(src_exports, {
155
194
  entrySearchSelectInput: () => entrySearchSelectInput,
156
195
  entrySearchSelectOption: () => entrySearchSelectOption,
157
196
  entrySearchWrapper: () => entrySearchWrapper,
197
+ filterMapper: () => filterMapper,
158
198
  hasReferencedVariables: () => hasReferencedVariables,
159
199
  prettifyBindExpression: () => prettifyBindExpression,
160
200
  productSearchRowActiveIcon: () => productSearchRowActiveIcon,
@@ -196,6 +236,7 @@ __export(src_exports, {
196
236
  urlEncodeRequestUrl: () => urlEncodeRequestUrl,
197
237
  useConnectedDataAsVariables: () => useConnectedDataAsVariables,
198
238
  useContentDataResourceLocaleInfo: () => useContentDataResourceLocaleInfo,
239
+ useDataResourceDynamicInputs: () => useDataResourceDynamicInputs,
199
240
  useDynamicInputsAsVariables: () => useDynamicInputsAsVariables,
200
241
  useMeshLocation: () => useMeshLocation,
201
242
  useObjectSearchContext: () => useObjectSearchContext,
@@ -205,10 +246,12 @@ __export(src_exports, {
205
246
  useRequest: () => useRequest,
206
247
  useRequestHeader: () => useRequestHeader,
207
248
  useRequestParameter: () => useRequestParameter,
249
+ useSearchAndFilter: () => useSearchAndFilter,
208
250
  useUniformMeshSdk: () => useUniformMeshSdk,
209
251
  useVariableEditor: () => useVariableEditor,
210
252
  useVariables: () => useVariables,
211
253
  useVariablesMenu: () => useVariablesMenu,
254
+ utilityColors: () => import_design_system54.utilityColors,
212
255
  variableDefaultTextValue: () => variableDefaultTextValue,
213
256
  variablePrefix: () => variablePrefix,
214
257
  variableSuffix: () => variableSuffix,
@@ -2855,6 +2898,9 @@ function DefaultDamItemRenderer({ item }) {
2855
2898
  ] }) : null;
2856
2899
  }
2857
2900
 
2901
+ // src/components/DataResourceDynamicInputProvider.tsx
2902
+ var import_react59 = require("react");
2903
+
2858
2904
  // src/hooks/useConnectedDataAsVariables.tsx
2859
2905
  var import_react26 = require("react");
2860
2906
  function useConnectedDataAsVariables(connectedData) {
@@ -3138,7 +3184,8 @@ var import_react40 = require("react");
3138
3184
 
3139
3185
  // src/components/Variables/util/prettifyBindExpression.tsx
3140
3186
  function prettifyBindExpression(bindExpression) {
3141
- return bindExpression.substring(bindExpression.lastIndexOf(":") + 1);
3187
+ const [, expression] = bindExpression.split(":");
3188
+ return expression;
3142
3189
  }
3143
3190
 
3144
3191
  // src/components/Variables/composer/VariableChip.tsx
@@ -3158,42 +3205,58 @@ function VariableChip({
3158
3205
  }) {
3159
3206
  const hasClickEvent = !!onClick;
3160
3207
  const referenceIsValidFr = isFresh ? true : referenceIsValid;
3161
- const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
3208
+ const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
3162
3209
  const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
3210
+ const chippy = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.MultilineChip, { onClick, "aria-selected": selected ? true : void 0, "aria-disabled": disabled, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference }) });
3211
+ if (tooltip) {
3212
+ const tip = tooltip ? `${tooltip}${extraTitle ? `
3213
+
3214
+ ${extraTitle}` : ""}` : extraTitle != null ? extraTitle : "";
3215
+ const tipLines = tip.split("\n");
3216
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3217
+ import_design_system15.Tooltip,
3218
+ {
3219
+ title: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_design_system15.VerticalRhythm, { gap: "sm", children: tipLines.map((t, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: t }, index)) }),
3220
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: chippy })
3221
+ }
3222
+ );
3223
+ }
3224
+ return chippy;
3225
+ }
3226
+ function UndefinedVariableReference({ children }) {
3163
3227
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3164
- import_design_system15.MultilineChip,
3228
+ "span",
3165
3229
  {
3166
- title: tooltip ? `${tooltip}${extraTitle ? `
3167
-
3168
- ${extraTitle}` : ""}` : extraTitle,
3169
- onClick,
3170
- "aria-selected": selected ? true : void 0,
3171
- "aria-disabled": disabled,
3172
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: displayName || reference })
3230
+ style: {
3231
+ textDecoration: "underline",
3232
+ textDecorationStyle: "wavy",
3233
+ textDecorationColor: "var(--error)"
3234
+ },
3235
+ children
3173
3236
  }
3174
3237
  );
3175
3238
  }
3176
- function UndefinedVariableReference({ children }) {
3239
+ function InfoVariableReference({ children }) {
3177
3240
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3178
3241
  "span",
3179
3242
  {
3180
3243
  style: {
3181
3244
  textDecoration: "underline",
3182
3245
  textDecorationStyle: "wavy",
3183
- textDecorationColor: "red"
3246
+ textDecorationColor: "var(--primary-action-default)"
3184
3247
  },
3185
3248
  children
3186
3249
  }
3187
3250
  );
3188
3251
  }
3189
- function InfoVariableReference({ children }) {
3252
+ function WarningVariableReference({ children }) {
3190
3253
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3191
3254
  "span",
3192
3255
  {
3193
3256
  style: {
3194
3257
  textDecoration: "underline",
3195
3258
  textDecorationStyle: "wavy",
3196
- textDecorationColor: "blue"
3259
+ textDecorationColor: "var(--alert)"
3197
3260
  },
3198
3261
  children
3199
3262
  }
@@ -3441,7 +3504,8 @@ function VariablesProvider({
3441
3504
  readOnly,
3442
3505
  isLoading,
3443
3506
  children,
3444
- knownUndefinedValues = {}
3507
+ knownUndefinedValues = {},
3508
+ onChangeKnownUndefinedValue
3445
3509
  }) {
3446
3510
  const [editing, setEditing] = (0, import_react37.useState)();
3447
3511
  const [editingContext, setEditingContext] = (0, import_react37.useState)();
@@ -3508,6 +3572,15 @@ function VariablesProvider({
3508
3572
  isLoading: !!isLoading
3509
3573
  };
3510
3574
  }, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
3575
+ (0, import_react37.useEffect)(() => {
3576
+ if (editing === void 0) {
3577
+ return;
3578
+ }
3579
+ const activeElement = document.activeElement;
3580
+ if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") {
3581
+ activeElement.blur();
3582
+ }
3583
+ }, [editing]);
3511
3584
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(VariablesContext.Provider, { value: contextValue, children: [
3512
3585
  children,
3513
3586
  typeof editing !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -3516,9 +3589,19 @@ function VariablesProvider({
3516
3589
  context: editingContext,
3517
3590
  onSubmit: (val, editorCompletedContext) => {
3518
3591
  contextValue.dispatch({ type: "cancelEdit" });
3519
- const { name, ...varValue } = val;
3520
- const latestValue = { ...value, [name]: varValue };
3521
- onChange == null ? void 0 : onChange(latestValue);
3592
+ if ("resultType" in val) {
3593
+ if (!onChangeKnownUndefinedValue) {
3594
+ throw new Error(
3595
+ "onChangeKnownUndefinedValue must be provided to handle known-undefined-value results"
3596
+ );
3597
+ }
3598
+ const { name, ...kuv } = val;
3599
+ onChangeKnownUndefinedValue(val.name, kuv);
3600
+ } else {
3601
+ const { name, ...varValue } = val;
3602
+ const latestValue = { ...value, [name]: varValue };
3603
+ onChange == null ? void 0 : onChange(latestValue);
3604
+ }
3522
3605
  events.emit("editCompleted", {
3523
3606
  canceled: false,
3524
3607
  selectedVariable: val,
@@ -3933,21 +4016,21 @@ function VariablesPlugin({
3933
4016
  ]);
3934
4017
  const updateExistingNodeIfChanged = (0, import_react39.useCallback)(
3935
4018
  (variableNode) => {
3936
- var _a, _b, _c;
4019
+ var _a, _b, _c, _d;
3937
4020
  const targetVar = variablesRef.current.variables[variableNode.reference];
3938
4021
  const targetUndefinedVar = variablesRef.current.knownUndefinedValues[variableNode.reference];
3939
4022
  const isLoadingVariables = variablesRef.current.isLoading;
3940
4023
  const currentState = variableNode.getState();
3941
- if (currentState.isFresh && !targetVar) {
4024
+ if (currentState.isFresh && !targetVar && !targetUndefinedVar) {
3942
4025
  return;
3943
4026
  }
3944
- const tooltip = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
4027
+ const tooltip = (_d = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
3945
4028
  const newState = {
3946
4029
  ...currentState,
3947
4030
  displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
3948
4031
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
3949
4032
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
3950
- referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
4033
+ referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
3951
4034
  tooltip,
3952
4035
  isFresh: false
3953
4036
  };
@@ -3963,7 +4046,7 @@ function VariablesPlugin({
3963
4046
  updateExistingNodeIfChanged(variableNode);
3964
4047
  });
3965
4048
  });
3966
- }, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
4049
+ }, [editor, variables, knownUndefinedValues, canEditVariable, updateExistingNodeIfChanged]);
3967
4050
  (0, import_react39.useEffect)(() => {
3968
4051
  return editor.registerNodeTransform(VariableNode, (variableNode) => {
3969
4052
  updateExistingNodeIfChanged(variableNode);
@@ -4231,8 +4314,9 @@ function $isTargetWithinDecorator(target) {
4231
4314
  }
4232
4315
 
4233
4316
  // src/components/Variables/InputVariables.tsx
4234
- var import_design_system20 = require("@uniformdev/design-system");
4235
- var import_react50 = require("react");
4317
+ var import_react51 = require("@emotion/react");
4318
+ var import_design_system21 = require("@uniformdev/design-system");
4319
+ var import_react52 = require("react");
4236
4320
  var import_uuid2 = require("uuid");
4237
4321
 
4238
4322
  // src/components/Variables/composer/EditorRefPlugin.tsx
@@ -4337,6 +4421,7 @@ var input = import_react42.css`
4337
4421
  var inputCompact = import_react42.css`
4338
4422
  border: 1px solid var(--white);
4339
4423
  padding-block: var(--spacing-sm);
4424
+ min-height: 39px;
4340
4425
  font-size: var(--fs-sm);
4341
4426
  `;
4342
4427
  var inputDisabled = import_react42.css`
@@ -4346,19 +4431,112 @@ var inputDisabled = import_react42.css`
4346
4431
  var placeholderCaption = import_react42.css`
4347
4432
  position: absolute;
4348
4433
  color: var(--gray-400);
4349
- inset: var(--spacing-base) var(--spacing-lg) var(--spacing-base) var(--spacing-base);
4434
+ inset: 12px var(--spacing-base) 12px var(--spacing-sm);
4350
4435
  overflow: hidden;
4351
4436
  text-overflow: ellipsis;
4352
4437
  white-space: nowrap;
4353
4438
  pointer-events: none;
4354
4439
  `;
4355
4440
  var placeholderCompact = import_react42.css`
4356
- inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
4441
+ inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-sm);
4442
+ `;
4443
+
4444
+ // src/components/Variables/styles/ParameterVariables.styles.ts
4445
+ var import_react43 = require("@emotion/react");
4446
+ var import_design_system19 = require("@uniformdev/design-system");
4447
+ var variableBindButton = import_react43.css`
4448
+ align-items: center;
4449
+ border: none;
4450
+ border-radius: var(--rounded-base);
4451
+ background: none;
4452
+ display: flex;
4453
+ height: 1.2rem;
4454
+ padding: var(--spacing-2xs);
4455
+ transition: background var(--duration-fast) var(--timing-ease-out),
4456
+ color var(--duration-fast) var(--timing-ease-out);
4457
+ width: 1.2rem;
4458
+
4459
+ &:hover,
4460
+ &[aria-pressed='true']:not(:disabled) {
4461
+ background: var(--brand-secondary-3);
4462
+ color: var(--white);
4463
+ }
4464
+
4465
+ &[aria-disabled='true'] {
4466
+ background: none;
4467
+ color: currentColor;
4468
+ }
4469
+
4470
+ // fixes menu resizing issue within iframes
4471
+ // see https://linear.app/uniform/issue/UNI-3068/mesh-integration-resizing-with-menus
4472
+ + [role='menu'] {
4473
+ max-height: unset;
4474
+ }
4475
+ `;
4476
+ var input2 = import_react43.css`
4477
+ display: block;
4478
+ appearance: none;
4479
+ box-sizing: border-box;
4480
+ background: var(--white);
4481
+ border: 1px solid var(--gray-200);
4482
+ border-radius: var(--rounded-sm);
4483
+ color: var(--gray-700);
4484
+ font-size: var(--fs-sm);
4485
+ line-height: 1.5;
4486
+ min-height: 2rem;
4487
+ padding: var(--spacing-sm);
4488
+ width: 100%;
4489
+ position: relative;
4490
+ white-space: normal;
4491
+ transition-property: background, border-color, color, box-shadow, border-radius;
4492
+ transition-duration: var(--duration-fast);
4493
+ transition-timing-function: var(--timing-ease-out);
4494
+
4495
+ &::placeholder {
4496
+ color: var(--gray-400);
4497
+ }
4498
+
4499
+ &:focus,
4500
+ &:focus-within {
4501
+ border-radius: var(--rounded-sm);
4502
+ box-shadow: var(--elevation-100);
4503
+ border: 1px solid var(--accent-dark-active);
4504
+ outline: none;
4505
+ }
4506
+ &:hover {
4507
+ border: 1px solid var(--accent-dark-hover);
4508
+ }
4509
+
4510
+ &:disabled,
4511
+ &:disabled::placeholder,
4512
+ &:disabled:hover {
4513
+ border-radius: var(--rounded-sm);
4514
+ cursor: not-allowed;
4515
+ color: var(--gray-400);
4516
+ }
4517
+
4518
+ &[readonly],
4519
+ &[contenteditable='false'] {
4520
+ cursor: not-allowed;
4521
+ color: var(--gray-400);
4522
+ }
4523
+
4524
+ > p {
4525
+ margin: 0;
4526
+ }
4527
+ `;
4528
+ var inputMultiLine = (lines) => import_react43.css`
4529
+ ${import_design_system19.scrollbarStyles}
4530
+ // 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
4531
+ // as the text looked to close to the bottom of the input
4532
+ height: calc(${lines * 1.5}em + var(--spacing-sm) + var(--spacing-xs));
4533
+ resize: vertical;
4534
+ overflow: auto;
4357
4535
  `;
4358
4536
 
4359
4537
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
4360
4538
  var React10 = __toESM(require("react"));
4361
- var import_react43 = require("react");
4539
+ var import_react44 = require("react");
4362
4540
 
4363
4541
  // src/components/Variables/util/hasReferencedVariables.ts
4364
4542
  var import_canvas5 = require("@uniformdev/canvas");
@@ -4403,7 +4581,7 @@ function useInputVariablesState({
4403
4581
  const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
4404
4582
  const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
4405
4583
  const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
4406
- const sharedMenuProps = (0, import_react43.useMemo)(
4584
+ const sharedMenuProps = (0, import_react44.useMemo)(
4407
4585
  () => ({
4408
4586
  menuTooltip,
4409
4587
  showAddVariableMenuOption,
@@ -4434,15 +4612,15 @@ function useInputVariablesState({
4434
4612
  }
4435
4613
 
4436
4614
  // src/components/Variables/toolbox/VariableField.styles.ts
4437
- var import_react44 = require("@emotion/react");
4438
- var labelText = import_react44.css`
4615
+ var import_react45 = require("@emotion/react");
4616
+ var labelText = import_react45.css`
4439
4617
  align-items: center;
4440
4618
  display: flex;
4441
4619
  gap: var(--spacing-xs);
4442
4620
  font-weight: var(--fw-regular);
4443
4621
  margin: 0 0 var(--spacing-xs);
4444
4622
  `;
4445
- var variableBindButton = import_react44.css`
4623
+ var variableBindButton2 = import_react45.css`
4446
4624
  align-items: center;
4447
4625
  border: none;
4448
4626
  border-radius: var(--rounded-base);
@@ -4473,8 +4651,8 @@ var import_lexical6 = require("lexical");
4473
4651
  // src/components/Variables/toolbox/SelectVariableMenu.tsx
4474
4652
  var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
4475
4653
  var import_CgUsbC = require("@react-icons/all-files/cg/CgUsbC");
4476
- var import_design_system19 = require("@uniformdev/design-system");
4477
- var import_react45 = require("react");
4654
+ var import_design_system20 = require("@uniformdev/design-system");
4655
+ var import_react46 = require("react");
4478
4656
  var import_jsx_runtime35 = require("@emotion/react/jsx-runtime");
4479
4657
  function SelectVariableMenu({
4480
4658
  onSelectVariable,
@@ -4489,7 +4667,7 @@ function SelectVariableMenu({
4489
4667
  filterVariable
4490
4668
  }) {
4491
4669
  const { variables, canDispatch, readOnly } = useVariables(true);
4492
- const btnRef = (0, import_react45.useRef)(null);
4670
+ const btnRef = (0, import_react46.useRef)(null);
4493
4671
  const { editVariable } = useVariableEditor();
4494
4672
  const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
4495
4673
  const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
@@ -4498,7 +4676,7 @@ function SelectVariableMenu({
4498
4676
  return null;
4499
4677
  }
4500
4678
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4501
- import_design_system19.Menu,
4679
+ import_design_system20.Menu,
4502
4680
  {
4503
4681
  placement: portal ? "bottom-end" : "bottom-start",
4504
4682
  portal,
@@ -4517,7 +4695,7 @@ function SelectVariableMenu({
4517
4695
  menuLabel: menuTooltip,
4518
4696
  children: [
4519
4697
  showAddVariableMenuOptionForReals ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4520
- import_design_system19.MenuItem,
4698
+ import_design_system20.MenuItem,
4521
4699
  {
4522
4700
  onClick: async () => {
4523
4701
  const result = await editVariable("", getEditorContext == null ? void 0 : getEditorContext());
@@ -4527,19 +4705,19 @@ function SelectVariableMenu({
4527
4705
  onSelectVariable == null ? void 0 : onSelectVariable(result.selectedVariable);
4528
4706
  },
4529
4707
  "data-testid": "add-variable-button",
4530
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_design_system19.HorizontalRhythm, { gap: "sm", align: "center", children: [
4708
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_design_system20.HorizontalRhythm, { gap: "sm", align: "center", children: [
4531
4709
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_BsFillPlusCircleFill.BsFillPlusCircleFill, { fill: "var(--gray-500)", size: "1.25em" }),
4532
4710
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: typeof showAddVariableMenuOption === "string" ? showAddVariableMenuOption : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: "Add\u2026" }) })
4533
4711
  ] })
4534
4712
  }
4535
4713
  ) : null,
4536
- showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItemSeparator, {}) : null,
4714
+ showAddVariableMenuOptionForReals && menuHasVariableOptions ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItemSeparator, {}) : null,
4537
4715
  variablesGroups.map((group) => {
4538
4716
  var _a;
4539
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuGroup, { title: (_a = group.name) != null ? _a : "", children: group.variables.map((variable) => {
4717
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuGroup, { title: (_a = group.name) != null ? _a : "", children: group.variables.map((variable) => {
4540
4718
  const { name, displayName, helpText } = variable;
4541
4719
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4542
- import_design_system19.MenuItem,
4720
+ import_design_system20.MenuItem,
4543
4721
  {
4544
4722
  id: name,
4545
4723
  css: menuItemTextGroup,
@@ -4553,9 +4731,9 @@ function SelectVariableMenu({
4553
4731
  );
4554
4732
  }) }, group.name);
4555
4733
  }),
4556
- menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItemSeparator, {}) : null,
4557
- onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItem, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
4558
- tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system19.MenuItemSeparator, {}) : null,
4734
+ menuHasVariableOptions && onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItemSeparator, {}) : null,
4735
+ onResetVariables ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItem, { onClick: onResetVariables, css: { color: "var(--brand-secondary-5)" }, children: "Reset" }) : null,
4736
+ tip && (menuHasVariableOptions || onResetVariables) ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_design_system20.MenuItemSeparator, {}) : null,
4559
4737
  tip ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("i", { css: variablesTipText, children: tip }) : null
4560
4738
  ]
4561
4739
  }
@@ -4601,14 +4779,14 @@ function VariableField({
4601
4779
  }) {
4602
4780
  const { variables } = useVariables(true);
4603
4781
  const varCount = Object.keys(variables).length;
4604
- const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4782
+ const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "data-testid": "label-var-menu", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4605
4783
  VariablesComposerVariableMenu,
4606
4784
  {
4607
4785
  ...selectVariableMenuOptions,
4608
- buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
4786
+ buttonCss: [variableBindButton2, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
4609
4787
  buttonProps: isActive ? { "aria-pressed": "true" } : void 0
4610
4788
  }
4611
- ) : null;
4789
+ ) }) : null;
4612
4790
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { "data-testid": "variable-field", children: [
4613
4791
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("label", { htmlFor: id, css: labelText, "data-testid": "field-name", children: [
4614
4792
  variableSelector,
@@ -4623,14 +4801,14 @@ var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlug
4623
4801
  var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
4624
4802
  var import_LexicalComposer = require("@lexical/react/LexicalComposer");
4625
4803
  var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin");
4626
- var import_react48 = require("react");
4804
+ var import_react49 = require("react");
4627
4805
 
4628
4806
  // src/components/Variables/composer/DisablePlugin.tsx
4629
4807
  var import_LexicalComposerContext7 = require("@lexical/react/LexicalComposerContext");
4630
- var import_react46 = require("react");
4808
+ var import_react47 = require("react");
4631
4809
  function DisablePlugin({ disabled }) {
4632
4810
  const [editor] = (0, import_LexicalComposerContext7.useLexicalComposerContext)();
4633
- (0, import_react46.useEffect)(() => {
4811
+ (0, import_react47.useEffect)(() => {
4634
4812
  editor.setEditable(!disabled);
4635
4813
  }, [editor, disabled]);
4636
4814
  return null;
@@ -4639,10 +4817,10 @@ function DisablePlugin({ disabled }) {
4639
4817
  // src/components/Variables/composer/SingleLineTextPlugin.tsx
4640
4818
  var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
4641
4819
  var import_lexical7 = require("lexical");
4642
- var import_react47 = require("react");
4820
+ var import_react48 = require("react");
4643
4821
  function SingleLineTextPlugin() {
4644
4822
  const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
4645
- (0, import_react47.useEffect)(() => {
4823
+ (0, import_react48.useEffect)(() => {
4646
4824
  editor.registerNodeTransform(import_lexical7.LineBreakNode, (node) => {
4647
4825
  node.remove();
4648
4826
  });
@@ -4695,8 +4873,8 @@ function VariablesComposer(props) {
4695
4873
  autoFocus,
4696
4874
  ...variablesPluginProps
4697
4875
  } = props;
4698
- const [lastEmittedValue, setLastEmittedValue] = (0, import_react48.useState)(value);
4699
- const editorConfig = (0, import_react48.useMemo)(
4876
+ const [lastEmittedValue, setLastEmittedValue] = (0, import_react49.useState)(value);
4877
+ const editorConfig = (0, import_react49.useMemo)(
4700
4878
  () => ({
4701
4879
  namespace: "uniform",
4702
4880
  onError(error) {
@@ -4708,8 +4886,8 @@ function VariablesComposer(props) {
4708
4886
  // eslint-disable-next-line react-hooks/exhaustive-deps
4709
4887
  []
4710
4888
  );
4711
- const editorState = (0, import_react48.useRef)();
4712
- const updateTimeout = (0, import_react48.useRef)();
4889
+ const editorState = (0, import_react49.useRef)();
4890
+ const updateTimeout = (0, import_react49.useRef)();
4713
4891
  if (typeof document === "undefined")
4714
4892
  return null;
4715
4893
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
@@ -4752,10 +4930,10 @@ var import_LexicalHistoryPlugin = require("@lexical/react/LexicalHistoryPlugin")
4752
4930
  var import_LexicalPlainTextPlugin = require("@lexical/react/LexicalPlainTextPlugin");
4753
4931
  var import_utils4 = require("@lexical/utils");
4754
4932
  var import_lexical9 = require("lexical");
4755
- var import_react49 = require("react");
4933
+ var import_react50 = require("react");
4756
4934
  var import_jsx_runtime39 = require("@emotion/react/jsx-runtime");
4757
4935
  function VariablesComposerInput({
4758
- css: css37,
4936
+ css: css40,
4759
4937
  placeholder,
4760
4938
  ...contentEditableProps
4761
4939
  }) {
@@ -4774,7 +4952,7 @@ function VariablesComposerInput({
4774
4952
  }
4775
4953
  function RichishCopyAndPastePlugin() {
4776
4954
  const [editor] = (0, import_LexicalComposerContext9.useLexicalComposerContext)();
4777
- (0, import_react49.useEffect)(() => {
4955
+ (0, import_react50.useEffect)(() => {
4778
4956
  return (0, import_utils4.mergeRegister)(
4779
4957
  editor.registerCommand(
4780
4958
  import_lexical9.COPY_COMMAND,
@@ -4858,6 +5036,7 @@ function InputVariables(props) {
4858
5036
  value,
4859
5037
  enableEditingVariables,
4860
5038
  disableInlineMenu,
5039
+ showMenuPosition,
4861
5040
  onChange,
4862
5041
  transformPaste,
4863
5042
  showAddVariableMenuOption,
@@ -4875,9 +5054,10 @@ function InputVariables(props) {
4875
5054
  editorRef,
4876
5055
  filterVariable,
4877
5056
  styleVariant = "default",
4878
- renderMenuInPortal
5057
+ renderMenuInPortal,
5058
+ disableDismissEditorOnChange
4879
5059
  } = props;
4880
- const [finalId] = (0, import_react50.useState)(id != null ? id : () => (0, import_uuid2.v4)());
5060
+ const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
4881
5061
  const { dispatch, canDispatch, isEditing } = useVariables(true);
4882
5062
  const { disableVariablesForReals, hadVariablesInValue, sharedMenuProps } = useInputVariablesState(props);
4883
5063
  const useInputWithNoVariables = Boolean(inputWhenNoVariables && !hadVariablesInValue);
@@ -4885,46 +5065,71 @@ function InputVariables(props) {
4885
5065
  "div",
4886
5066
  {
4887
5067
  onKeyDown: () => {
4888
- if (isEditing && canDispatch) {
5068
+ if (!disableDismissEditorOnChange && isEditing && canDispatch) {
4889
5069
  dispatch({ type: "cancelEdit" });
4890
5070
  }
4891
5071
  },
4892
5072
  css: disabled ? inputDisabled : "",
4893
5073
  children: [
4894
- useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4895
- InputVariablesOverlayMenu,
5074
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
5075
+ import_design_system21.HorizontalRhythm,
4896
5076
  {
4897
- ...sharedMenuProps,
4898
- disabled: disableVariablesForReals || disableInlineMenu === true || disableInlineMenu === "by-input",
4899
- portal: renderMenuInPortal,
4900
- replaceValueOnVariableInsert: useInputWithNoVariables,
4901
- useInputWhenNoVariables: useInputWithNoVariables,
4902
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4903
- VariablesComposerInput,
4904
- {
4905
- id: finalId,
4906
- "aria-label": ariaLabel,
4907
- "data-testid": dataTestId ? dataTestId : "input-container",
4908
- "data-text-value": value,
4909
- css: [input, styleVariant === "compact" ? inputCompact : null],
4910
- placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4911
- import_design_system20.Caption,
4912
- {
4913
- css: [
4914
- placeholderCaption,
4915
- styleVariant === "compact" ? placeholderCompact : null
4916
- ],
4917
- children: placeholder
4918
- }
4919
- ) : void 0
4920
- }
4921
- )
5077
+ align: "center",
5078
+ gap: "xs",
5079
+ css: import_react51.css`
5080
+ position: relative;
5081
+ & > div:first-child {
5082
+ flex-grow: 1;
5083
+ }
5084
+ `,
5085
+ children: [
5086
+ useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5087
+ InputVariablesOverlayMenu,
5088
+ {
5089
+ ...sharedMenuProps,
5090
+ disabled: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu === true || disableInlineMenu === "by-input",
5091
+ portal: renderMenuInPortal,
5092
+ replaceValueOnVariableInsert: useInputWithNoVariables,
5093
+ useInputWhenNoVariables: useInputWithNoVariables,
5094
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5095
+ VariablesComposerInput,
5096
+ {
5097
+ id: finalId,
5098
+ "aria-label": ariaLabel,
5099
+ "data-testid": dataTestId ? dataTestId : "input-container",
5100
+ "data-text-value": value,
5101
+ css: [input, styleVariant === "compact" ? inputCompact : null],
5102
+ placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5103
+ import_design_system21.Caption,
5104
+ {
5105
+ css: [
5106
+ placeholderCaption,
5107
+ styleVariant === "compact" ? placeholderCompact : null
5108
+ ],
5109
+ children: placeholder
5110
+ }
5111
+ ) : void 0
5112
+ }
5113
+ )
5114
+ }
5115
+ ),
5116
+ disableVariablesForReals || showMenuPosition !== "inline-right" ? null : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5117
+ VariablesComposerVariableMenu,
5118
+ {
5119
+ ...sharedMenuProps,
5120
+ buttonCss: variableBindButton,
5121
+ tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
5122
+ buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
5123
+ replaceValueOnVariableInsert: useInputWithNoVariables
5124
+ }
5125
+ )
5126
+ ]
4922
5127
  }
4923
5128
  ),
4924
- caption ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.Caption, { children: caption }) : null,
4925
- errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.ErrorMessage, { message: errorMessage }) : null,
4926
- warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.WarningMessage, { message: warningMessage }) : null,
4927
- infoMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system20.InfoMessage, { message: infoMessage }) : null
5129
+ caption ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.Caption, { children: caption }) : null,
5130
+ errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.ErrorMessage, { message: errorMessage }) : null,
5131
+ warningMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.WarningMessage, { message: warningMessage }) : null,
5132
+ infoMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system21.InfoMessage, { message: infoMessage }) : null
4928
5133
  ]
4929
5134
  }
4930
5135
  );
@@ -4940,7 +5145,7 @@ function InputVariables(props) {
4940
5145
  },
4941
5146
  id: finalId,
4942
5147
  isActive: hadVariablesInValue,
4943
- disableVariables: disableVariablesForReals || disableInlineMenu === "by-label",
5148
+ disableVariables: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu === "by-label",
4944
5149
  children: input3
4945
5150
  }
4946
5151
  );
@@ -4978,7 +5183,7 @@ function InputVariablesOverlayMenu({
4978
5183
  if (disabled) {
4979
5184
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
4980
5185
  }
4981
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { css: menuContainer, children: [
5186
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { css: menuContainer, "data-testid": "inline-var-menu", children: [
4982
5187
  children,
4983
5188
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
4984
5189
  VariablesComposerVariableMenu,
@@ -4996,111 +5201,17 @@ function InputVariablesOverlayMenu({
4996
5201
  var import_CgUsbC2 = require("@react-icons/all-files/cg/CgUsbC");
4997
5202
  var import_canvas7 = require("@uniformdev/canvas");
4998
5203
  var import_design_system22 = require("@uniformdev/design-system");
4999
- var import_react52 = require("react");
5000
-
5001
- // src/components/Variables/styles/ParameterVariables.styles.ts
5002
- var import_react51 = require("@emotion/react");
5003
- var import_design_system21 = require("@uniformdev/design-system");
5004
- var variableBindButton2 = import_react51.css`
5005
- align-items: center;
5006
- border: none;
5007
- border-radius: var(--rounded-base);
5008
- background: none;
5009
- display: flex;
5010
- height: 1.2rem;
5011
- padding: var(--spacing-2xs);
5012
- transition: background var(--duration-fast) var(--timing-ease-out),
5013
- color var(--duration-fast) var(--timing-ease-out);
5014
- width: 1.2rem;
5015
-
5016
- &:hover,
5017
- &[aria-pressed='true']:not(:disabled) {
5018
- background: var(--brand-secondary-3);
5019
- color: var(--white);
5020
- }
5021
-
5022
- &[aria-disabled='true'] {
5023
- background: none;
5024
- color: currentColor;
5025
- }
5026
-
5027
- // fixes menu resizing issue within iframes
5028
- // see https://linear.app/uniform/issue/UNI-3068/mesh-integration-resizing-with-menus
5029
- + [role='menu'] {
5030
- max-height: unset;
5031
- }
5032
- `;
5033
- var input2 = import_react51.css`
5034
- display: block;
5035
- appearance: none;
5036
- box-sizing: border-box;
5037
- background: var(--white);
5038
- border: 1px solid var(--gray-200);
5039
- border-radius: var(--rounded-sm);
5040
- color: var(--gray-700);
5041
- font-size: var(--fs-sm);
5042
- line-height: 1.5;
5043
- min-height: 2rem;
5044
- padding: var(--spacing-sm);
5045
- width: 100%;
5046
- position: relative;
5047
- white-space: normal;
5048
- transition-property: background, border-color, color, box-shadow, border-radius;
5049
- transition-duration: var(--duration-fast);
5050
- transition-timing-function: var(--timing-ease-out);
5051
-
5052
- &::placeholder {
5053
- color: var(--gray-400);
5054
- }
5055
-
5056
- &:focus,
5057
- &:focus-within {
5058
- border-radius: var(--rounded-sm);
5059
- box-shadow: var(--elevation-100);
5060
- border: 1px solid var(--accent-dark-active);
5061
- outline: none;
5062
- }
5063
- &:hover {
5064
- border: 1px solid var(--accent-dark-hover);
5065
- }
5066
-
5067
- &:disabled,
5068
- &:disabled::placeholder,
5069
- &:disabled:hover {
5070
- border-radius: var(--rounded-sm);
5071
- cursor: not-allowed;
5072
- color: var(--gray-400);
5073
- }
5074
-
5075
- &[readonly],
5076
- &[contenteditable='false'] {
5077
- cursor: not-allowed;
5078
- color: var(--gray-400);
5079
- }
5080
-
5081
- > p {
5082
- margin: 0;
5083
- }
5084
- `;
5085
- var inputMultiLine = (lines) => import_react51.css`
5086
- ${import_design_system21.scrollbarStyles}
5087
- // 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
5088
- // as the text looked to close to the bottom of the input
5089
- height: calc(${lines * 1.5}em + var(--spacing-sm) + var(--spacing-xs));
5090
- resize: vertical;
5091
- overflow: auto;
5092
- `;
5093
-
5094
- // src/components/Variables/ParameterConnectionIndicator.tsx
5204
+ var import_react53 = require("react");
5095
5205
  var import_jsx_runtime41 = require("@emotion/react/jsx-runtime");
5096
5206
  function ParameterConnectionIndicator({
5097
5207
  children,
5098
5208
  value,
5099
5209
  menuOptions,
5100
5210
  disabled,
5101
- menuTooltip = "Insert variable"
5211
+ menuTooltip = "Insert variable",
5212
+ overrideMenuButtonParentMargin
5102
5213
  }) {
5103
- const hasVariablesInValue = (0, import_react52.useMemo)(() => {
5214
+ const hasVariablesInValue = (0, import_react53.useMemo)(() => {
5104
5215
  let result = false;
5105
5216
  (0, import_canvas7.bindVariablesToObject)({
5106
5217
  value,
@@ -5119,13 +5230,21 @@ function ParameterConnectionIndicator({
5119
5230
  placement: "bottom-start",
5120
5231
  withoutPortal: true,
5121
5232
  menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5122
- "button",
5233
+ "div",
5123
5234
  {
5124
- title: menuTooltip,
5125
- "aria-pressed": hasVariablesInValue,
5126
- css: [menuBtn, variableBindButton2],
5127
- type: "button",
5128
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_CgUsbC2.CgUsbC, { size: "1.4rem" })
5235
+ css: overrideMenuButtonParentMargin ? {
5236
+ marginBottom: overrideMenuButtonParentMargin
5237
+ } : void 0,
5238
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5239
+ "button",
5240
+ {
5241
+ title: menuTooltip,
5242
+ "aria-pressed": hasVariablesInValue,
5243
+ css: [menuBtn, variableBindButton],
5244
+ type: "button",
5245
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_CgUsbC2.CgUsbC, { size: "1.4rem" })
5246
+ }
5247
+ )
5129
5248
  }
5130
5249
  ),
5131
5250
  menuLabel: menuTooltip,
@@ -5137,21 +5256,21 @@ function ParameterConnectionIndicator({
5137
5256
 
5138
5257
  // src/components/Variables/ParameterOrSingleVariable.tsx
5139
5258
  var import_design_system23 = require("@uniformdev/design-system");
5140
- var import_react54 = require("react");
5259
+ var import_react55 = require("react");
5141
5260
 
5142
5261
  // src/components/Variables/composer/OnDisconnectPlugin.tsx
5143
5262
  var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
5144
5263
  var import_utils5 = require("@lexical/utils");
5145
5264
  var import_lexical10 = require("lexical");
5146
- var import_react53 = require("react");
5265
+ var import_react54 = require("react");
5147
5266
  function OnDisconnectPlugin({
5148
5267
  onDisconnect
5149
5268
  }) {
5150
5269
  const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
5151
5270
  const { variables } = useVariables(true);
5152
- const variablesRef = (0, import_react53.useRef)(variables);
5271
+ const variablesRef = (0, import_react54.useRef)(variables);
5153
5272
  variablesRef.current = variables;
5154
- (0, import_react53.useEffect)(() => {
5273
+ (0, import_react54.useEffect)(() => {
5155
5274
  return (0, import_utils5.mergeRegister)(
5156
5275
  editor.registerCommand(
5157
5276
  DISCONNECT_VARIABLE_COMMAND,
@@ -5196,7 +5315,7 @@ function ParameterOrSingleVariable(props) {
5196
5315
  hasVariablesInValue,
5197
5316
  setHadVariablesInValue
5198
5317
  } = useInputVariablesState(props);
5199
- const handleDisconnect = (0, import_react54.useCallback)(
5318
+ const handleDisconnect = (0, import_react55.useCallback)(
5200
5319
  (variable) => {
5201
5320
  setHadVariablesInValue(false);
5202
5321
  if (onDisconnect) {
@@ -5235,7 +5354,7 @@ function ParameterOrSingleVariable(props) {
5235
5354
  VariablesComposerVariableMenu,
5236
5355
  {
5237
5356
  ...sharedMenuProps,
5238
- buttonCss: [variableBindButton2],
5357
+ buttonCss: [variableBindButton],
5239
5358
  buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
5240
5359
  replaceValueOnVariableInsert: true,
5241
5360
  filterVariable
@@ -5249,7 +5368,7 @@ function ParameterOrSingleVariable(props) {
5249
5368
  }
5250
5369
 
5251
5370
  // src/components/Variables/ParameterVariables.tsx
5252
- var import_react55 = require("@emotion/react");
5371
+ var import_react56 = require("@emotion/react");
5253
5372
  var import_design_system24 = require("@uniformdev/design-system");
5254
5373
  var import_jsx_runtime43 = require("@emotion/react/jsx-runtime");
5255
5374
  function ParameterVariables(props) {
@@ -5288,19 +5407,17 @@ function ParameterVariables(props) {
5288
5407
  children: [
5289
5408
  editorRef ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(EditorRefPlugin, { editorRef }) : null,
5290
5409
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
5291
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
5292
- import_design_system24.HorizontalRhythm,
5293
- {
5294
- align: "center",
5295
- gap: "xs",
5296
- css: { width: "100%" },
5297
- onKeyDown: () => {
5298
- if (isEditing && canDispatch) {
5299
- dispatch({ type: "cancelEdit" });
5300
- }
5301
- },
5302
- children: [
5303
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5410
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_design_system24.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5411
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5412
+ "div",
5413
+ {
5414
+ css: { flex: 1 },
5415
+ onKeyDown: () => {
5416
+ if (isEditing && canDispatch) {
5417
+ dispatch({ type: "cancelEdit" });
5418
+ }
5419
+ },
5420
+ children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5304
5421
  VariablesComposerInput,
5305
5422
  {
5306
5423
  "aria-label": ariaLabel,
@@ -5308,24 +5425,24 @@ function ParameterVariables(props) {
5308
5425
  "data-text-value": value,
5309
5426
  css: [
5310
5427
  input2,
5311
- typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) : import_react55.css``,
5312
- inputCss != null ? inputCss : import_react55.css``
5428
+ typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) : import_react56.css``,
5429
+ inputCss != null ? inputCss : import_react56.css``
5313
5430
  ]
5314
5431
  }
5315
- ) }),
5316
- disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5317
- VariablesComposerVariableMenu,
5318
- {
5319
- ...sharedMenuProps,
5320
- buttonCss: [variableBindButton2],
5321
- tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
5322
- buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
5323
- replaceValueOnVariableInsert: useInputWhenNoVariables
5324
- }
5325
5432
  )
5326
- ]
5327
- }
5328
- )
5433
+ }
5434
+ ),
5435
+ disableVariablesForReals ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5436
+ VariablesComposerVariableMenu,
5437
+ {
5438
+ ...sharedMenuProps,
5439
+ buttonCss: [variableBindButton],
5440
+ tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
5441
+ buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
5442
+ replaceValueOnVariableInsert: useInputWhenNoVariables
5443
+ }
5444
+ )
5445
+ ] })
5329
5446
  ]
5330
5447
  }
5331
5448
  );
@@ -5333,7 +5450,7 @@ function ParameterVariables(props) {
5333
5450
 
5334
5451
  // src/components/Variables/util/convertConnectedDataToVariable.ts
5335
5452
  function convertConnectedDataToVariable(bindExpression, value) {
5336
- const isValuePrimitive = typeof value === "string" || typeof value === "number" || typeof value === "boolean";
5453
+ const isValuePrimitive = typeof value === "string" && value.length > 0 || typeof value === "number" || typeof value === "boolean";
5337
5454
  return {
5338
5455
  ephemeral: true,
5339
5456
  displayName: isValuePrimitive ? value.toString() : prettifyBindExpression(bindExpression),
@@ -5345,13 +5462,13 @@ ${prettifyBindExpression(bindExpression)}`
5345
5462
  }
5346
5463
 
5347
5464
  // src/components/Variables/VariablesList.tsx
5348
- var import_react57 = require("@emotion/react");
5465
+ var import_react58 = require("@emotion/react");
5349
5466
  var import_design_system25 = require("@uniformdev/design-system");
5350
5467
  var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
5351
5468
 
5352
5469
  // src/components/Variables/styles/VariablesList.styles.ts
5353
- var import_react56 = require("@emotion/react");
5354
- var tableRow = (isDragging) => import_react56.css`
5470
+ var import_react57 = require("@emotion/react");
5471
+ var tableRow = (isDragging) => import_react57.css`
5355
5472
  position: relative;
5356
5473
  ${isDragging ? `
5357
5474
  display: table;
@@ -5359,7 +5476,7 @@ var tableRow = (isDragging) => import_react56.css`
5359
5476
  top: auto !important;
5360
5477
  ` : void 0}
5361
5478
  `;
5362
- var tableCellDragIcon = import_react56.css`
5479
+ var tableCellDragIcon = import_react57.css`
5363
5480
  &::after {
5364
5481
  content: '';
5365
5482
  display: block;
@@ -5377,7 +5494,7 @@ var tableCellDragIcon = import_react56.css`
5377
5494
  opacity: 1;
5378
5495
  }
5379
5496
  `;
5380
- var variableName = import_react56.css`
5497
+ var variableName = import_react57.css`
5381
5498
  border: none;
5382
5499
  font-weight: var(--fw-medium);
5383
5500
  padding: 0;
@@ -5387,7 +5504,7 @@ var variableName = import_react56.css`
5387
5504
  white-space: nowrap;
5388
5505
  max-width: 20ch;
5389
5506
  `;
5390
- var variableValue = import_react56.css`
5507
+ var variableValue = import_react57.css`
5391
5508
  overflow: hidden;
5392
5509
  text-overflow: ellipsis;
5393
5510
  white-space: nowrap;
@@ -5464,7 +5581,7 @@ function VariablesList() {
5464
5581
  title: `delete ${text}`,
5465
5582
  css: [
5466
5583
  import_design_system25.button,
5467
- import_react57.css`
5584
+ import_react58.css`
5468
5585
  background: transparent;
5469
5586
  `
5470
5587
  ],
@@ -5498,6 +5615,10 @@ function VariablesList() {
5498
5615
 
5499
5616
  // src/components/DataResourceDynamicInputProvider.tsx
5500
5617
  var import_jsx_runtime45 = require("@emotion/react/jsx-runtime");
5618
+ var DataResourceInputContext = (0, import_react59.createContext)(void 0);
5619
+ var useDataResourceDynamicInputs = () => {
5620
+ return (0, import_react59.useContext)(DataResourceInputContext);
5621
+ };
5501
5622
  function DataResourceDynamicInputProvider(props) {
5502
5623
  const { children, dynamicInputs } = props;
5503
5624
  if (dynamicInputs) {
@@ -5516,7 +5637,7 @@ function DataResourceDynamicInputProviderRenderer({
5516
5637
  dynamicInputs
5517
5638
  }) {
5518
5639
  const variables = useDynamicInputsAsVariables(dynamicInputs);
5519
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(VariablesProvider, { value: variables, readOnly: true, children });
5640
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DataResourceInputContext.Provider, { value: dynamicInputs, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(VariablesProvider, { value: variables, readOnly: true, children }) });
5520
5641
  }
5521
5642
 
5522
5643
  // src/components/DataResourceVariablesList.tsx
@@ -5593,9 +5714,9 @@ function TextVariableRenderer({ definition, value, setValue }) {
5593
5714
  }
5594
5715
 
5595
5716
  // src/components/Request/RequestBody.tsx
5596
- var import_react59 = require("@emotion/react");
5717
+ var import_react61 = require("@emotion/react");
5597
5718
  var import_design_system27 = require("@uniformdev/design-system");
5598
- var import_react60 = require("react");
5719
+ var import_react62 = require("react");
5599
5720
 
5600
5721
  // src/components/Request/RequestProvider.tsx
5601
5722
  var React11 = __toESM(require("react"));
@@ -5679,11 +5800,11 @@ function useRequest() {
5679
5800
  }
5680
5801
 
5681
5802
  // src/components/Request/styles/Request.styles.ts
5682
- var import_react58 = require("@emotion/react");
5683
- var innerContentStyles = import_react58.css`
5803
+ var import_react60 = require("@emotion/react");
5804
+ var innerContentStyles = import_react60.css`
5684
5805
  background: var(--white);
5685
5806
  `;
5686
- var requestTypeContainer = (bgColor) => import_react58.css`
5807
+ var requestTypeContainer = (bgColor) => import_react60.css`
5687
5808
  align-items: start;
5688
5809
  background: ${bgColor};
5689
5810
  display: grid;
@@ -5721,11 +5842,11 @@ var LANGUAGE_TO_CONTENT_TYPE = {
5721
5842
  };
5722
5843
  function RequestBody() {
5723
5844
  const { request, dispatch } = useRequest();
5724
- const [language, setLanguage] = (0, import_react60.useState)("json");
5845
+ const [language, setLanguage] = (0, import_react62.useState)("json");
5725
5846
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5726
5847
  "div",
5727
5848
  {
5728
- css: import_react59.css`
5849
+ css: import_react61.css`
5729
5850
  background: var(--white);
5730
5851
  `,
5731
5852
  children: [
@@ -5733,7 +5854,7 @@ function RequestBody() {
5733
5854
  RequestTypeContainer,
5734
5855
  {
5735
5856
  bgColor: "var(--gray-100)",
5736
- css: import_react59.css`
5857
+ css: import_react61.css`
5737
5858
  padding: var(--spacing-sm) var(--spacing-base);
5738
5859
  `,
5739
5860
  children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
@@ -5851,8 +5972,11 @@ function RequestHeaders({
5851
5972
  }
5852
5973
  ) : null }),
5853
5974
  addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system28.TableCellData, { width: "50%", children: header.key ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5854
- import_design_system28.Input,
5975
+ import_design_system28.InputToggle,
5855
5976
  {
5977
+ label: "Omit if empty",
5978
+ showLabel: false,
5979
+ name: "omitIfEmpty",
5856
5980
  type: "checkbox",
5857
5981
  checked: header.omitIfEmpty,
5858
5982
  "data-testid": "header-omitifempty",
@@ -5979,8 +6103,11 @@ function RequestParameters({
5979
6103
  }
5980
6104
  ) : null }),
5981
6105
  addOmitIfEmpty ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system30.TableCellData, { width: "50%", children: parameter.key ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
5982
- import_design_system30.Input,
6106
+ import_design_system30.InputToggle,
5983
6107
  {
6108
+ label: "Omit if empty",
6109
+ showLabel: false,
6110
+ name: "omitIfEmpty",
5984
6111
  type: "checkbox",
5985
6112
  checked: parameter.omitIfEmpty,
5986
6113
  "data-testid": "parameter-omitifempty",
@@ -6004,8 +6131,8 @@ function RequestParameters({
6004
6131
  }
6005
6132
 
6006
6133
  // src/components/Request/RequestUrl.tsx
6007
- var import_react61 = require("@emotion/react");
6008
- var import_react62 = require("react");
6134
+ var import_react63 = require("@emotion/react");
6135
+ var import_react64 = require("react");
6009
6136
 
6010
6137
  // src/components/Request/urlEncodeRequestParameter.ts
6011
6138
  function urlEncodeRequestUrl(url, varValues) {
@@ -6031,7 +6158,7 @@ function RequestUrl() {
6031
6158
  var _a, _b;
6032
6159
  const { variables } = useVariables();
6033
6160
  const { request } = useRequest();
6034
- const mergedParameters = (0, import_react62.useMemo)(() => {
6161
+ const mergedParameters = (0, import_react64.useMemo)(() => {
6035
6162
  var _a2;
6036
6163
  if (!((_a2 = request.baseRequest) == null ? void 0 : _a2.parameters)) {
6037
6164
  return request.parameters;
@@ -6041,7 +6168,7 @@ function RequestUrl() {
6041
6168
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
6042
6169
  "small",
6043
6170
  {
6044
- css: import_react61.css`
6171
+ css: import_react63.css`
6045
6172
  display: inline-block;
6046
6173
  margin-bottom: var(--spacing-xs);
6047
6174
  word-break: break-word;
@@ -6279,12 +6406,12 @@ var import_design_system31 = require("@uniformdev/design-system");
6279
6406
 
6280
6407
  // src/hooks/useInitializeUniformMeshSdk.ts
6281
6408
  var import_mesh_sdk = require("@uniformdev/mesh-sdk");
6282
- var import_react63 = require("react");
6409
+ var import_react65 = require("react");
6283
6410
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
6284
- const [error, setError] = (0, import_react63.useState)();
6285
- const [sdk, setSdk] = (0, import_react63.useState)();
6286
- const initializationInProgress = (0, import_react63.useRef)(false);
6287
- (0, import_react63.useEffect)(
6411
+ const [error, setError] = (0, import_react65.useState)();
6412
+ const [sdk, setSdk] = (0, import_react65.useState)();
6413
+ const initializationInProgress = (0, import_react65.useRef)(false);
6414
+ (0, import_react65.useEffect)(
6288
6415
  () => {
6289
6416
  if (typeof window === "undefined" || sdk) {
6290
6417
  return;
@@ -6342,7 +6469,7 @@ var MeshApp = ({
6342
6469
  };
6343
6470
 
6344
6471
  // src/components/ObjectSearch/DataRefreshButton.tsx
6345
- var import_react64 = require("@emotion/react");
6472
+ var import_react66 = require("@emotion/react");
6346
6473
  var import_design_system32 = require("@uniformdev/design-system");
6347
6474
  var import_jsx_runtime58 = require("@emotion/react/jsx-runtime");
6348
6475
  var DataRefreshButton = ({
@@ -6355,7 +6482,7 @@ var DataRefreshButton = ({
6355
6482
  !isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
6356
6483
  import_design_system32.LoadingIndicator,
6357
6484
  {
6358
- css: import_react64.css`
6485
+ css: import_react66.css`
6359
6486
  ${isLoading ? "opacity: 0.2;" : void 0}
6360
6487
  `
6361
6488
  }
@@ -6365,15 +6492,16 @@ var DataRefreshButton = ({
6365
6492
  };
6366
6493
 
6367
6494
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
6368
- var import_react67 = require("@emotion/react");
6495
+ var import_react72 = require("@emotion/react");
6369
6496
  var import_canvas9 = require("@uniformdev/canvas");
6370
- var import_design_system35 = require("@uniformdev/design-system");
6497
+ var import_design_system38 = require("@uniformdev/design-system");
6498
+ var import_react73 = __toESM(require("react"));
6371
6499
 
6372
6500
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
6373
6501
  var import_canvas8 = require("@uniformdev/canvas");
6374
- var import_react65 = require("react");
6502
+ var import_react67 = require("react");
6375
6503
  var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
6376
- var ObjectSearchContext = (0, import_react65.createContext)({
6504
+ var ObjectSearchContext = (0, import_react67.createContext)({
6377
6505
  onSetQuery: () => {
6378
6506
  },
6379
6507
  onSelectItem: () => {
@@ -6381,8 +6509,6 @@ var ObjectSearchContext = (0, import_react65.createContext)({
6381
6509
  query: {},
6382
6510
  boundQuery: {},
6383
6511
  list: {},
6384
- onSetList: () => {
6385
- },
6386
6512
  selectedListItems: [],
6387
6513
  onRemoveAllSelectedItems: () => {
6388
6514
  },
@@ -6394,16 +6520,16 @@ var ObjectSearchProvider = ({
6394
6520
  children,
6395
6521
  defaultQuery
6396
6522
  }) => {
6397
- const [query, setQuery] = (0, import_react65.useState)({
6523
+ const [query, setQuery] = (0, import_react67.useState)({
6398
6524
  contentType: "",
6399
6525
  keyword: "",
6400
6526
  ...defaultQuery
6401
6527
  });
6402
6528
  const { flatVariables } = useVariables(true);
6403
- const querySearchDeferred = (0, import_react65.useDeferredValue)(query);
6404
- const [selectedItems, setSelectedItems] = (0, import_react65.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
6405
- const [list, setList] = (0, import_react65.useState)({});
6406
- const onSetQuery = (0, import_react65.useCallback)(
6529
+ const querySearchDeferred = (0, import_react67.useDeferredValue)(query);
6530
+ const [selectedItems, setSelectedItems] = (0, import_react67.useState)(currentlySelectedItems != null ? currentlySelectedItems : []);
6531
+ const [list, setList] = (0, import_react67.useState)({});
6532
+ const onSetQuery = (0, import_react67.useCallback)(
6407
6533
  (value2) => {
6408
6534
  if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
6409
6535
  return setQuery({
@@ -6415,7 +6541,7 @@ var ObjectSearchProvider = ({
6415
6541
  },
6416
6542
  [setQuery]
6417
6543
  );
6418
- const onSelectItem = (0, import_react65.useCallback)(
6544
+ const onSelectItem = (0, import_react67.useCallback)(
6419
6545
  (selectedResult) => {
6420
6546
  if (Array.isArray(selectedResult)) {
6421
6547
  setSelectedItems(selectedResult);
@@ -6429,17 +6555,17 @@ var ObjectSearchProvider = ({
6429
6555
  },
6430
6556
  [setSelectedItems, selectedItems]
6431
6557
  );
6432
- const onRemoveAllSelectedItems = (0, import_react65.useCallback)(() => {
6558
+ const onRemoveAllSelectedItems = (0, import_react67.useCallback)(() => {
6433
6559
  setSelectedItems([]);
6434
6560
  }, [setSelectedItems]);
6435
- const onSetList = (0, import_react65.useCallback)(
6561
+ const onSetList = (0, import_react67.useCallback)(
6436
6562
  (value2) => {
6437
6563
  setList(value2);
6438
6564
  },
6439
6565
  [setList]
6440
6566
  );
6441
- const boundQuery = (0, import_react65.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
6442
- const value = (0, import_react65.useMemo)(
6567
+ const boundQuery = (0, import_react67.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
6568
+ const value = (0, import_react67.useMemo)(
6443
6569
  () => ({
6444
6570
  boundQuery,
6445
6571
  onSetQuery,
@@ -6466,7 +6592,7 @@ var ObjectSearchProvider = ({
6466
6592
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ObjectSearchContext.Provider, { value, children });
6467
6593
  };
6468
6594
  function useObjectSearchContext() {
6469
- return (0, import_react65.useContext)(ObjectSearchContext);
6595
+ return (0, import_react67.useContext)(ObjectSearchContext);
6470
6596
  }
6471
6597
  function bindQuery(query, inputs) {
6472
6598
  const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
@@ -6484,9 +6610,9 @@ function bindQuery(query, inputs) {
6484
6610
  var import_design_system34 = require("@uniformdev/design-system");
6485
6611
 
6486
6612
  // src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
6487
- var import_react66 = require("@emotion/react");
6613
+ var import_react68 = require("@emotion/react");
6488
6614
  var import_design_system33 = require("@uniformdev/design-system");
6489
- var ObjectListItemContainer = import_react66.css`
6615
+ var ObjectListItemContainer = import_react68.css`
6490
6616
  align-items: center;
6491
6617
  border: 1px solid var(--gray-300);
6492
6618
  border-radius: var(--rounded-base);
@@ -6495,11 +6621,11 @@ var ObjectListItemContainer = import_react66.css`
6495
6621
  grid-template-columns: 1fr auto;
6496
6622
  padding: var(--spacing-sm);
6497
6623
  `;
6498
- var ObjectListItemContainerDisabled = import_react66.css`
6624
+ var ObjectListItemContainerDisabled = import_react68.css`
6499
6625
  opacity: var(--opacity-50);
6500
6626
  pointer-events: none;
6501
6627
  `;
6502
- var ObjectListItemLoading = import_react66.css`
6628
+ var ObjectListItemLoading = import_react68.css`
6503
6629
  animation: ${import_design_system33.skeletonLoading} 1s linear infinite alternate;
6504
6630
  border-color: transparent;
6505
6631
  min-height: 42px;
@@ -6523,36 +6649,36 @@ var ObjectListItemLoading = import_react66.css`
6523
6649
  width: 1rem;
6524
6650
  }
6525
6651
  `;
6526
- var ObjectListItemHeadingGroup = import_react66.css`
6652
+ var ObjectListItemHeadingGroup = import_react68.css`
6527
6653
  align-items: center;
6528
6654
  display: grid;
6529
6655
  `;
6530
- var ObjectListItemThumbnail = import_react66.css`
6656
+ var ObjectListItemThumbnail = import_react68.css`
6531
6657
  width: 30px;
6532
6658
  object-fit: contain;
6533
6659
  `;
6534
- var ObjectListItemTitle = import_react66.css`
6660
+ var ObjectListItemTitle = import_react68.css`
6535
6661
  color: var(--typography-base);
6536
6662
  display: block;
6537
6663
  font-size: var(--fs-sm);
6538
6664
  `;
6539
- var ObjectListItemSubtitle = import_react66.css`
6665
+ var ObjectListItemSubtitle = import_react68.css`
6540
6666
  color: var(--gray-500);
6541
6667
  display: block;
6542
6668
  font-size: var(--fs-xs);
6543
6669
  line-height: 1;
6544
6670
  `;
6545
- var ObjectListItemInfoContainer = import_react66.css`
6671
+ var ObjectListItemInfoContainer = import_react68.css`
6546
6672
  align-items: center;
6547
6673
  display: flex;
6548
6674
  gap: var(--spacing-sm);
6549
6675
  justify-content: center;
6550
6676
  `;
6551
- var ObjectListItemControlledContent = import_react66.css`
6677
+ var ObjectListItemControlledContent = import_react68.css`
6552
6678
  display: flex;
6553
6679
  gap: var(--spacing-sm);
6554
6680
  `;
6555
- var ObjectListItemUnControlledContent = import_react66.css`
6681
+ var ObjectListItemUnControlledContent = import_react68.css`
6556
6682
  margin-top: var(--spacing-sm);
6557
6683
  grid-column: 1 / -1;
6558
6684
  `;
@@ -6622,202 +6748,19 @@ var ObjectSearchListItemLoadingSkeleton = () => {
6622
6748
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
6623
6749
  };
6624
6750
 
6625
- // src/components/ObjectSearch/ObjectSearchContainer.tsx
6626
- var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
6627
- var ObjectSearchContainer = ({
6628
- label,
6629
- enableDynamicInputToResultId,
6630
- searchFilters,
6631
- resultList,
6632
- children
6633
- }) => {
6634
- var _a, _b;
6635
- const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
6636
- const { flatVariables } = useVariables(true);
6637
- const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
6638
- const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
6639
- import_design_system35.ScrollableList,
6640
- {
6641
- role: "list",
6642
- css: import_react67.css`
6643
- > div {
6644
- transition: max-height var(--duration-slow) var(--timing-ease-out);
6645
- max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
6646
- }
6647
- `,
6648
- children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DefaultResultList, {})
6649
- }
6650
- );
6651
- const body = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
6652
- searchFilters,
6653
- listItems
6654
- ] });
6655
- const handleSelectedVariableChange = (selectedValue) => {
6656
- var _a2;
6657
- if (!selectedValue) {
6658
- onSelectItem([]);
6659
- return;
6660
- }
6661
- const { result, errors } = (0, import_canvas9.bindVariables)({
6662
- value: selectedValue,
6663
- variables: flatVariables,
6664
- errorPrefix: "Dynamic input"
6665
- });
6666
- if (!result) {
6667
- onSelectItem([]);
6668
- return;
6669
- }
6670
- const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
6671
- onSelectItem([
6672
- {
6673
- title: selectedValue,
6674
- 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`,
6675
- // spread any matched list item, overriding the above default props
6676
- ...item,
6677
- // we want to make sure the ID is our dynamic value
6678
- id: selectedValue
6679
- }
6680
- ]);
6681
- };
6682
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
6683
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
6684
- InputVariables,
6685
- {
6686
- label,
6687
- value: inputValue,
6688
- onChange: (value) => {
6689
- if (value === inputValue) {
6690
- return;
6691
- }
6692
- handleSelectedVariableChange(value);
6693
- },
6694
- inputWhenNoVariables: body,
6695
- disableVariables: !enableDynamicInputToResultId
6696
- }
6697
- ) : body }),
6698
- children
6699
- ] }) });
6700
- };
6701
- var DefaultResultList = () => {
6702
- var _a;
6703
- const { list } = useObjectSearchContext();
6704
- if (!list.items) {
6705
- return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
6706
- }
6707
- if (list.items.length === 0) {
6708
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Callout, { type: "info", children: "No results were found" });
6709
- }
6710
- return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ObjectSearchListItem, { ...item }, item.id));
6711
- };
6712
-
6713
- // src/components/ObjectSearch/ObjectSearchFilter.tsx
6714
- var import_design_system36 = require("@uniformdev/design-system");
6715
- var import_react69 = require("react");
6716
-
6717
- // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
6718
- var import_react68 = require("@emotion/react");
6719
- var ObjectSearchFilterContainerLabel = import_react68.css`
6720
- align-items: center;
6721
- display: flex;
6722
- font-size: var(--fs-sm);
6723
- font-weight: var(--fw-bold);
6724
- line-height: 1rem;
6725
- margin-bottom: var(--spacing-sm);
6726
- `;
6727
- var ObjectSearchFilterContainer = import_react68.css`
6728
- display: grid;
6729
- gap: var(--spacing-base);
6730
- `;
6731
- var ObjectSearchFilterGrid = (gridColumns) => import_react68.css`
6732
- display: grid;
6733
- grid-template-columns: ${gridColumns};
6734
- gap: var(--spacing-base);
6735
- `;
6736
-
6737
- // src/components/ObjectSearch/ObjectSearchFilter.tsx
6738
- var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
6739
- var ObjectSearchFilter = ({
6740
- requireContentType,
6741
- typeSelectorAllTypesOptionText = "All content types",
6742
- searchInputName = "searchText",
6743
- searchInputPlaceholderText = "Enter keyword to narrow your results",
6744
- selectLabel = "Content Type Select",
6745
- selectOptions
6746
- }) => {
6747
- var _a, _b;
6748
- const { query, onSetQuery } = useObjectSearchContext();
6749
- const [searchState, setSearchState] = (0, import_react69.useState)({
6750
- contentType: (_a = query.contentType) != null ? _a : "",
6751
- keyword: (_b = query.keyword) != null ? _b : ""
6752
- });
6753
- const handleFilterChange = (value) => {
6754
- setSearchState((prev) => {
6755
- return { ...prev, ...value };
6756
- });
6757
- onSetQuery({ ...query, ...value });
6758
- };
6759
- const memoizedSelectOptions = (0, import_react69.useMemo)(() => {
6760
- if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
6761
- return [];
6762
- }
6763
- return [
6764
- ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
6765
- ...selectOptions != null ? selectOptions : []
6766
- ];
6767
- }, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
6768
- const shouldRenderSelect = memoizedSelectOptions.length > 0;
6769
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
6770
- "fieldset",
6771
- {
6772
- css: [
6773
- ObjectSearchFilterContainer,
6774
- ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
6775
- ],
6776
- children: [
6777
- memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
6778
- import_design_system36.InputSelect,
6779
- {
6780
- label: selectLabel,
6781
- showLabel: false,
6782
- onChange: (e) => handleFilterChange({ contentType: e.target.value }),
6783
- options: memoizedSelectOptions,
6784
- value: query.contentType
6785
- }
6786
- ) : null,
6787
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
6788
- import_design_system36.DebouncedInputKeywordSearch,
6789
- {
6790
- inputFieldName: searchInputName,
6791
- placeholder: searchInputPlaceholderText,
6792
- onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
6793
- disabledFieldSubmission: true,
6794
- defaultValue: searchState.keyword,
6795
- delay: 300
6796
- }
6797
- )
6798
- ]
6799
- }
6800
- );
6801
- };
6802
-
6803
- // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
6804
- var import_jsx_runtime63 = require("@emotion/react/jsx-runtime");
6805
- var ObjectSearchFilterContainer2 = ({ label, children }) => {
6806
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { children: [
6807
- label ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
6808
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { css: ObjectSearchFilterContainer, children })
6809
- ] });
6810
- };
6751
+ // src/components/ObjectSearch/ObjectSearchResultList.tsx
6752
+ var import_design_system37 = require("@uniformdev/design-system");
6753
+ var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
6811
6754
 
6812
6755
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6813
- var import_design_system38 = require("@uniformdev/design-system");
6756
+ var import_design_system36 = require("@uniformdev/design-system");
6814
6757
  var import_timeago3 = require("timeago.js");
6815
6758
 
6816
6759
  // src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
6817
- var import_react70 = require("@emotion/react");
6818
- var import_design_system37 = require("@uniformdev/design-system");
6819
- var ButtonStyles = import_react70.css`
6820
- ${import_design_system37.button}
6760
+ var import_react69 = require("@emotion/react");
6761
+ var import_design_system35 = require("@uniformdev/design-system");
6762
+ var ButtonStyles = import_react69.css`
6763
+ ${import_design_system35.button}
6821
6764
  background: transparent;
6822
6765
  border: 1px solid var(--typography-base);
6823
6766
  color: var(--typography-base);
@@ -6843,20 +6786,20 @@ var ButtonStyles = import_react70.css`
6843
6786
  text-decoration: none;
6844
6787
  }
6845
6788
  `;
6846
- var ButtonIcon = import_react70.css`
6789
+ var ButtonIcon = import_react69.css`
6847
6790
  width: 1rem;
6848
6791
  height: 1rem;
6849
6792
  `;
6850
6793
 
6851
6794
  // src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
6852
- var import_jsx_runtime64 = require("@emotion/react/jsx-runtime");
6795
+ var import_jsx_runtime61 = require("@emotion/react/jsx-runtime");
6853
6796
  var ObjectSearchResultItemButton = ({
6854
6797
  text,
6855
6798
  icon,
6856
6799
  ...props
6857
6800
  }) => {
6858
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
6859
- !icon ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Image, { src: icon, css: ButtonIcon }),
6801
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("button", { type: "button", css: ButtonStyles, ...props, children: [
6802
+ !icon ? null : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Image, { src: icon, css: ButtonIcon }),
6860
6803
  text
6861
6804
  ] });
6862
6805
  };
@@ -6865,15 +6808,15 @@ var LinkButton = ({
6865
6808
  icon,
6866
6809
  ...props
6867
6810
  }) => {
6868
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6869
- !icon ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Image, { src: icon, css: ButtonIcon }),
6811
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6812
+ !icon ? null : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Image, { src: icon, css: ButtonIcon }),
6870
6813
  text
6871
6814
  ] });
6872
6815
  };
6873
6816
 
6874
6817
  // src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
6875
- var import_react71 = require("@emotion/react");
6876
- var ObjectSearchResultItemContainer = import_react71.css`
6818
+ var import_react70 = require("@emotion/react");
6819
+ var ObjectSearchResultItemContainer = import_react70.css`
6877
6820
  align-items: center;
6878
6821
  border: 1px solid var(--gray-300);
6879
6822
  border-radius: var(--rounded-base);
@@ -6889,7 +6832,7 @@ var ObjectSearchResultItemContainer = import_react71.css`
6889
6832
  }
6890
6833
  }
6891
6834
  `;
6892
- var ObjectSearchDragHandle = import_react71.css`
6835
+ var ObjectSearchDragHandle = import_react70.css`
6893
6836
  border-left: 2px dotted var(--gray-300);
6894
6837
  border-right: 2px dotted var(--gray-300);
6895
6838
  position: absolute;
@@ -6898,41 +6841,41 @@ var ObjectSearchDragHandle = import_react71.css`
6898
6841
  transition: opacity var(--duration-fast) var(--timing-ease-out);
6899
6842
  opacity: 0;
6900
6843
  `;
6901
- var ObjectSearchResultItemSubtitle = import_react71.css`
6844
+ var ObjectSearchResultItemSubtitle = import_react70.css`
6902
6845
  color: var(--gray-500);
6903
6846
  display: block;
6904
6847
  font-size: var(--fs-xs);
6905
6848
  line-height: 1;
6906
6849
  `;
6907
- var ObjectSearchResultItemTitle = import_react71.css`
6850
+ var ObjectSearchResultItemTitle = import_react70.css`
6908
6851
  align-items: center;
6909
6852
  color: var(--typography-base);
6910
6853
  display: flex;
6911
6854
  gap: var(--spacing-xs);
6912
6855
  `;
6913
- var ObjectSearchResultItemTimeStamp = import_react71.css`
6856
+ var ObjectSearchResultItemTimeStamp = import_react70.css`
6914
6857
  color: var(--gray-500);
6915
6858
  font-size: var(--fs-xs);
6916
6859
  `;
6917
- var ObjectSearchAuthorStateGroup = import_react71.css`
6860
+ var ObjectSearchAuthorStateGroup = import_react70.css`
6918
6861
  align-items: center;
6919
6862
  display: flex;
6920
6863
  gap: var(--spacing-sm);
6921
6864
  `;
6922
- var ObjectSearchUpdateGroup = import_react71.css`
6865
+ var ObjectSearchUpdateGroup = import_react70.css`
6923
6866
  display: grid;
6924
6867
  `;
6925
- var ObjectSearchContentContainer = import_react71.css`
6868
+ var ObjectSearchContentContainer = import_react70.css`
6926
6869
  display: flex;
6927
6870
  gap: var(--spacing-base);
6928
6871
  `;
6929
- var ObjectSearchImage = import_react71.css`
6872
+ var ObjectSearchImage = import_react70.css`
6930
6873
  width: 56px;
6931
6874
  object-fit: contain;
6932
6875
  `;
6933
6876
 
6934
6877
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6935
- var import_jsx_runtime65 = require("@emotion/react/jsx-runtime");
6878
+ var import_jsx_runtime62 = require("@emotion/react/jsx-runtime");
6936
6879
  var ObjectSearchResultItem = ({
6937
6880
  id,
6938
6881
  title,
@@ -6956,70 +6899,66 @@ var ObjectSearchResultItem = ({
6956
6899
  onSelectItem({ id, title: id });
6957
6900
  onRemove == null ? void 0 : onRemove();
6958
6901
  };
6959
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
6960
- disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6961
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchContentContainer, children: [
6962
- !imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6963
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { children: [
6964
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
6965
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
6902
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
6903
+ disableDnD ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6904
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchContentContainer, children: [
6905
+ !imageUrl ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6906
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { children: [
6907
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
6908
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
6966
6909
  title != null ? title : name,
6967
- !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6910
+ !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Popover, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6968
6911
  ] }),
6969
- !createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
6970
- !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6971
- !createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
6972
- !createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
6973
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("strong", { children: "Last updated: " }),
6912
+ !createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
6913
+ !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6914
+ !createdAt && !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchUpdateGroup, children: [
6915
+ !createdAt ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
6916
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: "Last updated: " }),
6974
6917
  (0, import_timeago3.format)(createdAt)
6975
6918
  ] }),
6976
- !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
6977
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("strong", { children: "Last published: " }),
6919
+ !publishedAt ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("small", { css: ObjectSearchResultItemTimeStamp, children: [
6920
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("strong", { children: "Last published: " }),
6978
6921
  (0, import_timeago3.format)(publishedAt)
6979
6922
  ] })
6980
6923
  ] })
6981
6924
  ] }),
6982
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children })
6925
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { children })
6983
6926
  ] })
6984
6927
  ] }) }),
6985
- !editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
6986
- !editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6987
- hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_design_system38.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6928
+ !editLink && hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
6929
+ !editLink ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6930
+ hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_design_system36.Button, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6988
6931
  ] })
6989
6932
  ] });
6990
6933
  };
6991
6934
 
6992
- // src/components/ObjectSearch/ObjectSearchResultList.tsx
6993
- var import_design_system39 = require("@uniformdev/design-system");
6994
- var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
6995
-
6996
6935
  // src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
6997
- var import_react72 = require("@emotion/react");
6998
- var ObjectSearchResultListContainer = import_react72.css`
6936
+ var import_react71 = require("@emotion/react");
6937
+ var ObjectSearchResultListContainer = import_react71.css`
6999
6938
  align-items: center;
7000
6939
  display: flex;
7001
6940
  gap: var(--spacing-sm);
7002
6941
  justify-content: space-between;
7003
6942
  `;
7004
- var ObjectSearchDragContainer = import_react72.css`
6943
+ var ObjectSearchDragContainer = import_react71.css`
7005
6944
  margin: 0 0 var(--spacing-sm);
7006
6945
  `;
7007
- var ObjectSearchContainerDragging = import_react72.css`
6946
+ var ObjectSearchContainerDragging = import_react71.css`
7008
6947
  box-shadow: var(--shadow-base);
7009
6948
  opacity: var(--opacity-50);
7010
6949
  `;
7011
- var ObjectSearchResultListCounterContainer = import_react72.css`
6950
+ var ObjectSearchResultListCounterContainer = import_react71.css`
7012
6951
  align-items: center;
7013
6952
  display: flex;
7014
6953
  gap: var(--spacing-sm);
7015
6954
  `;
7016
- var ObjectSearchResultListTitle = import_react72.css`
6955
+ var ObjectSearchResultListTitle = import_react71.css`
7017
6956
  font-weight: var(--fw-bold);
7018
6957
  line-height: 1;
7019
6958
  `;
7020
6959
 
7021
6960
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
7022
- var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
6961
+ var import_jsx_runtime63 = require("@emotion/react/jsx-runtime");
7023
6962
  function ObjectSearchResultList({
7024
6963
  resultLabelText = "Selected",
7025
6964
  removeButtonText = "Remove all",
@@ -7027,7 +6966,7 @@ function ObjectSearchResultList({
7027
6966
  hideRemoveButton = false,
7028
6967
  resultLabelOverride,
7029
6968
  additionalButtons,
7030
- renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ObjectSearchResultItem, { ...value }),
6969
+ renderResultComponent = (value) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ObjectSearchResultItem, { ...value }),
7031
6970
  multiSelectId,
7032
6971
  disableDnD = false,
7033
6972
  getContainerForDnDReparenting,
@@ -7052,9 +6991,10 @@ function ObjectSearchResultList({
7052
6991
  const item = selectedListItems.find((i) => i.id === rubric.draggableId);
7053
6992
  const renderListItem = renderResultComponent({
7054
6993
  ...item,
6994
+ hideRemoveButton,
7055
6995
  disableDnD: selectedListItems.length === 1 || disableDnD
7056
6996
  });
7057
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
6997
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
7058
6998
  "div",
7059
6999
  {
7060
7000
  css: [
@@ -7069,17 +7009,17 @@ function ObjectSearchResultList({
7069
7009
  }
7070
7010
  );
7071
7011
  };
7072
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
7073
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
7074
- !resultLabelOverride ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
7075
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
7012
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
7013
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { role: "group", css: ObjectSearchResultListContainer, children: [
7014
+ !resultLabelOverride ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
7015
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
7076
7016
  " ",
7077
- !selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_design_system39.Counter, { count: selectedListItems.length })
7017
+ !selectedListItems.length ? null : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_design_system37.Counter, { count: selectedListItems.length })
7078
7018
  ] }) : resultLabelOverride,
7079
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
7019
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { css: ObjectSearchResultListCounterContainer, children: [
7080
7020
  additionalButtons,
7081
- hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7082
- import_design_system39.Button,
7021
+ hideRemoveButton ? null : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
7022
+ import_design_system37.Button,
7083
7023
  {
7084
7024
  buttonType: "ghostDestructive",
7085
7025
  size: "xs",
@@ -7090,15 +7030,15 @@ function ObjectSearchResultList({
7090
7030
  )
7091
7031
  ] })
7092
7032
  ] }),
7093
- !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7033
+ !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
7094
7034
  import_react_beautiful_dnd4.Droppable,
7095
7035
  {
7096
7036
  droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
7097
7037
  renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
7098
7038
  getContainerForClone: getContainerForDnDReparenting,
7099
- children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
7039
+ children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
7100
7040
  selectedListItems.map((item, i) => {
7101
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7041
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
7102
7042
  import_react_beautiful_dnd4.Draggable,
7103
7043
  {
7104
7044
  draggableId: item.id,
@@ -7116,42 +7056,306 @@ function ObjectSearchResultList({
7116
7056
  ] });
7117
7057
  }
7118
7058
 
7119
- // src/components/ObjectSearch/QueryFilter.tsx
7120
- var import_design_system40 = require("@uniformdev/design-system");
7121
- var import_react73 = require("react");
7122
- var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
7123
- var QueryFilter = ({
7124
- requireContentType,
7125
- queryFilterTitle = "Configure Query",
7126
- contentTypeLabel = "Filter by content type",
7127
- typeSelectorAllTypesOptionText = "All content types",
7128
- contentTypeOptions,
7129
- searchInputName = "searchText",
7130
- searchInputPlaceholderText = "Enter keyword to narrow your results",
7131
- searchInputLabel = "Query",
7132
- countLabel = "Count",
7133
- countValue = 5,
7134
- sortLabel = "Sort By",
7135
- sortOptions,
7136
- sortOrderLabel = "Sort Order",
7137
- sortOrderOptions = [
7138
- {
7139
- value: "asc",
7140
- label: "Ascending"
7141
- },
7059
+ // src/components/ObjectSearch/ObjectSearchContainer.tsx
7060
+ var import_jsx_runtime64 = require("@emotion/react/jsx-runtime");
7061
+ var ObjectSearchContainer = ({
7062
+ label,
7063
+ enableDynamicInputToResultId,
7064
+ searchFilters,
7065
+ resultList,
7066
+ children = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchResultList, {})
7067
+ }) => {
7068
+ var _a, _b;
7069
+ const { onSelectItem, selectedListItems, list, dynamicEntryId, onSetQuery, query } = useObjectSearchContext();
7070
+ const { flatVariables } = useVariables(true);
7071
+ const inputValue = (_b = dynamicEntryId != null ? dynamicEntryId : (_a = selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
7072
+ const isDynamicEntryIdAvailable = import_react73.default.useMemo(
7073
+ () => Boolean(inputValue && hasReferencedVariables(inputValue)),
7074
+ [inputValue]
7075
+ );
7076
+ const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
7077
+ import_design_system38.ScrollableList,
7142
7078
  {
7143
- value: "desc",
7144
- label: "Descending"
7079
+ role: "list",
7080
+ css: import_react72.css`
7081
+ > div {
7082
+ transition: max-height var(--duration-slow) var(--timing-ease-out);
7083
+ max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
7084
+ }
7085
+ `,
7086
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DefaultResultList, {})
7145
7087
  }
7146
- ],
7147
- children
7148
- }) => {
7149
- var _a, _b, _c, _d, _e, _f, _g;
7150
- const { query, onSetQuery } = useObjectSearchContext();
7151
- const [queryState, setQueryState] = (0, import_react73.useState)({
7152
- contentType: (_a = query.contentType) != null ? _a : "",
7153
- keyword: (_b = query.keyword) != null ? _b : "",
7154
- count: (_c = query.count) != null ? _c : countValue,
7088
+ );
7089
+ const handleSelectedVariableChange = (selectedValue) => {
7090
+ var _a2;
7091
+ if (!selectedValue) {
7092
+ onSelectItem([]);
7093
+ return;
7094
+ }
7095
+ const { result, errors } = (0, import_canvas9.bindVariables)({
7096
+ value: selectedValue,
7097
+ variables: flatVariables,
7098
+ errorPrefix: "Dynamic input"
7099
+ });
7100
+ if (!result) {
7101
+ onSelectItem([]);
7102
+ return;
7103
+ }
7104
+ const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
7105
+ onSelectItem([
7106
+ {
7107
+ title: selectedValue,
7108
+ 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`,
7109
+ // spread any matched list item, overriding the above default props
7110
+ ...item,
7111
+ // we want to make sure the ID is our dynamic value
7112
+ id: selectedValue
7113
+ }
7114
+ ]);
7115
+ if (hasReferencedVariables(selectedValue)) {
7116
+ onSetQuery({ ...query, dynamicEntryId: selectedValue });
7117
+ }
7118
+ };
7119
+ const showSearchList = !label || !isDynamicEntryIdAvailable || !enableDynamicInputToResultId;
7120
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_design_system38.VerticalRhythm, { children: [
7121
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_design_system38.VerticalRhythm, { children: [
7122
+ label ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
7123
+ InputVariables,
7124
+ {
7125
+ id: "entryId",
7126
+ label,
7127
+ value: inputValue,
7128
+ onChange: (value) => {
7129
+ if (value === inputValue) {
7130
+ return;
7131
+ }
7132
+ handleSelectedVariableChange(value);
7133
+ },
7134
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: searchFilters }),
7135
+ disableVariables: !enableDynamicInputToResultId
7136
+ }
7137
+ ) : searchFilters,
7138
+ showSearchList ? listItems : null
7139
+ ] }) }),
7140
+ children
7141
+ ] }) });
7142
+ };
7143
+ var DefaultResultList = () => {
7144
+ var _a, _b;
7145
+ const { list, isListLoading } = useObjectSearchContext();
7146
+ if (isListLoading || !list.items) {
7147
+ return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
7148
+ }
7149
+ if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
7150
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_design_system38.Callout, { type: "info", children: "No results were found" });
7151
+ }
7152
+ return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ObjectSearchListItem, { ...item }, item.id));
7153
+ };
7154
+
7155
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
7156
+ var import_design_system39 = require("@uniformdev/design-system");
7157
+ var import_react76 = require("react");
7158
+ var import_react_use5 = require("react-use");
7159
+
7160
+ // src/utils/createLocationValidator.ts
7161
+ function createLocationValidator(setValue, validate) {
7162
+ return (dispatch) => setValue((previous) => {
7163
+ const { newValue, options } = dispatch(previous);
7164
+ return { newValue, options: validate(newValue, options) };
7165
+ });
7166
+ }
7167
+
7168
+ // src/utils/useContentDataResourceLocaleInfo.ts
7169
+ var import_canvas10 = require("@uniformdev/canvas");
7170
+ var import_react74 = require("react");
7171
+ function useContentDataResourceLocaleInfo({
7172
+ locale,
7173
+ setLocale,
7174
+ dynamicInputs
7175
+ }) {
7176
+ var _a;
7177
+ const setLocaleRef = (0, import_react74.useRef)(setLocale);
7178
+ setLocaleRef.current = setLocale;
7179
+ const { flatVariables } = useVariables();
7180
+ const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
7181
+ const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
7182
+ (0, import_react74.useEffect)(() => {
7183
+ if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
7184
+ setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
7185
+ }
7186
+ }, [locale, effectiveLocale]);
7187
+ return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
7188
+ }
7189
+
7190
+ // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
7191
+ var import_react75 = require("@emotion/react");
7192
+ var ObjectSearchFilterContainerLabel = import_react75.css`
7193
+ align-items: center;
7194
+ display: flex;
7195
+ font-size: var(--fs-sm);
7196
+ font-weight: var(--fw-bold);
7197
+ line-height: 1rem;
7198
+ margin-bottom: var(--spacing-sm);
7199
+ `;
7200
+ var ObjectSearchFilterContainer = import_react75.css`
7201
+ display: grid;
7202
+ gap: var(--spacing-base);
7203
+ `;
7204
+ var ObjectSearchFilterGrid = (gridColumns) => import_react75.css`
7205
+ display: grid;
7206
+ grid-template-columns: ${gridColumns};
7207
+ gap: var(--spacing-base);
7208
+ `;
7209
+
7210
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
7211
+ var import_jsx_runtime65 = require("@emotion/react/jsx-runtime");
7212
+ var ObjectSearchFilter = ({
7213
+ requireContentType,
7214
+ typeSelectorAllTypesOptionText = "All content types",
7215
+ searchInputName = "searchText",
7216
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
7217
+ selectLabel = "Content Type Select",
7218
+ localeFilterLabel = "Filter by locale",
7219
+ selectOptions
7220
+ }) => {
7221
+ var _a, _b, _c;
7222
+ const { query, onSetQuery, localeOptions, enableFilterByLocale } = useObjectSearchContext();
7223
+ const dynamicInputs = useDataResourceDynamicInputs();
7224
+ const { boundLocale = "", effectiveLocale } = useContentDataResourceLocaleInfo({
7225
+ locale: query.locale,
7226
+ dynamicInputs: dynamicInputs != null ? dynamicInputs : {},
7227
+ setLocale: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" })
7228
+ });
7229
+ const [searchState, setSearchState] = (0, import_react76.useState)({
7230
+ keyword: (_a = query.keyword) != null ? _a : "",
7231
+ contentType: (_b = query.contentType) != null ? _b : "",
7232
+ locale: (_c = query.locale) != null ? _c : ""
7233
+ });
7234
+ const handleFilterChange = (value) => {
7235
+ setSearchState((prev) => {
7236
+ return { ...prev, ...value };
7237
+ });
7238
+ };
7239
+ (0, import_react_use5.useDebounce)(
7240
+ () => {
7241
+ onSetQuery({ ...query, ...searchState });
7242
+ },
7243
+ 500,
7244
+ [searchState]
7245
+ );
7246
+ const memoizedSelectOptions = (0, import_react76.useMemo)(() => {
7247
+ if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
7248
+ return [];
7249
+ }
7250
+ return [
7251
+ ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
7252
+ ...selectOptions != null ? selectOptions : []
7253
+ ];
7254
+ }, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
7255
+ const shouldRenderSelect = memoizedSelectOptions.length > 0;
7256
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_design_system39.VerticalRhythm, { gap: "base", children: [
7257
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
7258
+ "fieldset",
7259
+ {
7260
+ css: [
7261
+ ObjectSearchFilterContainer,
7262
+ ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
7263
+ ],
7264
+ children: [
7265
+ memoizedSelectOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7266
+ import_design_system39.InputSelect,
7267
+ {
7268
+ label: selectLabel,
7269
+ showLabel: false,
7270
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
7271
+ options: memoizedSelectOptions,
7272
+ value: query.contentType,
7273
+ "data-testid": "select-entry"
7274
+ }
7275
+ ) : null,
7276
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7277
+ import_design_system39.DebouncedInputKeywordSearch,
7278
+ {
7279
+ inputFieldName: searchInputName,
7280
+ placeholder: searchInputPlaceholderText,
7281
+ onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
7282
+ disabledFieldSubmission: true,
7283
+ defaultValue: searchState.keyword,
7284
+ delay: 300
7285
+ }
7286
+ )
7287
+ ]
7288
+ }
7289
+ ),
7290
+ enableFilterByLocale && (localeOptions == null ? void 0 : localeOptions.length) && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7291
+ InputVariables,
7292
+ {
7293
+ label: localeFilterLabel,
7294
+ id: "locale",
7295
+ value: effectiveLocale,
7296
+ onChange: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" }),
7297
+ disableInlineMenu: true,
7298
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7299
+ import_design_system39.InputSelect,
7300
+ {
7301
+ id: "locale",
7302
+ options: localeOptions,
7303
+ name: "locale",
7304
+ label: "",
7305
+ value: boundLocale,
7306
+ onChange: (e) => handleFilterChange({ locale: e.target.value })
7307
+ }
7308
+ )
7309
+ }
7310
+ )
7311
+ ] });
7312
+ };
7313
+
7314
+ // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
7315
+ var import_jsx_runtime66 = require("@emotion/react/jsx-runtime");
7316
+ var ObjectSearchFilterContainer2 = ({ label, children }) => {
7317
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { children: [
7318
+ label ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
7319
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { css: ObjectSearchFilterContainer, children })
7320
+ ] });
7321
+ };
7322
+
7323
+ // src/components/ObjectSearch/QueryFilter.tsx
7324
+ var import_design_system40 = require("@uniformdev/design-system");
7325
+ var import_react77 = require("react");
7326
+ var import_jsx_runtime67 = require("@emotion/react/jsx-runtime");
7327
+ var QueryFilter = ({
7328
+ requireContentType,
7329
+ queryFilterTitle = "Configure Query",
7330
+ contentTypeLabel = "Filter by content type",
7331
+ typeSelectorAllTypesOptionText = "All content types",
7332
+ contentTypeOptions,
7333
+ searchInputName = "searchText",
7334
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
7335
+ searchInputLabel = "Query",
7336
+ countLabel = "Count",
7337
+ countValue = 5,
7338
+ sortLabel = "Sort By",
7339
+ sortOptions,
7340
+ sortOrderLabel = "Sort Order",
7341
+ sortOrderOptions = [
7342
+ {
7343
+ value: "asc",
7344
+ label: "Ascending"
7345
+ },
7346
+ {
7347
+ value: "desc",
7348
+ label: "Descending"
7349
+ }
7350
+ ],
7351
+ children
7352
+ }) => {
7353
+ var _a, _b, _c, _d, _e, _f, _g;
7354
+ const { query, onSetQuery } = useObjectSearchContext();
7355
+ const [queryState, setQueryState] = (0, import_react77.useState)({
7356
+ contentType: (_a = query.contentType) != null ? _a : "",
7357
+ keyword: (_b = query.keyword) != null ? _b : "",
7358
+ count: (_c = query.count) != null ? _c : countValue,
7155
7359
  sortBy: (_d = query.sortBy) != null ? _d : "",
7156
7360
  sortOrder: (_e = query.sortOrder) != null ? _e : ""
7157
7361
  });
@@ -7159,7 +7363,7 @@ var QueryFilter = ({
7159
7363
  setQueryState((prev) => ({ ...prev, ...value }));
7160
7364
  onSetQuery({ ...query, ...value });
7161
7365
  };
7162
- (0, import_react73.useEffect)(() => {
7366
+ (0, import_react77.useEffect)(() => {
7163
7367
  onSetQuery(queryState);
7164
7368
  }, []);
7165
7369
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("fieldset", { children: [
@@ -7284,9 +7488,107 @@ var QueryFilter = ({
7284
7488
  ] });
7285
7489
  };
7286
7490
 
7287
- // src/components/ParamTypeDynamicDataProvider.tsx
7288
- var import_react74 = require("react");
7491
+ // src/components/ObjectSearch/ObjectSearchListOfSearchResults.tsx
7492
+ var import_design_system41 = require("@uniformdev/design-system");
7289
7493
  var import_jsx_runtime68 = require("@emotion/react/jsx-runtime");
7494
+ function ObjectSearchListOfSearchResults() {
7495
+ var _a, _b;
7496
+ const { list, isListLoading } = useObjectSearchContext();
7497
+ if (isListLoading) {
7498
+ return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ObjectSearchListItemLoadingSkeleton, {}, i));
7499
+ }
7500
+ if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
7501
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system41.Callout, { type: "info", children: "No results were found" });
7502
+ }
7503
+ return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ObjectSearchListItem, { ...item }, item.id));
7504
+ }
7505
+
7506
+ // src/components/ObjectSearch/hooks/ControlledObjectSearchProvider.tsx
7507
+ var import_react78 = require("react");
7508
+ var import_jsx_runtime69 = require("@emotion/react/jsx-runtime");
7509
+ var ControlledObjectSearchProvider = ({
7510
+ selectedItems,
7511
+ searchResultItems,
7512
+ selectedItemsLoading,
7513
+ searchResultListLoading,
7514
+ onQueryChange = () => {
7515
+ },
7516
+ onSelectItemsChange,
7517
+ isMulti = false,
7518
+ children,
7519
+ query = {},
7520
+ enableFilterByLocale,
7521
+ localeOptions,
7522
+ dynamicEntryId,
7523
+ isManualSelection
7524
+ }) => {
7525
+ var _a, _b;
7526
+ const { flatVariables } = useVariables(true);
7527
+ const querySearchDeferred = (0, import_react78.useDeferredValue)(query);
7528
+ const innerSelectedItems = (0, import_react78.useRef)(selectedItems);
7529
+ (0, import_react78.useEffect)(() => {
7530
+ if (selectedItems !== void 0) {
7531
+ innerSelectedItems.current = selectedItems;
7532
+ }
7533
+ }, [selectedItems]);
7534
+ const onSetQuery = (0, import_react78.useCallback)(
7535
+ (value) => {
7536
+ const newQuery = { ...query, ...value };
7537
+ onQueryChange(newQuery);
7538
+ },
7539
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7540
+ [onQueryChange]
7541
+ );
7542
+ const onSelectItem = (0, import_react78.useCallback)(
7543
+ (selectedResult) => {
7544
+ var _a2;
7545
+ if (Array.isArray(selectedResult)) {
7546
+ innerSelectedItems.current = selectedResult;
7547
+ onSelectItemsChange(selectedResult);
7548
+ } else {
7549
+ const itemIsAlreadySelected = selectedItems == null ? void 0 : selectedItems.some((item) => item.id === selectedResult.id);
7550
+ const updatedSelectedItems = itemIsAlreadySelected ? (_a2 = selectedItems == null ? void 0 : selectedItems.filter((item) => item.id !== selectedResult.id)) != null ? _a2 : [] : [...selectedItems != null ? selectedItems : [], selectedResult];
7551
+ innerSelectedItems.current = updatedSelectedItems;
7552
+ onSelectItemsChange(updatedSelectedItems);
7553
+ }
7554
+ },
7555
+ [onSelectItemsChange, selectedItems]
7556
+ );
7557
+ const onRemoveAllSelectedItems = (0, import_react78.useCallback)(() => {
7558
+ innerSelectedItems.current = [];
7559
+ onSelectItemsChange([]);
7560
+ }, [onSelectItemsChange]);
7561
+ const list = (0, import_react78.useMemo)(() => ({ items: searchResultItems }), [searchResultItems]);
7562
+ const boundQuery = (0, import_react78.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
7563
+ const isLoadingInitially = Boolean(
7564
+ isManualSelection ? !((_a = innerSelectedItems.current) == null ? void 0 : _a.length) && selectedItemsLoading : selectedItemsLoading
7565
+ );
7566
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7567
+ ObjectSearchContext.Provider,
7568
+ {
7569
+ value: {
7570
+ boundQuery,
7571
+ onSetQuery,
7572
+ query: querySearchDeferred,
7573
+ onSelectItem,
7574
+ selectedListItems: (_b = isManualSelection ? innerSelectedItems.current : selectedItems) != null ? _b : [],
7575
+ onRemoveAllSelectedItems,
7576
+ list,
7577
+ isSelectedItemsListLoading: isLoadingInitially,
7578
+ isListLoading: searchResultListLoading,
7579
+ isMulti,
7580
+ localeOptions,
7581
+ enableFilterByLocale,
7582
+ dynamicEntryId
7583
+ },
7584
+ children
7585
+ }
7586
+ );
7587
+ };
7588
+
7589
+ // src/components/ParamTypeDynamicDataProvider.tsx
7590
+ var import_react79 = require("react");
7591
+ var import_jsx_runtime70 = require("@emotion/react/jsx-runtime");
7290
7592
  function ParamTypeDynamicDataProvider(props) {
7291
7593
  const { children } = props;
7292
7594
  const {
@@ -7294,11 +7596,11 @@ function ParamTypeDynamicDataProvider(props) {
7294
7596
  } = useMeshLocation("paramType");
7295
7597
  const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
7296
7598
  const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
7297
- const variables = (0, import_react74.useMemo)(
7599
+ const variables = (0, import_react79.useMemo)(
7298
7600
  () => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
7299
7601
  [dynamicInputsAsVariables, connectedDataAsVariables]
7300
7602
  );
7301
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(VariablesProvider, { value: variables, onChange: () => {
7603
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(VariablesProvider, { value: variables, onChange: () => {
7302
7604
  }, editVariableComponent: JsonMeshVariableEditor, children });
7303
7605
  }
7304
7606
  var JsonMeshVariableEditor = ({
@@ -7307,9 +7609,9 @@ var JsonMeshVariableEditor = ({
7307
7609
  variable,
7308
7610
  context
7309
7611
  }) => {
7310
- const sillyRef = (0, import_react74.useRef)(false);
7612
+ const sillyRef = (0, import_react79.useRef)(false);
7311
7613
  const { editConnectedData } = useMeshLocation("paramType");
7312
- (0, import_react74.useEffect)(() => {
7614
+ (0, import_react79.useEffect)(() => {
7313
7615
  if (sillyRef.current) {
7314
7616
  return;
7315
7617
  }
@@ -7337,38 +7639,2078 @@ var JsonMeshVariableEditor = ({
7337
7639
  return null;
7338
7640
  };
7339
7641
 
7340
- // src/utils/createLocationValidator.ts
7341
- function createLocationValidator(setValue, validate) {
7342
- return (dispatch) => setValue((previous) => {
7343
- const { newValue, options } = dispatch(previous);
7344
- return { newValue, options: validate(newValue, options) };
7345
- });
7346
- }
7347
-
7348
- // src/utils/useContentDataResourceLocaleInfo.ts
7349
- var import_canvas10 = require("@uniformdev/canvas");
7350
- var import_react75 = require("react");
7351
- function useContentDataResourceLocaleInfo({
7352
- locale,
7353
- setLocale,
7354
- dynamicInputs
7355
- }) {
7356
- var _a;
7357
- const setLocaleRef = (0, import_react75.useRef)(setLocale);
7358
- setLocaleRef.current = setLocale;
7359
- const { flatVariables } = useVariables();
7360
- const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
7361
- const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
7362
- (0, import_react75.useEffect)(() => {
7363
- if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
7364
- setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
7365
- }
7366
- }, [locale, effectiveLocale]);
7367
- return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
7368
- }
7369
-
7370
- // src/index.ts
7371
- var import_design_system41 = require("@uniformdev/design-system");
7642
+ // src/components/SearchAndFilter/constants.ts
7643
+ var NUMBER_OPERATORS = [
7644
+ {
7645
+ label: "equals...",
7646
+ symbol: "=",
7647
+ value: "eq",
7648
+ editorType: "number"
7649
+ },
7650
+ {
7651
+ label: "does not equal...",
7652
+ symbol: "\u2260",
7653
+ value: "neq",
7654
+ editorType: "number"
7655
+ },
7656
+ {
7657
+ label: "greater than...",
7658
+ symbol: ">",
7659
+ value: "gt",
7660
+ editorType: "number"
7661
+ },
7662
+ {
7663
+ label: "greater than or equal to...",
7664
+ symbol: "\u2265",
7665
+ value: "gte",
7666
+ editorType: "number"
7667
+ },
7668
+ {
7669
+ label: "less than...",
7670
+ symbol: "<",
7671
+ value: "lt",
7672
+ editorType: "number"
7673
+ },
7674
+ {
7675
+ label: "less than or equal to...",
7676
+ symbol: "\u2264",
7677
+ value: "lte",
7678
+ editorType: "number"
7679
+ },
7680
+ {
7681
+ label: "is empty",
7682
+ value: "ndef",
7683
+ editorType: "empty"
7684
+ },
7685
+ {
7686
+ label: "is between...",
7687
+ value: "between",
7688
+ editorType: "numberRange"
7689
+ },
7690
+ {
7691
+ label: "is not empty",
7692
+ value: "def",
7693
+ editorType: "empty"
7694
+ }
7695
+ ];
7696
+ var DATE_OPERATORS = [
7697
+ {
7698
+ label: "is",
7699
+ value: "eq",
7700
+ editorType: "date"
7701
+ },
7702
+ {
7703
+ label: "is between...",
7704
+ value: "between",
7705
+ editorType: "dateRange"
7706
+ },
7707
+ {
7708
+ label: "is before...",
7709
+ value: "lt",
7710
+ editorType: "date"
7711
+ },
7712
+ {
7713
+ label: "is after...",
7714
+ value: "gt",
7715
+ editorType: "date"
7716
+ },
7717
+ {
7718
+ label: "is on or before...",
7719
+ value: "lte",
7720
+ editorType: "date"
7721
+ },
7722
+ {
7723
+ label: "is on or after...",
7724
+ value: "gte",
7725
+ editorType: "date"
7726
+ },
7727
+ {
7728
+ label: "is empty",
7729
+ value: "ndef",
7730
+ editorType: "empty"
7731
+ },
7732
+ {
7733
+ label: "is not",
7734
+ value: "neq",
7735
+ editorType: "date"
7736
+ },
7737
+ {
7738
+ label: "is not empty",
7739
+ value: "def",
7740
+ editorType: "empty"
7741
+ }
7742
+ ];
7743
+ var TEXTBOX_OPERATORS = [
7744
+ {
7745
+ label: "contains...",
7746
+ value: "match",
7747
+ editorType: "text"
7748
+ },
7749
+ {
7750
+ label: "is",
7751
+ value: "eq",
7752
+ editorType: "text"
7753
+ },
7754
+ {
7755
+ label: "is empty",
7756
+ value: "ndef",
7757
+ editorType: "empty"
7758
+ },
7759
+ {
7760
+ label: "starts with...",
7761
+ value: "starts",
7762
+ editorType: "text"
7763
+ },
7764
+ {
7765
+ label: "is not",
7766
+ value: "neq",
7767
+ editorType: "text"
7768
+ },
7769
+ {
7770
+ label: "is not empty",
7771
+ value: "def",
7772
+ editorType: "empty"
7773
+ }
7774
+ ];
7775
+ var USER_OPERATORS = [
7776
+ {
7777
+ label: "contains...",
7778
+ value: "match",
7779
+ editorType: "text"
7780
+ },
7781
+ {
7782
+ label: "is",
7783
+ value: "eq",
7784
+ editorType: "text"
7785
+ },
7786
+ {
7787
+ label: "starts with...",
7788
+ value: "starts",
7789
+ editorType: "text"
7790
+ },
7791
+ {
7792
+ label: "is not",
7793
+ value: "neq",
7794
+ editorType: "text"
7795
+ }
7796
+ ];
7797
+ var SYSTEM_DATE_OPERATORS = [
7798
+ {
7799
+ label: "is",
7800
+ value: "sys-date-eq",
7801
+ editorType: "date"
7802
+ },
7803
+ {
7804
+ label: "is between...",
7805
+ value: "sys-date-between",
7806
+ editorType: "dateRange"
7807
+ },
7808
+ {
7809
+ label: "is before...",
7810
+ value: "sys-date-lt",
7811
+ editorType: "date"
7812
+ },
7813
+ {
7814
+ label: "is after...",
7815
+ value: "sys-date-gt",
7816
+ editorType: "date"
7817
+ },
7818
+ {
7819
+ label: "is on or before...",
7820
+ value: "sys-date-lte",
7821
+ editorType: "date"
7822
+ },
7823
+ {
7824
+ label: "is on or after...",
7825
+ value: "sys-date-gte",
7826
+ editorType: "date"
7827
+ },
7828
+ {
7829
+ label: "is not",
7830
+ value: "sys-date-neq",
7831
+ editorType: "date"
7832
+ }
7833
+ ];
7834
+ var RICHTEXT_OPERATORS = [
7835
+ {
7836
+ label: "contains...",
7837
+ value: "match",
7838
+ editorType: "text"
7839
+ },
7840
+ {
7841
+ label: "is empty",
7842
+ value: "ndef",
7843
+ editorType: "empty"
7844
+ },
7845
+ {
7846
+ label: "starts with...",
7847
+ value: "starts",
7848
+ editorType: "text"
7849
+ },
7850
+ {
7851
+ label: "is not empty",
7852
+ value: "def",
7853
+ editorType: "empty"
7854
+ }
7855
+ ];
7856
+ var CHECKBOX_OPERATORS = [
7857
+ {
7858
+ label: "is checked",
7859
+ value: "def",
7860
+ editorType: "empty"
7861
+ },
7862
+ {
7863
+ label: "is not checked",
7864
+ value: "ndef",
7865
+ editorType: "empty"
7866
+ }
7867
+ ];
7868
+ var SYSTEM_FIELD_OPERATORS = [
7869
+ {
7870
+ label: "is",
7871
+ value: "eq",
7872
+ editorType: "singleChoice"
7873
+ },
7874
+ {
7875
+ label: "is any of...",
7876
+ value: "in",
7877
+ editorType: "multiChoice"
7878
+ },
7879
+ {
7880
+ label: "is not",
7881
+ value: "neq",
7882
+ editorType: "singleChoice"
7883
+ },
7884
+ {
7885
+ label: "is none of...",
7886
+ value: "nin",
7887
+ editorType: "multiChoice"
7888
+ }
7889
+ ];
7890
+ var PUBLISH_STATUS_FIELD_OPERATORS = [
7891
+ {
7892
+ label: "is",
7893
+ value: "eq",
7894
+ editorType: "statusSingleChoice"
7895
+ },
7896
+ {
7897
+ label: "is any of...",
7898
+ value: "in",
7899
+ editorType: "statusMultiChoice"
7900
+ },
7901
+ {
7902
+ label: "is not",
7903
+ value: "neq",
7904
+ editorType: "statusSingleChoice"
7905
+ },
7906
+ {
7907
+ label: "is none of...",
7908
+ value: "nin",
7909
+ editorType: "statusMultiChoice"
7910
+ }
7911
+ ];
7912
+ var SELECT_OPERATORS = [
7913
+ {
7914
+ label: "is",
7915
+ value: "eq",
7916
+ editorType: "singleChoice"
7917
+ },
7918
+ {
7919
+ label: "is any of...",
7920
+ value: "in",
7921
+ editorType: "multiChoice"
7922
+ },
7923
+ {
7924
+ label: "is empty",
7925
+ value: "ndef",
7926
+ editorType: "empty"
7927
+ },
7928
+ {
7929
+ label: "contains...",
7930
+ value: "match",
7931
+ editorType: "text"
7932
+ },
7933
+ {
7934
+ label: "starts with...",
7935
+ value: "starts",
7936
+ editorType: "text"
7937
+ },
7938
+ {
7939
+ label: "is not",
7940
+ value: "neq",
7941
+ editorType: "singleChoice"
7942
+ },
7943
+ {
7944
+ label: "is none of...",
7945
+ value: "nin",
7946
+ editorType: "multiChoice"
7947
+ },
7948
+ {
7949
+ label: "is not empty",
7950
+ value: "def",
7951
+ editorType: "empty"
7952
+ }
7953
+ ];
7954
+
7955
+ // src/components/SearchAndFilter/FilterButton.tsx
7956
+ var import_design_system43 = require("@uniformdev/design-system");
7957
+
7958
+ // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
7959
+ var import_react80 = require("@emotion/react");
7960
+ var import_design_system42 = require("@uniformdev/design-system");
7961
+ var SearchAndFilterControlsWrapper = (gridColumns) => import_react80.css`
7962
+ align-items: stretch;
7963
+ display: grid;
7964
+ grid-template-columns: ${gridColumns};
7965
+ gap: var(--spacing-sm);
7966
+ `;
7967
+ var SearchAndFilterOutterControlWrapper = (gridColumns) => import_react80.css`
7968
+ align-items: stretch;
7969
+ display: grid;
7970
+ grid-template-columns: ${gridColumns};
7971
+ gap: var(--spacing-sm);
7972
+ `;
7973
+ var ConditionalFilterRow = import_react80.css`
7974
+ display: grid;
7975
+ grid-template-columns: 35px 1fr;
7976
+ gap: var(--spacing-sm);
7977
+ margin-left: var(--spacing-base);
7978
+
7979
+ ${(0, import_design_system42.cq)("380px")} {
7980
+ align-items: center;
7981
+
7982
+ &:after {
7983
+ content: '';
7984
+ display: block;
7985
+ height: 1px;
7986
+ background: var(--gray-300);
7987
+ width: calc(100% - var(--spacing-base));
7988
+ margin-left: var(--spacing-base);
7989
+ }
7990
+ &:last-of-type:after {
7991
+ display: none;
7992
+ }
7993
+ }
7994
+
7995
+ &:nth-of-type(2) {
7996
+ margin-left: 0;
7997
+ grid-template-columns: 50px 1fr;
7998
+ }
7999
+
8000
+ ${(0, import_design_system42.cq)("580px")} {
8001
+ &:after {
8002
+ display: none;
8003
+ }
8004
+ }
8005
+
8006
+ @media (prefers-reduced-motion: no-preference) {
8007
+ animation: ${import_design_system42.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
8008
+ }
8009
+ `;
8010
+ var ConditionalInputRow = import_react80.css`
8011
+ display: flex;
8012
+ gap: var(--spacing-sm);
8013
+ flex-wrap: wrap;
8014
+
8015
+ ${(0, import_design_system42.cq)("380px")} {
8016
+ & > div:nth-child(-n + 2) {
8017
+ width: calc(50% - var(--spacing-sm));
8018
+ }
8019
+
8020
+ & > div:nth-child(n + 3) {
8021
+ width: calc(100% - 48px);
8022
+ }
8023
+ }
8024
+ ${(0, import_design_system42.cq)("764px")} {
8025
+ display: grid;
8026
+ grid-template-columns: 200px 160px 1fr 32px;
8027
+
8028
+ & > div:nth-child(n) {
8029
+ width: auto;
8030
+ }
8031
+ }
8032
+ `;
8033
+ var SearchInput = import_react80.css`
8034
+ max-height: 40px;
8035
+ min-height: unset;
8036
+ `;
8037
+ var BindableKeywordSearchInputStyles = import_react80.css`
8038
+ position: relative;
8039
+ width: 100%;
8040
+
8041
+ & [data-lexical-editor='true'] {
8042
+ padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
8043
+ font-size: var(--fs-sm);
8044
+ border-radius: var(--rounded-full);
8045
+ max-height: 40px;
8046
+ min-height: unset;
8047
+ width: 100%;
8048
+ position: relative;
8049
+ white-space: nowrap;
8050
+ }
8051
+ `;
8052
+ var ClearSearchButtonContainer = import_react80.css`
8053
+ align-items: center;
8054
+ display: flex;
8055
+ position: absolute;
8056
+ inset: 0 var(--spacing-lg) 0 auto;
8057
+ `;
8058
+ var ClearSearchButtonStyles = import_react80.css`
8059
+ background: none;
8060
+ border: none;
8061
+ padding: 0;
8062
+ pointer-events: all;
8063
+ `;
8064
+ var FilterButton = import_react80.css`
8065
+ align-items: center;
8066
+ background: var(--white);
8067
+ border: 1px solid var(--gray-300);
8068
+ border-radius: var(--rounded-full);
8069
+ color: var(--typography-base);
8070
+ display: flex;
8071
+ font-size: var(--fs-sm);
8072
+ gap: var(--spacing-sm);
8073
+ padding: var(--spacing-sm) var(--spacing-base);
8074
+ max-height: 40px;
8075
+ transition: color var(--duration-fast) var(--timing-ease-out),
8076
+ background-color var(--duration-fast) var(--timing-ease-out),
8077
+ border-color var(--duration-fast) var(--timing-ease-out),
8078
+ box-shadow var(--duration-fast) var(--timing-ease-out);
8079
+
8080
+ svg {
8081
+ color: var(--gray-300);
8082
+ transition: color var(--duration-fast) var(--timing-ease-out);
8083
+ }
8084
+
8085
+ &:hover,
8086
+ :where([aria-expanded='true']) {
8087
+ outline: none;
8088
+ background: var(--gray-200);
8089
+ border-color: var(--gray-300);
8090
+
8091
+ svg {
8092
+ color: var(--typography-base);
8093
+ }
8094
+ }
8095
+
8096
+ &:disabled {
8097
+ opacity: var(--opacity-50);
8098
+ }
8099
+ `;
8100
+ var FilterButtonText = import_react80.css`
8101
+ overflow: hidden;
8102
+ text-overflow: ellipsis;
8103
+ white-space: nowrap;
8104
+ max-width: 14ch;
8105
+ `;
8106
+ var FilterButtonSelected = import_react80.css`
8107
+ background: var(--gray-100);
8108
+ border-color: var(--gray-300);
8109
+
8110
+ svg {
8111
+ color: var(--accent-dark);
8112
+ }
8113
+ `;
8114
+ var FilterButtonWithOptions = import_react80.css`
8115
+ :where([aria-expanded='true']) {
8116
+ background: var(--purple-rain-100);
8117
+ border-color: var(--accent-light);
8118
+ color: var(--typography-base);
8119
+ box-shadow: var(--elevation-100);
8120
+
8121
+ svg {
8122
+ color: var(--accent-dark);
8123
+ }
8124
+ }
8125
+ `;
8126
+ var SearchIcon = import_react80.css`
8127
+ color: var(--icon-color);
8128
+ position: absolute;
8129
+ inset: 0 var(--spacing-base) 0 auto;
8130
+ margin: auto;
8131
+ transition: color var(--duration-fast) var(--timing-ease-out);
8132
+ `;
8133
+ var AddConditionalBtn = import_react80.css`
8134
+ align-items: center;
8135
+ background: transparent;
8136
+ border: none;
8137
+ color: var(--primary-action-default);
8138
+ display: flex;
8139
+ gap: var(--spacing-sm);
8140
+ transition: color var(--duration-fast) var(--timing-ease-out);
8141
+ padding: 0;
8142
+
8143
+ &:hover,
8144
+ &:focus {
8145
+ color: var(--primary-action-hover);
8146
+ }
8147
+
8148
+ &:disabled {
8149
+ color: var(--gray-400);
8150
+ }
8151
+ `;
8152
+ var Title = import_react80.css`
8153
+ color: var(--typography-light);
8154
+
8155
+ &:focus {
8156
+ outline: none;
8157
+ }
8158
+ `;
8159
+ var ResetConditionsBtn = import_react80.css`
8160
+ background: transparent;
8161
+ border: none;
8162
+ color: var(--action-destructive-default);
8163
+ transition: color var(--duration-fast) var(--timing-ease-out);
8164
+ padding: 0;
8165
+
8166
+ &:hover,
8167
+ &:focus {
8168
+ color: var(--action-destructive-hover);
8169
+ }
8170
+ `;
8171
+ var IconBtn = import_react80.css`
8172
+ background: transparent;
8173
+ border: none;
8174
+ padding: var(--spacing-sm);
8175
+ `;
8176
+ var SearchAndFilterOptionsContainer = import_react80.css`
8177
+ background: var(--gray-50);
8178
+ border: 1px solid var(--gray-300);
8179
+ border-radius: var(--rounded-base);
8180
+ container-type: inline-size;
8181
+ display: flex;
8182
+ flex-direction: column;
8183
+ gap: var(--spacing-sm);
8184
+ padding: var(--spacing-md) 0 var(--spacing-base);
8185
+ will-change: height;
8186
+ position: relative;
8187
+ z-index: 1;
8188
+ `;
8189
+ var SearchAndFilterOptionsInnerContainer = import_react80.css`
8190
+ display: flex;
8191
+ flex-direction: column;
8192
+ gap: var(--spacing-sm);
8193
+ padding-inline: var(--spacing-md);
8194
+ `;
8195
+ var SearchAndFilterButtonGroup = import_react80.css`
8196
+ margin-top: var(--spacing-xs);
8197
+ margin-left: calc(56px + var(--spacing-md));
8198
+ `;
8199
+
8200
+ // src/components/SearchAndFilter/FilterButton.tsx
8201
+ var import_jsx_runtime71 = require("@emotion/react/jsx-runtime");
8202
+ var FilterButton2 = ({
8203
+ text = "Filters",
8204
+ icon = "filter-add",
8205
+ filterCount,
8206
+ hasSelectedValue,
8207
+ dataTestId,
8208
+ ...props
8209
+ }) => {
8210
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
8211
+ "button",
8212
+ {
8213
+ type: "button",
8214
+ css: [
8215
+ FilterButton,
8216
+ hasSelectedValue ? FilterButtonSelected : void 0,
8217
+ filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
8218
+ ],
8219
+ ...props,
8220
+ "data-testid": dataTestId,
8221
+ children: [
8222
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system43.Icon, { icon, iconColor: "currentColor", size: "1rem" }),
8223
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { css: FilterButtonText, children: text }),
8224
+ filterCount ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system43.Counter, { count: filterCount, bgColor: "var(--white)" }) : null
8225
+ ]
8226
+ }
8227
+ );
8228
+ };
8229
+
8230
+ // src/components/SearchAndFilter/FilterControls.tsx
8231
+ var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
8232
+ var import_design_system46 = require("@uniformdev/design-system");
8233
+ var import_lexical11 = require("lexical");
8234
+ var import_react83 = require("react");
8235
+ var import_react_use7 = require("react-use");
8236
+ var import_uuid3 = require("uuid");
8237
+
8238
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8239
+ var import_design_system45 = require("@uniformdev/design-system");
8240
+ var import_react82 = require("react");
8241
+
8242
+ // src/components/SearchAndFilter/FilterEditor.tsx
8243
+ var import_design_system44 = require("@uniformdev/design-system");
8244
+ var import_react81 = require("react");
8245
+ var import_react_use6 = require("react-use");
8246
+ var import_jsx_runtime72 = require("@emotion/react/jsx-runtime");
8247
+ var readOnlyAttributes = {
8248
+ isSearchable: false,
8249
+ menuIsOpen: false,
8250
+ isClearable: false
8251
+ };
8252
+ var FilterMultiChoiceEditor = ({
8253
+ value,
8254
+ options,
8255
+ disabled,
8256
+ readOnly,
8257
+ valueTestId,
8258
+ ...props
8259
+ }) => {
8260
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8261
+ const isClearable = !readOnly || !disabled;
8262
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8263
+ import_design_system44.InputComboBox,
8264
+ {
8265
+ ...props,
8266
+ placeholder: "Type to search...",
8267
+ options,
8268
+ isMulti: true,
8269
+ isClearable,
8270
+ isDisabled: disabled,
8271
+ onChange: (e) => {
8272
+ var _a;
8273
+ return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
8274
+ },
8275
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
8276
+ "aria-readonly": readOnly,
8277
+ styles: {
8278
+ menu(base) {
8279
+ return {
8280
+ ...base,
8281
+ minWidth: "max-content"
8282
+ };
8283
+ }
8284
+ },
8285
+ ...readOnlyProps
8286
+ }
8287
+ ) });
8288
+ };
8289
+ var FilterSingleChoiceEditor = ({
8290
+ options,
8291
+ value,
8292
+ disabled,
8293
+ readOnly,
8294
+ onChange,
8295
+ valueTestId
8296
+ }) => {
8297
+ var _a;
8298
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8299
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8300
+ import_design_system44.InputComboBox,
8301
+ {
8302
+ placeholder: "Type to search...",
8303
+ options,
8304
+ isClearable: true,
8305
+ onChange: (e) => {
8306
+ var _a2;
8307
+ return onChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8308
+ },
8309
+ isDisabled: disabled,
8310
+ value: (_a = options == null ? void 0 : options.find((option) => option.value === value)) != null ? _a : null,
8311
+ "aria-readonly": readOnly,
8312
+ styles: {
8313
+ menu(base) {
8314
+ return {
8315
+ ...base,
8316
+ minWidth: "max-content"
8317
+ };
8318
+ }
8319
+ },
8320
+ ...readOnlyProps
8321
+ }
8322
+ ) });
8323
+ };
8324
+ var CustomOptions = ({ label, value }) => {
8325
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system44.StatusBullet, { status: label, message: value });
8326
+ };
8327
+ var StatusMultiEditor = ({
8328
+ options,
8329
+ value,
8330
+ disabled,
8331
+ readOnly,
8332
+ onChange,
8333
+ valueTestId
8334
+ }) => {
8335
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8336
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8337
+ import_design_system44.InputComboBox,
8338
+ {
8339
+ options,
8340
+ isMulti: true,
8341
+ onChange: (e) => {
8342
+ var _a;
8343
+ return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
8344
+ },
8345
+ formatOptionLabel: CustomOptions,
8346
+ "aria-readonly": readOnly,
8347
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
8348
+ isDisabled: disabled,
8349
+ styles: {
8350
+ menu(base) {
8351
+ return {
8352
+ ...base,
8353
+ minWidth: "max-content"
8354
+ };
8355
+ }
8356
+ },
8357
+ ...readOnlyProps
8358
+ }
8359
+ ) });
8360
+ };
8361
+ var StatusSingleEditor = ({
8362
+ options,
8363
+ value,
8364
+ disabled,
8365
+ readOnly,
8366
+ onChange,
8367
+ valueTestId
8368
+ }) => {
8369
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8370
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8371
+ import_design_system44.InputComboBox,
8372
+ {
8373
+ options,
8374
+ onChange: (e) => {
8375
+ var _a;
8376
+ return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
8377
+ },
8378
+ formatOptionLabel: CustomOptions,
8379
+ "aria-readonly": readOnly,
8380
+ value: options == null ? void 0 : options.find((option) => option.value === value),
8381
+ isDisabled: disabled,
8382
+ styles: {
8383
+ menu(base) {
8384
+ return {
8385
+ ...base,
8386
+ minWidth: "max-content"
8387
+ };
8388
+ }
8389
+ },
8390
+ ...readOnlyProps
8391
+ }
8392
+ ) });
8393
+ };
8394
+ var TextEditor = ({
8395
+ onChange,
8396
+ ariaLabel,
8397
+ value,
8398
+ readOnly,
8399
+ valueTestId
8400
+ }) => {
8401
+ const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
8402
+ (0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8403
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8404
+ import_design_system44.Input,
8405
+ {
8406
+ showLabel: false,
8407
+ label: ariaLabel,
8408
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8409
+ placeholder: "Enter phrase to search\u2026",
8410
+ value: innerValue,
8411
+ readOnly,
8412
+ "data-testid": valueTestId
8413
+ }
8414
+ );
8415
+ };
8416
+ var NumberRangeEditor = ({
8417
+ onChange,
8418
+ disabled,
8419
+ ariaLabel,
8420
+ value,
8421
+ readOnly,
8422
+ valueTestId
8423
+ }) => {
8424
+ const [minValue, setMinValue] = (0, import_react81.useState)("");
8425
+ const [maxValue, setMaxValue] = (0, import_react81.useState)("");
8426
+ const [error, setError] = (0, import_react81.useState)("");
8427
+ (0, import_react_use6.useDebounce)(
8428
+ () => {
8429
+ if (minValue && maxValue && !error) {
8430
+ onChange([minValue, maxValue]);
8431
+ } else {
8432
+ onChange([]);
8433
+ }
8434
+ },
8435
+ 500,
8436
+ [minValue, maxValue]
8437
+ );
8438
+ (0, import_react81.useEffect)(() => {
8439
+ if (!maxValue && !minValue) {
8440
+ return;
8441
+ }
8442
+ const max = Number(maxValue);
8443
+ const min = Number(minValue);
8444
+ if (max < min || min > max) {
8445
+ setError("Please enter a valid numeric range");
8446
+ return;
8447
+ }
8448
+ if (maxValue && !minValue || minValue && !maxValue) {
8449
+ setError("Please enter both a low and high number");
8450
+ return;
8451
+ }
8452
+ if (error) {
8453
+ setError("");
8454
+ }
8455
+ if (min && max) {
8456
+ setMinValue(minValue);
8457
+ setMaxValue(maxValue);
8458
+ }
8459
+ }, [maxValue, minValue, setError]);
8460
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
8461
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8462
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8463
+ import_design_system44.Input,
8464
+ {
8465
+ label: `${ariaLabel}-min`,
8466
+ type: "number",
8467
+ showLabel: false,
8468
+ min: 0,
8469
+ placeholder: "Low",
8470
+ onChange: (e) => setMinValue(e.currentTarget.value),
8471
+ "aria-invalid": !error ? false : true,
8472
+ disabled,
8473
+ value: value ? value[0] : "",
8474
+ readOnly,
8475
+ "data-testid": "value-low"
8476
+ }
8477
+ ),
8478
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8479
+ import_design_system44.Input,
8480
+ {
8481
+ type: "number",
8482
+ label: `${ariaLabel}-max`,
8483
+ showLabel: false,
8484
+ min: 0,
8485
+ placeholder: "High",
8486
+ onChange: (e) => setMaxValue(e.currentTarget.value),
8487
+ "aria-invalid": !error ? false : true,
8488
+ disabled,
8489
+ value: value ? value[1] : "",
8490
+ readOnly,
8491
+ "data-testid": "value-high"
8492
+ }
8493
+ )
8494
+ ] }),
8495
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ErrorContainer, { errorMessage: error })
8496
+ ] });
8497
+ };
8498
+ var NumberEditor = ({
8499
+ ariaLabel,
8500
+ onChange,
8501
+ disabled,
8502
+ value,
8503
+ readOnly,
8504
+ valueTestId
8505
+ }) => {
8506
+ const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
8507
+ (0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8508
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8509
+ import_design_system44.Input,
8510
+ {
8511
+ label: ariaLabel,
8512
+ type: "number",
8513
+ showLabel: false,
8514
+ min: 0,
8515
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8516
+ disabled,
8517
+ value: innerValue,
8518
+ readOnly,
8519
+ "data-testid": valueTestId
8520
+ }
8521
+ );
8522
+ };
8523
+ var DateEditor = ({
8524
+ onChange,
8525
+ ariaLabel,
8526
+ disabled,
8527
+ value,
8528
+ readOnly,
8529
+ valueTestId
8530
+ }) => {
8531
+ const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
8532
+ (0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8533
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8534
+ import_design_system44.Input,
8535
+ {
8536
+ type: "date",
8537
+ label: ariaLabel,
8538
+ showLabel: false,
8539
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8540
+ disabled,
8541
+ value: innerValue,
8542
+ readOnly,
8543
+ "data-testid": valueTestId
8544
+ }
8545
+ );
8546
+ };
8547
+ var DateRangeEditor = ({
8548
+ ariaLabel,
8549
+ onChange,
8550
+ disabled,
8551
+ value,
8552
+ readOnly,
8553
+ valueTestId
8554
+ }) => {
8555
+ const [minDateValue, setMinDateValue] = (0, import_react81.useState)(value ? value[0] : "");
8556
+ const [maxDateValue, setMaxDateValue] = (0, import_react81.useState)(value ? value[1] : "");
8557
+ const [error, setError] = (0, import_react81.useState)("");
8558
+ (0, import_react_use6.useDebounce)(
8559
+ () => {
8560
+ if (minDateValue && maxDateValue && !error) {
8561
+ onChange([minDateValue, maxDateValue]);
8562
+ } else {
8563
+ onChange([]);
8564
+ }
8565
+ },
8566
+ 500,
8567
+ [minDateValue, maxDateValue]
8568
+ );
8569
+ (0, import_react81.useEffect)(() => {
8570
+ if (!minDateValue || !maxDateValue) {
8571
+ return;
8572
+ }
8573
+ const minDate = new Date(minDateValue);
8574
+ const maxDate = new Date(maxDateValue);
8575
+ if (maxDate < minDate) {
8576
+ setError("The max date cannot be lower than the min date");
8577
+ return;
8578
+ }
8579
+ if (maxDate && !minDate) {
8580
+ setError("Please enter both a low and high date");
8581
+ return;
8582
+ }
8583
+ const minDateString = minDate.toDateString();
8584
+ const maxDateString = maxDate.toDateString();
8585
+ if (minDateString === maxDateString || maxDateString === minDateString) {
8586
+ setError("The min and max date cannot be the same");
8587
+ return;
8588
+ }
8589
+ if (minDate > maxDate) {
8590
+ setError("The min date cannot be higher than the max date");
8591
+ return;
8592
+ }
8593
+ if (error) {
8594
+ setError("");
8595
+ }
8596
+ if (minDate && maxDate) {
8597
+ setMinDateValue(minDateValue);
8598
+ setMaxDateValue(maxDateValue);
8599
+ } else {
8600
+ setMinDateValue("");
8601
+ setMaxDateValue("");
8602
+ }
8603
+ }, [minDateValue, maxDateValue, setError]);
8604
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
8605
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8606
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8607
+ import_design_system44.Input,
8608
+ {
8609
+ label: `${ariaLabel}-min-date`,
8610
+ type: "date",
8611
+ showLabel: false,
8612
+ value: minDateValue,
8613
+ onChange: (e) => setMinDateValue(e.currentTarget.value),
8614
+ "aria-invalid": !error ? false : true,
8615
+ disabled,
8616
+ readOnly,
8617
+ "data-testid": "value-low"
8618
+ }
8619
+ ),
8620
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8621
+ import_design_system44.Input,
8622
+ {
8623
+ label: `${ariaLabel}-max-date`,
8624
+ type: "date",
8625
+ showLabel: false,
8626
+ value: maxDateValue,
8627
+ onChange: (e) => setMaxDateValue(e.currentTarget.value),
8628
+ "aria-invalid": !error ? false : true,
8629
+ disabled,
8630
+ readOnly,
8631
+ "data-testid": "value-high"
8632
+ }
8633
+ )
8634
+ ] }),
8635
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ErrorContainer, { errorMessage: error })
8636
+ ] });
8637
+ };
8638
+ var FilterEditorRenderer = ({ editorType, ...props }) => {
8639
+ const { filterMapper: contextFilterMapper } = useSearchAndFilter();
8640
+ const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
8641
+ if (!Editor) {
8642
+ return null;
8643
+ }
8644
+ if (editorType === "empty") {
8645
+ return null;
8646
+ }
8647
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Editor, { ...props });
8648
+ };
8649
+ var filterMapper = {
8650
+ multiChoice: FilterMultiChoiceEditor,
8651
+ singleChoice: FilterSingleChoiceEditor,
8652
+ date: DateEditor,
8653
+ dateRange: DateRangeEditor,
8654
+ text: TextEditor,
8655
+ numberRange: NumberRangeEditor,
8656
+ number: NumberEditor,
8657
+ statusMultiChoice: StatusMultiEditor,
8658
+ statusSingleChoice: StatusSingleEditor,
8659
+ empty: null
8660
+ };
8661
+ function withInputVariables(WrappedComponent) {
8662
+ const WithInputVariables = (props) => {
8663
+ if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8664
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props });
8665
+ }
8666
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8667
+ InputVariables,
8668
+ {
8669
+ disableInlineMenu: true,
8670
+ showMenuPosition: "inline-right",
8671
+ onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8672
+ value: props.value,
8673
+ disabled: props.disabled,
8674
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props })
8675
+ }
8676
+ );
8677
+ };
8678
+ return WithInputVariables;
8679
+ }
8680
+ function withInputVariablesForMultiValue(WrappedComponent) {
8681
+ const WithInputVariables = (props) => {
8682
+ var _a;
8683
+ if (!props.bindable || props.disabled || props.readOnly) {
8684
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props });
8685
+ }
8686
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8687
+ InputVariables,
8688
+ {
8689
+ disableInlineMenu: true,
8690
+ showMenuPosition: "inline-right",
8691
+ onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
8692
+ value: (_a = props.value) == null ? void 0 : _a[0],
8693
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props })
8694
+ }
8695
+ );
8696
+ };
8697
+ return WithInputVariables;
8698
+ }
8699
+ var bindableFiltersMapper = {
8700
+ ...filterMapper,
8701
+ multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
8702
+ singleChoice: withInputVariables(FilterSingleChoiceEditor),
8703
+ date: withInputVariables(DateEditor),
8704
+ text: withInputVariables(TextEditor),
8705
+ number: withInputVariables(NumberEditor)
8706
+ };
8707
+ var ErrorContainer = ({ errorMessage }) => {
8708
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8709
+ "div",
8710
+ {
8711
+ css: {
8712
+ gridColumn: "span 6",
8713
+ order: 6
8714
+ },
8715
+ children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system44.FieldMessage, { errorMessage })
8716
+ }
8717
+ );
8718
+ };
8719
+ var twoColumnGrid = {
8720
+ display: "grid",
8721
+ gridTemplateColumns: "1fr 1fr",
8722
+ gap: "var(--spacing-sm);"
8723
+ };
8724
+
8725
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8726
+ var import_jsx_runtime73 = require("@emotion/react/jsx-runtime");
8727
+ var SearchAndFilterContext = (0, import_react82.createContext)({
8728
+ searchTerm: "",
8729
+ setSearchTerm: () => {
8730
+ },
8731
+ filterVisibility: void 0,
8732
+ setFilterVisibility: () => {
8733
+ },
8734
+ filters: [],
8735
+ setFilters: () => {
8736
+ },
8737
+ handleAddFilter: () => {
8738
+ },
8739
+ handleResetFilters: () => {
8740
+ },
8741
+ handleDeleteFilter: () => {
8742
+ },
8743
+ filterOptions: [],
8744
+ validFilterQuery: [],
8745
+ filterMapper: {},
8746
+ totalResults: 0,
8747
+ allowBindingSearchTerm: false
8748
+ });
8749
+ var SearchAndFilterProvider = ({
8750
+ filters,
8751
+ filterOptions,
8752
+ filterVisible = false,
8753
+ defaultSearchTerm = "",
8754
+ onSearchChange,
8755
+ onChange,
8756
+ resetFilterValues = [{ field: "", operator: "", value: "" }],
8757
+ totalResults,
8758
+ filterMapper: filterMapper2 = filterMapper,
8759
+ children,
8760
+ allowBindingSearchTerm
8761
+ }) => {
8762
+ const [searchTerm, setSearchTerm] = (0, import_react82.useState)(defaultSearchTerm);
8763
+ const deferredSearchTerm = (0, import_react82.useDeferredValue)(searchTerm);
8764
+ const [filterVisibility, setFilterVisibility] = (0, import_react82.useState)(filterVisible);
8765
+ const handleSearchTerm = (0, import_react82.useCallback)(
8766
+ (term) => {
8767
+ setSearchTerm(term);
8768
+ onSearchChange == null ? void 0 : onSearchChange(term);
8769
+ },
8770
+ [setSearchTerm, onSearchChange]
8771
+ );
8772
+ const handleToggleFilterVisibility = (0, import_react82.useCallback)(
8773
+ (visible) => setFilterVisibility(visible),
8774
+ [setFilterVisibility]
8775
+ );
8776
+ const handleAddFilter = (0, import_react82.useCallback)(() => {
8777
+ onChange([...filters, { field: "", operator: "", value: "" }]);
8778
+ }, [filters, onChange]);
8779
+ const handleResetFilters = (0, import_react82.useCallback)(() => {
8780
+ onSearchChange == null ? void 0 : onSearchChange("");
8781
+ onChange(resetFilterValues);
8782
+ }, [onChange, resetFilterValues, onSearchChange]);
8783
+ const handleDeleteFilter = (0, import_react82.useCallback)(
8784
+ (index) => {
8785
+ const remainingFilters = filters.filter((_, i) => i !== index);
8786
+ onChange(remainingFilters);
8787
+ },
8788
+ [filters, onChange]
8789
+ );
8790
+ const validFilterQuery = (0, import_react82.useMemo)(() => {
8791
+ const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
8792
+ if (hasValidFilters) {
8793
+ return filters;
8794
+ }
8795
+ }, [filters]);
8796
+ (0, import_react82.useEffect)(() => {
8797
+ if (filterVisibility) {
8798
+ const handleEscKeyFilterClose = (e) => {
8799
+ if (e.key === "Escape") {
8800
+ setFilterVisibility(false);
8801
+ }
8802
+ };
8803
+ document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8804
+ return () => {
8805
+ document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8806
+ };
8807
+ }
8808
+ }, [filterVisibility]);
8809
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
8810
+ SearchAndFilterContext.Provider,
8811
+ {
8812
+ value: {
8813
+ searchTerm: deferredSearchTerm,
8814
+ setSearchTerm: (e) => handleSearchTerm(e),
8815
+ filterVisibility,
8816
+ setFilterVisibility: (e) => handleToggleFilterVisibility(e),
8817
+ filters,
8818
+ setFilters: (e) => onChange(e),
8819
+ handleAddFilter,
8820
+ handleResetFilters,
8821
+ handleDeleteFilter,
8822
+ filterOptions,
8823
+ validFilterQuery,
8824
+ totalResults,
8825
+ filterMapper: filterMapper2,
8826
+ allowBindingSearchTerm
8827
+ },
8828
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_design_system45.VerticalRhythm, { children })
8829
+ }
8830
+ );
8831
+ };
8832
+ var useSearchAndFilter = () => {
8833
+ const value = (0, import_react82.useContext)(SearchAndFilterContext);
8834
+ return { ...value };
8835
+ };
8836
+
8837
+ // src/components/SearchAndFilter/FilterControls.tsx
8838
+ var import_jsx_runtime74 = require("@emotion/react/jsx-runtime");
8839
+ var FilterControls = ({
8840
+ children,
8841
+ hideSearchInput
8842
+ }) => {
8843
+ const {
8844
+ setFilterVisibility,
8845
+ filterVisibility,
8846
+ setSearchTerm,
8847
+ validFilterQuery,
8848
+ searchTerm,
8849
+ allowBindingSearchTerm
8850
+ } = useSearchAndFilter();
8851
+ const editorRef = (0, import_react83.useRef)(null);
8852
+ const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8853
+ const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react83.useState)("data-resource-search-term-input");
8854
+ const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react83.useState)(searchTerm);
8855
+ (0, import_react_use7.useDebounce)(
8856
+ () => {
8857
+ setSearchTerm(localeSearchTerm);
8858
+ },
8859
+ 300,
8860
+ [localeSearchTerm]
8861
+ );
8862
+ (0, import_react83.useEffect)(() => {
8863
+ if (searchTerm === "") {
8864
+ setLocaleSearchTerm("");
8865
+ setIdToResetInputVariables(`data-resource-search-term-input-${(0, import_uuid3.v4)()}`);
8866
+ }
8867
+ }, [searchTerm]);
8868
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
8869
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8870
+ FilterButton2,
8871
+ {
8872
+ "aria-controls": "search-and-filter-options",
8873
+ "aria-label": "filter options",
8874
+ "aria-haspopup": "true",
8875
+ text: "Filter/Sort",
8876
+ "aria-expanded": filterVisibility === true,
8877
+ filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
8878
+ onClick: () => setFilterVisibility(!filterVisibility),
8879
+ dataTestId: "filters-button"
8880
+ }
8881
+ ),
8882
+ hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { css: BindableKeywordSearchInputStyles, children: [
8883
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8884
+ InputVariables,
8885
+ {
8886
+ label: "",
8887
+ id: idToResetInputVariables,
8888
+ showMenuPosition: "inline-right",
8889
+ editorRef,
8890
+ value: localeSearchTerm,
8891
+ onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
8892
+ disableVariables: !allowBindingSearchTerm,
8893
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8894
+ import_design_system46.InputKeywordSearch,
8895
+ {
8896
+ placeholder: "Search...",
8897
+ onSearchTextChanged: (e) => setLocaleSearchTerm(e),
8898
+ value: localeSearchTerm,
8899
+ compact: true,
8900
+ rounded: true,
8901
+ css: SearchInput
8902
+ }
8903
+ )
8904
+ }
8905
+ ),
8906
+ hasVariableInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8907
+ "button",
8908
+ {
8909
+ css: ClearSearchButtonStyles,
8910
+ onClick: () => {
8911
+ setLocaleSearchTerm("");
8912
+ if (editorRef.current) {
8913
+ if (editorRef.current.getRootElement() !== document.activeElement) {
8914
+ editorRef.current.dispatchCommand(import_lexical11.CLEAR_EDITOR_COMMAND, void 0);
8915
+ }
8916
+ }
8917
+ },
8918
+ type: "button",
8919
+ "data-testid": "keyword-search-clear-button",
8920
+ children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_design_system46.Icon, { icon: import_CgClose5.CgClose, iconColor: "red", size: "1rem" })
8921
+ }
8922
+ ) }) : null
8923
+ ] }),
8924
+ children
8925
+ ] });
8926
+ };
8927
+
8928
+ // src/components/SearchAndFilter/FilterItem.tsx
8929
+ var import_design_system48 = require("@uniformdev/design-system");
8930
+ var import_react85 = require("react");
8931
+
8932
+ // src/components/SearchAndFilter/FilterMenu.tsx
8933
+ var import_design_system47 = require("@uniformdev/design-system");
8934
+ var import_react84 = __toESM(require("react"));
8935
+ var import_jsx_runtime75 = require("@emotion/react/jsx-runtime");
8936
+ var SearchAndFilterOptionsContainer2 = ({
8937
+ buttonRow,
8938
+ additionalFiltersContainer,
8939
+ children
8940
+ }) => {
8941
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
8942
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8943
+ buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
8944
+ import_design_system47.HorizontalRhythm,
8945
+ {
8946
+ css: SearchAndFilterButtonGroup,
8947
+ gap: "sm",
8948
+ align: "center",
8949
+ justify: "space-between",
8950
+ children: buttonRow
8951
+ }
8952
+ ) : null,
8953
+ additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: additionalFiltersContainer }) : null
8954
+ ] });
8955
+ };
8956
+ var FilterMenu = ({
8957
+ id,
8958
+ filterTitle = "Show results",
8959
+ menuControls,
8960
+ additionalFiltersContainer,
8961
+ children,
8962
+ dataTestId,
8963
+ resetButtonText = "reset"
8964
+ }) => {
8965
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
8966
+ const innerMenuRef = import_react84.default.useRef(null);
8967
+ (0, import_react84.useEffect)(() => {
8968
+ var _a;
8969
+ if (filterVisibility) {
8970
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
8971
+ }
8972
+ }, [filterVisibility]);
8973
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_design_system47.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
8974
+ SearchAndFilterOptionsContainer2,
8975
+ {
8976
+ buttonRow: menuControls,
8977
+ additionalFiltersContainer,
8978
+ children: [
8979
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_design_system47.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
8980
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
8981
+ (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
8982
+ "button",
8983
+ {
8984
+ type: "button",
8985
+ css: ResetConditionsBtn,
8986
+ onClick: () => {
8987
+ handleResetFilters();
8988
+ setFilterVisibility(false);
8989
+ },
8990
+ "data-testid": "reset-filters",
8991
+ children: resetButtonText
8992
+ }
8993
+ ) : null
8994
+ ] }),
8995
+ children
8996
+ ]
8997
+ }
8998
+ ) : null });
8999
+ };
9000
+
9001
+ // src/components/SearchAndFilter/FilterItem.tsx
9002
+ var import_jsx_runtime76 = require("@emotion/react/jsx-runtime");
9003
+ var FilterItem = ({
9004
+ index,
9005
+ paramOptions,
9006
+ operatorOptions,
9007
+ valueOptions,
9008
+ onParamChange,
9009
+ onOperatorChange,
9010
+ onValueChange
9011
+ }) => {
9012
+ var _a, _b;
9013
+ const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
9014
+ const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
9015
+ const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
9016
+ const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
9017
+ const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
9018
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react85.useMemo)(() => {
9019
+ var _a2;
9020
+ const currentSelectedFilter = filterOptions.find((item) => {
9021
+ var _a3;
9022
+ return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
9023
+ });
9024
+ const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
9025
+ return filters[index].field === item.value;
9026
+ });
9027
+ const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
9028
+ const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
9029
+ return filters[index].operator === item.value;
9030
+ });
9031
+ return {
9032
+ selectedFieldValue: selectedFieldValue2,
9033
+ selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
9034
+ selectedMetaValue: filters[index].value,
9035
+ readOnly: isCurrentFieldReadOnly,
9036
+ bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
9037
+ };
9038
+ }, [filters, filterOptions, index, operatorOptions]);
9039
+ const readOnlyProps = readOnly ? {
9040
+ "aria-readonly": true,
9041
+ isSearchable: false,
9042
+ menuIsOpen: false,
9043
+ isClearable: false
9044
+ } : {};
9045
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
9046
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: index === 0 ? "Where" : "and" }),
9047
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: ConditionalInputRow, children: [
9048
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9049
+ import_design_system48.InputComboBox,
9050
+ {
9051
+ "aria-label": label,
9052
+ options: paramOptions,
9053
+ onChange: (e) => {
9054
+ var _a2;
9055
+ onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
9056
+ },
9057
+ isOptionDisabled: (option) => {
9058
+ var _a2;
9059
+ return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
9060
+ },
9061
+ styles: {
9062
+ menu(base) {
9063
+ return {
9064
+ ...base,
9065
+ minWidth: "max-content"
9066
+ };
9067
+ }
9068
+ },
9069
+ value: selectedFieldValue,
9070
+ ...readOnlyProps,
9071
+ id: "filter-field",
9072
+ name: `filter-field-${index}`
9073
+ }
9074
+ ),
9075
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9076
+ import_design_system48.InputComboBox,
9077
+ {
9078
+ "aria-label": operatorLabel,
9079
+ options: operatorOptions,
9080
+ onChange: (e) => {
9081
+ var _a2;
9082
+ return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
9083
+ },
9084
+ isDisabled: !filters[index].field,
9085
+ value: selectedOperatorValue,
9086
+ styles: {
9087
+ menu(base) {
9088
+ return {
9089
+ ...base,
9090
+ minWidth: "max-content"
9091
+ };
9092
+ }
9093
+ },
9094
+ ...readOnlyProps,
9095
+ id: "filter-operator",
9096
+ name: `filter-operator-${index}`
9097
+ }
9098
+ ),
9099
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9100
+ FilterEditorRenderer,
9101
+ {
9102
+ "aria-label": metaDataLabel,
9103
+ editorType: metaDataPossibleOptions,
9104
+ options: valueOptions,
9105
+ onChange: (e) => onValueChange(e != null ? e : ""),
9106
+ readOnly,
9107
+ bindable,
9108
+ disabled: !filters[index].operator,
9109
+ value: selectedMetaValue,
9110
+ valueTestId: "filter-value"
9111
+ }
9112
+ ),
9113
+ readOnly || index === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9114
+ "button",
9115
+ {
9116
+ type: "button",
9117
+ onClick: () => handleDeleteFilter(index),
9118
+ "aria-label": "delete filter",
9119
+ css: IconBtn,
9120
+ "data-testid": "delete-filter",
9121
+ children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_design_system48.Icon, { icon: "trash", iconColor: "red", size: "1rem" })
9122
+ }
9123
+ )
9124
+ ] })
9125
+ ] });
9126
+ };
9127
+ var FilterItems = ({
9128
+ addButtonText = "add condition",
9129
+ additionalFiltersContainer
9130
+ }) => {
9131
+ const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
9132
+ const handleUpdateFilter = (index, prop, value) => {
9133
+ var _a, _b, _c, _d, _e;
9134
+ const next = [...filters];
9135
+ next[index] = { ...next[index], [prop]: value };
9136
+ if (prop === "operator") {
9137
+ if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
9138
+ next[index].value = next[index].value[0];
9139
+ }
9140
+ if (filters[index].operator === "ndef" || filters[index].operator === "def") {
9141
+ next[index].value = "";
9142
+ }
9143
+ if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
9144
+ next[index].value = [next[index].value, ""];
9145
+ }
9146
+ if (value === "def" || value === "true") {
9147
+ next[index].value = "true";
9148
+ }
9149
+ if (value === "ndef" || value === "false") {
9150
+ next[index].value = "false";
9151
+ }
9152
+ }
9153
+ if (prop === "field") {
9154
+ const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
9155
+ var _a2;
9156
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
9157
+ })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
9158
+ next[index].operator = firstOperatorInAvailableOperators;
9159
+ next[index].value = "";
9160
+ }
9161
+ setFilters(next);
9162
+ };
9163
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9164
+ FilterMenu,
9165
+ {
9166
+ id: "search-and-filter-options",
9167
+ dataTestId: "search-and-filter-options",
9168
+ menuControls: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
9169
+ "button",
9170
+ {
9171
+ type: "button",
9172
+ css: AddConditionalBtn,
9173
+ onClick: handleAddFilter,
9174
+ "data-testid": "add-filter",
9175
+ children: [
9176
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_design_system48.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9177
+ addButtonText
9178
+ ]
9179
+ }
9180
+ ),
9181
+ additionalFiltersContainer,
9182
+ children: filters.map((item, i) => {
9183
+ var _a, _b, _c, _d, _e, _f;
9184
+ const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
9185
+ var _a2;
9186
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
9187
+ })) == null ? void 0 : _a.options) != null ? _b : [];
9188
+ const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
9189
+ const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
9190
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9191
+ FilterItem,
9192
+ {
9193
+ index: i,
9194
+ paramOptions: filterOptions,
9195
+ onParamChange: (e) => handleUpdateFilter(i, "field", e),
9196
+ operatorOptions: possibleOperators,
9197
+ onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
9198
+ onValueChange: (e) => handleUpdateFilter(i, "value", e),
9199
+ valueOptions: possibleValueOptions
9200
+ },
9201
+ i
9202
+ );
9203
+ })
9204
+ }
9205
+ );
9206
+ };
9207
+
9208
+ // src/components/SearchAndFilter/SearchAndFilter.tsx
9209
+ var import_design_system50 = require("@uniformdev/design-system");
9210
+
9211
+ // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9212
+ var import_design_system49 = require("@uniformdev/design-system");
9213
+ var import_jsx_runtime77 = require("@emotion/react/jsx-runtime");
9214
+ var SearchAndFilterResultContainer = ({
9215
+ buttonText,
9216
+ clearButtonLabel = "clear",
9217
+ calloutTitle,
9218
+ calloutText,
9219
+ onHandleClear,
9220
+ hideClearButton
9221
+ }) => {
9222
+ const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
9223
+ const automateCalloutTitle = () => {
9224
+ if (searchTerm && !filters.length) {
9225
+ return "No search results found";
9226
+ }
9227
+ if (filters.length && !searchTerm) {
9228
+ return "No results match the selected filters";
9229
+ }
9230
+ return "No matching results found";
9231
+ };
9232
+ if (totalResults && totalResults > 0) {
9233
+ return null;
9234
+ }
9235
+ const handleClearSearch = () => {
9236
+ setSearchTerm("");
9237
+ if (onHandleClear) {
9238
+ onHandleClear();
9239
+ } else {
9240
+ handleResetFilters();
9241
+ }
9242
+ };
9243
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
9244
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system49.HorizontalRhythm, { children: [
9245
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("span", { children: [
9246
+ totalResults,
9247
+ " results ",
9248
+ searchTerm ? `for "${searchTerm}"` : null
9249
+ ] }),
9250
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9251
+ ] }),
9252
+ totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system49.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9253
+ calloutText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Paragraph, { children: calloutText }) : null,
9254
+ hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Button, { buttonType: "tertiaryOutline", size: "xs", onClick: handleClearSearch, children: buttonText != null ? buttonText : "Clear search" })
9255
+ ] }) : null
9256
+ ] });
9257
+ };
9258
+
9259
+ // src/components/SearchAndFilter/SearchAndFilter.tsx
9260
+ var import_jsx_runtime78 = require("@emotion/react/jsx-runtime");
9261
+ var SearchAndFilter = ({
9262
+ filters,
9263
+ filterOptions,
9264
+ filterVisible,
9265
+ filterControls,
9266
+ viewSwitchControls,
9267
+ resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(SearchAndFilterResultContainer, {}),
9268
+ filterMapper: filterMapper2 = filterMapper,
9269
+ additionalFiltersContainer,
9270
+ onChange,
9271
+ defaultSearchTerm,
9272
+ onSearchChange,
9273
+ totalResults,
9274
+ allowBindingSearchTerm = false,
9275
+ resetFilterValues = []
9276
+ }) => {
9277
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
9278
+ SearchAndFilterProvider,
9279
+ {
9280
+ filters,
9281
+ filterOptions,
9282
+ filterVisible,
9283
+ onChange,
9284
+ defaultSearchTerm,
9285
+ onSearchChange,
9286
+ totalResults,
9287
+ resetFilterValues,
9288
+ filterMapper: filterMapper2,
9289
+ allowBindingSearchTerm,
9290
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_design_system50.VerticalRhythm, { "data-testid": "search-and-filter", children: [
9291
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9292
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
9293
+ "div",
9294
+ {
9295
+ css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9296
+ children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9297
+ }
9298
+ ),
9299
+ viewSwitchControls
9300
+ ] }),
9301
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FilterItems, { additionalFiltersContainer }),
9302
+ resultsContainerView
9303
+ ] })
9304
+ }
9305
+ );
9306
+ };
9307
+
9308
+ // src/components/SearchAndFilter/SearchOnlyFilter.tsx
9309
+ var import_design_system51 = require("@uniformdev/design-system");
9310
+ var import_react86 = require("react");
9311
+ var import_react_use8 = require("react-use");
9312
+ var import_jsx_runtime79 = require("@emotion/react/jsx-runtime");
9313
+ var SearchOnlyContext = (0, import_react86.createContext)({
9314
+ searchTerm: "",
9315
+ setSearchTerm: () => {
9316
+ }
9317
+ });
9318
+ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9319
+ const { searchTerm, setSearchTerm } = useSearchAndFilter();
9320
+ const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react86.useState)("");
9321
+ (0, import_react_use8.useDebounce)(
9322
+ () => {
9323
+ setSearchTerm(localeSearchTerm);
9324
+ onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
9325
+ },
9326
+ 300,
9327
+ [localeSearchTerm]
9328
+ );
9329
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
9330
+ SearchOnlyContext.Provider,
9331
+ {
9332
+ value: {
9333
+ searchTerm,
9334
+ setSearchTerm: setLocaleSearchTerm
9335
+ },
9336
+ children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
9337
+ import_design_system51.InputKeywordSearch,
9338
+ {
9339
+ placeholder: "Search...",
9340
+ onSearchTextChanged: (e) => setLocaleSearchTerm(e),
9341
+ value: localeSearchTerm,
9342
+ compact: true,
9343
+ rounded: true
9344
+ }
9345
+ ) })
9346
+ }
9347
+ );
9348
+ };
9349
+
9350
+ // src/components/SearchAndFilter/SortItems.tsx
9351
+ var import_design_system53 = require("@uniformdev/design-system");
9352
+
9353
+ // src/components/SearchAndFilter/styles/SortItems.styles.ts
9354
+ var import_react87 = require("@emotion/react");
9355
+ var import_design_system52 = require("@uniformdev/design-system");
9356
+ var ConditionalFilterRow2 = import_react87.css`
9357
+ display: grid;
9358
+ grid-template-columns: 35px 1fr;
9359
+ gap: var(--spacing-sm);
9360
+ margin-left: var(--spacing-base);
9361
+
9362
+ ${(0, import_design_system52.cq)("380px")} {
9363
+ align-items: center;
9364
+
9365
+ &:after {
9366
+ content: '';
9367
+ display: block;
9368
+ height: 1px;
9369
+ background: var(--gray-300);
9370
+ width: calc(100% - var(--spacing-base));
9371
+ margin-left: var(--spacing-base);
9372
+ }
9373
+ &:last-of-type:after {
9374
+ display: none;
9375
+ }
9376
+ }
9377
+
9378
+ &:nth-of-type(2) {
9379
+ margin-left: 0;
9380
+ grid-template-columns: 50px 1fr;
9381
+ }
9382
+
9383
+ ${(0, import_design_system52.cq)("580px")} {
9384
+ &:after {
9385
+ display: none;
9386
+ }
9387
+ }
9388
+
9389
+ @media (prefers-reduced-motion: no-preference) {
9390
+ animation: ${import_design_system52.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
9391
+ }
9392
+ `;
9393
+ var ConditionalInputRow2 = import_react87.css`
9394
+ display: flex;
9395
+ gap: var(--spacing-sm);
9396
+ flex-wrap: wrap;
9397
+
9398
+ ${(0, import_design_system52.cq)("380px")} {
9399
+ & > div:nth-child(-n + 2) {
9400
+ width: calc(50% - var(--spacing-sm));
9401
+ }
9402
+
9403
+ & > div:nth-child(n + 3) {
9404
+ width: calc(100% - 48px);
9405
+ }
9406
+ }
9407
+ ${(0, import_design_system52.cq)("580px")} {
9408
+ display: grid;
9409
+ grid-template-columns: 200px 160px 1fr 32px;
9410
+
9411
+ & > div:nth-child(n) {
9412
+ width: auto;
9413
+ }
9414
+ }
9415
+ `;
9416
+ var SearchInput2 = import_react87.css`
9417
+ max-height: 40px;
9418
+ min-height: unset;
9419
+ `;
9420
+ var FilterButton3 = import_react87.css`
9421
+ align-items: center;
9422
+ background: var(--white);
9423
+ border: 1px solid var(--gray-300);
9424
+ border-radius: var(--rounded-full);
9425
+ color: var(--typography-base);
9426
+ display: flex;
9427
+ font-size: var(--fs-sm);
9428
+ gap: var(--spacing-sm);
9429
+ padding: var(--spacing-sm) var(--spacing-base);
9430
+ max-height: 40px;
9431
+ transition: color var(--duration-fast) var(--timing-ease-out),
9432
+ background-color var(--duration-fast) var(--timing-ease-out),
9433
+ border-color var(--duration-fast) var(--timing-ease-out),
9434
+ box-shadow var(--duration-fast) var(--timing-ease-out);
9435
+
9436
+ svg {
9437
+ color: var(--gray-300);
9438
+ transition: color var(--duration-fast) var(--timing-ease-out);
9439
+ }
9440
+
9441
+ &:hover,
9442
+ :where([aria-expanded='true']) {
9443
+ outline: none;
9444
+ background: var(--gray-200);
9445
+ border-color: var(--gray-300);
9446
+
9447
+ svg {
9448
+ color: var(--typography-base);
9449
+ }
9450
+ }
9451
+
9452
+ &:disabled {
9453
+ opacity: var(--opacity-50);
9454
+ }
9455
+ `;
9456
+ var FilterButtonText2 = import_react87.css`
9457
+ overflow: hidden;
9458
+ text-overflow: ellipsis;
9459
+ white-space: nowrap;
9460
+ max-width: 14ch;
9461
+ `;
9462
+ var FilterButtonSelected2 = import_react87.css`
9463
+ background: var(--gray-100);
9464
+ border-color: var(--gray-300);
9465
+
9466
+ svg {
9467
+ color: var(--accent-dark);
9468
+ }
9469
+ `;
9470
+ var FilterButtonWithOptions2 = import_react87.css`
9471
+ :where([aria-expanded='true']) {
9472
+ background: var(--purple-rain-100);
9473
+ border-color: var(--accent-light);
9474
+ color: var(--typography-base);
9475
+ box-shadow: var(--elevation-100);
9476
+
9477
+ svg {
9478
+ color: var(--accent-dark);
9479
+ }
9480
+ }
9481
+ `;
9482
+ var SearchIcon2 = import_react87.css`
9483
+ color: var(--icon-color);
9484
+ position: absolute;
9485
+ inset: 0 var(--spacing-base) 0 auto;
9486
+ margin: auto;
9487
+ transition: color var(--duration-fast) var(--timing-ease-out);
9488
+ `;
9489
+ var AddConditionalBtn2 = import_react87.css`
9490
+ align-items: center;
9491
+ background: transparent;
9492
+ border: none;
9493
+ color: var(--primary-action-default);
9494
+ display: flex;
9495
+ gap: var(--spacing-sm);
9496
+ transition: color var(--duration-fast) var(--timing-ease-out);
9497
+ padding: 0;
9498
+
9499
+ &:hover,
9500
+ &:focus {
9501
+ color: var(--primary-action-hover);
9502
+ }
9503
+
9504
+ &:disabled {
9505
+ color: var(--gray-400);
9506
+ }
9507
+ `;
9508
+ var Title2 = import_react87.css`
9509
+ color: var(--typography-light);
9510
+
9511
+ &:focus {
9512
+ outline: none;
9513
+ }
9514
+ `;
9515
+ var ResetConditionsBtn2 = import_react87.css`
9516
+ background: transparent;
9517
+ border: none;
9518
+ color: var(--action-destructive-default);
9519
+ transition: color var(--duration-fast) var(--timing-ease-out);
9520
+ padding: 0;
9521
+
9522
+ &:hover,
9523
+ &:focus {
9524
+ color: var(--action-destructive-hover);
9525
+ }
9526
+ `;
9527
+ var IconBtn2 = import_react87.css`
9528
+ background: transparent;
9529
+ border: none;
9530
+ padding: var(--spacing-sm);
9531
+ `;
9532
+ var SearchAndFilterOptionsContainer3 = import_react87.css`
9533
+ background: var(--gray-50);
9534
+ border: 1px solid var(--gray-300);
9535
+ border-radius: var(--rounded-base);
9536
+ container-type: inline-size;
9537
+ display: flex;
9538
+ flex-direction: column;
9539
+ gap: var(--spacing-sm);
9540
+ padding: var(--spacing-md) 0 var(--spacing-base);
9541
+ will-change: height;
9542
+ position: relative;
9543
+ z-index: 1;
9544
+ `;
9545
+ var SearchAndFilterOptionsInnerContainer2 = import_react87.css`
9546
+ display: flex;
9547
+ flex-direction: column;
9548
+ gap: var(--spacing-sm);
9549
+ padding-inline: var(--spacing-md);
9550
+ `;
9551
+ var SearchAndFilterButtonGroup2 = import_react87.css`
9552
+ margin-top: var(--spacing-xs);
9553
+ margin-left: calc(56px + var(--spacing-md));
9554
+ `;
9555
+ var SortFilterWrapper = (hiddenLocaleInput) => import_react87.css`
9556
+ align-items: center;
9557
+ border-top: 1px solid var(--gray-300);
9558
+ display: flex;
9559
+ flex-wrap: wrap;
9560
+ gap: var(--spacing-base);
9561
+ padding: var(--spacing-base) var(--spacing-md) 0;
9562
+ position: relative;
9563
+ z-index: 0;
9564
+
9565
+ ${(0, import_design_system52.cq)("420px")} {
9566
+ display: grid;
9567
+ grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
9568
+ }
9569
+ `;
9570
+ var SortFilterInputRow = import_react87.css`
9571
+ align-items: center;
9572
+ display: grid;
9573
+ grid-template-columns: 1fr auto;
9574
+ gap: var(--spacing-base);
9575
+ `;
9576
+ var InputVariableWrapper = import_react87.css`
9577
+ flex-grow: 1;
9578
+
9579
+ // we need to override label styles nested within the input variable
9580
+ // as these are slightly different from the default label styles
9581
+ label > span {
9582
+ color: var(--typography-light);
9583
+ }
9584
+ `;
9585
+
9586
+ // src/components/SearchAndFilter/SortItems.tsx
9587
+ var import_jsx_runtime80 = require("@emotion/react/jsx-runtime");
9588
+ var SortItems = ({
9589
+ sortByLabel = "Sort by",
9590
+ localeLabel = "Show locale",
9591
+ sortOptions,
9592
+ sortByValue,
9593
+ onSortChange,
9594
+ localeValue,
9595
+ localeOptions,
9596
+ onLocaleChange,
9597
+ disableSortBinding
9598
+ }) => {
9599
+ var _a, _b;
9600
+ const hideLocaleOptions = !localeOptions || !onLocaleChange;
9601
+ const values = sortByValue == null ? void 0 : sortByValue.split("_");
9602
+ const sortDirection = values == null ? void 0 : values.pop();
9603
+ const sortField = values == null ? void 0 : values.join("_");
9604
+ const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
9605
+ var _a2;
9606
+ return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9607
+ })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9608
+ const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9609
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9610
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_design_system53.VerticalRhythm, { gap: "xs", children: [
9611
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { css: Title2, children: sortByLabel }),
9612
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { css: SortFilterInputRow, children: [
9613
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9614
+ InputVariables,
9615
+ {
9616
+ disableInlineMenu: disableSortBinding,
9617
+ showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9618
+ value: sortField,
9619
+ valueToResetTo: "created_at",
9620
+ onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9621
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9622
+ import_design_system53.InputComboBox,
9623
+ {
9624
+ id: "sort-by-field",
9625
+ "aria-label": "Sort by",
9626
+ options: sortOptions,
9627
+ onChange: (e) => {
9628
+ const fieldName = e == null ? void 0 : e.value;
9629
+ onSortChange(`${fieldName}_${sortDirection}`);
9630
+ },
9631
+ styles: {
9632
+ menu(base) {
9633
+ return {
9634
+ ...base,
9635
+ minWidth: "max-content"
9636
+ };
9637
+ }
9638
+ },
9639
+ value: currentSelectedOption
9640
+ }
9641
+ )
9642
+ }
9643
+ ),
9644
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9645
+ InputVariables,
9646
+ {
9647
+ disableInlineMenu: disableSortBinding,
9648
+ value: sortDirection,
9649
+ valueToResetTo: "DESC",
9650
+ showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9651
+ onChange: (e) => onSortChange(`${sortField}_${e}`),
9652
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9653
+ import_design_system53.SegmentedControl,
9654
+ {
9655
+ noCheckmark: true,
9656
+ name: "sortBy",
9657
+ hideOptionText: true,
9658
+ iconSize: "1rem",
9659
+ size: "xl",
9660
+ options: [
9661
+ {
9662
+ label: "Ascending",
9663
+ icon: "arrow-up",
9664
+ value: `ASC`,
9665
+ tooltip: "Ascending (e.g. A-Z, oldest to newest)",
9666
+ "data-testid": "sort-ascending"
9667
+ },
9668
+ {
9669
+ label: "Descending",
9670
+ icon: "arrow-down",
9671
+ value: `DESC`,
9672
+ tooltip: "Descending (e.g. Z-A, newest to oldest)",
9673
+ "data-testid": "sort-descending"
9674
+ }
9675
+ ],
9676
+ onChange: (e) => onSortChange(`${sortField}_${e}`),
9677
+ value: sortDirection
9678
+ }
9679
+ )
9680
+ }
9681
+ )
9682
+ ] })
9683
+ ] }),
9684
+ hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_design_system53.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9685
+ InputVariables,
9686
+ {
9687
+ label: localeLabelValue,
9688
+ value: localeValue,
9689
+ showMenuPosition: "inline-right",
9690
+ onChange: (e) => onLocaleChange(e != null ? e : ""),
9691
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9692
+ import_design_system53.InputSelect,
9693
+ {
9694
+ name: "localeReturned",
9695
+ "aria-label": localeLabelValue,
9696
+ label: localeLabelValue,
9697
+ showLabel: false,
9698
+ "data-testid": "context-locale",
9699
+ onChange: (e) => {
9700
+ var _a2;
9701
+ return onLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
9702
+ },
9703
+ options: localeOptions,
9704
+ value: localeValue
9705
+ }
9706
+ )
9707
+ }
9708
+ ) })
9709
+ ] });
9710
+ };
9711
+
9712
+ // src/index.ts
9713
+ var import_design_system54 = require("@uniformdev/design-system");
7372
9714
  __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7373
9715
  // Annotate the CommonJS export names for ESM import in node:
7374
9716
  0 && (module.exports = {
@@ -7376,21 +9718,35 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7376
9718
  $isVariableNode,
7377
9719
  AddListButton,
7378
9720
  Button,
9721
+ CHECKBOX_OPERATORS,
7379
9722
  Callout,
9723
+ ControlledObjectSearchProvider,
7380
9724
  ControlledValuePlugin,
9725
+ DATE_OPERATORS,
7381
9726
  DISCONNECT_VARIABLE_COMMAND,
7382
9727
  DamSelectedItem,
7383
9728
  DataRefreshButton,
7384
9729
  DataResourceDynamicInputProvider,
9730
+ DataResourceInputContext,
7385
9731
  DataResourceVariablesList,
7386
9732
  DataResourceVariablesListExplicit,
7387
9733
  DataSourceEditor,
7388
9734
  DataTypeEditor,
9735
+ DateEditor,
9736
+ DateRangeEditor,
7389
9737
  DefaultSearchRow,
7390
9738
  DefaultSelectedItem,
7391
9739
  DrawerContent,
7392
9740
  EDIT_VARIABLE_COMMAND,
7393
9741
  EntrySearch,
9742
+ FilterButton,
9743
+ FilterControls,
9744
+ FilterEditorRenderer,
9745
+ FilterItem,
9746
+ FilterItems,
9747
+ FilterMenu,
9748
+ FilterMultiChoiceEditor,
9749
+ FilterSingleChoiceEditor,
7394
9750
  Heading,
7395
9751
  INSERT_VARIABLE_COMMAND,
7396
9752
  Icons,
@@ -7407,16 +9763,22 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7407
9763
  Menu,
7408
9764
  MenuItem,
7409
9765
  MeshApp,
9766
+ NUMBER_OPERATORS,
9767
+ NumberEditor,
9768
+ NumberRangeEditor,
7410
9769
  OPEN_INSERT_VARIABLE_COMMAND,
7411
9770
  ObjectSearchContainer,
9771
+ ObjectSearchContext,
7412
9772
  ObjectSearchFilter,
7413
9773
  ObjectSearchFilterContainer,
7414
9774
  ObjectSearchListItem,
7415
9775
  ObjectSearchListItemLoadingSkeleton,
9776
+ ObjectSearchListOfSearchResults,
7416
9777
  ObjectSearchProvider,
7417
9778
  ObjectSearchResultItem,
7418
9779
  ObjectSearchResultItemButton,
7419
9780
  ObjectSearchResultList,
9781
+ PUBLISH_STATUS_FIELD_OPERATORS,
7420
9782
  ParamTypeDynamicDataProvider,
7421
9783
  ParameterConnectionIndicator,
7422
9784
  ParameterGroup,
@@ -7444,6 +9806,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7444
9806
  ProductSearchRow,
7445
9807
  ProductSelectedItem,
7446
9808
  QueryFilter,
9809
+ RICHTEXT_OPERATORS,
7447
9810
  RequestBody,
7448
9811
  RequestHeaders,
7449
9812
  RequestMethodSelect,
@@ -7453,19 +9816,37 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7453
9816
  RequestUrl,
7454
9817
  RequestUrlInput,
7455
9818
  ResolvableLoadingValue,
9819
+ SELECT_OPERATORS,
9820
+ SYSTEM_DATE_OPERATORS,
9821
+ SYSTEM_FIELD_OPERATORS,
7456
9822
  ScrollableList,
7457
9823
  ScrollableListItem,
9824
+ SearchAndFilter,
9825
+ SearchAndFilterContext,
9826
+ SearchAndFilterOptionsContainer,
9827
+ SearchAndFilterProvider,
9828
+ SearchAndFilterResultContainer,
9829
+ SearchOnlyContext,
9830
+ SearchOnlyFilter,
7458
9831
  SelectionField,
9832
+ SortItems,
9833
+ StatusMultiEditor,
9834
+ StatusSingleEditor,
7459
9835
  Switch,
9836
+ TEXTBOX_OPERATORS,
9837
+ TextEditor,
7460
9838
  TextVariableRenderer,
7461
9839
  Textarea,
7462
9840
  Theme,
9841
+ USER_OPERATORS,
7463
9842
  VariableEditor,
7464
9843
  VariableNode,
7465
9844
  VariablesList,
7466
9845
  VariablesPlugin,
7467
9846
  VariablesProvider,
7468
9847
  badgeIcon,
9848
+ bindQuery,
9849
+ bindableFiltersMapper,
7469
9850
  convertConnectedDataToVariable,
7470
9851
  createLocationValidator,
7471
9852
  damSelectItemImage,
@@ -7496,6 +9877,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7496
9877
  entrySearchSelectInput,
7497
9878
  entrySearchSelectOption,
7498
9879
  entrySearchWrapper,
9880
+ filterMapper,
7499
9881
  hasReferencedVariables,
7500
9882
  prettifyBindExpression,
7501
9883
  productSearchRowActiveIcon,
@@ -7537,6 +9919,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7537
9919
  urlEncodeRequestUrl,
7538
9920
  useConnectedDataAsVariables,
7539
9921
  useContentDataResourceLocaleInfo,
9922
+ useDataResourceDynamicInputs,
7540
9923
  useDynamicInputsAsVariables,
7541
9924
  useMeshLocation,
7542
9925
  useObjectSearchContext,
@@ -7546,10 +9929,12 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
7546
9929
  useRequest,
7547
9930
  useRequestHeader,
7548
9931
  useRequestParameter,
9932
+ useSearchAndFilter,
7549
9933
  useUniformMeshSdk,
7550
9934
  useVariableEditor,
7551
9935
  useVariables,
7552
9936
  useVariablesMenu,
9937
+ utilityColors,
7553
9938
  variableDefaultTextValue,
7554
9939
  variablePrefix,
7555
9940
  variableSuffix,