@uniformdev/mesh-sdk-react 19.135.1-alpha.10 → 19.135.1-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -33,13 +33,14 @@ var src_exports = {};
33
33
  __export(src_exports, {
34
34
  $createVariableNode: () => $createVariableNode,
35
35
  $isVariableNode: () => $isVariableNode,
36
- AddListButton: () => import_design_system54.AddListButton,
37
- Button: () => import_design_system54.Button,
36
+ AddListButton: () => import_design_system66.AddListButton,
37
+ Button: () => import_design_system66.Button,
38
38
  CHECKBOX_OPERATORS: () => CHECKBOX_OPERATORS,
39
- Callout: () => import_design_system54.Callout,
39
+ Callout: () => import_design_system66.Callout,
40
40
  ControlledObjectSearchProvider: () => ControlledObjectSearchProvider,
41
41
  ControlledValuePlugin: () => ControlledValuePlugin,
42
42
  DATE_OPERATORS: () => DATE_OPERATORS,
43
+ DATE_TIME_OPERATORS: () => DATE_TIME_OPERATORS,
43
44
  DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
44
45
  DamSelectedItem: () => DamSelectedItem,
45
46
  DataRefreshButton: () => DataRefreshButton,
@@ -53,7 +54,7 @@ __export(src_exports, {
53
54
  DateRangeEditor: () => DateRangeEditor,
54
55
  DefaultSearchRow: () => DefaultSearchRow,
55
56
  DefaultSelectedItem: () => DefaultSelectedItem,
56
- DrawerContent: () => import_design_system54.DrawerContent,
57
+ DrawerContent: () => import_design_system66.DrawerContent,
57
58
  EDIT_VARIABLE_COMMAND: () => EDIT_VARIABLE_COMMAND,
58
59
  EntrySearch: () => EntrySearch,
59
60
  FilterButton: () => FilterButton2,
@@ -64,27 +65,28 @@ __export(src_exports, {
64
65
  FilterMenu: () => FilterMenu,
65
66
  FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
66
67
  FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
67
- Heading: () => import_design_system54.Heading,
68
+ Heading: () => import_design_system66.Heading,
68
69
  INSERT_VARIABLE_COMMAND: () => INSERT_VARIABLE_COMMAND,
69
70
  Icons: () => icons_exports,
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,
71
+ Input: () => import_design_system66.Input,
72
+ InputComboBox: () => import_design_system66.InputComboBox,
73
+ InputKeywordSearch: () => import_design_system66.InputKeywordSearch,
74
+ InputSelect: () => import_design_system66.InputSelect,
75
+ InputToggle: () => import_design_system66.InputToggle,
75
76
  InputVariables: () => InputVariables,
76
- Label: () => import_design_system54.Label,
77
+ Label: () => import_design_system66.Label,
77
78
  LinkButton: () => LinkButton,
78
- LoadingIndicator: () => import_design_system54.LoadingIndicator,
79
- LoadingOverlay: () => import_design_system54.LoadingOverlay,
79
+ LoadingIndicator: () => import_design_system66.LoadingIndicator,
80
+ LoadingOverlay: () => import_design_system66.LoadingOverlay,
80
81
  MULTI_SELECT_OPERATORS: () => MULTI_SELECT_OPERATORS,
81
- Menu: () => import_design_system54.Menu,
82
- MenuItem: () => import_design_system54.MenuItem,
82
+ Menu: () => import_design_system66.Menu,
83
+ MenuItem: () => import_design_system66.MenuItem,
83
84
  MeshApp: () => MeshApp,
84
85
  NUMBER_OPERATORS: () => NUMBER_OPERATORS,
85
86
  NumberEditor: () => NumberEditor,
86
87
  NumberRangeEditor: () => NumberRangeEditor,
87
88
  OPEN_INSERT_VARIABLE_COMMAND: () => OPEN_INSERT_VARIABLE_COMMAND,
89
+ OPTIONAL_SYSTEM_FIELD_OPERATORS: () => OPTIONAL_SYSTEM_FIELD_OPERATORS,
88
90
  ObjectSearchContainer: () => ObjectSearchContainer,
89
91
  ObjectSearchContext: () => ObjectSearchContext,
90
92
  ObjectSearchFilter: () => ObjectSearchFilter,
@@ -99,22 +101,22 @@ __export(src_exports, {
99
101
  PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
100
102
  ParamTypeDynamicDataProvider: () => ParamTypeDynamicDataProvider,
101
103
  ParameterConnectionIndicator: () => ParameterConnectionIndicator,
102
- ParameterGroup: () => import_design_system54.ParameterGroup,
103
- ParameterImage: () => import_design_system54.ParameterImage,
104
- ParameterImageInner: () => import_design_system54.ParameterImageInner,
105
- ParameterInput: () => import_design_system54.ParameterInput,
106
- ParameterInputInner: () => import_design_system54.ParameterInputInner,
107
- ParameterLabel: () => import_design_system54.ParameterLabel,
108
- ParameterMenuButton: () => import_design_system54.ParameterMenuButton,
104
+ ParameterGroup: () => import_design_system66.ParameterGroup,
105
+ ParameterImage: () => import_design_system66.ParameterImage,
106
+ ParameterImageInner: () => import_design_system66.ParameterImageInner,
107
+ ParameterInput: () => import_design_system66.ParameterInput,
108
+ ParameterInputInner: () => import_design_system66.ParameterInputInner,
109
+ ParameterLabel: () => import_design_system66.ParameterLabel,
110
+ ParameterMenuButton: () => import_design_system66.ParameterMenuButton,
109
111
  ParameterOrSingleVariable: () => ParameterOrSingleVariable,
110
- ParameterSelect: () => import_design_system54.ParameterSelect,
111
- ParameterSelectInner: () => import_design_system54.ParameterSelectInner,
112
- ParameterShell: () => import_design_system54.ParameterShell,
112
+ ParameterSelect: () => import_design_system66.ParameterSelect,
113
+ ParameterSelectInner: () => import_design_system66.ParameterSelectInner,
114
+ ParameterShell: () => import_design_system66.ParameterShell,
113
115
  ParameterShellContext: () => import_design_system14.ParameterShellContext,
114
- ParameterTextarea: () => import_design_system54.ParameterTextarea,
115
- ParameterTextareaInner: () => import_design_system54.ParameterTextareaInner,
116
- ParameterToggle: () => import_design_system54.ParameterToggle,
117
- ParameterToggleInner: () => import_design_system54.ParameterToggleInner,
116
+ ParameterTextarea: () => import_design_system66.ParameterTextarea,
117
+ ParameterTextareaInner: () => import_design_system66.ParameterTextareaInner,
118
+ ParameterToggle: () => import_design_system66.ParameterToggle,
119
+ ParameterToggleInner: () => import_design_system66.ParameterToggleInner,
118
120
  ParameterVariables: () => ParameterVariables,
119
121
  ProductPreviewList: () => ProductPreviewList,
120
122
  ProductQuery: () => ProductQuery,
@@ -135,10 +137,9 @@ __export(src_exports, {
135
137
  RequestUrlInput: () => RequestUrlInput,
136
138
  ResolvableLoadingValue: () => ResolvableLoadingValue,
137
139
  SELECT_OPERATORS: () => SELECT_OPERATORS,
138
- SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
139
140
  SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
140
- ScrollableList: () => import_design_system54.ScrollableList,
141
- ScrollableListItem: () => import_design_system54.ScrollableListItem,
141
+ ScrollableList: () => import_design_system66.ScrollableList,
142
+ ScrollableListItem: () => import_design_system66.ScrollableListItem,
142
143
  SearchAndFilter: () => SearchAndFilter,
143
144
  SearchAndFilterContext: () => SearchAndFilterContext,
144
145
  SearchAndFilterOptionsContainer: () => SearchAndFilterOptionsContainer2,
@@ -150,13 +151,15 @@ __export(src_exports, {
150
151
  SortItems: () => SortItems,
151
152
  StatusMultiEditor: () => StatusMultiEditor,
152
153
  StatusSingleEditor: () => StatusSingleEditor,
153
- Switch: () => import_design_system54.Switch,
154
+ Switch: () => import_design_system66.Switch,
154
155
  TEXTBOX_OPERATORS: () => TEXTBOX_OPERATORS,
155
156
  TextEditor: () => TextEditor,
157
+ TextMultiChoiceEditor: () => TextMultiChoiceEditor,
156
158
  TextVariableRenderer: () => TextVariableRenderer,
157
- Textarea: () => import_design_system54.Textarea,
158
- Theme: () => import_design_system54.Theme,
159
+ Textarea: () => import_design_system66.Textarea,
160
+ Theme: () => import_design_system66.Theme,
159
161
  USER_OPERATORS: () => USER_OPERATORS,
162
+ VariableChip: () => VariableChip,
160
163
  VariableEditor: () => VariableEditor,
161
164
  VariableNode: () => VariableNode,
162
165
  VariablesList: () => VariablesList,
@@ -196,7 +199,7 @@ __export(src_exports, {
196
199
  entrySearchSelectOption: () => entrySearchSelectOption,
197
200
  entrySearchWrapper: () => entrySearchWrapper,
198
201
  filterMapper: () => filterMapper,
199
- hasReferencedVariables: () => hasReferencedVariables,
202
+ hasReferencedVariables: () => hasReferencedVariables2,
200
203
  prettifyBindExpression: () => prettifyBindExpression,
201
204
  productSearchRowActiveIcon: () => productSearchRowActiveIcon,
202
205
  productSearchRowCategory: () => productSearchRowCategory,
@@ -231,6 +234,7 @@ __export(src_exports, {
231
234
  selectedItemIcon: () => selectedItemIcon,
232
235
  selectedItemInner: () => selectedItemInner,
233
236
  selectedItemTitle: () => selectedItemTitle,
237
+ serializeVariablesEditorSerializedState: () => serializeVariablesEditorSerializedState,
234
238
  serializeVariablesEditorState: () => serializeVariablesEditorState,
235
239
  setVariablesEditorValue: () => setVariablesEditorValue,
236
240
  urlEncodeRequestParameter: () => urlEncodeRequestParameter,
@@ -252,7 +256,7 @@ __export(src_exports, {
252
256
  useVariableEditor: () => useVariableEditor,
253
257
  useVariables: () => useVariables,
254
258
  useVariablesMenu: () => useVariablesMenu,
255
- utilityColors: () => import_design_system54.utilityColors,
259
+ utilityColors: () => import_design_system66.utilityColors,
256
260
  variableDefaultTextValue: () => variableDefaultTextValue,
257
261
  variablePrefix: () => variablePrefix,
258
262
  variableSuffix: () => variableSuffix,
@@ -1223,7 +1227,8 @@ var searchRowContainer = import_react8.css`
1223
1227
  cursor: pointer;
1224
1228
  padding: var(--spacing-sm);
1225
1229
  position: relative;
1226
- transition: background-color var(--duration-fast) var(--timing-ease-out),
1230
+ transition:
1231
+ background-color var(--duration-fast) var(--timing-ease-out),
1227
1232
  color var(--duration-fast) var(--timing-ease-out);
1228
1233
  `;
1229
1234
  var searchRowContainerWithPopover = import_react8.css`
@@ -1898,8 +1903,7 @@ var EntrySearch = ({
1898
1903
  const handleCancelClick = (e) => {
1899
1904
  e.preventDefault();
1900
1905
  setListOpen(false);
1901
- if (onCancel)
1902
- onCancel();
1906
+ if (onCancel) onCancel();
1903
1907
  };
1904
1908
  const handleLoadMoreClick = () => {
1905
1909
  search(textInput, {
@@ -2204,7 +2208,8 @@ var productSearchRowContainer = import_react18.css`
2204
2208
  padding: var(--spacing-sm) 0;
2205
2209
  margin-right: var(--spacing-sm);
2206
2210
  position: relative;
2207
- transition: background-color var(--duration-fast) var(--timing-ease-out),
2211
+ transition:
2212
+ background-color var(--duration-fast) var(--timing-ease-out),
2208
2213
  color var(--duration-fast) var(--timing-ease-out);
2209
2214
  `;
2210
2215
  var productSearchRowContent = import_react18.css`
@@ -3043,18 +3048,55 @@ var import_design_system14 = require("@uniformdev/design-system");
3043
3048
 
3044
3049
  // src/components/Variables/composer/ControlledValuePlugin.tsx
3045
3050
  var import_LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
3046
- var import_lite = require("dequal/lite");
3047
3051
  var import_react31 = require("react");
3048
3052
 
3049
- // src/components/Variables/util/deserializeVariablesEditorState.ts
3053
+ // src/components/Variables/util/serializeVariablesEditorState.ts
3050
3054
  var import_canvas2 = require("@uniformdev/canvas");
3051
3055
  var import_lexical = require("lexical");
3056
+
3057
+ // src/components/Variables/util/variableExpression.ts
3058
+ var variablePrefix = "${";
3059
+ var variableSuffix = "}";
3060
+
3061
+ // src/components/Variables/util/serializeVariablesEditorState.ts
3062
+ function serializeVariablesEditorState(editorState) {
3063
+ return serializeVariablesEditorSerializedState(editorState.toJSON().root);
3064
+ }
3065
+ function serializeVariablesEditorSerializedState(serializedEditorState) {
3066
+ const buf = [];
3067
+ serializeRecursive(serializedEditorState, buf);
3068
+ const result = buf.join("");
3069
+ return result.length > 0 ? result : void 0;
3070
+ }
3071
+ function serializeRecursive(node, buffer) {
3072
+ if (node.type === import_lexical.TextNode.getType()) {
3073
+ buffer.push(node.text.replace(variablePrefix, "\\${"));
3074
+ }
3075
+ if (node.type === VariableNode.getType()) {
3076
+ buffer.push((0, import_canvas2.createVariableReference)(node.reference));
3077
+ }
3078
+ if (node.type === import_lexical.LineBreakNode.getType()) {
3079
+ buffer.push("\n");
3080
+ }
3081
+ if ("children" in node && node.children) {
3082
+ for (const child of node.children) {
3083
+ serializeRecursive(child, buffer);
3084
+ }
3085
+ }
3086
+ }
3087
+
3088
+ // src/components/Variables/util/setVariablesEditorValue.ts
3089
+ var import_richtext = require("@uniformdev/richtext");
3090
+
3091
+ // src/components/Variables/util/deserializeVariablesEditorState.ts
3092
+ var import_canvas3 = require("@uniformdev/canvas");
3093
+ var import_lexical2 = require("lexical");
3052
3094
  function deserializeVariablesEditorState(serialized) {
3053
3095
  const result = [];
3054
- (0, import_canvas2.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
3096
+ (0, import_canvas3.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
3055
3097
  if (type === "text") {
3056
3098
  const node = {
3057
- type: import_lexical.TextNode.getType(),
3099
+ type: import_lexical2.TextNode.getType(),
3058
3100
  text: token,
3059
3101
  mode: "normal",
3060
3102
  version: 1,
@@ -3096,11 +3138,11 @@ function deserializeVariablesEditorState(serialized) {
3096
3138
  }
3097
3139
 
3098
3140
  // src/components/Variables/util/refreshVariableNodeMetadata.ts
3099
- var import_lexical2 = require("lexical");
3141
+ var import_lexical3 = require("lexical");
3100
3142
  function refreshVariableNodeMetadata(editor) {
3101
3143
  setTimeout(() => {
3102
3144
  editor.update(() => {
3103
- (0, import_lexical2.$nodesOfType)(VariableNode).forEach((variableNode) => {
3145
+ (0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
3104
3146
  variableNode.markDirty();
3105
3147
  });
3106
3148
  });
@@ -3108,14 +3150,18 @@ function refreshVariableNodeMetadata(editor) {
3108
3150
  }
3109
3151
 
3110
3152
  // src/components/Variables/util/setVariablesEditorValue.ts
3111
- function setVariablesEditorValue(editor, newValue) {
3153
+ function setVariablesEditorValue(editor, newValue, tag) {
3112
3154
  if (typeof newValue === "undefined" || typeof newValue === "string") {
3113
3155
  const parsedState = editor.parseEditorState(deserializeVariablesEditorState(newValue));
3114
- editor.setEditorState(parsedState);
3156
+ editor.setEditorState(parsedState.clone(null), {
3157
+ tag
3158
+ });
3115
3159
  } else {
3116
3160
  try {
3117
3161
  const parsedState = editor.parseEditorState(newValue);
3118
- editor.setEditorState(parsedState);
3162
+ editor.setEditorState(parsedState.clone(null), {
3163
+ tag
3164
+ });
3119
3165
  } catch (e) {
3120
3166
  console.warn(
3121
3167
  "Tried to set invalid Lexical state, probably invalidly formatted state object - falling back to empty state. Invalid state attempted:",
@@ -3123,26 +3169,10 @@ function setVariablesEditorValue(editor, newValue) {
3123
3169
  "Error:",
3124
3170
  e
3125
3171
  );
3126
- const parsedState = editor.parseEditorState({
3127
- root: {
3128
- type: "root",
3129
- version: 1,
3130
- direction: null,
3131
- format: "",
3132
- indent: 0,
3133
- children: [
3134
- {
3135
- type: "paragraph",
3136
- version: 1,
3137
- format: "start",
3138
- indent: 0,
3139
- direction: null,
3140
- children: []
3141
- }
3142
- ]
3143
- }
3172
+ const parsedState = editor.parseEditorState(import_richtext.emptyRichTextValue);
3173
+ editor.setEditorState(parsedState.clone(null), {
3174
+ tag
3144
3175
  });
3145
- editor.setEditorState(parsedState);
3146
3176
  }
3147
3177
  }
3148
3178
  refreshVariableNodeMetadata(editor);
@@ -3155,17 +3185,18 @@ function ControlledValuePlugin({
3155
3185
  extraDependencies
3156
3186
  }) {
3157
3187
  const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
3158
- const lastValueRef = (0, import_react31.useRef)(value);
3159
3188
  (0, import_react31.useEffect)(() => {
3189
+ var _a, _b;
3160
3190
  if (!enabled) {
3161
3191
  return;
3162
3192
  }
3163
- if ((0, import_lite.dequal)(lastValueRef.current, value)) {
3193
+ const currentValue = (_a = serializeVariablesEditorState(editor.getEditorState())) != null ? _a : "";
3194
+ const newValue = (_b = value !== void 0 && typeof value !== "string" ? serializeVariablesEditorSerializedState(value.root) : value) != null ? _b : "";
3195
+ if (currentValue === newValue) {
3164
3196
  return;
3165
3197
  }
3166
3198
  setTimeout(() => {
3167
3199
  if (editor) {
3168
- lastValueRef.current = value;
3169
3200
  setVariablesEditorValue(editor, value);
3170
3201
  }
3171
3202
  });
@@ -3173,22 +3204,6 @@ function ControlledValuePlugin({
3173
3204
  return null;
3174
3205
  }
3175
3206
 
3176
- // src/components/Variables/composer/VariableNode.tsx
3177
- var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
3178
- var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
3179
- var import_selection = require("@lexical/selection");
3180
- var import_utils2 = require("@lexical/utils");
3181
- var import_canvas4 = require("@uniformdev/canvas");
3182
- var import_design_system18 = require("@uniformdev/design-system");
3183
- var import_lexical4 = require("lexical");
3184
- var import_react40 = require("react");
3185
-
3186
- // src/components/Variables/util/prettifyBindExpression.tsx
3187
- function prettifyBindExpression(bindExpression) {
3188
- const [, expression] = bindExpression.split(":");
3189
- return expression;
3190
- }
3191
-
3192
3207
  // src/components/Variables/composer/VariableChip.tsx
3193
3208
  var import_design_system15 = require("@uniformdev/design-system");
3194
3209
  var import_react32 = require("react");
@@ -3202,12 +3217,13 @@ function VariableChip({
3202
3217
  clickToEdit,
3203
3218
  isFresh,
3204
3219
  selected,
3205
- disabled
3220
+ disabled,
3221
+ errorMessage = `${reference} is not defined.`
3206
3222
  }) {
3207
3223
  const hasClickEvent = !!onClick;
3208
3224
  const referenceIsValidFr = isFresh ? true : referenceIsValid;
3209
3225
  const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? import_react32.Fragment : UndefinedVariableReference;
3210
- const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
3226
+ const extraTitle = !referenceIsValidFr ? errorMessage : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
3211
3227
  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 }) });
3212
3228
  if (tooltip) {
3213
3229
  const tip = tooltip ? `${tooltip}${extraTitle ? `
@@ -3264,16 +3280,32 @@ function WarningVariableReference({ children }) {
3264
3280
  );
3265
3281
  }
3266
3282
 
3283
+ // src/components/Variables/composer/VariableNode.tsx
3284
+ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerContext");
3285
+ var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
3286
+ var import_selection = require("@lexical/selection");
3287
+ var import_utils2 = require("@lexical/utils");
3288
+ var import_canvas5 = require("@uniformdev/canvas");
3289
+ var import_design_system18 = require("@uniformdev/design-system");
3290
+ var import_lexical5 = require("lexical");
3291
+ var import_react40 = require("react");
3292
+
3293
+ // src/components/Variables/util/prettifyBindExpression.tsx
3294
+ function prettifyBindExpression(bindExpression) {
3295
+ const [, expression] = bindExpression.split(":");
3296
+ return expression;
3297
+ }
3298
+
3267
3299
  // src/components/Variables/composer/VariablesPlugin.tsx
3268
3300
  var import_react38 = require("@emotion/react");
3269
3301
  var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerContext");
3270
3302
  var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
3271
3303
  var import_utils = require("@lexical/utils");
3272
3304
  var import_AiFillPlusCircle = require("@react-icons/all-files/ai/AiFillPlusCircle");
3273
- var import_canvas3 = require("@uniformdev/canvas");
3305
+ var import_canvas4 = require("@uniformdev/canvas");
3274
3306
  var import_design_system17 = require("@uniformdev/design-system");
3275
- var import_lite2 = require("dequal/lite");
3276
- var import_lexical3 = require("lexical");
3307
+ var import_lite = require("dequal/lite");
3308
+ var import_lexical4 = require("lexical");
3277
3309
  var import_react39 = require("react");
3278
3310
  var import_react_dom = require("react-dom");
3279
3311
 
@@ -3728,12 +3760,12 @@ function variablesToGroupedList(variables, filterFn, context) {
3728
3760
 
3729
3761
  // src/components/Variables/composer/VariablesPlugin.tsx
3730
3762
  var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
3731
- var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:open-insert-variable");
3732
- var EDIT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:edit-variable");
3733
- var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)(
3763
+ var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:open-insert-variable");
3764
+ var EDIT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:edit-variable");
3765
+ var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)(
3734
3766
  "uniform:disconnect-variable"
3735
3767
  );
3736
- var INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:insert-variable");
3768
+ var INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:insert-variable");
3737
3769
  var TRIGGER = "\\$\\$";
3738
3770
  var LENGTH_LIMIT = 20;
3739
3771
  var DollarSignVariablesRegex = new RegExp(`(^.*)(${TRIGGER}(.{0,${LENGTH_LIMIT}}))$`);
@@ -3803,7 +3835,7 @@ function useVariablesMenu({
3803
3835
  var _a;
3804
3836
  const targetVariable = variables[value];
3805
3837
  if (overwriteExistingValue) {
3806
- setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(value));
3838
+ setVariablesEditorValue(editor, (0, import_canvas4.createVariableReference)(value));
3807
3839
  return true;
3808
3840
  }
3809
3841
  const variableNode = $createVariableNode(value, {
@@ -3817,7 +3849,7 @@ function useVariablesMenu({
3817
3849
  if (nodeToReplace) {
3818
3850
  nodeToReplace.replace(variableNode);
3819
3851
  } else {
3820
- (0, import_lexical3.$insertNodes)([variableNode]);
3852
+ (0, import_lexical4.$insertNodes)([variableNode]);
3821
3853
  }
3822
3854
  });
3823
3855
  }
@@ -3900,11 +3932,11 @@ function VariablesPlugin({
3900
3932
  return;
3901
3933
  }
3902
3934
  editor.update(() => {
3903
- const selection = (0, import_lexical3.$getSelection)();
3904
- if ((0, import_lexical3.$isNodeSelection)(selection)) {
3935
+ const selection = (0, import_lexical4.$getSelection)();
3936
+ if ((0, import_lexical4.$isNodeSelection)(selection)) {
3905
3937
  const selectedNodes = selection.getNodes();
3906
3938
  if (selectedNodes.every((node) => $isVariableNode(node))) {
3907
- (0, import_lexical3.$setSelection)(null);
3939
+ (0, import_lexical4.$setSelection)(null);
3908
3940
  }
3909
3941
  }
3910
3942
  });
@@ -3920,7 +3952,7 @@ function VariablesPlugin({
3920
3952
  }
3921
3953
  return true;
3922
3954
  },
3923
- import_lexical3.COMMAND_PRIORITY_NORMAL
3955
+ import_lexical4.COMMAND_PRIORITY_NORMAL
3924
3956
  ),
3925
3957
  // disconnects a variable node from its variable value and leaves the variable's default value
3926
3958
  // as a string literal in its place. Note that single-valued binding UIs override this so that it
@@ -3930,17 +3962,17 @@ function VariablesPlugin({
3930
3962
  ({ sourceKey }) => {
3931
3963
  editor.update(() => {
3932
3964
  var _a;
3933
- const currentNode = (0, import_lexical3.$getNodeByKey)(sourceKey);
3965
+ const currentNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
3934
3966
  if (!$isVariableNode(currentNode)) {
3935
3967
  throw new Error("Cannot disconnect a non-variable node");
3936
3968
  }
3937
3969
  const currentVariableDefinition = variablesRef.current.variables[currentNode.reference];
3938
- const variableTextNode = (0, import_lexical3.$createTextNode)(
3970
+ const variableTextNode = (0, import_lexical4.$createTextNode)(
3939
3971
  variableDefaultTextValue(
3940
3972
  (_a = currentVariableDefinition == null ? void 0 : currentVariableDefinition.default) != null ? _a : currentNode.getState().displayName
3941
3973
  )
3942
3974
  );
3943
- const variableNode = (0, import_lexical3.$getNodeByKey)(sourceKey);
3975
+ const variableNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
3944
3976
  if (!variableNode) {
3945
3977
  console.error("Disconnected from unknown node.");
3946
3978
  return true;
@@ -3950,7 +3982,7 @@ function VariablesPlugin({
3950
3982
  });
3951
3983
  return true;
3952
3984
  },
3953
- import_lexical3.COMMAND_PRIORITY_NORMAL
3985
+ import_lexical4.COMMAND_PRIORITY_NORMAL
3954
3986
  ),
3955
3987
  editor.registerCommand(
3956
3988
  OPEN_INSERT_VARIABLE_COMMAND,
@@ -3970,7 +4002,7 @@ function VariablesPlugin({
3970
4002
  }
3971
4003
  return true;
3972
4004
  },
3973
- import_lexical3.COMMAND_PRIORITY_NORMAL
4005
+ import_lexical4.COMMAND_PRIORITY_NORMAL
3974
4006
  ),
3975
4007
  // register the insert variable command, used to handle inserting
3976
4008
  // a variable reference from non-autocomplete menus at the current selection,
@@ -3981,27 +4013,33 @@ function VariablesPlugin({
3981
4013
  var _a, _b;
3982
4014
  if (!disableVariables) {
3983
4015
  const targetVariable = variablesRef.current.variables[reference];
3984
- if (overwriteExistingValue) {
3985
- setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(reference));
3986
- return true;
3987
- }
3988
4016
  const variableNode = $createVariableNode(reference, {
3989
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
4017
+ displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
3990
4018
  hasClickEvent: canEditVariable(reference, targetVariable),
3991
4019
  referenceIsValid: true,
3992
4020
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
3993
4021
  isFresh: true,
3994
4022
  isLoading: false
3995
4023
  });
4024
+ if (overwriteExistingValue) {
4025
+ const pNode = (0, import_lexical4.$createParagraphNode)();
4026
+ pNode.append(variableNode);
4027
+ editor.update(() => {
4028
+ const root = (0, import_lexical4.$getRoot)();
4029
+ root.clear();
4030
+ root.append(pNode);
4031
+ });
4032
+ return true;
4033
+ }
3996
4034
  if (targetKey) {
3997
- (_b = (0, import_lexical3.$getNodeByKey)(targetKey)) == null ? void 0 : _b.replace(variableNode);
4035
+ (_b = (0, import_lexical4.$getNodeByKey)(targetKey)) == null ? void 0 : _b.replace(variableNode);
3998
4036
  } else {
3999
- (0, import_lexical3.$insertNodes)([variableNode]);
4037
+ (0, import_lexical4.$insertNodes)([variableNode]);
4000
4038
  }
4001
4039
  }
4002
4040
  return true;
4003
4041
  },
4004
- import_lexical3.COMMAND_PRIORITY_NORMAL
4042
+ import_lexical4.COMMAND_PRIORITY_NORMAL
4005
4043
  )
4006
4044
  );
4007
4045
  }, [
@@ -4028,14 +4066,14 @@ function VariablesPlugin({
4028
4066
  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;
4029
4067
  const newState = {
4030
4068
  ...currentState,
4031
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
4069
+ displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
4032
4070
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
4033
4071
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
4034
4072
  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),
4035
4073
  tooltip,
4036
4074
  isFresh: false
4037
4075
  };
4038
- if (!(0, import_lite2.dequal)(currentState, newState)) {
4076
+ if (!(0, import_lite.dequal)(currentState, newState)) {
4039
4077
  variableNode.setState(newState);
4040
4078
  }
4041
4079
  },
@@ -4043,7 +4081,7 @@ function VariablesPlugin({
4043
4081
  );
4044
4082
  (0, import_react39.useEffect)(() => {
4045
4083
  editor.update(() => {
4046
- (0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
4084
+ (0, import_lexical4.$nodesOfType)(VariableNode).forEach((variableNode) => {
4047
4085
  updateExistingNodeIfChanged(variableNode);
4048
4086
  });
4049
4087
  });
@@ -4133,7 +4171,7 @@ function VariablesPlugin({
4133
4171
 
4134
4172
  // src/components/Variables/composer/VariableNode.tsx
4135
4173
  var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
4136
- var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
4174
+ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
4137
4175
  constructor(reference, state, key) {
4138
4176
  super(key);
4139
4177
  this.reference = reference;
@@ -4182,7 +4220,7 @@ var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
4182
4220
  * (albeit it won't get the fancy chip-node)
4183
4221
  */
4184
4222
  getTextContent() {
4185
- return (0, import_canvas4.createVariableReference)(this.reference);
4223
+ return (0, import_canvas5.createVariableReference)(this.reference);
4186
4224
  }
4187
4225
  /** Creates the DOM wrapper that hosts the node */
4188
4226
  createDOM() {
@@ -4216,9 +4254,9 @@ function VariableNodeComponent({
4216
4254
  const readOnly = !editor.isEditable();
4217
4255
  const onDelete = (0, import_react40.useCallback)(
4218
4256
  (event) => {
4219
- if (isSelected && (0, import_lexical4.$isNodeSelection)((0, import_lexical4.$getSelection)())) {
4257
+ if (isSelected && (0, import_lexical5.$isNodeSelection)((0, import_lexical5.$getSelection)())) {
4220
4258
  event.preventDefault();
4221
- const node = (0, import_lexical4.$getNodeByKey)(nodeKey);
4259
+ const node = (0, import_lexical5.$getNodeByKey)(nodeKey);
4222
4260
  if ($isVariableNode(node)) {
4223
4261
  node.remove();
4224
4262
  }
@@ -4229,18 +4267,18 @@ function VariableNodeComponent({
4229
4267
  );
4230
4268
  (0, import_react40.useEffect)(() => {
4231
4269
  return (0, import_utils2.mergeRegister)(
4232
- editor.registerCommand(import_lexical4.KEY_DELETE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
4233
- editor.registerCommand(import_lexical4.KEY_BACKSPACE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
4270
+ editor.registerCommand(import_lexical5.KEY_DELETE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
4271
+ editor.registerCommand(import_lexical5.KEY_BACKSPACE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
4234
4272
  // HACK: see https://github.com/facebook/lexical/issues/4214
4235
4273
  // Copied from https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L775
4236
4274
  // Fixes selection moving into and out of this node with arrow keys and plain text plugin.
4237
4275
  // If the above bug is fixed this may be removable. It's been tested when this is used within the RTE,
4238
4276
  // and seems to work ok there. It should also unregister itself when not in the context of the node. I think?
4239
4277
  editor.registerCommand(
4240
- import_lexical4.KEY_ARROW_LEFT_COMMAND,
4278
+ import_lexical5.KEY_ARROW_LEFT_COMMAND,
4241
4279
  (event) => {
4242
- const selection = (0, import_lexical4.$getSelection)();
4243
- if ((0, import_lexical4.$isNodeSelection)(selection)) {
4280
+ const selection = (0, import_lexical5.$getSelection)();
4281
+ if ((0, import_lexical5.$isNodeSelection)(selection)) {
4244
4282
  const nodes = selection.getNodes();
4245
4283
  if (nodes.length > 0) {
4246
4284
  event.preventDefault();
@@ -4248,7 +4286,7 @@ function VariableNodeComponent({
4248
4286
  return true;
4249
4287
  }
4250
4288
  }
4251
- if (!(0, import_lexical4.$isRangeSelection)(selection)) {
4289
+ if (!(0, import_lexical5.$isRangeSelection)(selection)) {
4252
4290
  return false;
4253
4291
  }
4254
4292
  if ((0, import_selection.$shouldOverrideDefaultCharacterSelection)(selection, true)) {
@@ -4259,15 +4297,15 @@ function VariableNodeComponent({
4259
4297
  }
4260
4298
  return false;
4261
4299
  },
4262
- import_lexical4.COMMAND_PRIORITY_EDITOR
4300
+ import_lexical5.COMMAND_PRIORITY_EDITOR
4263
4301
  ),
4264
4302
  // HACK: as above
4265
4303
  // Source: https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L802C5-L831C7
4266
4304
  editor.registerCommand(
4267
- import_lexical4.KEY_ARROW_RIGHT_COMMAND,
4305
+ import_lexical5.KEY_ARROW_RIGHT_COMMAND,
4268
4306
  (event) => {
4269
- const selection = (0, import_lexical4.$getSelection)();
4270
- if ((0, import_lexical4.$isNodeSelection)(selection) && !$isTargetWithinDecorator(event.target)) {
4307
+ const selection = (0, import_lexical5.$getSelection)();
4308
+ if ((0, import_lexical5.$isNodeSelection)(selection) && !$isTargetWithinDecorator(event.target)) {
4271
4309
  const nodes = selection.getNodes();
4272
4310
  if (nodes.length > 0) {
4273
4311
  event.preventDefault();
@@ -4275,7 +4313,7 @@ function VariableNodeComponent({
4275
4313
  return true;
4276
4314
  }
4277
4315
  }
4278
- if (!(0, import_lexical4.$isRangeSelection)(selection)) {
4316
+ if (!(0, import_lexical5.$isRangeSelection)(selection)) {
4279
4317
  return false;
4280
4318
  }
4281
4319
  const isHoldingShift = event.shiftKey;
@@ -4286,7 +4324,7 @@ function VariableNodeComponent({
4286
4324
  }
4287
4325
  return false;
4288
4326
  },
4289
- import_lexical4.COMMAND_PRIORITY_EDITOR
4327
+ import_lexical5.COMMAND_PRIORITY_EDITOR
4290
4328
  )
4291
4329
  );
4292
4330
  }, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
@@ -4310,8 +4348,8 @@ function VariableNodeComponent({
4310
4348
  );
4311
4349
  }
4312
4350
  function $isTargetWithinDecorator(target) {
4313
- const node = (0, import_lexical4.$getNearestNodeFromDOMNode)(target);
4314
- return (0, import_lexical4.$isDecoratorNode)(node);
4351
+ const node = (0, import_lexical5.$getNearestNodeFromDOMNode)(target);
4352
+ return (0, import_lexical5.$isDecoratorNode)(node);
4315
4353
  }
4316
4354
 
4317
4355
  // src/components/Variables/InputVariables.tsx
@@ -4337,19 +4375,19 @@ function EditorRefPlugin({
4337
4375
  // src/components/Variables/composer/PasteTransformerPlugin.tsx
4338
4376
  var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
4339
4377
  var import_utils3 = require("@lexical/utils");
4340
- var import_lexical5 = require("lexical");
4378
+ var import_lexical6 = require("lexical");
4341
4379
  var import_react41 = require("react");
4342
4380
  function PasteTransformerPlugin({ transformPaste }) {
4343
4381
  const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
4344
4382
  (0, import_react41.useEffect)(() => {
4345
4383
  return (0, import_utils3.mergeRegister)(
4346
4384
  editor.registerCommand(
4347
- import_lexical5.PASTE_COMMAND,
4385
+ import_lexical6.PASTE_COMMAND,
4348
4386
  (event) => {
4349
4387
  var _a;
4350
- const selection = (0, import_lexical5.$getSelection)();
4388
+ const selection = (0, import_lexical6.$getSelection)();
4351
4389
  const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
4352
- if (pastedText && transformPaste && (0, import_lexical5.$isRangeSelection)(selection)) {
4390
+ if (pastedText && transformPaste && (0, import_lexical6.$isRangeSelection)(selection)) {
4353
4391
  const result = transformPaste(pastedText);
4354
4392
  if (result !== void 0) {
4355
4393
  selection.insertText(result);
@@ -4358,7 +4396,7 @@ function PasteTransformerPlugin({ transformPaste }) {
4358
4396
  }
4359
4397
  return false;
4360
4398
  },
4361
- import_lexical5.COMMAND_PRIORITY_HIGH
4399
+ import_lexical6.COMMAND_PRIORITY_HIGH
4362
4400
  )
4363
4401
  );
4364
4402
  }, [editor, transformPaste]);
@@ -4387,9 +4425,11 @@ var input = import_react42.css`
4387
4425
  min-height: 50px;
4388
4426
  width: 100%;
4389
4427
  position: relative;
4390
- transition: background var(--duration-fast) var(--timing-ease-out),
4428
+ transition:
4429
+ background var(--duration-fast) var(--timing-ease-out),
4391
4430
  border-color var(--duration-fast) var(--timing-ease-out),
4392
- color var(--duration-fast) var(--timing-ease-out), box-shadow var(--duration-fast) var(--timing-ease-out);
4431
+ color var(--duration-fast) var(--timing-ease-out),
4432
+ box-shadow var(--duration-fast) var(--timing-ease-out);
4393
4433
 
4394
4434
  &::placeholder {
4395
4435
  color: var(--gray-400);
@@ -4453,7 +4493,8 @@ var variableBindButton = import_react43.css`
4453
4493
  display: flex;
4454
4494
  height: 1.2rem;
4455
4495
  padding: var(--spacing-2xs);
4456
- transition: background var(--duration-fast) var(--timing-ease-out),
4496
+ transition:
4497
+ background var(--duration-fast) var(--timing-ease-out),
4457
4498
  color var(--duration-fast) var(--timing-ease-out);
4458
4499
  width: 1.2rem;
4459
4500
 
@@ -4536,23 +4577,9 @@ var inputMultiLine = (lines) => import_react43.css`
4536
4577
  `;
4537
4578
 
4538
4579
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
4580
+ var import_canvas6 = require("@uniformdev/canvas");
4539
4581
  var React10 = __toESM(require("react"));
4540
4582
  var import_react44 = require("react");
4541
-
4542
- // src/components/Variables/util/hasReferencedVariables.ts
4543
- var import_canvas5 = require("@uniformdev/canvas");
4544
- function hasReferencedVariables(value) {
4545
- let result = false;
4546
- (0, import_canvas5.parseVariableExpression)(value, (token, type) => {
4547
- if (type === "variable") {
4548
- result = true;
4549
- return false;
4550
- }
4551
- });
4552
- return result;
4553
- }
4554
-
4555
- // src/components/Variables/toolbox/InputVariablesProvider.tsx
4556
4583
  function useInputVariablesState({
4557
4584
  value,
4558
4585
  onChange,
@@ -4563,23 +4590,24 @@ function useInputVariablesState({
4563
4590
  valueToResetTo = void 0,
4564
4591
  menuTooltip,
4565
4592
  id,
4566
- filterVariable
4593
+ filterVariable,
4594
+ renderMenuInPortal
4567
4595
  }) {
4568
4596
  const { variables } = useVariables(true);
4569
- const hasVariablesInValue = hasReferencedVariables(value != null ? value : "");
4597
+ const variableReferenceCountInValue = (0, import_canvas6.hasReferencedVariables)(value != null ? value : "");
4570
4598
  const [lastKnownId] = React10.useState(id);
4571
- const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(hasVariablesInValue);
4599
+ const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
4572
4600
  React10.useEffect(() => {
4573
- if (hasVariablesInValue) {
4601
+ if (variableReferenceCountInValue) {
4574
4602
  setHadVariablesInValue(true);
4575
4603
  }
4576
- }, [hasVariablesInValue]);
4604
+ }, [variableReferenceCountInValue]);
4577
4605
  React10.useEffect(() => {
4578
4606
  if (id !== lastKnownId) {
4579
- setHadVariablesInValue(hasVariablesInValue);
4607
+ setHadVariablesInValue(variableReferenceCountInValue > 0);
4580
4608
  }
4581
- }, [hasVariablesInValue, id, lastKnownId]);
4582
- const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
4609
+ }, [variableReferenceCountInValue, id, lastKnownId]);
4610
+ const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
4583
4611
  const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
4584
4612
  const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
4585
4613
  const sharedMenuProps = (0, import_react44.useMemo)(
@@ -4591,7 +4619,8 @@ function useInputVariablesState({
4591
4619
  onChange(valueToResetTo);
4592
4620
  },
4593
4621
  getEditorContext,
4594
- filterVariable
4622
+ filterVariable,
4623
+ portal: renderMenuInPortal
4595
4624
  }),
4596
4625
  [
4597
4626
  disableResetForReals,
@@ -4600,13 +4629,14 @@ function useInputVariablesState({
4600
4629
  menuTooltip,
4601
4630
  onChange,
4602
4631
  showAddVariableMenuOption,
4603
- valueToResetTo
4632
+ valueToResetTo,
4633
+ renderMenuInPortal
4604
4634
  ]
4605
4635
  );
4606
4636
  return {
4607
4637
  sharedMenuProps,
4608
4638
  disableVariablesForReals,
4609
- hasVariablesInValue,
4639
+ hasVariablesInValue: variableReferenceCountInValue > 0,
4610
4640
  hadVariablesInValue: hadVariablesInValueForReals,
4611
4641
  setHadVariablesInValue
4612
4642
  };
@@ -4629,7 +4659,8 @@ var variableBindButton2 = import_react45.css`
4629
4659
  display: flex;
4630
4660
  height: 1.2rem;
4631
4661
  padding: var(--spacing-2xs);
4632
- transition: background var(--duration-fast) var(--timing-ease-out),
4662
+ transition:
4663
+ background var(--duration-fast) var(--timing-ease-out),
4633
4664
  color var(--duration-fast) var(--timing-ease-out);
4634
4665
  width: 1.2rem;
4635
4666
 
@@ -4647,7 +4678,7 @@ var variableBindButton2 = import_react45.css`
4647
4678
 
4648
4679
  // src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
4649
4680
  var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
4650
- var import_lexical6 = require("lexical");
4681
+ var import_lexical7 = require("lexical");
4651
4682
 
4652
4683
  // src/components/Variables/toolbox/SelectVariableMenu.tsx
4653
4684
  var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
@@ -4755,7 +4786,7 @@ function VariablesComposerVariableMenu(props) {
4755
4786
  };
4756
4787
  const onResetVariable = () => {
4757
4788
  var _a;
4758
- editor.dispatchCommand(import_lexical6.CLEAR_EDITOR_COMMAND, void 0);
4789
+ editor.dispatchCommand(import_lexical7.CLEAR_EDITOR_COMMAND, void 0);
4759
4790
  (_a = props.onResetVariables) == null ? void 0 : _a.call(props);
4760
4791
  };
4761
4792
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -4817,50 +4848,18 @@ function DisablePlugin({ disabled }) {
4817
4848
 
4818
4849
  // src/components/Variables/composer/SingleLineTextPlugin.tsx
4819
4850
  var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
4820
- var import_lexical7 = require("lexical");
4851
+ var import_lexical8 = require("lexical");
4821
4852
  var import_react48 = require("react");
4822
4853
  function SingleLineTextPlugin() {
4823
4854
  const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
4824
4855
  (0, import_react48.useEffect)(() => {
4825
- editor.registerNodeTransform(import_lexical7.LineBreakNode, (node) => {
4856
+ editor.registerNodeTransform(import_lexical8.LineBreakNode, (node) => {
4826
4857
  node.remove();
4827
4858
  });
4828
4859
  }, [editor]);
4829
4860
  return null;
4830
4861
  }
4831
4862
 
4832
- // src/components/Variables/util/serializeVariablesEditorState.ts
4833
- var import_canvas6 = require("@uniformdev/canvas");
4834
- var import_lexical8 = require("lexical");
4835
-
4836
- // src/components/Variables/util/variableExpression.ts
4837
- var variablePrefix = "${";
4838
- var variableSuffix = "}";
4839
-
4840
- // src/components/Variables/util/serializeVariablesEditorState.ts
4841
- function serializeVariablesEditorState(editorState) {
4842
- const buf = [];
4843
- serializeRecursive(editorState.toJSON().root, buf);
4844
- const result = buf.join("");
4845
- return result.length > 0 ? result : void 0;
4846
- }
4847
- function serializeRecursive(node, buffer) {
4848
- if (node.type === import_lexical8.TextNode.getType()) {
4849
- buffer.push(node.text.replace(variablePrefix, "\\${"));
4850
- }
4851
- if (node.type === VariableNode.getType()) {
4852
- buffer.push((0, import_canvas6.createVariableReference)(node.reference));
4853
- }
4854
- if (node.type === import_lexical8.LineBreakNode.getType()) {
4855
- buffer.push("\n");
4856
- }
4857
- if ("children" in node && node.children) {
4858
- for (const child of node.children) {
4859
- serializeRecursive(child, buffer);
4860
- }
4861
- }
4862
- }
4863
-
4864
4863
  // src/components/Variables/toolbox/VariablesComposer.tsx
4865
4864
  var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
4866
4865
  function VariablesComposer(props) {
@@ -4889,8 +4888,7 @@ function VariablesComposer(props) {
4889
4888
  );
4890
4889
  const editorState = (0, import_react49.useRef)();
4891
4890
  const updateTimeout = (0, import_react49.useRef)();
4892
- if (typeof document === "undefined")
4893
- return null;
4891
+ if (typeof document === "undefined") return null;
4894
4892
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: editorConfig, children: [
4895
4893
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4896
4894
  import_LexicalOnChangePlugin.OnChangePlugin,
@@ -5056,7 +5054,8 @@ function InputVariables(props) {
5056
5054
  filterVariable,
5057
5055
  styleVariant = "default",
5058
5056
  renderMenuInPortal,
5059
- disableDismissEditorOnChange
5057
+ disableDismissEditorOnChange,
5058
+ singleTokenMode
5060
5059
  } = props;
5061
5060
  const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
5062
5061
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -5121,7 +5120,7 @@ function InputVariables(props) {
5121
5120
  buttonCss: variableBindButton,
5122
5121
  tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
5123
5122
  buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
5124
- replaceValueOnVariableInsert: useInputWithNoVariables
5123
+ replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
5125
5124
  }
5126
5125
  )
5127
5126
  ]
@@ -5161,13 +5160,13 @@ function InputVariables(props) {
5161
5160
  showAddVariableMenuOption,
5162
5161
  enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
5163
5162
  getEditorContext,
5164
- disabled,
5163
+ disabled: disabled || singleTokenMode,
5165
5164
  replaceValueOnVariableInsert: useInputWithNoVariables,
5166
5165
  autoFocus,
5167
5166
  filterVariable,
5168
5167
  children: [
5169
5168
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PasteTransformerPlugin, { transformPaste }),
5170
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
5169
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
5171
5170
  editorRef ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorRefPlugin, { editorRef }) : null,
5172
5171
  body
5173
5172
  ]
@@ -5210,7 +5209,8 @@ function ParameterConnectionIndicator({
5210
5209
  menuOptions,
5211
5210
  disabled,
5212
5211
  menuTooltip = "Insert variable",
5213
- overrideMenuButtonParentMargin
5212
+ overrideMenuButtonParentMargin,
5213
+ renderMenuInPortal = false
5214
5214
  }) {
5215
5215
  const hasVariablesInValue = (0, import_react53.useMemo)(() => {
5216
5216
  let result = false;
@@ -5224,12 +5224,12 @@ function ParameterConnectionIndicator({
5224
5224
  return result;
5225
5225
  }, [value]);
5226
5226
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5227
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: { flex: 1 }, children }),
5227
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: { flex: 1, maxWidth: "100%" }, children }),
5228
5228
  disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5229
5229
  import_design_system22.Menu,
5230
5230
  {
5231
5231
  placement: "bottom-start",
5232
- withoutPortal: true,
5232
+ withoutPortal: !renderMenuInPortal,
5233
5233
  menuTrigger: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5234
5234
  "div",
5235
5235
  {
@@ -5343,7 +5343,7 @@ function ParameterOrSingleVariable(props) {
5343
5343
  editorRef ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(EditorRefPlugin, { editorRef }) : null,
5344
5344
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ControlledValuePlugin, { enabled: true, value }),
5345
5345
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system23.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5346
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5346
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { css: { flex: 1, minWidth: "0" }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5347
5347
  VariablesComposerInput,
5348
5348
  {
5349
5349
  "data-text-value": value,
@@ -5462,6 +5462,12 @@ ${prettifyBindExpression(bindExpression)}`
5462
5462
  };
5463
5463
  }
5464
5464
 
5465
+ // src/components/Variables/util/hasReferencedVariables.ts
5466
+ var import_canvas8 = require("@uniformdev/canvas");
5467
+ function hasReferencedVariables2(value) {
5468
+ return (0, import_canvas8.hasReferencedVariables)(value) > 0;
5469
+ }
5470
+
5465
5471
  // src/components/Variables/VariablesList.tsx
5466
5472
  var import_react58 = require("@emotion/react");
5467
5473
  var import_design_system25 = require("@uniformdev/design-system");
@@ -6494,12 +6500,12 @@ var DataRefreshButton = ({
6494
6500
 
6495
6501
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
6496
6502
  var import_react72 = require("@emotion/react");
6497
- var import_canvas9 = require("@uniformdev/canvas");
6503
+ var import_canvas10 = require("@uniformdev/canvas");
6498
6504
  var import_design_system38 = require("@uniformdev/design-system");
6499
6505
  var import_react73 = __toESM(require("react"));
6500
6506
 
6501
6507
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
6502
- var import_canvas8 = require("@uniformdev/canvas");
6508
+ var import_canvas9 = require("@uniformdev/canvas");
6503
6509
  var import_react67 = require("react");
6504
6510
  var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
6505
6511
  var ObjectSearchContext = (0, import_react67.createContext)({
@@ -6596,7 +6602,7 @@ function useObjectSearchContext() {
6596
6602
  return (0, import_react67.useContext)(ObjectSearchContext);
6597
6603
  }
6598
6604
  function bindQuery(query, inputs) {
6599
- const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
6605
+ const { result, errors } = (0, import_canvas9.bindVariablesToObject)({
6600
6606
  value: query,
6601
6607
  variables: inputs,
6602
6608
  errorPrefix: "Dynamic input"
@@ -6769,7 +6775,8 @@ var ButtonStyles = import_react69.css`
6769
6775
  font-size: var(--fs-sm);
6770
6776
  line-height: 1;
6771
6777
  gap: var(--spacing-xs);
6772
- transition: border-color var(--duration-fast) var(--timing-ease-out),
6778
+ transition:
6779
+ border-color var(--duration-fast) var(--timing-ease-out),
6773
6780
  background-color var(--duration-fast) var(--timing-ease-out);
6774
6781
 
6775
6782
  &:hover {
@@ -7071,7 +7078,7 @@ var ObjectSearchContainer = ({
7071
7078
  const { flatVariables } = useVariables(true);
7072
7079
  const inputValue = (_b = dynamicEntryId != null ? dynamicEntryId : (_a = selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
7073
7080
  const isDynamicEntryIdAvailable = import_react73.default.useMemo(
7074
- () => Boolean(inputValue && hasReferencedVariables(inputValue)),
7081
+ () => Boolean(inputValue && hasReferencedVariables2(inputValue)),
7075
7082
  [inputValue]
7076
7083
  );
7077
7084
  const listItems = resultList != null ? resultList : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
@@ -7093,7 +7100,7 @@ var ObjectSearchContainer = ({
7093
7100
  onSelectItem([]);
7094
7101
  return;
7095
7102
  }
7096
- const { result, errors } = (0, import_canvas9.bindVariables)({
7103
+ const { result, errors } = (0, import_canvas10.bindVariables)({
7097
7104
  value: selectedValue,
7098
7105
  variables: flatVariables,
7099
7106
  errorPrefix: "Dynamic input"
@@ -7113,7 +7120,7 @@ var ObjectSearchContainer = ({
7113
7120
  id: selectedValue
7114
7121
  }
7115
7122
  ]);
7116
- if (hasReferencedVariables(selectedValue)) {
7123
+ if (hasReferencedVariables2(selectedValue)) {
7117
7124
  onSetQuery({ ...query, dynamicEntryId: selectedValue });
7118
7125
  }
7119
7126
  };
@@ -7167,7 +7174,7 @@ function createLocationValidator(setValue, validate) {
7167
7174
  }
7168
7175
 
7169
7176
  // src/utils/useContentDataResourceLocaleInfo.ts
7170
- var import_canvas10 = require("@uniformdev/canvas");
7177
+ var import_canvas11 = require("@uniformdev/canvas");
7171
7178
  var import_react74 = require("react");
7172
7179
  function useContentDataResourceLocaleInfo({
7173
7180
  locale,
@@ -7178,11 +7185,11 @@ function useContentDataResourceLocaleInfo({
7178
7185
  const setLocaleRef = (0, import_react74.useRef)(setLocale);
7179
7186
  setLocaleRef.current = setLocale;
7180
7187
  const { flatVariables } = useVariables();
7181
- const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
7182
- const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
7188
+ const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas11.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas11.createVariableReference)(import_canvas11.LOCALE_DYNAMIC_INPUT_NAME) : "";
7189
+ const boundLocale = (_a = (0, import_canvas11.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
7183
7190
  (0, import_react74.useEffect)(() => {
7184
7191
  if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
7185
- setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
7192
+ setLocaleRef.current((0, import_canvas11.createVariableReference)(import_canvas11.LOCALE_DYNAMIC_INPUT_NAME));
7186
7193
  }
7187
7194
  }, [locale, effectiveLocale]);
7188
7195
  return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
@@ -7542,13 +7549,15 @@ var ControlledObjectSearchProvider = ({
7542
7549
  );
7543
7550
  const onSelectItem = (0, import_react78.useCallback)(
7544
7551
  (selectedResult) => {
7545
- var _a2;
7552
+ var _a2, _b2;
7546
7553
  if (Array.isArray(selectedResult)) {
7547
7554
  innerSelectedItems.current = selectedResult;
7548
7555
  onSelectItemsChange(selectedResult);
7549
7556
  } else {
7550
- const itemIsAlreadySelected = selectedItems == null ? void 0 : selectedItems.some((item) => item.id === selectedResult.id);
7551
- const updatedSelectedItems = itemIsAlreadySelected ? (_a2 = selectedItems == null ? void 0 : selectedItems.filter((item) => item.id !== selectedResult.id)) != null ? _a2 : [] : [...selectedItems != null ? selectedItems : [], selectedResult];
7557
+ const itemIsAlreadySelected = (_a2 = selectedItems != null ? selectedItems : innerSelectedItems.current) == null ? void 0 : _a2.some(
7558
+ (item) => item.id === selectedResult.id
7559
+ );
7560
+ const updatedSelectedItems = itemIsAlreadySelected ? (_b2 = selectedItems == null ? void 0 : selectedItems.filter((item) => item.id !== selectedResult.id)) != null ? _b2 : [] : [...selectedItems != null ? selectedItems : [], selectedResult];
7552
7561
  innerSelectedItems.current = updatedSelectedItems;
7553
7562
  onSelectItemsChange(updatedSelectedItems);
7554
7563
  }
@@ -7561,6 +7570,13 @@ var ControlledObjectSearchProvider = ({
7561
7570
  }, [onSelectItemsChange]);
7562
7571
  const list = (0, import_react78.useMemo)(() => ({ items: searchResultItems }), [searchResultItems]);
7563
7572
  const boundQuery = (0, import_react78.useMemo)(() => bindQuery(query, flatVariables), [query, flatVariables]);
7573
+ const flatLocaleOptions = (0, import_react78.useMemo)(
7574
+ () => {
7575
+ var _a2;
7576
+ return (_a2 = localeOptions == null ? void 0 : localeOptions.flatMap((option) => "type" in option && option.type === "group" ? option.options : option).filter((v) => !Array.isArray(v))) != null ? _a2 : [];
7577
+ },
7578
+ [localeOptions]
7579
+ );
7564
7580
  const isLoadingInitially = Boolean(
7565
7581
  isManualSelection ? !((_a = innerSelectedItems.current) == null ? void 0 : _a.length) && selectedItemsLoading : selectedItemsLoading
7566
7582
  );
@@ -7578,7 +7594,7 @@ var ControlledObjectSearchProvider = ({
7578
7594
  isSelectedItemsListLoading: isLoadingInitially,
7579
7595
  isListLoading: searchResultListLoading,
7580
7596
  isMulti,
7581
- localeOptions,
7597
+ localeOptions: flatLocaleOptions,
7582
7598
  enableFilterByLocale,
7583
7599
  dynamicEntryId
7584
7600
  },
@@ -7644,669 +7660,868 @@ var JsonMeshVariableEditor = ({
7644
7660
  var NUMBER_OPERATORS = [
7645
7661
  {
7646
7662
  label: "equals...",
7647
- symbol: "=",
7648
7663
  value: "eq",
7649
- editorType: "number"
7664
+ editorType: "number",
7665
+ expectedValueType: "single"
7650
7666
  },
7651
7667
  {
7652
7668
  label: "does not equal...",
7653
- symbol: "\u2260",
7654
7669
  value: "neq",
7655
- editorType: "number"
7670
+ editorType: "number",
7671
+ expectedValueType: "single"
7656
7672
  },
7657
7673
  {
7658
7674
  label: "greater than...",
7659
- symbol: ">",
7660
7675
  value: "gt",
7661
- editorType: "number"
7676
+ editorType: "number",
7677
+ expectedValueType: "single"
7662
7678
  },
7663
7679
  {
7664
7680
  label: "greater than or equal to...",
7665
- symbol: "\u2265",
7666
7681
  value: "gte",
7667
- editorType: "number"
7682
+ editorType: "number",
7683
+ expectedValueType: "single"
7668
7684
  },
7669
7685
  {
7670
7686
  label: "less than...",
7671
- symbol: "<",
7672
7687
  value: "lt",
7673
- editorType: "number"
7688
+ editorType: "number",
7689
+ expectedValueType: "single"
7674
7690
  },
7675
7691
  {
7676
7692
  label: "less than or equal to...",
7677
- symbol: "\u2264",
7678
7693
  value: "lte",
7679
- editorType: "number"
7694
+ editorType: "number",
7695
+ expectedValueType: "single"
7680
7696
  },
7681
7697
  {
7682
7698
  label: "is empty",
7683
7699
  value: "ndef",
7684
- editorType: "empty"
7700
+ editorType: "empty",
7701
+ expectedValueType: "false"
7685
7702
  },
7686
7703
  {
7687
7704
  label: "is between...",
7688
7705
  value: "between",
7689
- editorType: "numberRange"
7706
+ editorType: "numberRange",
7707
+ expectedValueType: "between"
7690
7708
  },
7691
7709
  {
7692
7710
  label: "is not empty",
7693
7711
  value: "def",
7694
- editorType: "empty"
7712
+ editorType: "empty",
7713
+ expectedValueType: "true"
7695
7714
  }
7696
7715
  ];
7697
7716
  var DATE_OPERATORS = [
7698
7717
  {
7699
7718
  label: "is",
7700
7719
  value: "eq",
7701
- editorType: "date"
7720
+ editorType: "date",
7721
+ expectedValueType: "single"
7702
7722
  },
7703
7723
  {
7704
7724
  label: "is between...",
7705
7725
  value: "between",
7706
- editorType: "dateRange"
7726
+ editorType: "dateRange",
7727
+ expectedValueType: "between"
7707
7728
  },
7708
7729
  {
7709
7730
  label: "is before...",
7710
7731
  value: "lt",
7711
- editorType: "date"
7732
+ editorType: "date",
7733
+ expectedValueType: "single"
7712
7734
  },
7713
7735
  {
7714
7736
  label: "is after...",
7715
7737
  value: "gt",
7716
- editorType: "date"
7738
+ editorType: "date",
7739
+ expectedValueType: "single"
7717
7740
  },
7718
7741
  {
7719
7742
  label: "is on or before...",
7720
7743
  value: "lte",
7721
- editorType: "date"
7744
+ editorType: "date",
7745
+ expectedValueType: "single"
7722
7746
  },
7723
7747
  {
7724
7748
  label: "is on or after...",
7725
7749
  value: "gte",
7726
- editorType: "date"
7750
+ editorType: "date",
7751
+ expectedValueType: "single"
7727
7752
  },
7728
7753
  {
7729
7754
  label: "is empty",
7730
7755
  value: "ndef",
7731
- editorType: "empty"
7756
+ editorType: "empty",
7757
+ expectedValueType: "false"
7732
7758
  },
7733
7759
  {
7734
7760
  label: "is not",
7735
7761
  value: "neq",
7736
- editorType: "date"
7762
+ editorType: "date",
7763
+ expectedValueType: "single"
7737
7764
  },
7738
7765
  {
7739
7766
  label: "is not empty",
7740
7767
  value: "def",
7741
- editorType: "empty"
7768
+ editorType: "empty",
7769
+ expectedValueType: "true"
7742
7770
  }
7743
7771
  ];
7744
7772
  var TEXTBOX_OPERATORS = [
7745
7773
  {
7746
7774
  label: "contains...",
7747
7775
  value: "match",
7748
- editorType: "text"
7776
+ editorType: "text",
7777
+ expectedValueType: "single"
7749
7778
  },
7750
7779
  {
7751
7780
  label: "is",
7752
7781
  value: "eq",
7753
- editorType: "text"
7782
+ editorType: "text",
7783
+ expectedValueType: "single"
7754
7784
  },
7755
7785
  {
7756
7786
  label: "is empty",
7757
7787
  value: "ndef",
7758
- editorType: "empty"
7788
+ editorType: "empty",
7789
+ expectedValueType: "false"
7759
7790
  },
7760
7791
  {
7761
7792
  label: "starts with...",
7762
7793
  value: "starts",
7763
- editorType: "text"
7794
+ editorType: "text",
7795
+ expectedValueType: "single"
7764
7796
  },
7765
7797
  {
7766
7798
  label: "is not",
7767
7799
  value: "neq",
7768
- editorType: "text"
7800
+ editorType: "text",
7801
+ expectedValueType: "single"
7769
7802
  },
7770
7803
  {
7771
7804
  label: "is not empty",
7772
7805
  value: "def",
7773
- editorType: "empty"
7806
+ editorType: "empty",
7807
+ expectedValueType: "true"
7774
7808
  }
7775
7809
  ];
7776
7810
  var USER_OPERATORS = [
7777
7811
  {
7778
7812
  label: "contains...",
7779
7813
  value: "match",
7780
- editorType: "text"
7814
+ editorType: "text",
7815
+ expectedValueType: "single"
7781
7816
  },
7782
7817
  {
7783
7818
  label: "is",
7784
7819
  value: "eq",
7785
- editorType: "text"
7820
+ editorType: "text",
7821
+ expectedValueType: "single"
7786
7822
  },
7787
7823
  {
7788
7824
  label: "starts with...",
7789
7825
  value: "starts",
7790
- editorType: "text"
7826
+ editorType: "text",
7827
+ expectedValueType: "single"
7791
7828
  },
7792
7829
  {
7793
7830
  label: "is not",
7794
7831
  value: "neq",
7795
- editorType: "text"
7832
+ editorType: "text",
7833
+ expectedValueType: "single"
7796
7834
  }
7797
7835
  ];
7798
- var SYSTEM_DATE_OPERATORS = [
7836
+ var DATE_TIME_OPERATORS = [
7799
7837
  {
7800
7838
  label: "is",
7801
7839
  value: "sys-date-eq",
7802
- editorType: "date"
7840
+ editorType: "date",
7841
+ expectedValueType: "single"
7803
7842
  },
7804
7843
  {
7805
7844
  label: "is between...",
7806
7845
  value: "sys-date-between",
7807
- editorType: "dateRange"
7846
+ editorType: "dateRange",
7847
+ expectedValueType: "between"
7808
7848
  },
7809
7849
  {
7810
7850
  label: "is before...",
7811
7851
  value: "sys-date-lt",
7812
- editorType: "date"
7852
+ editorType: "date",
7853
+ expectedValueType: "single"
7813
7854
  },
7814
7855
  {
7815
7856
  label: "is after...",
7816
7857
  value: "sys-date-gt",
7817
- editorType: "date"
7858
+ editorType: "date",
7859
+ expectedValueType: "single"
7818
7860
  },
7819
7861
  {
7820
7862
  label: "is on or before...",
7821
7863
  value: "sys-date-lte",
7822
- editorType: "date"
7864
+ editorType: "date",
7865
+ expectedValueType: "single"
7823
7866
  },
7824
7867
  {
7825
7868
  label: "is on or after...",
7826
7869
  value: "sys-date-gte",
7827
- editorType: "date"
7870
+ editorType: "date",
7871
+ expectedValueType: "single"
7828
7872
  },
7829
7873
  {
7830
- label: "is not",
7831
- value: "sys-date-neq",
7832
- editorType: "date"
7874
+ label: "is empty",
7875
+ value: "ndef",
7876
+ editorType: "empty",
7877
+ expectedValueType: "false"
7878
+ },
7879
+ {
7880
+ label: "is not empty",
7881
+ value: "def",
7882
+ editorType: "empty",
7883
+ expectedValueType: "true"
7833
7884
  }
7834
7885
  ];
7835
7886
  var RICHTEXT_OPERATORS = [
7836
7887
  {
7837
7888
  label: "contains...",
7838
7889
  value: "match",
7839
- editorType: "text"
7890
+ editorType: "text",
7891
+ expectedValueType: "single"
7840
7892
  },
7841
7893
  {
7842
7894
  label: "is empty",
7843
7895
  value: "ndef",
7844
- editorType: "empty"
7896
+ editorType: "empty",
7897
+ expectedValueType: "false"
7845
7898
  },
7846
7899
  {
7847
7900
  label: "starts with...",
7848
7901
  value: "starts",
7849
- editorType: "text"
7902
+ editorType: "text",
7903
+ expectedValueType: "single"
7850
7904
  },
7851
7905
  {
7852
7906
  label: "is not empty",
7853
7907
  value: "def",
7854
- editorType: "empty"
7908
+ editorType: "empty",
7909
+ expectedValueType: "true"
7855
7910
  }
7856
7911
  ];
7857
7912
  var CHECKBOX_OPERATORS = [
7858
7913
  {
7859
7914
  label: "is checked",
7860
7915
  value: "def",
7861
- editorType: "empty"
7916
+ editorType: "empty",
7917
+ expectedValueType: "true"
7862
7918
  },
7863
7919
  {
7864
7920
  label: "is not checked",
7865
7921
  value: "ndef",
7866
- editorType: "empty"
7922
+ editorType: "empty",
7923
+ expectedValueType: "false"
7867
7924
  }
7868
7925
  ];
7869
7926
  var SYSTEM_FIELD_OPERATORS = [
7870
7927
  {
7871
7928
  label: "is",
7872
7929
  value: "eq",
7873
- editorType: "singleChoice"
7930
+ editorType: "singleChoice",
7931
+ expectedValueType: "single"
7932
+ },
7933
+ {
7934
+ label: "is any of...",
7935
+ value: "in",
7936
+ editorType: "multiChoice",
7937
+ expectedValueType: "array"
7938
+ },
7939
+ {
7940
+ label: "is not",
7941
+ value: "neq",
7942
+ editorType: "singleChoice",
7943
+ expectedValueType: "single"
7944
+ },
7945
+ {
7946
+ label: "is none of...",
7947
+ value: "nin",
7948
+ editorType: "multiChoice",
7949
+ expectedValueType: "array"
7950
+ }
7951
+ ];
7952
+ var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
7953
+ {
7954
+ label: "is",
7955
+ value: "eq",
7956
+ editorType: "singleChoice",
7957
+ expectedValueType: "single"
7874
7958
  },
7875
7959
  {
7876
7960
  label: "is any of...",
7877
7961
  value: "in",
7878
- editorType: "multiChoice"
7962
+ editorType: "multiChoice",
7963
+ expectedValueType: "array"
7964
+ },
7965
+ {
7966
+ label: "is empty",
7967
+ value: "ndef",
7968
+ editorType: "empty",
7969
+ expectedValueType: "false"
7879
7970
  },
7880
7971
  {
7881
7972
  label: "is not",
7882
7973
  value: "neq",
7883
- editorType: "singleChoice"
7974
+ editorType: "singleChoice",
7975
+ expectedValueType: "single"
7884
7976
  },
7885
7977
  {
7886
7978
  label: "is none of...",
7887
7979
  value: "nin",
7888
- editorType: "multiChoice"
7980
+ editorType: "multiChoice",
7981
+ expectedValueType: "array"
7982
+ },
7983
+ {
7984
+ label: "is not empty",
7985
+ value: "def",
7986
+ editorType: "empty",
7987
+ expectedValueType: "true"
7889
7988
  }
7890
7989
  ];
7891
7990
  var PUBLISH_STATUS_FIELD_OPERATORS = [
7892
7991
  {
7893
7992
  label: "is",
7894
7993
  value: "eq",
7895
- editorType: "statusSingleChoice"
7994
+ editorType: "statusSingleChoice",
7995
+ expectedValueType: "single"
7896
7996
  },
7897
7997
  {
7898
7998
  label: "is any of...",
7899
7999
  value: "in",
7900
- editorType: "statusMultiChoice"
8000
+ editorType: "statusMultiChoice",
8001
+ expectedValueType: "array"
7901
8002
  },
7902
8003
  {
7903
8004
  label: "is not",
7904
8005
  value: "neq",
7905
- editorType: "statusSingleChoice"
8006
+ editorType: "statusSingleChoice",
8007
+ expectedValueType: "single"
7906
8008
  },
7907
8009
  {
7908
8010
  label: "is none of...",
7909
8011
  value: "nin",
7910
- editorType: "statusMultiChoice"
8012
+ editorType: "statusMultiChoice",
8013
+ expectedValueType: "array"
7911
8014
  }
7912
8015
  ];
7913
8016
  var SELECT_OPERATORS = [
7914
8017
  {
7915
8018
  label: "is",
7916
8019
  value: "eq",
7917
- editorType: "singleChoice"
8020
+ editorType: "singleChoice",
8021
+ expectedValueType: "single"
7918
8022
  },
7919
8023
  {
7920
8024
  label: "is any of...",
7921
8025
  value: "in",
7922
- editorType: "multiChoice"
8026
+ editorType: "multiChoice",
8027
+ expectedValueType: "array"
7923
8028
  },
7924
8029
  {
7925
8030
  label: "is empty",
7926
8031
  value: "ndef",
7927
- editorType: "empty"
8032
+ editorType: "empty",
8033
+ expectedValueType: "false"
7928
8034
  },
7929
8035
  {
7930
8036
  label: "contains...",
7931
8037
  value: "match",
7932
- editorType: "text"
8038
+ editorType: "text",
8039
+ expectedValueType: "single"
7933
8040
  },
7934
8041
  {
7935
8042
  label: "starts with...",
7936
8043
  value: "starts",
7937
- editorType: "text"
8044
+ editorType: "text",
8045
+ expectedValueType: "single"
7938
8046
  },
7939
8047
  {
7940
8048
  label: "is not",
7941
8049
  value: "neq",
7942
- editorType: "singleChoice"
8050
+ editorType: "singleChoice",
8051
+ expectedValueType: "single"
7943
8052
  },
7944
8053
  {
7945
8054
  label: "is none of...",
7946
8055
  value: "nin",
7947
- editorType: "multiChoice"
8056
+ editorType: "multiChoice",
8057
+ expectedValueType: "array"
7948
8058
  },
7949
8059
  {
7950
8060
  label: "is not empty",
7951
8061
  value: "def",
7952
- editorType: "empty"
8062
+ editorType: "empty",
8063
+ expectedValueType: "true"
7953
8064
  }
7954
8065
  ];
7955
8066
  var MULTI_SELECT_OPERATORS = [
7956
8067
  {
7957
8068
  label: "is",
7958
8069
  value: "eq",
7959
- editorType: "singleChoice"
8070
+ editorType: "singleChoice",
8071
+ expectedValueType: "single"
7960
8072
  },
7961
8073
  {
7962
8074
  label: "is any of...",
7963
8075
  value: "in",
7964
- editorType: "multiChoice"
8076
+ editorType: "multiChoice",
8077
+ expectedValueType: "array"
7965
8078
  },
7966
8079
  {
7967
8080
  label: "is empty",
7968
8081
  value: "ndef",
7969
- editorType: "empty"
8082
+ editorType: "empty",
8083
+ expectedValueType: "false"
7970
8084
  },
7971
8085
  {
7972
8086
  label: "is not",
7973
8087
  value: "neq",
7974
- editorType: "singleChoice"
8088
+ editorType: "singleChoice",
8089
+ expectedValueType: "single"
7975
8090
  },
7976
8091
  {
7977
8092
  label: "is none of...",
7978
8093
  value: "nin",
7979
- editorType: "multiChoice"
8094
+ editorType: "multiChoice",
8095
+ expectedValueType: "array"
7980
8096
  },
7981
8097
  {
7982
8098
  label: "is not empty",
7983
8099
  value: "def",
7984
- editorType: "empty"
8100
+ editorType: "empty",
8101
+ expectedValueType: "true"
7985
8102
  }
7986
8103
  ];
7987
8104
 
7988
- // src/components/SearchAndFilter/FilterButton.tsx
7989
- var import_design_system43 = require("@uniformdev/design-system");
7990
-
7991
- // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
7992
- var import_react80 = require("@emotion/react");
8105
+ // src/components/SearchAndFilter/editors/DateEditor.tsx
7993
8106
  var import_design_system42 = require("@uniformdev/design-system");
7994
- var SearchAndFilterControlsWrapper = (gridColumns) => import_react80.css`
7995
- align-items: stretch;
7996
- display: grid;
7997
- grid-template-columns: ${gridColumns};
7998
- gap: var(--spacing-sm);
7999
- `;
8000
- var SearchAndFilterOutterControlWrapper = (gridColumns) => import_react80.css`
8001
- align-items: stretch;
8002
- display: grid;
8003
- grid-template-columns: ${gridColumns};
8004
- gap: var(--spacing-sm);
8005
- `;
8006
- var ConditionalFilterRow = import_react80.css`
8007
- display: grid;
8008
- grid-template-columns: 35px 1fr;
8009
- gap: var(--spacing-sm);
8010
- margin-left: var(--spacing-base);
8011
-
8012
- ${(0, import_design_system42.cq)("380px")} {
8013
- align-items: center;
8014
-
8015
- &:after {
8016
- content: '';
8017
- display: block;
8018
- height: 1px;
8019
- background: var(--gray-300);
8020
- width: calc(100% - var(--spacing-base));
8021
- margin-left: var(--spacing-base);
8022
- }
8023
- &:last-of-type:after {
8024
- display: none;
8107
+ var import_react80 = require("react");
8108
+ var import_react_use6 = require("react-use");
8109
+ var import_jsx_runtime71 = require("@emotion/react/jsx-runtime");
8110
+ var DateEditor = ({
8111
+ onChange,
8112
+ ariaLabel,
8113
+ disabled,
8114
+ value,
8115
+ readOnly,
8116
+ valueTestId
8117
+ }) => {
8118
+ const [innerValue, setInnerValue] = (0, import_react80.useState)(value != null ? value : "");
8119
+ (0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8120
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
8121
+ import_design_system42.Input,
8122
+ {
8123
+ type: "date",
8124
+ label: ariaLabel,
8125
+ showLabel: false,
8126
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8127
+ disabled,
8128
+ value: innerValue,
8129
+ readOnly,
8130
+ "data-testid": valueTestId
8025
8131
  }
8026
- }
8132
+ );
8133
+ };
8027
8134
 
8028
- &:nth-of-type(2) {
8029
- margin-left: 0;
8030
- grid-template-columns: 50px 1fr;
8031
- }
8135
+ // src/components/SearchAndFilter/editors/DateRangeEditor.tsx
8136
+ var import_design_system44 = require("@uniformdev/design-system");
8137
+ var import_react81 = require("react");
8138
+ var import_react_use7 = require("react-use");
8032
8139
 
8033
- ${(0, import_design_system42.cq)("580px")} {
8034
- &:after {
8035
- display: none;
8140
+ // src/components/SearchAndFilter/editors/shared/ErrorContainer.tsx
8141
+ var import_design_system43 = require("@uniformdev/design-system");
8142
+ var import_jsx_runtime72 = require("@emotion/react/jsx-runtime");
8143
+ var ErrorContainer = ({ errorMessage }) => {
8144
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8145
+ "div",
8146
+ {
8147
+ css: {
8148
+ gridColumn: "span 6",
8149
+ order: 6
8150
+ },
8151
+ children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system43.FieldMessage, { errorMessage })
8036
8152
  }
8037
- }
8153
+ );
8154
+ };
8038
8155
 
8039
- @media (prefers-reduced-motion: no-preference) {
8040
- animation: ${import_design_system42.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
8041
- }
8042
- `;
8043
- var ConditionalInputRow = import_react80.css`
8044
- display: flex;
8045
- gap: var(--spacing-sm);
8046
- flex-wrap: wrap;
8156
+ // src/components/SearchAndFilter/editors/shared/twoColumnGrid.tsx
8157
+ var twoColumnGrid = {
8158
+ display: "grid",
8159
+ gridTemplateColumns: "1fr 1fr",
8160
+ gap: "var(--spacing-sm);"
8161
+ };
8047
8162
 
8048
- ${(0, import_design_system42.cq)("380px")} {
8049
- & > div:nth-child(-n + 2) {
8050
- width: calc(50% - var(--spacing-sm));
8163
+ // src/components/SearchAndFilter/editors/DateRangeEditor.tsx
8164
+ var import_jsx_runtime73 = require("@emotion/react/jsx-runtime");
8165
+ var DateRangeEditor = ({
8166
+ ariaLabel,
8167
+ onChange,
8168
+ disabled,
8169
+ value,
8170
+ readOnly,
8171
+ valueTestId
8172
+ }) => {
8173
+ const [minDateValue, setMinDateValue] = (0, import_react81.useState)(value ? value[0] : "");
8174
+ const [maxDateValue, setMaxDateValue] = (0, import_react81.useState)(value ? value[1] : "");
8175
+ const [error, setError] = (0, import_react81.useState)("");
8176
+ (0, import_react_use7.useDebounce)(
8177
+ () => {
8178
+ if (minDateValue && maxDateValue && !error) {
8179
+ onChange([minDateValue, maxDateValue]);
8180
+ } else {
8181
+ onChange([]);
8182
+ }
8183
+ },
8184
+ 500,
8185
+ [minDateValue, maxDateValue]
8186
+ );
8187
+ (0, import_react81.useEffect)(() => {
8188
+ if (!minDateValue || !maxDateValue) {
8189
+ return;
8051
8190
  }
8052
-
8053
- & > div:nth-child(n + 3) {
8054
- width: calc(100% - 48px);
8191
+ const minDate = new Date(minDateValue);
8192
+ const maxDate = new Date(maxDateValue);
8193
+ if (maxDate < minDate) {
8194
+ setError("The max date cannot be lower than the min date");
8195
+ return;
8055
8196
  }
8056
- }
8057
- ${(0, import_design_system42.cq)("764px")} {
8058
- display: grid;
8059
- grid-template-columns: 200px 160px 1fr 32px;
8060
-
8061
- & > div:nth-child(n) {
8062
- width: auto;
8197
+ if (maxDate && !minDate) {
8198
+ setError("Please enter both a low and high date");
8199
+ return;
8063
8200
  }
8064
- }
8065
- `;
8066
- var SearchInput = import_react80.css`
8067
- max-height: 40px;
8068
- min-height: unset;
8069
- `;
8070
- var BindableKeywordSearchInputStyles = import_react80.css`
8071
- position: relative;
8072
- width: 100%;
8201
+ const minDateString = minDate.toDateString();
8202
+ const maxDateString = maxDate.toDateString();
8203
+ if (minDateString === maxDateString || maxDateString === minDateString) {
8204
+ setError("The min and max date cannot be the same");
8205
+ return;
8206
+ }
8207
+ if (minDate > maxDate) {
8208
+ setError("The min date cannot be higher than the max date");
8209
+ return;
8210
+ }
8211
+ if (error) {
8212
+ setError("");
8213
+ }
8214
+ if (minDate && maxDate) {
8215
+ setMinDateValue(minDateValue);
8216
+ setMaxDateValue(maxDateValue);
8217
+ } else {
8218
+ setMinDateValue("");
8219
+ setMaxDateValue("");
8220
+ }
8221
+ }, [minDateValue, maxDateValue, setError]);
8222
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
8223
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8224
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
8225
+ import_design_system44.Input,
8226
+ {
8227
+ label: `${ariaLabel}-min-date`,
8228
+ type: "date",
8229
+ showLabel: false,
8230
+ value: minDateValue,
8231
+ onChange: (e) => setMinDateValue(e.currentTarget.value),
8232
+ "aria-invalid": !error ? false : true,
8233
+ disabled,
8234
+ readOnly,
8235
+ "data-testid": "value-low"
8236
+ }
8237
+ ),
8238
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
8239
+ import_design_system44.Input,
8240
+ {
8241
+ label: `${ariaLabel}-max-date`,
8242
+ type: "date",
8243
+ showLabel: false,
8244
+ value: maxDateValue,
8245
+ onChange: (e) => setMaxDateValue(e.currentTarget.value),
8246
+ "aria-invalid": !error ? false : true,
8247
+ disabled,
8248
+ readOnly,
8249
+ "data-testid": "value-high"
8250
+ }
8251
+ )
8252
+ ] }),
8253
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ErrorContainer, { errorMessage: error })
8254
+ ] });
8255
+ };
8073
8256
 
8074
- & [data-lexical-editor='true'] {
8075
- padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
8076
- font-size: var(--fs-sm);
8077
- border-radius: var(--rounded-full);
8078
- max-height: 40px;
8079
- min-height: unset;
8080
- width: 100%;
8081
- position: relative;
8082
- white-space: nowrap;
8083
- }
8084
- `;
8085
- var ClearSearchButtonContainer = import_react80.css`
8086
- align-items: center;
8087
- display: flex;
8088
- position: absolute;
8089
- inset: 0 var(--spacing-lg) 0 auto;
8090
- `;
8091
- var ClearSearchButtonStyles = import_react80.css`
8092
- background: none;
8093
- border: none;
8094
- padding: 0;
8095
- pointer-events: all;
8096
- `;
8097
- var FilterButton = import_react80.css`
8098
- align-items: center;
8099
- background: var(--white);
8100
- border: 1px solid var(--gray-300);
8101
- border-radius: var(--rounded-full);
8102
- color: var(--typography-base);
8103
- display: flex;
8104
- font-size: var(--fs-sm);
8105
- gap: var(--spacing-sm);
8106
- padding: var(--spacing-sm) var(--spacing-base);
8107
- max-height: 40px;
8108
- transition: color var(--duration-fast) var(--timing-ease-out),
8109
- background-color var(--duration-fast) var(--timing-ease-out),
8110
- border-color var(--duration-fast) var(--timing-ease-out),
8111
- box-shadow var(--duration-fast) var(--timing-ease-out);
8257
+ // src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
8258
+ var import_design_system45 = require("@uniformdev/design-system");
8259
+ var import_react82 = require("react");
8112
8260
 
8113
- svg {
8114
- color: var(--gray-300);
8115
- transition: color var(--duration-fast) var(--timing-ease-out);
8116
- }
8261
+ // src/components/SearchAndFilter/editors/shared/readOnlyAttributes.tsx
8262
+ var readOnlyAttributes = {
8263
+ isSearchable: false,
8264
+ menuIsOpen: false,
8265
+ isClearable: false
8266
+ };
8117
8267
 
8118
- &:hover,
8119
- :where([aria-expanded='true']) {
8120
- outline: none;
8121
- background: var(--gray-200);
8122
- border-color: var(--gray-300);
8268
+ // src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
8269
+ var import_jsx_runtime74 = require("@emotion/react/jsx-runtime");
8270
+ var FilterMultiChoiceEditor = ({
8271
+ value,
8272
+ options,
8273
+ disabled,
8274
+ readOnly,
8275
+ valueTestId,
8276
+ ...props
8277
+ }) => {
8278
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8279
+ const isClearable = !readOnly || !disabled;
8280
+ const { groupedOptions, selectedOptions } = (0, import_react82.useMemo)(
8281
+ () => (0, import_design_system45.convertComboBoxGroupsToSelectableGroups)({ options: options != null ? options : [], selectedItems: new Set(value) }),
8282
+ [options, value]
8283
+ );
8284
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8285
+ import_design_system45.InputComboBox,
8286
+ {
8287
+ ...props,
8288
+ placeholder: "Type to search...",
8289
+ options: groupedOptions,
8290
+ isMulti: true,
8291
+ isClearable,
8292
+ isDisabled: disabled,
8293
+ onChange: (e) => {
8294
+ const selectedValues = (0, import_design_system45.getComboBoxSelectedSelectableGroups)(e);
8295
+ return props.onChange([...selectedValues]);
8296
+ },
8297
+ value: selectedOptions,
8298
+ "aria-readonly": readOnly,
8299
+ styles: {
8300
+ menu(base) {
8301
+ return {
8302
+ ...base,
8303
+ minWidth: "max-content"
8304
+ };
8305
+ }
8306
+ },
8307
+ ...readOnlyProps
8308
+ }
8309
+ ) });
8310
+ };
8123
8311
 
8124
- svg {
8125
- color: var(--typography-base);
8312
+ // src/components/SearchAndFilter/editors/FilterSingleChoiceEditor.tsx
8313
+ var import_design_system46 = require("@uniformdev/design-system");
8314
+ var import_react83 = require("react");
8315
+ var import_jsx_runtime75 = require("@emotion/react/jsx-runtime");
8316
+ var FilterSingleChoiceEditor = ({
8317
+ options,
8318
+ value,
8319
+ disabled,
8320
+ readOnly,
8321
+ onChange,
8322
+ valueTestId
8323
+ }) => {
8324
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8325
+ const { groupedOptions, selectedOptions } = (0, import_react83.useMemo)(
8326
+ () => (0, import_design_system46.convertComboBoxGroupsToSelectableGroups)({
8327
+ options: options != null ? options : [],
8328
+ selectedItems: new Set(value ? [value] : void 0),
8329
+ selectionMode: "single"
8330
+ }),
8331
+ [options, value]
8332
+ );
8333
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
8334
+ import_design_system46.InputComboBox,
8335
+ {
8336
+ placeholder: "Type to search...",
8337
+ options: groupedOptions,
8338
+ isClearable: true,
8339
+ onChange: (e) => {
8340
+ if (Array.isArray(e == null ? void 0 : e.value)) {
8341
+ return;
8342
+ }
8343
+ return onChange(e == null ? void 0 : e.value);
8344
+ },
8345
+ isDisabled: disabled,
8346
+ value: selectedOptions,
8347
+ "aria-readonly": readOnly,
8348
+ styles: {
8349
+ menu(base) {
8350
+ return {
8351
+ ...base,
8352
+ minWidth: "max-content"
8353
+ };
8354
+ }
8355
+ },
8356
+ ...readOnlyProps
8126
8357
  }
8127
- }
8358
+ ) });
8359
+ };
8128
8360
 
8129
- &:disabled {
8130
- opacity: var(--opacity-50);
8131
- }
8132
- `;
8133
- var FilterButtonText = import_react80.css`
8134
- overflow: hidden;
8135
- text-overflow: ellipsis;
8136
- white-space: nowrap;
8137
- max-width: 14ch;
8138
- `;
8139
- var FilterButtonSelected = import_react80.css`
8140
- background: var(--gray-100);
8141
- border-color: var(--gray-300);
8142
-
8143
- svg {
8144
- color: var(--accent-dark);
8145
- }
8146
- `;
8147
- var FilterButtonWithOptions = import_react80.css`
8148
- :where([aria-expanded='true']) {
8149
- background: var(--purple-rain-100);
8150
- border-color: var(--accent-light);
8151
- color: var(--typography-base);
8152
- box-shadow: var(--elevation-100);
8153
-
8154
- svg {
8155
- color: var(--accent-dark);
8156
- }
8157
- }
8158
- `;
8159
- var SearchIcon = import_react80.css`
8160
- color: var(--icon-color);
8161
- position: absolute;
8162
- inset: 0 var(--spacing-base) 0 auto;
8163
- margin: auto;
8164
- transition: color var(--duration-fast) var(--timing-ease-out);
8165
- `;
8166
- var AddConditionalBtn = import_react80.css`
8167
- align-items: center;
8168
- background: transparent;
8169
- border: none;
8170
- color: var(--primary-action-default);
8171
- display: flex;
8172
- gap: var(--spacing-sm);
8173
- transition: color var(--duration-fast) var(--timing-ease-out);
8174
- padding: 0;
8175
-
8176
- &:hover,
8177
- &:focus {
8178
- color: var(--primary-action-hover);
8179
- }
8180
-
8181
- &:disabled {
8182
- color: var(--gray-400);
8183
- }
8184
- `;
8185
- var Title = import_react80.css`
8186
- color: var(--typography-light);
8187
-
8188
- &:focus {
8189
- outline: none;
8190
- }
8191
- `;
8192
- var ResetConditionsBtn = import_react80.css`
8193
- background: transparent;
8194
- border: none;
8195
- color: var(--action-destructive-default);
8196
- transition: color var(--duration-fast) var(--timing-ease-out);
8197
- padding: 0;
8198
-
8199
- &:hover,
8200
- &:focus {
8201
- color: var(--action-destructive-hover);
8202
- }
8203
- `;
8204
- var IconBtn = import_react80.css`
8205
- background: transparent;
8206
- border: none;
8207
- padding: var(--spacing-sm);
8208
- `;
8209
- var SearchAndFilterOptionsContainer = import_react80.css`
8210
- background: var(--gray-50);
8211
- border: 1px solid var(--gray-300);
8212
- border-radius: var(--rounded-base);
8213
- container-type: inline-size;
8214
- display: flex;
8215
- flex-direction: column;
8216
- gap: var(--spacing-sm);
8217
- padding: var(--spacing-md) 0 var(--spacing-base);
8218
- will-change: height;
8219
- position: relative;
8220
- z-index: 1;
8221
- `;
8222
- var SearchAndFilterOptionsInnerContainer = import_react80.css`
8223
- display: flex;
8224
- flex-direction: column;
8225
- gap: var(--spacing-sm);
8226
- padding-inline: var(--spacing-md);
8227
- `;
8228
- var SearchAndFilterButtonGroup = import_react80.css`
8229
- margin-top: var(--spacing-xs);
8230
- margin-left: calc(56px + var(--spacing-md));
8231
- `;
8232
-
8233
- // src/components/SearchAndFilter/FilterButton.tsx
8234
- var import_jsx_runtime71 = require("@emotion/react/jsx-runtime");
8235
- var FilterButton2 = ({
8236
- text = "Filters",
8237
- icon = "filter-add",
8238
- filterCount,
8239
- hasSelectedValue,
8240
- dataTestId,
8241
- ...props
8361
+ // src/components/SearchAndFilter/editors/NumberEditor.tsx
8362
+ var import_design_system47 = require("@uniformdev/design-system");
8363
+ var import_react84 = require("react");
8364
+ var import_react_use8 = require("react-use");
8365
+ var import_jsx_runtime76 = require("@emotion/react/jsx-runtime");
8366
+ var NumberEditor = ({
8367
+ ariaLabel,
8368
+ onChange,
8369
+ disabled,
8370
+ value,
8371
+ readOnly,
8372
+ valueTestId
8242
8373
  }) => {
8243
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
8244
- "button",
8374
+ const [innerValue, setInnerValue] = (0, import_react84.useState)(value != null ? value : "");
8375
+ (0, import_react_use8.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8376
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
8377
+ import_design_system47.Input,
8245
8378
  {
8246
- type: "button",
8247
- css: [
8248
- FilterButton,
8249
- hasSelectedValue ? FilterButtonSelected : void 0,
8250
- filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
8251
- ],
8252
- ...props,
8253
- "data-testid": dataTestId,
8254
- children: [
8255
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system43.Icon, { icon, iconColor: "currentColor", size: "1rem" }),
8256
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { css: FilterButtonText, children: text }),
8257
- filterCount ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_design_system43.Counter, { count: filterCount, bgColor: "var(--white)" }) : null
8258
- ]
8379
+ label: ariaLabel,
8380
+ type: "number",
8381
+ showLabel: false,
8382
+ min: 0,
8383
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8384
+ disabled,
8385
+ value: innerValue,
8386
+ readOnly,
8387
+ "data-testid": valueTestId
8259
8388
  }
8260
8389
  );
8261
8390
  };
8262
8391
 
8263
- // src/components/SearchAndFilter/FilterControls.tsx
8264
- var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
8265
- var import_design_system46 = require("@uniformdev/design-system");
8266
- var import_lexical11 = require("lexical");
8267
- var import_react83 = require("react");
8268
- var import_react_use7 = require("react-use");
8269
- var import_uuid3 = require("uuid");
8392
+ // src/components/SearchAndFilter/editors/NumberRangeEditor.tsx
8393
+ var import_design_system48 = require("@uniformdev/design-system");
8394
+ var import_react85 = require("react");
8395
+ var import_react_use9 = require("react-use");
8396
+ var import_jsx_runtime77 = require("@emotion/react/jsx-runtime");
8397
+ var NumberRangeEditor = ({
8398
+ onChange,
8399
+ disabled,
8400
+ ariaLabel,
8401
+ value,
8402
+ readOnly,
8403
+ valueTestId
8404
+ }) => {
8405
+ const [minValue, setMinValue] = (0, import_react85.useState)("");
8406
+ const [maxValue, setMaxValue] = (0, import_react85.useState)("");
8407
+ const [error, setError] = (0, import_react85.useState)("");
8408
+ (0, import_react_use9.useDebounce)(
8409
+ () => {
8410
+ if (minValue && maxValue && !error) {
8411
+ onChange([minValue, maxValue]);
8412
+ } else {
8413
+ onChange([]);
8414
+ }
8415
+ },
8416
+ 500,
8417
+ [minValue, maxValue]
8418
+ );
8419
+ (0, import_react85.useEffect)(() => {
8420
+ if (!maxValue && !minValue) {
8421
+ return;
8422
+ }
8423
+ const max = Number(maxValue);
8424
+ const min = Number(minValue);
8425
+ if (max < min || min > max) {
8426
+ setError("Please enter a valid numeric range");
8427
+ return;
8428
+ }
8429
+ if (maxValue && !minValue || minValue && !maxValue) {
8430
+ setError("Please enter both a low and high number");
8431
+ return;
8432
+ }
8433
+ if (error) {
8434
+ setError("");
8435
+ }
8436
+ if (min && max) {
8437
+ setMinValue(minValue);
8438
+ setMaxValue(maxValue);
8439
+ }
8440
+ }, [maxValue, minValue, setError]);
8441
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
8442
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8443
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
8444
+ import_design_system48.Input,
8445
+ {
8446
+ label: `${ariaLabel}-min`,
8447
+ type: "number",
8448
+ showLabel: false,
8449
+ min: 0,
8450
+ placeholder: "Low",
8451
+ onChange: (e) => setMinValue(e.currentTarget.value),
8452
+ "aria-invalid": !error ? false : true,
8453
+ disabled,
8454
+ value: value ? value[0] : "",
8455
+ readOnly,
8456
+ "data-testid": "value-low"
8457
+ }
8458
+ ),
8459
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
8460
+ import_design_system48.Input,
8461
+ {
8462
+ type: "number",
8463
+ label: `${ariaLabel}-max`,
8464
+ showLabel: false,
8465
+ min: 0,
8466
+ placeholder: "High",
8467
+ onChange: (e) => setMaxValue(e.currentTarget.value),
8468
+ "aria-invalid": !error ? false : true,
8469
+ disabled,
8470
+ value: value ? value[1] : "",
8471
+ readOnly,
8472
+ "data-testid": "value-high"
8473
+ }
8474
+ )
8475
+ ] }),
8476
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ErrorContainer, { errorMessage: error })
8477
+ ] });
8478
+ };
8270
8479
 
8271
- // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8272
- var import_design_system45 = require("@uniformdev/design-system");
8273
- var import_react82 = require("react");
8480
+ // src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
8481
+ var import_design_system50 = require("@uniformdev/design-system");
8482
+ var import_react86 = require("react");
8274
8483
 
8275
- // src/components/SearchAndFilter/FilterEditor.tsx
8276
- var import_design_system44 = require("@uniformdev/design-system");
8277
- var import_react81 = require("react");
8278
- var import_react_use6 = require("react-use");
8279
- var import_jsx_runtime72 = require("@emotion/react/jsx-runtime");
8280
- var readOnlyAttributes = {
8281
- isSearchable: false,
8282
- menuIsOpen: false,
8283
- isClearable: false
8484
+ // src/components/SearchAndFilter/editors/shared/CustomOptions.tsx
8485
+ var import_design_system49 = require("@uniformdev/design-system");
8486
+ var import_jsx_runtime78 = require("@emotion/react/jsx-runtime");
8487
+ var CustomOptions = ({ label, value }) => {
8488
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
8489
+ import_design_system49.StatusBullet,
8490
+ {
8491
+ status: label,
8492
+ message: Array.isArray(value) ? value.join(",") : value
8493
+ }
8494
+ );
8284
8495
  };
8285
- var FilterMultiChoiceEditor = ({
8286
- value,
8496
+
8497
+ // src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
8498
+ var import_jsx_runtime79 = require("@emotion/react/jsx-runtime");
8499
+ var StatusMultiEditor = ({
8287
8500
  options,
8501
+ value,
8288
8502
  disabled,
8289
8503
  readOnly,
8290
- valueTestId,
8291
- ...props
8504
+ onChange,
8505
+ valueTestId
8292
8506
  }) => {
8293
8507
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
8294
- const isClearable = !readOnly || !disabled;
8295
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8296
- import_design_system44.InputComboBox,
8508
+ const { groupedOptions, selectedOptions } = (0, import_react86.useMemo)(
8509
+ () => (0, import_design_system50.convertComboBoxGroupsToSelectableGroups)({ options: options != null ? options : [], selectedItems: new Set(value) }),
8510
+ [options, value]
8511
+ );
8512
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
8513
+ import_design_system50.InputComboBox,
8297
8514
  {
8298
- ...props,
8299
- placeholder: "Type to search...",
8300
- options,
8515
+ options: groupedOptions != null ? groupedOptions : [],
8301
8516
  isMulti: true,
8302
- isClearable,
8303
- isDisabled: disabled,
8304
8517
  onChange: (e) => {
8305
- var _a;
8306
- return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
8518
+ const selectedValues = (0, import_design_system50.getComboBoxSelectedSelectableGroups)(e);
8519
+ return onChange([...selectedValues]);
8307
8520
  },
8308
- value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
8521
+ formatOptionLabel: CustomOptions,
8309
8522
  "aria-readonly": readOnly,
8523
+ value: selectedOptions,
8524
+ isDisabled: disabled,
8310
8525
  styles: {
8311
8526
  menu(base) {
8312
8527
  return {
@@ -8319,7 +8534,12 @@ var FilterMultiChoiceEditor = ({
8319
8534
  }
8320
8535
  ) });
8321
8536
  };
8322
- var FilterSingleChoiceEditor = ({
8537
+
8538
+ // src/components/SearchAndFilter/editors/StatusSingleEditor.tsx
8539
+ var import_design_system51 = require("@uniformdev/design-system");
8540
+ var import_react87 = require("react");
8541
+ var import_jsx_runtime80 = require("@emotion/react/jsx-runtime");
8542
+ var StatusSingleEditor = ({
8323
8543
  options,
8324
8544
  value,
8325
8545
  disabled,
@@ -8327,90 +8547,28 @@ var FilterSingleChoiceEditor = ({
8327
8547
  onChange,
8328
8548
  valueTestId
8329
8549
  }) => {
8330
- var _a;
8331
8550
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
8332
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8333
- import_design_system44.InputComboBox,
8334
- {
8335
- placeholder: "Type to search...",
8336
- options,
8337
- isClearable: true,
8338
- onChange: (e) => {
8339
- var _a2;
8340
- return onChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8341
- },
8342
- isDisabled: disabled,
8343
- value: (_a = options == null ? void 0 : options.find((option) => option.value === value)) != null ? _a : null,
8344
- "aria-readonly": readOnly,
8345
- styles: {
8346
- menu(base) {
8347
- return {
8348
- ...base,
8349
- minWidth: "max-content"
8350
- };
8351
- }
8352
- },
8353
- ...readOnlyProps
8354
- }
8355
- ) });
8356
- };
8357
- var CustomOptions = ({ label, value }) => {
8358
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system44.StatusBullet, { status: label, message: value });
8359
- };
8360
- var StatusMultiEditor = ({
8361
- options,
8362
- value,
8363
- disabled,
8364
- readOnly,
8365
- onChange,
8366
- valueTestId
8367
- }) => {
8368
- const readOnlyProps = readOnly ? readOnlyAttributes : {};
8369
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8370
- import_design_system44.InputComboBox,
8551
+ const { groupedOptions, selectedOptions } = (0, import_react87.useMemo)(
8552
+ () => (0, import_design_system51.convertComboBoxGroupsToSelectableGroups)({
8553
+ options: options != null ? options : [],
8554
+ selectedItems: new Set(value ? [value] : void 0),
8555
+ selectionMode: "single"
8556
+ }),
8557
+ [options, value]
8558
+ );
8559
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
8560
+ import_design_system51.InputComboBox,
8371
8561
  {
8372
- options,
8373
- isMulti: true,
8562
+ options: groupedOptions,
8374
8563
  onChange: (e) => {
8375
- var _a;
8376
- return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
8377
- },
8378
- formatOptionLabel: CustomOptions,
8379
- "aria-readonly": readOnly,
8380
- value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
8381
- isDisabled: disabled,
8382
- styles: {
8383
- menu(base) {
8384
- return {
8385
- ...base,
8386
- minWidth: "max-content"
8387
- };
8564
+ if (Array.isArray(e == null ? void 0 : e.value)) {
8565
+ return;
8388
8566
  }
8389
- },
8390
- ...readOnlyProps
8391
- }
8392
- ) });
8393
- };
8394
- var StatusSingleEditor = ({
8395
- options,
8396
- value,
8397
- disabled,
8398
- readOnly,
8399
- onChange,
8400
- valueTestId
8401
- }) => {
8402
- const readOnlyProps = readOnly ? readOnlyAttributes : {};
8403
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8404
- import_design_system44.InputComboBox,
8405
- {
8406
- options,
8407
- onChange: (e) => {
8408
- var _a;
8409
- return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
8567
+ return onChange(e == null ? void 0 : e.value);
8410
8568
  },
8411
8569
  formatOptionLabel: CustomOptions,
8412
8570
  "aria-readonly": readOnly,
8413
- value: options == null ? void 0 : options.find((option) => option.value === value),
8571
+ value: selectedOptions,
8414
8572
  isDisabled: disabled,
8415
8573
  styles: {
8416
8574
  menu(base) {
@@ -8424,6 +8582,12 @@ var StatusSingleEditor = ({
8424
8582
  }
8425
8583
  ) });
8426
8584
  };
8585
+
8586
+ // src/components/SearchAndFilter/editors/TextEditor.tsx
8587
+ var import_design_system52 = require("@uniformdev/design-system");
8588
+ var import_react88 = require("react");
8589
+ var import_react_use10 = require("react-use");
8590
+ var import_jsx_runtime81 = require("@emotion/react/jsx-runtime");
8427
8591
  var TextEditor = ({
8428
8592
  onChange,
8429
8593
  ariaLabel,
@@ -8431,10 +8595,10 @@ var TextEditor = ({
8431
8595
  readOnly,
8432
8596
  valueTestId
8433
8597
  }) => {
8434
- const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
8435
- (0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8436
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8437
- import_design_system44.Input,
8598
+ const [innerValue, setInnerValue] = (0, import_react88.useState)(value != null ? value : "");
8599
+ (0, import_react_use10.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8600
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
8601
+ import_design_system52.Input,
8438
8602
  {
8439
8603
  showLabel: false,
8440
8604
  label: ariaLabel,
@@ -8446,238 +8610,357 @@ var TextEditor = ({
8446
8610
  }
8447
8611
  );
8448
8612
  };
8449
- var NumberRangeEditor = ({
8450
- onChange,
8451
- disabled,
8452
- ariaLabel,
8613
+
8614
+ // src/components/SearchAndFilter/editors/TextMultiChoiceEditor.tsx
8615
+ var import_design_system53 = require("@uniformdev/design-system");
8616
+ var import_react89 = require("react");
8617
+ var import_jsx_runtime82 = require("@emotion/react/jsx-runtime");
8618
+ var TextMultiChoiceEditor = ({
8453
8619
  value,
8454
- readOnly,
8455
- valueTestId
8456
- }) => {
8457
- const [minValue, setMinValue] = (0, import_react81.useState)("");
8458
- const [maxValue, setMaxValue] = (0, import_react81.useState)("");
8459
- const [error, setError] = (0, import_react81.useState)("");
8460
- (0, import_react_use6.useDebounce)(
8461
- () => {
8462
- if (minValue && maxValue && !error) {
8463
- onChange([minValue, maxValue]);
8464
- } else {
8465
- onChange([]);
8466
- }
8467
- },
8468
- 500,
8469
- [minValue, maxValue]
8470
- );
8471
- (0, import_react81.useEffect)(() => {
8472
- if (!maxValue && !minValue) {
8473
- return;
8474
- }
8475
- const max = Number(maxValue);
8476
- const min = Number(minValue);
8477
- if (max < min || min > max) {
8478
- setError("Please enter a valid numeric range");
8479
- return;
8480
- }
8481
- if (maxValue && !minValue || minValue && !maxValue) {
8482
- setError("Please enter both a low and high number");
8483
- return;
8484
- }
8485
- if (error) {
8486
- setError("");
8487
- }
8488
- if (min && max) {
8489
- setMinValue(minValue);
8490
- setMaxValue(maxValue);
8491
- }
8492
- }, [maxValue, minValue, setError]);
8493
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
8494
- /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8495
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8496
- import_design_system44.Input,
8497
- {
8498
- label: `${ariaLabel}-min`,
8499
- type: "number",
8500
- showLabel: false,
8501
- min: 0,
8502
- placeholder: "Low",
8503
- onChange: (e) => setMinValue(e.currentTarget.value),
8504
- "aria-invalid": !error ? false : true,
8505
- disabled,
8506
- value: value ? value[0] : "",
8507
- readOnly,
8508
- "data-testid": "value-low"
8509
- }
8510
- ),
8511
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8512
- import_design_system44.Input,
8513
- {
8514
- type: "number",
8515
- label: `${ariaLabel}-max`,
8516
- showLabel: false,
8517
- min: 0,
8518
- placeholder: "High",
8519
- onChange: (e) => setMaxValue(e.currentTarget.value),
8520
- "aria-invalid": !error ? false : true,
8521
- disabled,
8522
- value: value ? value[1] : "",
8523
- readOnly,
8524
- "data-testid": "value-high"
8525
- }
8526
- )
8527
- ] }),
8528
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ErrorContainer, { errorMessage: error })
8529
- ] });
8530
- };
8531
- var NumberEditor = ({
8532
- ariaLabel,
8533
- onChange,
8534
8620
  disabled,
8535
- value,
8536
8621
  readOnly,
8537
- valueTestId
8622
+ valueTestId,
8623
+ ...props
8538
8624
  }) => {
8539
- const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
8540
- (0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8541
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8542
- import_design_system44.Input,
8625
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8626
+ const isClearable = !readOnly || !disabled;
8627
+ const { groupedOptions, selectedOptions } = (0, import_react89.useMemo)(() => {
8628
+ var _a;
8629
+ const coercedValue = typeof value === "string" ? [value] : value != null ? value : [];
8630
+ const options = (_a = coercedValue.map((v) => ({ label: v, value: v }))) != null ? _a : [];
8631
+ return (0, import_design_system53.convertComboBoxGroupsToSelectableGroups)({ options, selectedItems: new Set(value) });
8632
+ }, [value]);
8633
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
8634
+ import_design_system53.InputCreatableComboBox,
8543
8635
  {
8544
- label: ariaLabel,
8545
- type: "number",
8546
- showLabel: false,
8547
- min: 0,
8548
- onChange: (e) => setInnerValue(e.currentTarget.value),
8549
- disabled,
8550
- value: innerValue,
8551
- readOnly,
8552
- "data-testid": valueTestId
8636
+ ...props,
8637
+ placeholder: "Type a value\u2026",
8638
+ noOptionsMessage: () => "Type to create a new value",
8639
+ options: groupedOptions,
8640
+ isMulti: true,
8641
+ isClearable,
8642
+ isDisabled: disabled,
8643
+ onChange: (e) => {
8644
+ const selectedValues = (0, import_design_system53.getComboBoxSelectedSelectableGroups)(e);
8645
+ return props.onChange([...selectedValues]);
8646
+ },
8647
+ value: selectedOptions,
8648
+ "aria-readonly": readOnly,
8649
+ styles: {
8650
+ menu(base) {
8651
+ return {
8652
+ ...base,
8653
+ minWidth: "max-content"
8654
+ };
8655
+ }
8656
+ },
8657
+ ...readOnlyProps
8553
8658
  }
8554
- );
8659
+ ) });
8555
8660
  };
8556
- var DateEditor = ({
8557
- onChange,
8558
- ariaLabel,
8559
- disabled,
8560
- value,
8561
- readOnly,
8562
- valueTestId
8563
- }) => {
8564
- const [innerValue, setInnerValue] = (0, import_react81.useState)(value != null ? value : "");
8565
- (0, import_react_use6.useDebounce)(() => onChange(innerValue), 500, [innerValue]);
8566
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8567
- import_design_system44.Input,
8568
- {
8569
- type: "date",
8570
- label: ariaLabel,
8571
- showLabel: false,
8572
- onChange: (e) => setInnerValue(e.currentTarget.value),
8573
- disabled,
8574
- value: innerValue,
8575
- readOnly,
8576
- "data-testid": valueTestId
8661
+
8662
+ // src/components/SearchAndFilter/FilterButton.tsx
8663
+ var import_design_system55 = require("@uniformdev/design-system");
8664
+
8665
+ // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
8666
+ var import_react90 = require("@emotion/react");
8667
+ var import_design_system54 = require("@uniformdev/design-system");
8668
+ var SearchAndFilterControlsWrapper = (gridColumns) => import_react90.css`
8669
+ align-items: stretch;
8670
+ display: grid;
8671
+ grid-template-columns: ${gridColumns};
8672
+ gap: var(--spacing-sm);
8673
+ `;
8674
+ var SearchAndFilterOutterControlWrapper = (gridColumns) => import_react90.css`
8675
+ align-items: stretch;
8676
+ display: grid;
8677
+ grid-template-columns: ${gridColumns};
8678
+ gap: var(--spacing-sm);
8679
+ `;
8680
+ var ConditionalFilterRow = import_react90.css`
8681
+ align-items: baseline;
8682
+ display: grid;
8683
+ grid-template-columns: 35px 1fr;
8684
+ gap: var(--spacing-sm);
8685
+ margin-left: var(--spacing-base);
8686
+
8687
+ ${(0, import_design_system54.cq)("380px")} {
8688
+ &:after {
8689
+ content: '';
8690
+ display: block;
8691
+ height: 1px;
8692
+ background: var(--gray-300);
8693
+ width: calc(100% - var(--spacing-base));
8694
+ margin-left: var(--spacing-base);
8577
8695
  }
8578
- );
8579
- };
8580
- var DateRangeEditor = ({
8581
- ariaLabel,
8582
- onChange,
8583
- disabled,
8584
- value,
8585
- readOnly,
8586
- valueTestId
8587
- }) => {
8588
- const [minDateValue, setMinDateValue] = (0, import_react81.useState)(value ? value[0] : "");
8589
- const [maxDateValue, setMaxDateValue] = (0, import_react81.useState)(value ? value[1] : "");
8590
- const [error, setError] = (0, import_react81.useState)("");
8591
- (0, import_react_use6.useDebounce)(
8592
- () => {
8593
- if (minDateValue && maxDateValue && !error) {
8594
- onChange([minDateValue, maxDateValue]);
8595
- } else {
8596
- onChange([]);
8597
- }
8598
- },
8599
- 500,
8600
- [minDateValue, maxDateValue]
8601
- );
8602
- (0, import_react81.useEffect)(() => {
8603
- if (!minDateValue || !maxDateValue) {
8604
- return;
8696
+ &:last-of-type:after {
8697
+ display: none;
8605
8698
  }
8606
- const minDate = new Date(minDateValue);
8607
- const maxDate = new Date(maxDateValue);
8608
- if (maxDate < minDate) {
8609
- setError("The max date cannot be lower than the min date");
8610
- return;
8699
+ }
8700
+
8701
+ &:nth-of-type(2) {
8702
+ margin-left: 0;
8703
+ grid-template-columns: 50px 1fr;
8704
+ }
8705
+
8706
+ ${(0, import_design_system54.cq)("580px")} {
8707
+ &:after {
8708
+ display: none;
8611
8709
  }
8612
- if (maxDate && !minDate) {
8613
- setError("Please enter both a low and high date");
8614
- return;
8710
+ }
8711
+
8712
+ @media (prefers-reduced-motion: no-preference) {
8713
+ animation: ${import_design_system54.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
8714
+ }
8715
+ `;
8716
+ var ConditionalInputRow = import_react90.css`
8717
+ display: flex;
8718
+ gap: var(--spacing-sm);
8719
+ flex-wrap: wrap;
8720
+
8721
+ ${(0, import_design_system54.cq)("380px")} {
8722
+ & > div:nth-child(-n + 2) {
8723
+ width: calc(50% - var(--spacing-sm));
8615
8724
  }
8616
- const minDateString = minDate.toDateString();
8617
- const maxDateString = maxDate.toDateString();
8618
- if (minDateString === maxDateString || maxDateString === minDateString) {
8619
- setError("The min and max date cannot be the same");
8620
- return;
8725
+
8726
+ & > div:nth-child(n + 3) {
8727
+ width: calc(100% - 48px);
8621
8728
  }
8622
- if (minDate > maxDate) {
8623
- setError("The min date cannot be higher than the max date");
8624
- return;
8729
+ }
8730
+ ${(0, import_design_system54.cq)("764px")} {
8731
+ align-items: flex-start;
8732
+ display: grid;
8733
+ grid-template-columns: 250px 160px 1fr 32px;
8734
+
8735
+ & > div:nth-child(n) {
8736
+ width: auto;
8625
8737
  }
8626
- if (error) {
8627
- setError("");
8738
+ }
8739
+ `;
8740
+ var SearchInput = import_react90.css`
8741
+ max-height: 40px;
8742
+ min-height: unset;
8743
+ `;
8744
+ var BindableKeywordSearchInputStyles = import_react90.css`
8745
+ position: relative;
8746
+ width: 100%;
8747
+
8748
+ & [data-lexical-editor='true'] {
8749
+ padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
8750
+ font-size: var(--fs-sm);
8751
+ border-radius: var(--rounded-full);
8752
+ max-height: 40px;
8753
+ min-height: unset;
8754
+ width: 100%;
8755
+ position: relative;
8756
+ white-space: nowrap;
8757
+ }
8758
+ `;
8759
+ var ClearSearchButtonContainer = import_react90.css`
8760
+ align-items: center;
8761
+ display: flex;
8762
+ position: absolute;
8763
+ inset: 0 var(--spacing-lg) 0 auto;
8764
+ `;
8765
+ var ClearSearchButtonStyles = import_react90.css`
8766
+ background: none;
8767
+ border: none;
8768
+ padding: 0;
8769
+ pointer-events: all;
8770
+ `;
8771
+ var FilterButton = import_react90.css`
8772
+ align-items: center;
8773
+ background: var(--white);
8774
+ border: 1px solid var(--gray-300);
8775
+ border-radius: var(--rounded-full);
8776
+ color: var(--typography-base);
8777
+ display: flex;
8778
+ font-size: var(--fs-sm);
8779
+ gap: var(--spacing-sm);
8780
+ padding: var(--spacing-sm) var(--spacing-base);
8781
+ max-height: 40px;
8782
+ transition:
8783
+ color var(--duration-fast) var(--timing-ease-out),
8784
+ background-color var(--duration-fast) var(--timing-ease-out),
8785
+ border-color var(--duration-fast) var(--timing-ease-out),
8786
+ box-shadow var(--duration-fast) var(--timing-ease-out);
8787
+
8788
+ svg {
8789
+ color: var(--gray-300);
8790
+ transition: color var(--duration-fast) var(--timing-ease-out);
8791
+ }
8792
+
8793
+ &:hover,
8794
+ :where([aria-expanded='true']) {
8795
+ outline: none;
8796
+ background: var(--gray-200);
8797
+ border-color: var(--gray-300);
8798
+
8799
+ svg {
8800
+ color: var(--typography-base);
8628
8801
  }
8629
- if (minDate && maxDate) {
8630
- setMinDateValue(minDateValue);
8631
- setMaxDateValue(maxDateValue);
8632
- } else {
8633
- setMinDateValue("");
8634
- setMaxDateValue("");
8802
+ }
8803
+
8804
+ &:disabled {
8805
+ opacity: var(--opacity-50);
8806
+ }
8807
+ `;
8808
+ var FilterButtonText = import_react90.css`
8809
+ overflow: hidden;
8810
+ text-overflow: ellipsis;
8811
+ white-space: nowrap;
8812
+ max-width: 14ch;
8813
+ `;
8814
+ var FilterButtonSelected = import_react90.css`
8815
+ background: var(--gray-100);
8816
+ border-color: var(--gray-300);
8817
+
8818
+ svg {
8819
+ color: var(--accent-dark);
8820
+ }
8821
+ `;
8822
+ var FilterButtonWithOptions = import_react90.css`
8823
+ :where([aria-expanded='true']) {
8824
+ background: var(--purple-rain-100);
8825
+ border-color: var(--accent-light);
8826
+ color: var(--typography-base);
8827
+ box-shadow: var(--elevation-100);
8828
+
8829
+ svg {
8830
+ color: var(--accent-dark);
8831
+ }
8832
+ }
8833
+ `;
8834
+ var SearchIcon = import_react90.css`
8835
+ color: var(--icon-color);
8836
+ position: absolute;
8837
+ inset: 0 var(--spacing-base) 0 auto;
8838
+ margin: auto;
8839
+ transition: color var(--duration-fast) var(--timing-ease-out);
8840
+ `;
8841
+ var AddConditionalBtn = import_react90.css`
8842
+ align-items: center;
8843
+ background: transparent;
8844
+ border: none;
8845
+ color: var(--primary-action-default);
8846
+ display: flex;
8847
+ gap: var(--spacing-sm);
8848
+ transition: color var(--duration-fast) var(--timing-ease-out);
8849
+ padding: 0;
8850
+
8851
+ &:hover,
8852
+ &:focus {
8853
+ color: var(--primary-action-hover);
8854
+ }
8855
+
8856
+ &:disabled {
8857
+ color: var(--gray-400);
8858
+ }
8859
+ `;
8860
+ var Title = import_react90.css`
8861
+ color: var(--typography-light);
8862
+
8863
+ &:focus {
8864
+ outline: none;
8865
+ }
8866
+ `;
8867
+ var ResetConditionsBtn = import_react90.css`
8868
+ background: transparent;
8869
+ border: none;
8870
+ color: var(--action-destructive-default);
8871
+ transition: color var(--duration-fast) var(--timing-ease-out);
8872
+ padding: 0 var(--spacing-sm) 0 0;
8873
+
8874
+ &:hover,
8875
+ &:focus {
8876
+ color: var(--action-destructive-hover);
8877
+ }
8878
+ &:disabled {
8879
+ color: var(--gray-400);
8880
+ }
8881
+ `;
8882
+ var IconBtn = import_react90.css`
8883
+ align-self: center;
8884
+ background: transparent;
8885
+ border: none;
8886
+ padding: var(--spacing-sm);
8887
+ `;
8888
+ var SearchAndFilterOptionsContainer = import_react90.css`
8889
+ background: var(--gray-50);
8890
+ border: 1px solid var(--gray-300);
8891
+ border-radius: var(--rounded-base);
8892
+ container-type: inline-size;
8893
+ display: flex;
8894
+ flex-direction: column;
8895
+ gap: var(--spacing-sm);
8896
+ padding: var(--spacing-md) 0 var(--spacing-base);
8897
+ will-change: height;
8898
+ position: relative;
8899
+ z-index: 2;
8900
+ `;
8901
+ var SearchAndFilterOptionsInnerContainer = import_react90.css`
8902
+ display: flex;
8903
+ flex-direction: column;
8904
+ gap: var(--spacing-sm);
8905
+ padding-inline: var(--spacing-md);
8906
+ `;
8907
+ var SearchAndFilterButtonGroup = import_react90.css`
8908
+ margin-top: var(--spacing-xs);
8909
+ margin-left: calc(56px + var(--spacing-md));
8910
+ `;
8911
+
8912
+ // src/components/SearchAndFilter/FilterButton.tsx
8913
+ var import_jsx_runtime83 = require("@emotion/react/jsx-runtime");
8914
+ var FilterButton2 = ({
8915
+ text = "Filters",
8916
+ icon = "filter-add",
8917
+ filterCount,
8918
+ hasSelectedValue,
8919
+ dataTestId,
8920
+ ...props
8921
+ }) => {
8922
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
8923
+ "button",
8924
+ {
8925
+ type: "button",
8926
+ css: [
8927
+ FilterButton,
8928
+ hasSelectedValue ? FilterButtonSelected : void 0,
8929
+ filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
8930
+ ],
8931
+ ...props,
8932
+ "data-testid": dataTestId,
8933
+ children: [
8934
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_design_system55.Icon, { icon, iconColor: "currentColor", size: "1rem" }),
8935
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { css: FilterButtonText, children: text }),
8936
+ filterCount ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_design_system55.Counter, { count: filterCount, bgColor: "var(--white)" }) : null
8937
+ ]
8635
8938
  }
8636
- }, [minDateValue, maxDateValue, setError]);
8637
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
8638
- /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8639
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8640
- import_design_system44.Input,
8641
- {
8642
- label: `${ariaLabel}-min-date`,
8643
- type: "date",
8644
- showLabel: false,
8645
- value: minDateValue,
8646
- onChange: (e) => setMinDateValue(e.currentTarget.value),
8647
- "aria-invalid": !error ? false : true,
8648
- disabled,
8649
- readOnly,
8650
- "data-testid": "value-low"
8651
- }
8652
- ),
8653
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8654
- import_design_system44.Input,
8655
- {
8656
- label: `${ariaLabel}-max-date`,
8657
- type: "date",
8658
- showLabel: false,
8659
- value: maxDateValue,
8660
- onChange: (e) => setMaxDateValue(e.currentTarget.value),
8661
- "aria-invalid": !error ? false : true,
8662
- disabled,
8663
- readOnly,
8664
- "data-testid": "value-high"
8665
- }
8666
- )
8667
- ] }),
8668
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ErrorContainer, { errorMessage: error })
8669
- ] });
8939
+ );
8670
8940
  };
8941
+
8942
+ // src/components/SearchAndFilter/FilterControls.tsx
8943
+ var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
8944
+ var import_canvas12 = require("@uniformdev/canvas");
8945
+ var import_design_system57 = require("@uniformdev/design-system");
8946
+ var import_lexical11 = require("lexical");
8947
+ var import_react92 = require("react");
8948
+ var import_react_use11 = require("react-use");
8949
+ var import_uuid3 = require("uuid");
8950
+
8951
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8952
+ var import_design_system56 = require("@uniformdev/design-system");
8953
+ var import_react91 = require("react");
8954
+
8955
+ // src/components/SearchAndFilter/FilterEditor.tsx
8956
+ var import_jsx_runtime84 = require("@emotion/react/jsx-runtime");
8671
8957
  var FilterEditorRenderer = ({ editorType, ...props }) => {
8672
8958
  const { filterMapper: contextFilterMapper } = useSearchAndFilter();
8673
8959
  const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
8674
- if (!Editor) {
8675
- return null;
8676
- }
8677
- if (editorType === "empty") {
8678
- return null;
8960
+ if (!Editor || editorType === "empty") {
8961
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", {});
8679
8962
  }
8680
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Editor, { ...props });
8963
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Editor, { ...props });
8681
8964
  };
8682
8965
  var filterMapper = {
8683
8966
  multiChoice: FilterMultiChoiceEditor,
@@ -8685,18 +8968,19 @@ var filterMapper = {
8685
8968
  date: DateEditor,
8686
8969
  dateRange: DateRangeEditor,
8687
8970
  text: TextEditor,
8971
+ textMultiChoice: TextMultiChoiceEditor,
8688
8972
  numberRange: NumberRangeEditor,
8689
8973
  number: NumberEditor,
8690
8974
  statusMultiChoice: StatusMultiEditor,
8691
8975
  statusSingleChoice: StatusSingleEditor,
8692
8976
  empty: null
8693
8977
  };
8694
- function withInputVariables(WrappedComponent) {
8978
+ function withInputVariables(WrappedComponent, noSwapping = false) {
8695
8979
  const WithInputVariables = (props) => {
8696
8980
  if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8697
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props });
8981
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(WrappedComponent, { ...props });
8698
8982
  }
8699
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8983
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8700
8984
  InputVariables,
8701
8985
  {
8702
8986
  disableInlineMenu: true,
@@ -8704,7 +8988,7 @@ function withInputVariables(WrappedComponent) {
8704
8988
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8705
8989
  value: props.value,
8706
8990
  disabled: props.disabled,
8707
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props })
8991
+ inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(WrappedComponent, { ...props })
8708
8992
  }
8709
8993
  );
8710
8994
  };
@@ -8714,16 +8998,16 @@ function withInputVariablesForMultiValue(WrappedComponent) {
8714
8998
  const WithInputVariables = (props) => {
8715
8999
  var _a;
8716
9000
  if (!props.bindable || props.disabled || props.readOnly) {
8717
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props });
9001
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(WrappedComponent, { ...props });
8718
9002
  }
8719
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
9003
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8720
9004
  InputVariables,
8721
9005
  {
8722
9006
  disableInlineMenu: true,
8723
9007
  showMenuPosition: "inline-right",
8724
9008
  onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
8725
9009
  value: (_a = props.value) == null ? void 0 : _a[0],
8726
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WrappedComponent, { ...props })
9010
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(WrappedComponent, { ...props })
8727
9011
  }
8728
9012
  );
8729
9013
  };
@@ -8734,30 +9018,13 @@ var bindableFiltersMapper = {
8734
9018
  multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
8735
9019
  singleChoice: withInputVariables(FilterSingleChoiceEditor),
8736
9020
  date: withInputVariables(DateEditor),
8737
- text: withInputVariables(TextEditor),
9021
+ text: withInputVariables(TextEditor, true),
8738
9022
  number: withInputVariables(NumberEditor)
8739
9023
  };
8740
- var ErrorContainer = ({ errorMessage }) => {
8741
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
8742
- "div",
8743
- {
8744
- css: {
8745
- gridColumn: "span 6",
8746
- order: 6
8747
- },
8748
- children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system44.FieldMessage, { errorMessage })
8749
- }
8750
- );
8751
- };
8752
- var twoColumnGrid = {
8753
- display: "grid",
8754
- gridTemplateColumns: "1fr 1fr",
8755
- gap: "var(--spacing-sm);"
8756
- };
8757
9024
 
8758
9025
  // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8759
- var import_jsx_runtime73 = require("@emotion/react/jsx-runtime");
8760
- var SearchAndFilterContext = (0, import_react82.createContext)({
9026
+ var import_jsx_runtime85 = require("@emotion/react/jsx-runtime");
9027
+ var SearchAndFilterContext = (0, import_react91.createContext)({
8761
9028
  searchTerm: "",
8762
9029
  setSearchTerm: () => {
8763
9030
  },
@@ -8783,6 +9050,7 @@ var SearchAndFilterProvider = ({
8783
9050
  filters,
8784
9051
  filterOptions,
8785
9052
  filterVisible = false,
9053
+ alwaysVisible = false,
8786
9054
  defaultSearchTerm = "",
8787
9055
  onSearchChange,
8788
9056
  onChange,
@@ -8792,45 +9060,50 @@ var SearchAndFilterProvider = ({
8792
9060
  children,
8793
9061
  allowBindingSearchTerm
8794
9062
  }) => {
8795
- const [searchTerm, setSearchTerm] = (0, import_react82.useState)(defaultSearchTerm);
8796
- const deferredSearchTerm = (0, import_react82.useDeferredValue)(searchTerm);
8797
- const [filterVisibility, setFilterVisibility] = (0, import_react82.useState)(filterVisible);
8798
- const handleSearchTerm = (0, import_react82.useCallback)(
9063
+ const [searchTerm, setSearchTerm] = (0, import_react91.useState)(defaultSearchTerm);
9064
+ const deferredSearchTerm = (0, import_react91.useDeferredValue)(searchTerm);
9065
+ const [filterVisibility, setFilterVisibility] = (0, import_react91.useState)(alwaysVisible || filterVisible);
9066
+ const handleSearchTerm = (0, import_react91.useCallback)(
8799
9067
  (term) => {
8800
9068
  setSearchTerm(term);
8801
9069
  onSearchChange == null ? void 0 : onSearchChange(term);
8802
9070
  },
8803
9071
  [setSearchTerm, onSearchChange]
8804
9072
  );
8805
- const handleToggleFilterVisibility = (0, import_react82.useCallback)(
8806
- (visible) => setFilterVisibility(visible),
8807
- [setFilterVisibility]
9073
+ const handleToggleFilterVisibility = (0, import_react91.useCallback)(
9074
+ (visible) => {
9075
+ if (alwaysVisible) {
9076
+ return;
9077
+ }
9078
+ setFilterVisibility(visible);
9079
+ },
9080
+ [alwaysVisible]
8808
9081
  );
8809
- const handleAddFilter = (0, import_react82.useCallback)(() => {
9082
+ const handleAddFilter = (0, import_react91.useCallback)(() => {
8810
9083
  onChange([...filters, { field: "", operator: "", value: "" }]);
8811
9084
  }, [filters, onChange]);
8812
- const handleResetFilters = (0, import_react82.useCallback)(() => {
9085
+ const handleResetFilters = (0, import_react91.useCallback)(() => {
8813
9086
  onSearchChange == null ? void 0 : onSearchChange("");
8814
9087
  onChange(resetFilterValues);
8815
9088
  }, [onChange, resetFilterValues, onSearchChange]);
8816
- const handleDeleteFilter = (0, import_react82.useCallback)(
9089
+ const handleDeleteFilter = (0, import_react91.useCallback)(
8817
9090
  (index) => {
8818
9091
  const remainingFilters = filters.filter((_, i) => i !== index);
8819
9092
  onChange(remainingFilters);
8820
9093
  },
8821
9094
  [filters, onChange]
8822
9095
  );
8823
- const validFilterQuery = (0, import_react82.useMemo)(() => {
9096
+ const validFilterQuery = (0, import_react91.useMemo)(() => {
8824
9097
  const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
8825
9098
  if (hasValidFilters) {
8826
9099
  return filters;
8827
9100
  }
8828
9101
  }, [filters]);
8829
- (0, import_react82.useEffect)(() => {
9102
+ (0, import_react91.useEffect)(() => {
8830
9103
  if (filterVisibility) {
8831
9104
  const handleEscKeyFilterClose = (e) => {
8832
9105
  if (e.key === "Escape") {
8833
- setFilterVisibility(false);
9106
+ handleToggleFilterVisibility(false);
8834
9107
  }
8835
9108
  };
8836
9109
  document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
@@ -8838,8 +9111,8 @@ var SearchAndFilterProvider = ({
8838
9111
  document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8839
9112
  };
8840
9113
  }
8841
- }, [filterVisibility]);
8842
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
9114
+ }, [filterVisibility, handleToggleFilterVisibility]);
9115
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
8843
9116
  SearchAndFilterContext.Provider,
8844
9117
  {
8845
9118
  value: {
@@ -8858,17 +9131,17 @@ var SearchAndFilterProvider = ({
8858
9131
  filterMapper: filterMapper2,
8859
9132
  allowBindingSearchTerm
8860
9133
  },
8861
- children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_design_system45.VerticalRhythm, { children })
9134
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_design_system56.VerticalRhythm, { children })
8862
9135
  }
8863
9136
  );
8864
9137
  };
8865
9138
  var useSearchAndFilter = () => {
8866
- const value = (0, import_react82.useContext)(SearchAndFilterContext);
9139
+ const value = (0, import_react91.useContext)(SearchAndFilterContext);
8867
9140
  return { ...value };
8868
9141
  };
8869
9142
 
8870
9143
  // src/components/SearchAndFilter/FilterControls.tsx
8871
- var import_jsx_runtime74 = require("@emotion/react/jsx-runtime");
9144
+ var import_jsx_runtime86 = require("@emotion/react/jsx-runtime");
8872
9145
  var FilterControls = ({
8873
9146
  children,
8874
9147
  hideSearchInput
@@ -8881,25 +9154,25 @@ var FilterControls = ({
8881
9154
  searchTerm,
8882
9155
  allowBindingSearchTerm
8883
9156
  } = useSearchAndFilter();
8884
- const editorRef = (0, import_react83.useRef)(null);
8885
- const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8886
- const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react83.useState)("data-resource-search-term-input");
8887
- const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react83.useState)(searchTerm);
8888
- (0, import_react_use7.useDebounce)(
9157
+ const editorRef = (0, import_react92.useRef)(null);
9158
+ const variableRefernceCountInSearchTerm = (0, import_canvas12.hasReferencedVariables)(searchTerm);
9159
+ const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react92.useState)("data-resource-search-term-input");
9160
+ const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react92.useState)(searchTerm);
9161
+ (0, import_react_use11.useDebounce)(
8889
9162
  () => {
8890
9163
  setSearchTerm(localeSearchTerm);
8891
9164
  },
8892
9165
  300,
8893
9166
  [localeSearchTerm]
8894
9167
  );
8895
- (0, import_react83.useEffect)(() => {
9168
+ (0, import_react92.useEffect)(() => {
8896
9169
  if (searchTerm === "") {
8897
9170
  setLocaleSearchTerm("");
8898
9171
  setIdToResetInputVariables(`data-resource-search-term-input-${(0, import_uuid3.v4)()}`);
8899
9172
  }
8900
9173
  }, [searchTerm]);
8901
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
8902
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
9174
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
9175
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8903
9176
  FilterButton2,
8904
9177
  {
8905
9178
  "aria-controls": "search-and-filter-options",
@@ -8912,8 +9185,8 @@ var FilterControls = ({
8912
9185
  dataTestId: "filters-button"
8913
9186
  }
8914
9187
  ),
8915
- hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { css: BindableKeywordSearchInputStyles, children: [
8916
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
9188
+ hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { css: BindableKeywordSearchInputStyles, children: [
9189
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8917
9190
  InputVariables,
8918
9191
  {
8919
9192
  label: "",
@@ -8923,8 +9196,8 @@ var FilterControls = ({
8923
9196
  value: localeSearchTerm,
8924
9197
  onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
8925
9198
  disableVariables: !allowBindingSearchTerm,
8926
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8927
- import_design_system46.InputKeywordSearch,
9199
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9200
+ import_design_system57.InputKeywordSearch,
8928
9201
  {
8929
9202
  placeholder: "Search...",
8930
9203
  onSearchTextChanged: (e) => setLocaleSearchTerm(e),
@@ -8936,7 +9209,7 @@ var FilterControls = ({
8936
9209
  )
8937
9210
  }
8938
9211
  ),
8939
- hasVariableInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
9212
+ variableRefernceCountInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8940
9213
  "button",
8941
9214
  {
8942
9215
  css: ClearSearchButtonStyles,
@@ -8950,7 +9223,7 @@ var FilterControls = ({
8950
9223
  },
8951
9224
  type: "button",
8952
9225
  "data-testid": "keyword-search-clear-button",
8953
- children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_design_system46.Icon, { icon: import_CgClose5.CgClose, iconColor: "red", size: "1rem" })
9226
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_design_system57.Icon, { icon: import_CgClose5.CgClose, iconColor: "red", size: "1rem" })
8954
9227
  }
8955
9228
  ) }) : null
8956
9229
  ] }),
@@ -8959,88 +9232,27 @@ var FilterControls = ({
8959
9232
  };
8960
9233
 
8961
9234
  // src/components/SearchAndFilter/FilterItem.tsx
8962
- var import_design_system48 = require("@uniformdev/design-system");
8963
- var import_react85 = require("react");
9235
+ var import_design_system58 = require("@uniformdev/design-system");
9236
+ var import_react93 = require("react");
8964
9237
 
8965
- // src/components/SearchAndFilter/FilterMenu.tsx
8966
- var import_design_system47 = require("@uniformdev/design-system");
8967
- var import_react84 = __toESM(require("react"));
8968
- var import_jsx_runtime75 = require("@emotion/react/jsx-runtime");
8969
- var SearchAndFilterOptionsContainer2 = ({
8970
- buttonRow,
8971
- additionalFiltersContainer,
8972
- children
8973
- }) => {
8974
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
8975
- /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8976
- buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
8977
- import_design_system47.HorizontalRhythm,
8978
- {
8979
- css: SearchAndFilterButtonGroup,
8980
- gap: "sm",
8981
- align: "center",
8982
- justify: "space-between",
8983
- children: buttonRow
8984
- }
8985
- ) : null,
8986
- additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: additionalFiltersContainer }) : null
8987
- ] });
8988
- };
8989
- var FilterMenu = ({
8990
- id,
8991
- filterTitle = "Show results",
8992
- menuControls,
8993
- additionalFiltersContainer,
8994
- children,
8995
- dataTestId,
8996
- resetButtonText = "reset"
8997
- }) => {
8998
- const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
8999
- const innerMenuRef = import_react84.default.useRef(null);
9000
- (0, import_react84.useEffect)(() => {
9001
- var _a;
9002
- if (filterVisibility) {
9003
- (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
9004
- }
9005
- }, [filterVisibility]);
9006
- 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)(
9007
- SearchAndFilterOptionsContainer2,
9008
- {
9009
- buttonRow: menuControls,
9010
- additionalFiltersContainer,
9011
- children: [
9012
- /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_design_system47.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
9013
- /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
9014
- (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
9015
- "button",
9016
- {
9017
- type: "button",
9018
- css: ResetConditionsBtn,
9019
- onClick: () => {
9020
- handleResetFilters();
9021
- setFilterVisibility(false);
9022
- },
9023
- "data-testid": "reset-filters",
9024
- children: resetButtonText
9025
- }
9026
- ) : null
9027
- ] }),
9028
- children
9029
- ]
9030
- }
9031
- ) : null });
9032
- };
9238
+ // src/components/SearchAndFilter/util/isFilterBindable.ts
9239
+ function isFilterBindable(filter, operator) {
9240
+ var _a, _b;
9241
+ return (_b = (_a = operator == null ? void 0 : operator.bindable) != null ? _a : filter == null ? void 0 : filter.bindable) != null ? _b : false;
9242
+ }
9033
9243
 
9034
9244
  // src/components/SearchAndFilter/FilterItem.tsx
9035
- var import_jsx_runtime76 = require("@emotion/react/jsx-runtime");
9245
+ var import_jsx_runtime87 = require("@emotion/react/jsx-runtime");
9036
9246
  var FilterItem = ({
9037
9247
  index,
9038
- paramOptions,
9039
9248
  operatorOptions,
9040
9249
  valueOptions,
9041
- onParamChange,
9250
+ onFilterOptionChange,
9251
+ onFilterDynamicChange,
9042
9252
  onOperatorChange,
9043
- onValueChange
9253
+ onValueChange,
9254
+ initialCriteriaTitle = "Where",
9255
+ criteriaGroupOperator = "and"
9044
9256
  }) => {
9045
9257
  var _a, _b;
9046
9258
  const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
@@ -9048,25 +9260,26 @@ var FilterItem = ({
9048
9260
  const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
9049
9261
  const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
9050
9262
  const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
9051
- const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react85.useMemo)(() => {
9263
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react93.useMemo)(() => {
9052
9264
  var _a2;
9053
- const currentSelectedFilter = filterOptions.find((item) => {
9265
+ const currentSelectedFilterGroup = filterOptions.find((item) => {
9054
9266
  var _a3;
9055
9267
  return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
9056
9268
  });
9057
- const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
9269
+ const selectedFilterOption = (_a2 = currentSelectedFilterGroup == null ? void 0 : currentSelectedFilterGroup.options) == null ? void 0 : _a2.find((item) => {
9058
9270
  return filters[index].field === item.value;
9059
9271
  });
9060
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
9272
+ const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
9061
9273
  const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
9062
9274
  return filters[index].operator === item.value;
9063
9275
  });
9276
+ const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
9064
9277
  return {
9065
- selectedFieldValue: selectedFieldValue2,
9278
+ selectedFieldValue: selectedFilterOption,
9066
9279
  selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
9067
9280
  selectedMetaValue: filters[index].value,
9068
9281
  readOnly: isCurrentFieldReadOnly,
9069
- bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
9282
+ bindable: bindable2
9070
9283
  };
9071
9284
  }, [filters, filterOptions, index, operatorOptions]);
9072
9285
  const readOnlyProps = readOnly ? {
@@ -9075,17 +9288,28 @@ var FilterItem = ({
9075
9288
  menuIsOpen: false,
9076
9289
  isClearable: false
9077
9290
  } : {};
9078
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
9079
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: index === 0 ? "Where" : "and" }),
9080
- /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { css: ConditionalInputRow, children: [
9081
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9082
- import_design_system48.InputComboBox,
9291
+ const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
9292
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
9293
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
9294
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { css: ConditionalInputRow, children: [
9295
+ CustomLeftHandComponent ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9296
+ CustomLeftHandComponent,
9297
+ {
9298
+ filterOption: selectedFieldValue,
9299
+ filter: filters[index],
9300
+ setFilterDynamicValue: onFilterDynamicChange,
9301
+ deselectFilterOption: () => {
9302
+ onFilterOptionChange("");
9303
+ }
9304
+ }
9305
+ ) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9306
+ import_design_system58.InputComboBox,
9083
9307
  {
9084
9308
  "aria-label": label,
9085
- options: paramOptions,
9309
+ options: filterOptions,
9086
9310
  onChange: (e) => {
9087
9311
  var _a2;
9088
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
9312
+ onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
9089
9313
  },
9090
9314
  isOptionDisabled: (option) => {
9091
9315
  var _a2;
@@ -9105,8 +9329,8 @@ var FilterItem = ({
9105
9329
  name: `filter-field-${index}`
9106
9330
  }
9107
9331
  ),
9108
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9109
- import_design_system48.InputComboBox,
9332
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9333
+ import_design_system58.InputComboBox,
9110
9334
  {
9111
9335
  "aria-label": operatorLabel,
9112
9336
  options: operatorOptions,
@@ -9129,7 +9353,7 @@ var FilterItem = ({
9129
9353
  name: `filter-operator-${index}`
9130
9354
  }
9131
9355
  ),
9132
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9356
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9133
9357
  FilterEditorRenderer,
9134
9358
  {
9135
9359
  "aria-label": metaDataLabel,
@@ -9143,7 +9367,7 @@ var FilterItem = ({
9143
9367
  valueTestId: "filter-value"
9144
9368
  }
9145
9369
  ),
9146
- readOnly || index === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9370
+ readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9147
9371
  "button",
9148
9372
  {
9149
9373
  type: "button",
@@ -9151,15 +9375,185 @@ var FilterItem = ({
9151
9375
  "aria-label": "delete filter",
9152
9376
  css: IconBtn,
9153
9377
  "data-testid": "delete-filter",
9154
- children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_design_system48.Icon, { icon: "trash", iconColor: "red", size: "1rem" })
9378
+ disabled: filters.length === 1,
9379
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_design_system58.Icon, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
9155
9380
  }
9156
9381
  )
9157
9382
  ] })
9158
9383
  ] });
9159
9384
  };
9385
+
9386
+ // src/components/SearchAndFilter/FilterItems.tsx
9387
+ var import_design_system60 = require("@uniformdev/design-system");
9388
+
9389
+ // src/components/SearchAndFilter/FilterMenu.tsx
9390
+ var import_design_system59 = require("@uniformdev/design-system");
9391
+ var import_react94 = __toESM(require("react"));
9392
+ var import_jsx_runtime88 = require("@emotion/react/jsx-runtime");
9393
+ var SearchAndFilterOptionsContainer2 = ({
9394
+ buttonRow,
9395
+ additionalFiltersContainer,
9396
+ children
9397
+ }) => {
9398
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
9399
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
9400
+ buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9401
+ import_design_system59.HorizontalRhythm,
9402
+ {
9403
+ css: SearchAndFilterButtonGroup,
9404
+ gap: "sm",
9405
+ align: "center",
9406
+ justify: "space-between",
9407
+ children: buttonRow
9408
+ }
9409
+ ) : null,
9410
+ additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { children: additionalFiltersContainer }) : null
9411
+ ] });
9412
+ };
9413
+ var FilterMenu = ({
9414
+ id,
9415
+ filterTitle = "Show results",
9416
+ menuControls,
9417
+ additionalFiltersContainer,
9418
+ children,
9419
+ dataTestId,
9420
+ resetButtonText = "reset"
9421
+ }) => {
9422
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
9423
+ const innerMenuRef = import_react94.default.useRef(null);
9424
+ (0, import_react94.useEffect)(() => {
9425
+ var _a;
9426
+ if (filterVisibility) {
9427
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
9428
+ }
9429
+ }, [filterVisibility]);
9430
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_design_system59.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
9431
+ SearchAndFilterOptionsContainer2,
9432
+ {
9433
+ buttonRow: menuControls,
9434
+ additionalFiltersContainer,
9435
+ children: [
9436
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system59.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
9437
+ filterTitle ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
9438
+ (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9439
+ "button",
9440
+ {
9441
+ type: "button",
9442
+ css: ResetConditionsBtn,
9443
+ disabled: filters.every((f) => !f.field),
9444
+ onClick: () => {
9445
+ handleResetFilters();
9446
+ setFilterVisibility(false);
9447
+ },
9448
+ "data-testid": "reset-filters",
9449
+ children: resetButtonText
9450
+ }
9451
+ ) : null
9452
+ ] }),
9453
+ children
9454
+ ]
9455
+ }
9456
+ ) : null });
9457
+ };
9458
+
9459
+ // src/components/SearchAndFilter/util/getNewFilterValueAfterOperatorChange.ts
9460
+ var import_canvas13 = require("@uniformdev/canvas");
9461
+ function getNewFilterValueAfterOperatorChange({
9462
+ newOperatorId,
9463
+ currentFilter,
9464
+ filterOptions
9465
+ }) {
9466
+ var _a, _b, _c;
9467
+ if (Array.isArray(newOperatorId)) {
9468
+ throw new Error("Operator value must be a single string");
9469
+ }
9470
+ const result = {
9471
+ ...currentFilter,
9472
+ operator: newOperatorId,
9473
+ value: ""
9474
+ };
9475
+ const currentOperatorId = currentFilter.operator;
9476
+ let currentValue = currentFilter.value;
9477
+ const currentFieldDefinition = filterOptions.flatMap((group) => {
9478
+ var _a2;
9479
+ return (_a2 = group.options) != null ? _a2 : [];
9480
+ }).find((filter) => filter.value === currentFilter.field);
9481
+ const currentOperator = (_a = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _a.find(
9482
+ (op) => op.value === currentOperatorId
9483
+ );
9484
+ const newOperator = (_b = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _b.find((op) => op.value === newOperatorId);
9485
+ if (!currentOperator || !newOperator) {
9486
+ result.value = "";
9487
+ return result;
9488
+ } else {
9489
+ const currentOperatorValueType = currentOperator.expectedValueType;
9490
+ const newOperatorValueType = newOperator.expectedValueType;
9491
+ if (!isFilterBindable(currentFieldDefinition, newOperator) && hasBindings(currentValue)) {
9492
+ currentValue = "";
9493
+ }
9494
+ if (isHardcodedOperatorValue(currentOperatorValueType)) {
9495
+ result.value = isHardcodedOperatorValue(newOperatorValueType) ? newOperatorValueType : "";
9496
+ return result;
9497
+ }
9498
+ switch (newOperatorValueType) {
9499
+ case "single":
9500
+ if (Array.isArray(currentValue)) {
9501
+ if (currentOperatorValueType === "between") {
9502
+ result.value = "";
9503
+ } else {
9504
+ result.value = (_c = currentValue[0]) != null ? _c : "";
9505
+ }
9506
+ } else {
9507
+ result.value = currentValue;
9508
+ }
9509
+ return result;
9510
+ case "array":
9511
+ if (currentOperatorValueType === "between") {
9512
+ result.value = "";
9513
+ } else if (Array.isArray(currentValue)) {
9514
+ result.value = currentValue;
9515
+ } else {
9516
+ result.value = currentValue ? [currentValue] : [];
9517
+ }
9518
+ return result;
9519
+ case "between":
9520
+ if (Array.isArray(currentValue)) {
9521
+ result.value = "";
9522
+ } else {
9523
+ result.value = [currentValue, ""];
9524
+ }
9525
+ return result;
9526
+ case "none":
9527
+ result.value = "";
9528
+ return result;
9529
+ default:
9530
+ result.value = newOperatorValueType;
9531
+ return result;
9532
+ }
9533
+ }
9534
+ }
9535
+ function isHardcodedOperatorValue(valueType) {
9536
+ return valueType !== void 0 && valueType !== "array" && valueType !== "between" && valueType !== "none" && valueType !== "single";
9537
+ }
9538
+ function hasBindings(currentValue) {
9539
+ if (currentValue === void 0) {
9540
+ return false;
9541
+ }
9542
+ if (Array.isArray(currentValue)) {
9543
+ return currentValue.some((value) => (0, import_canvas13.hasReferencedVariables)(value));
9544
+ }
9545
+ return (0, import_canvas13.hasReferencedVariables)(currentValue) > 0;
9546
+ }
9547
+
9548
+ // src/components/SearchAndFilter/FilterItems.tsx
9549
+ var import_jsx_runtime89 = require("@emotion/react/jsx-runtime");
9160
9550
  var FilterItems = ({
9161
9551
  addButtonText = "add condition",
9162
- additionalFiltersContainer
9552
+ additionalFiltersContainer,
9553
+ filterTitle,
9554
+ resetButtonText,
9555
+ initialCriteriaTitle,
9556
+ criteriaGroupOperator
9163
9557
  }) => {
9164
9558
  const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
9165
9559
  const handleUpdateFilter = (index, prop, value) => {
@@ -9167,21 +9561,16 @@ var FilterItems = ({
9167
9561
  const next = [...filters];
9168
9562
  next[index] = { ...next[index], [prop]: value };
9169
9563
  if (prop === "operator") {
9170
- if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
9171
- next[index].value = next[index].value[0];
9172
- }
9173
- if (filters[index].operator === "ndef" || filters[index].operator === "def") {
9174
- next[index].value = "";
9175
- }
9176
- if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
9177
- next[index].value = [next[index].value, ""];
9178
- }
9179
- if (value === "def" || value === "true") {
9180
- next[index].value = "true";
9181
- }
9182
- if (value === "ndef" || value === "false") {
9183
- next[index].value = "false";
9564
+ const newOperatorId = value;
9565
+ const currentFilter = next[index];
9566
+ if (!newOperatorId) {
9567
+ throw new Error("you bad");
9184
9568
  }
9569
+ next[index] = getNewFilterValueAfterOperatorChange({
9570
+ newOperatorId,
9571
+ currentFilter,
9572
+ filterOptions
9573
+ });
9185
9574
  }
9186
9575
  if (prop === "field") {
9187
9576
  const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
@@ -9190,15 +9579,16 @@ var FilterItems = ({
9190
9579
  })) == 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";
9191
9580
  next[index].operator = firstOperatorInAvailableOperators;
9192
9581
  next[index].value = "";
9582
+ next[index].dynamicField = void 0;
9193
9583
  }
9194
9584
  setFilters(next);
9195
9585
  };
9196
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9586
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9197
9587
  FilterMenu,
9198
9588
  {
9199
9589
  id: "search-and-filter-options",
9200
9590
  dataTestId: "search-and-filter-options",
9201
- menuControls: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
9591
+ menuControls: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
9202
9592
  "button",
9203
9593
  {
9204
9594
  type: "button",
@@ -9206,12 +9596,14 @@ var FilterItems = ({
9206
9596
  onClick: handleAddFilter,
9207
9597
  "data-testid": "add-filter",
9208
9598
  children: [
9209
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_design_system48.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9599
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_design_system60.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9210
9600
  addButtonText
9211
9601
  ]
9212
9602
  }
9213
9603
  ),
9214
9604
  additionalFiltersContainer,
9605
+ filterTitle,
9606
+ resetButtonText,
9215
9607
  children: filters.map((item, i) => {
9216
9608
  var _a, _b, _c, _d, _e, _f;
9217
9609
  const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
@@ -9220,16 +9612,18 @@ var FilterItems = ({
9220
9612
  })) == null ? void 0 : _a.options) != null ? _b : [];
9221
9613
  const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
9222
9614
  const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
9223
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9615
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9224
9616
  FilterItem,
9225
9617
  {
9226
9618
  index: i,
9227
- paramOptions: filterOptions,
9228
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
9619
+ onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
9229
9620
  operatorOptions: possibleOperators,
9230
9621
  onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
9231
9622
  onValueChange: (e) => handleUpdateFilter(i, "value", e),
9232
- valueOptions: possibleValueOptions
9623
+ onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
9624
+ valueOptions: possibleValueOptions,
9625
+ initialCriteriaTitle,
9626
+ criteriaGroupOperator
9233
9627
  },
9234
9628
  i
9235
9629
  );
@@ -9239,11 +9633,11 @@ var FilterItems = ({
9239
9633
  };
9240
9634
 
9241
9635
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9242
- var import_design_system50 = require("@uniformdev/design-system");
9636
+ var import_design_system62 = require("@uniformdev/design-system");
9243
9637
 
9244
9638
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9245
- var import_design_system49 = require("@uniformdev/design-system");
9246
- var import_jsx_runtime77 = require("@emotion/react/jsx-runtime");
9639
+ var import_design_system61 = require("@uniformdev/design-system");
9640
+ var import_jsx_runtime90 = require("@emotion/react/jsx-runtime");
9247
9641
  var SearchAndFilterResultContainer = ({
9248
9642
  buttonText,
9249
9643
  clearButtonLabel = "clear",
@@ -9273,31 +9667,40 @@ var SearchAndFilterResultContainer = ({
9273
9667
  handleResetFilters();
9274
9668
  }
9275
9669
  };
9276
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
9277
- /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system49.HorizontalRhythm, { children: [
9278
- /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("span", { children: [
9670
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
9671
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_design_system61.HorizontalRhythm, { children: [
9672
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("span", { children: [
9279
9673
  totalResults,
9280
9674
  " results ",
9281
9675
  searchTerm ? `for "${searchTerm}"` : null
9282
9676
  ] }),
9283
- !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9677
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_design_system61.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9284
9678
  ] }),
9285
- totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system49.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9286
- calloutText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Paragraph, { children: calloutText }) : null,
9287
- hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system49.Button, { buttonType: "tertiaryOutline", size: "xs", onClick: handleClearSearch, children: buttonText != null ? buttonText : "Clear search" })
9679
+ totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_design_system61.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9680
+ calloutText ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_design_system61.Paragraph, { children: calloutText }) : null,
9681
+ hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9682
+ import_design_system61.Button,
9683
+ {
9684
+ buttonType: "tertiaryOutline",
9685
+ size: "xs",
9686
+ onClick: handleClearSearch,
9687
+ "data-testid": "clear-search",
9688
+ children: buttonText != null ? buttonText : "Clear search"
9689
+ }
9690
+ )
9288
9691
  ] }) : null
9289
9692
  ] });
9290
9693
  };
9291
9694
 
9292
9695
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9293
- var import_jsx_runtime78 = require("@emotion/react/jsx-runtime");
9696
+ var import_jsx_runtime91 = require("@emotion/react/jsx-runtime");
9294
9697
  var SearchAndFilter = ({
9295
9698
  filters,
9296
9699
  filterOptions,
9297
9700
  filterVisible,
9298
9701
  filterControls,
9299
9702
  viewSwitchControls,
9300
- resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(SearchAndFilterResultContainer, {}),
9703
+ resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SearchAndFilterResultContainer, {}),
9301
9704
  filterMapper: filterMapper2 = filterMapper,
9302
9705
  additionalFiltersContainer,
9303
9706
  onChange,
@@ -9307,7 +9710,7 @@ var SearchAndFilter = ({
9307
9710
  allowBindingSearchTerm = false,
9308
9711
  resetFilterValues = []
9309
9712
  }) => {
9310
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
9713
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9311
9714
  SearchAndFilterProvider,
9312
9715
  {
9313
9716
  filters,
@@ -9320,18 +9723,18 @@ var SearchAndFilter = ({
9320
9723
  resetFilterValues,
9321
9724
  filterMapper: filterMapper2,
9322
9725
  allowBindingSearchTerm,
9323
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_design_system50.VerticalRhythm, { "data-testid": "search-and-filter", children: [
9324
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9325
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
9726
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_design_system62.VerticalRhythm, { "data-testid": "search-and-filter", children: [
9727
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9728
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9326
9729
  "div",
9327
9730
  {
9328
9731
  css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9329
- children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9732
+ children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9330
9733
  }
9331
9734
  ),
9332
9735
  viewSwitchControls
9333
9736
  ] }),
9334
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FilterItems, { additionalFiltersContainer }),
9737
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FilterItems, { additionalFiltersContainer }),
9335
9738
  resultsContainerView
9336
9739
  ] })
9337
9740
  }
@@ -9339,19 +9742,19 @@ var SearchAndFilter = ({
9339
9742
  };
9340
9743
 
9341
9744
  // src/components/SearchAndFilter/SearchOnlyFilter.tsx
9342
- var import_design_system51 = require("@uniformdev/design-system");
9343
- var import_react86 = require("react");
9344
- var import_react_use8 = require("react-use");
9345
- var import_jsx_runtime79 = require("@emotion/react/jsx-runtime");
9346
- var SearchOnlyContext = (0, import_react86.createContext)({
9745
+ var import_design_system63 = require("@uniformdev/design-system");
9746
+ var import_react95 = require("react");
9747
+ var import_react_use12 = require("react-use");
9748
+ var import_jsx_runtime92 = require("@emotion/react/jsx-runtime");
9749
+ var SearchOnlyContext = (0, import_react95.createContext)({
9347
9750
  searchTerm: "",
9348
9751
  setSearchTerm: () => {
9349
9752
  }
9350
9753
  });
9351
9754
  var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9352
9755
  const { searchTerm, setSearchTerm } = useSearchAndFilter();
9353
- const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react86.useState)("");
9354
- (0, import_react_use8.useDebounce)(
9756
+ const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react95.useState)("");
9757
+ (0, import_react_use12.useDebounce)(
9355
9758
  () => {
9356
9759
  setSearchTerm(localeSearchTerm);
9357
9760
  onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
@@ -9359,15 +9762,15 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9359
9762
  300,
9360
9763
  [localeSearchTerm]
9361
9764
  );
9362
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
9765
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
9363
9766
  SearchOnlyContext.Provider,
9364
9767
  {
9365
9768
  value: {
9366
9769
  searchTerm,
9367
9770
  setSearchTerm: setLocaleSearchTerm
9368
9771
  },
9369
- children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
9370
- import_design_system51.InputKeywordSearch,
9772
+ children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
9773
+ import_design_system63.InputKeywordSearch,
9371
9774
  {
9372
9775
  placeholder: "Search...",
9373
9776
  onSearchTextChanged: (e) => setLocaleSearchTerm(e),
@@ -9381,18 +9784,18 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9381
9784
  };
9382
9785
 
9383
9786
  // src/components/SearchAndFilter/SortItems.tsx
9384
- var import_design_system53 = require("@uniformdev/design-system");
9787
+ var import_design_system65 = require("@uniformdev/design-system");
9385
9788
 
9386
9789
  // src/components/SearchAndFilter/styles/SortItems.styles.ts
9387
- var import_react87 = require("@emotion/react");
9388
- var import_design_system52 = require("@uniformdev/design-system");
9389
- var ConditionalFilterRow2 = import_react87.css`
9790
+ var import_react96 = require("@emotion/react");
9791
+ var import_design_system64 = require("@uniformdev/design-system");
9792
+ var ConditionalFilterRow2 = import_react96.css`
9390
9793
  display: grid;
9391
9794
  grid-template-columns: 35px 1fr;
9392
9795
  gap: var(--spacing-sm);
9393
9796
  margin-left: var(--spacing-base);
9394
9797
 
9395
- ${(0, import_design_system52.cq)("380px")} {
9798
+ ${(0, import_design_system64.cq)("380px")} {
9396
9799
  align-items: center;
9397
9800
 
9398
9801
  &:after {
@@ -9413,22 +9816,22 @@ var ConditionalFilterRow2 = import_react87.css`
9413
9816
  grid-template-columns: 50px 1fr;
9414
9817
  }
9415
9818
 
9416
- ${(0, import_design_system52.cq)("580px")} {
9819
+ ${(0, import_design_system64.cq)("580px")} {
9417
9820
  &:after {
9418
9821
  display: none;
9419
9822
  }
9420
9823
  }
9421
9824
 
9422
9825
  @media (prefers-reduced-motion: no-preference) {
9423
- animation: ${import_design_system52.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
9826
+ animation: ${import_design_system64.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
9424
9827
  }
9425
9828
  `;
9426
- var ConditionalInputRow2 = import_react87.css`
9829
+ var ConditionalInputRow2 = import_react96.css`
9427
9830
  display: flex;
9428
9831
  gap: var(--spacing-sm);
9429
9832
  flex-wrap: wrap;
9430
9833
 
9431
- ${(0, import_design_system52.cq)("380px")} {
9834
+ ${(0, import_design_system64.cq)("380px")} {
9432
9835
  & > div:nth-child(-n + 2) {
9433
9836
  width: calc(50% - var(--spacing-sm));
9434
9837
  }
@@ -9437,7 +9840,7 @@ var ConditionalInputRow2 = import_react87.css`
9437
9840
  width: calc(100% - 48px);
9438
9841
  }
9439
9842
  }
9440
- ${(0, import_design_system52.cq)("580px")} {
9843
+ ${(0, import_design_system64.cq)("580px")} {
9441
9844
  display: grid;
9442
9845
  grid-template-columns: 200px 160px 1fr 32px;
9443
9846
 
@@ -9446,11 +9849,11 @@ var ConditionalInputRow2 = import_react87.css`
9446
9849
  }
9447
9850
  }
9448
9851
  `;
9449
- var SearchInput2 = import_react87.css`
9852
+ var SearchInput2 = import_react96.css`
9450
9853
  max-height: 40px;
9451
9854
  min-height: unset;
9452
9855
  `;
9453
- var FilterButton3 = import_react87.css`
9856
+ var FilterButton3 = import_react96.css`
9454
9857
  align-items: center;
9455
9858
  background: var(--white);
9456
9859
  border: 1px solid var(--gray-300);
@@ -9461,7 +9864,8 @@ var FilterButton3 = import_react87.css`
9461
9864
  gap: var(--spacing-sm);
9462
9865
  padding: var(--spacing-sm) var(--spacing-base);
9463
9866
  max-height: 40px;
9464
- transition: color var(--duration-fast) var(--timing-ease-out),
9867
+ transition:
9868
+ color var(--duration-fast) var(--timing-ease-out),
9465
9869
  background-color var(--duration-fast) var(--timing-ease-out),
9466
9870
  border-color var(--duration-fast) var(--timing-ease-out),
9467
9871
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -9486,13 +9890,13 @@ var FilterButton3 = import_react87.css`
9486
9890
  opacity: var(--opacity-50);
9487
9891
  }
9488
9892
  `;
9489
- var FilterButtonText2 = import_react87.css`
9893
+ var FilterButtonText2 = import_react96.css`
9490
9894
  overflow: hidden;
9491
9895
  text-overflow: ellipsis;
9492
9896
  white-space: nowrap;
9493
9897
  max-width: 14ch;
9494
9898
  `;
9495
- var FilterButtonSelected2 = import_react87.css`
9899
+ var FilterButtonSelected2 = import_react96.css`
9496
9900
  background: var(--gray-100);
9497
9901
  border-color: var(--gray-300);
9498
9902
 
@@ -9500,7 +9904,7 @@ var FilterButtonSelected2 = import_react87.css`
9500
9904
  color: var(--accent-dark);
9501
9905
  }
9502
9906
  `;
9503
- var FilterButtonWithOptions2 = import_react87.css`
9907
+ var FilterButtonWithOptions2 = import_react96.css`
9504
9908
  :where([aria-expanded='true']) {
9505
9909
  background: var(--purple-rain-100);
9506
9910
  border-color: var(--accent-light);
@@ -9512,14 +9916,14 @@ var FilterButtonWithOptions2 = import_react87.css`
9512
9916
  }
9513
9917
  }
9514
9918
  `;
9515
- var SearchIcon2 = import_react87.css`
9919
+ var SearchIcon2 = import_react96.css`
9516
9920
  color: var(--icon-color);
9517
9921
  position: absolute;
9518
9922
  inset: 0 var(--spacing-base) 0 auto;
9519
9923
  margin: auto;
9520
9924
  transition: color var(--duration-fast) var(--timing-ease-out);
9521
9925
  `;
9522
- var AddConditionalBtn2 = import_react87.css`
9926
+ var AddConditionalBtn2 = import_react96.css`
9523
9927
  align-items: center;
9524
9928
  background: transparent;
9525
9929
  border: none;
@@ -9538,14 +9942,14 @@ var AddConditionalBtn2 = import_react87.css`
9538
9942
  color: var(--gray-400);
9539
9943
  }
9540
9944
  `;
9541
- var Title2 = import_react87.css`
9945
+ var Title2 = import_react96.css`
9542
9946
  color: var(--typography-light);
9543
9947
 
9544
9948
  &:focus {
9545
9949
  outline: none;
9546
9950
  }
9547
9951
  `;
9548
- var ResetConditionsBtn2 = import_react87.css`
9952
+ var ResetConditionsBtn2 = import_react96.css`
9549
9953
  background: transparent;
9550
9954
  border: none;
9551
9955
  color: var(--action-destructive-default);
@@ -9557,12 +9961,12 @@ var ResetConditionsBtn2 = import_react87.css`
9557
9961
  color: var(--action-destructive-hover);
9558
9962
  }
9559
9963
  `;
9560
- var IconBtn2 = import_react87.css`
9964
+ var IconBtn2 = import_react96.css`
9561
9965
  background: transparent;
9562
9966
  border: none;
9563
9967
  padding: var(--spacing-sm);
9564
9968
  `;
9565
- var SearchAndFilterOptionsContainer3 = import_react87.css`
9969
+ var SearchAndFilterOptionsContainer3 = import_react96.css`
9566
9970
  background: var(--gray-50);
9567
9971
  border: 1px solid var(--gray-300);
9568
9972
  border-radius: var(--rounded-base);
@@ -9575,17 +9979,17 @@ var SearchAndFilterOptionsContainer3 = import_react87.css`
9575
9979
  position: relative;
9576
9980
  z-index: 1;
9577
9981
  `;
9578
- var SearchAndFilterOptionsInnerContainer2 = import_react87.css`
9982
+ var SearchAndFilterOptionsInnerContainer2 = import_react96.css`
9579
9983
  display: flex;
9580
9984
  flex-direction: column;
9581
9985
  gap: var(--spacing-sm);
9582
9986
  padding-inline: var(--spacing-md);
9583
9987
  `;
9584
- var SearchAndFilterButtonGroup2 = import_react87.css`
9988
+ var SearchAndFilterButtonGroup2 = import_react96.css`
9585
9989
  margin-top: var(--spacing-xs);
9586
9990
  margin-left: calc(56px + var(--spacing-md));
9587
9991
  `;
9588
- var SortFilterWrapper = (hiddenLocaleInput) => import_react87.css`
9992
+ var SortFilterWrapper = (hiddenLocaleInput) => import_react96.css`
9589
9993
  align-items: center;
9590
9994
  border-top: 1px solid var(--gray-300);
9591
9995
  display: flex;
@@ -9595,18 +9999,18 @@ var SortFilterWrapper = (hiddenLocaleInput) => import_react87.css`
9595
9999
  position: relative;
9596
10000
  z-index: 0;
9597
10001
 
9598
- ${(0, import_design_system52.cq)("420px")} {
10002
+ ${(0, import_design_system64.cq)("420px")} {
9599
10003
  display: grid;
9600
10004
  grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
9601
10005
  }
9602
10006
  `;
9603
- var SortFilterInputRow = import_react87.css`
10007
+ var SortFilterInputRow = import_react96.css`
9604
10008
  align-items: center;
9605
10009
  display: grid;
9606
10010
  grid-template-columns: 1fr auto;
9607
10011
  gap: var(--spacing-base);
9608
10012
  `;
9609
- var InputVariableWrapper = import_react87.css`
10013
+ var InputVariableWrapper = import_react96.css`
9610
10014
  flex-grow: 1;
9611
10015
 
9612
10016
  // we need to override label styles nested within the input variable
@@ -9617,7 +10021,7 @@ var InputVariableWrapper = import_react87.css`
9617
10021
  `;
9618
10022
 
9619
10023
  // src/components/SearchAndFilter/SortItems.tsx
9620
- var import_jsx_runtime80 = require("@emotion/react/jsx-runtime");
10024
+ var import_jsx_runtime93 = require("@emotion/react/jsx-runtime");
9621
10025
  var SortItems = ({
9622
10026
  sortByLabel = "Sort by",
9623
10027
  localeLabel = "Show locale",
@@ -9639,11 +10043,11 @@ var SortItems = ({
9639
10043
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9640
10044
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9641
10045
  const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9642
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9643
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_design_system53.VerticalRhythm, { gap: "xs", children: [
9644
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { css: Title2, children: sortByLabel }),
9645
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { css: SortFilterInputRow, children: [
9646
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
10046
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
10047
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_design_system65.VerticalRhythm, { gap: "xs", children: [
10048
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { css: Title2, children: sortByLabel }),
10049
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { css: SortFilterInputRow, children: [
10050
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
9647
10051
  InputVariables,
9648
10052
  {
9649
10053
  disableInlineMenu: disableSortBinding,
@@ -9651,8 +10055,8 @@ var SortItems = ({
9651
10055
  value: sortField,
9652
10056
  valueToResetTo: "created_at",
9653
10057
  onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9654
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9655
- import_design_system53.InputComboBox,
10058
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
10059
+ import_design_system65.InputComboBox,
9656
10060
  {
9657
10061
  id: "sort-by-field",
9658
10062
  "aria-label": "Sort by",
@@ -9674,7 +10078,7 @@ var SortItems = ({
9674
10078
  )
9675
10079
  }
9676
10080
  ),
9677
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
10081
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
9678
10082
  InputVariables,
9679
10083
  {
9680
10084
  disableInlineMenu: disableSortBinding,
@@ -9682,8 +10086,8 @@ var SortItems = ({
9682
10086
  valueToResetTo: "DESC",
9683
10087
  showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9684
10088
  onChange: (e) => onSortChange(`${sortField}_${e}`),
9685
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9686
- import_design_system53.SegmentedControl,
10089
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
10090
+ import_design_system65.SegmentedControl,
9687
10091
  {
9688
10092
  noCheckmark: true,
9689
10093
  name: "sortBy",
@@ -9714,15 +10118,15 @@ var SortItems = ({
9714
10118
  )
9715
10119
  ] })
9716
10120
  ] }),
9717
- hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_design_system53.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
10121
+ hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_design_system65.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
9718
10122
  InputVariables,
9719
10123
  {
9720
10124
  label: localeLabelValue,
9721
10125
  value: localeValue,
9722
10126
  showMenuPosition: "inline-right",
9723
10127
  onChange: (e) => onLocaleChange(e != null ? e : ""),
9724
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
9725
- import_design_system53.InputSelect,
10128
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
10129
+ import_design_system65.InputSelect,
9726
10130
  {
9727
10131
  name: "localeReturned",
9728
10132
  "aria-label": localeLabelValue,
@@ -9743,7 +10147,7 @@ var SortItems = ({
9743
10147
  };
9744
10148
 
9745
10149
  // src/index.ts
9746
- var import_design_system54 = require("@uniformdev/design-system");
10150
+ var import_design_system66 = require("@uniformdev/design-system");
9747
10151
  __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9748
10152
  // Annotate the CommonJS export names for ESM import in node:
9749
10153
  0 && (module.exports = {
@@ -9756,6 +10160,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9756
10160
  ControlledObjectSearchProvider,
9757
10161
  ControlledValuePlugin,
9758
10162
  DATE_OPERATORS,
10163
+ DATE_TIME_OPERATORS,
9759
10164
  DISCONNECT_VARIABLE_COMMAND,
9760
10165
  DamSelectedItem,
9761
10166
  DataRefreshButton,
@@ -9801,6 +10206,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9801
10206
  NumberEditor,
9802
10207
  NumberRangeEditor,
9803
10208
  OPEN_INSERT_VARIABLE_COMMAND,
10209
+ OPTIONAL_SYSTEM_FIELD_OPERATORS,
9804
10210
  ObjectSearchContainer,
9805
10211
  ObjectSearchContext,
9806
10212
  ObjectSearchFilter,
@@ -9851,7 +10257,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9851
10257
  RequestUrlInput,
9852
10258
  ResolvableLoadingValue,
9853
10259
  SELECT_OPERATORS,
9854
- SYSTEM_DATE_OPERATORS,
9855
10260
  SYSTEM_FIELD_OPERATORS,
9856
10261
  ScrollableList,
9857
10262
  ScrollableListItem,
@@ -9869,10 +10274,12 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9869
10274
  Switch,
9870
10275
  TEXTBOX_OPERATORS,
9871
10276
  TextEditor,
10277
+ TextMultiChoiceEditor,
9872
10278
  TextVariableRenderer,
9873
10279
  Textarea,
9874
10280
  Theme,
9875
10281
  USER_OPERATORS,
10282
+ VariableChip,
9876
10283
  VariableEditor,
9877
10284
  VariableNode,
9878
10285
  VariablesList,
@@ -9947,6 +10354,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9947
10354
  selectedItemIcon,
9948
10355
  selectedItemInner,
9949
10356
  selectedItemTitle,
10357
+ serializeVariablesEditorSerializedState,
9950
10358
  serializeVariablesEditorState,
9951
10359
  setVariablesEditorValue,
9952
10360
  urlEncodeRequestParameter,