@uniformdev/mesh-sdk-react 19.173.0 → 19.173.2-alpha.210

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,12 +33,13 @@ var src_exports = {};
33
33
  __export(src_exports, {
34
34
  $createVariableNode: () => $createVariableNode,
35
35
  $isVariableNode: () => $isVariableNode,
36
- AddListButton: () => import_design_system64.AddListButton,
37
- Button: () => import_design_system64.Button,
36
+ AddListButton: () => import_design_system65.AddListButton,
37
+ Button: () => import_design_system65.Button,
38
38
  CHECKBOX_OPERATORS: () => CHECKBOX_OPERATORS,
39
- Callout: () => import_design_system64.Callout,
39
+ Callout: () => import_design_system65.Callout,
40
40
  ControlledValuePlugin: () => ControlledValuePlugin,
41
41
  DATE_OPERATORS: () => DATE_OPERATORS,
42
+ DATE_TIME_OPERATORS: () => DATE_TIME_OPERATORS,
42
43
  DISCONNECT_VARIABLE_COMMAND: () => DISCONNECT_VARIABLE_COMMAND,
43
44
  DamSelectedItem: () => DamSelectedItem,
44
45
  DataRefreshButton: () => DataRefreshButton,
@@ -51,7 +52,7 @@ __export(src_exports, {
51
52
  DateRangeEditor: () => DateRangeEditor,
52
53
  DefaultSearchRow: () => DefaultSearchRow,
53
54
  DefaultSelectedItem: () => DefaultSelectedItem,
54
- DrawerContent: () => import_design_system64.DrawerContent,
55
+ DrawerContent: () => import_design_system65.DrawerContent,
55
56
  EDIT_VARIABLE_COMMAND: () => EDIT_VARIABLE_COMMAND,
56
57
  EntrySearch: () => EntrySearch,
57
58
  FilterButton: () => FilterButton2,
@@ -62,22 +63,22 @@ __export(src_exports, {
62
63
  FilterMenu: () => FilterMenu,
63
64
  FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
64
65
  FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
65
- Heading: () => import_design_system64.Heading,
66
+ Heading: () => import_design_system65.Heading,
66
67
  INSERT_VARIABLE_COMMAND: () => INSERT_VARIABLE_COMMAND,
67
68
  Icons: () => icons_exports,
68
- Input: () => import_design_system64.Input,
69
- InputComboBox: () => import_design_system64.InputComboBox,
70
- InputKeywordSearch: () => import_design_system64.InputKeywordSearch,
71
- InputSelect: () => import_design_system64.InputSelect,
72
- InputToggle: () => import_design_system64.InputToggle,
69
+ Input: () => import_design_system65.Input,
70
+ InputComboBox: () => import_design_system65.InputComboBox,
71
+ InputKeywordSearch: () => import_design_system65.InputKeywordSearch,
72
+ InputSelect: () => import_design_system65.InputSelect,
73
+ InputToggle: () => import_design_system65.InputToggle,
73
74
  InputVariables: () => InputVariables,
74
- Label: () => import_design_system64.Label,
75
+ Label: () => import_design_system65.Label,
75
76
  LinkButton: () => LinkButton,
76
- LoadingIndicator: () => import_design_system64.LoadingIndicator,
77
- LoadingOverlay: () => import_design_system64.LoadingOverlay,
77
+ LoadingIndicator: () => import_design_system65.LoadingIndicator,
78
+ LoadingOverlay: () => import_design_system65.LoadingOverlay,
78
79
  MULTI_SELECT_OPERATORS: () => MULTI_SELECT_OPERATORS,
79
- Menu: () => import_design_system64.Menu,
80
- MenuItem: () => import_design_system64.MenuItem,
80
+ Menu: () => import_design_system65.Menu,
81
+ MenuItem: () => import_design_system65.MenuItem,
81
82
  MeshApp: () => MeshApp,
82
83
  NUMBER_OPERATORS: () => NUMBER_OPERATORS,
83
84
  NumberEditor: () => NumberEditor,
@@ -96,22 +97,22 @@ __export(src_exports, {
96
97
  PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
97
98
  ParamTypeDynamicDataProvider: () => ParamTypeDynamicDataProvider,
98
99
  ParameterConnectionIndicator: () => ParameterConnectionIndicator,
99
- ParameterGroup: () => import_design_system64.ParameterGroup,
100
- ParameterImage: () => import_design_system64.ParameterImage,
101
- ParameterImageInner: () => import_design_system64.ParameterImageInner,
102
- ParameterInput: () => import_design_system64.ParameterInput,
103
- ParameterInputInner: () => import_design_system64.ParameterInputInner,
104
- ParameterLabel: () => import_design_system64.ParameterLabel,
105
- ParameterMenuButton: () => import_design_system64.ParameterMenuButton,
100
+ ParameterGroup: () => import_design_system65.ParameterGroup,
101
+ ParameterImage: () => import_design_system65.ParameterImage,
102
+ ParameterImageInner: () => import_design_system65.ParameterImageInner,
103
+ ParameterInput: () => import_design_system65.ParameterInput,
104
+ ParameterInputInner: () => import_design_system65.ParameterInputInner,
105
+ ParameterLabel: () => import_design_system65.ParameterLabel,
106
+ ParameterMenuButton: () => import_design_system65.ParameterMenuButton,
106
107
  ParameterOrSingleVariable: () => ParameterOrSingleVariable,
107
- ParameterSelect: () => import_design_system64.ParameterSelect,
108
- ParameterSelectInner: () => import_design_system64.ParameterSelectInner,
109
- ParameterShell: () => import_design_system64.ParameterShell,
108
+ ParameterSelect: () => import_design_system65.ParameterSelect,
109
+ ParameterSelectInner: () => import_design_system65.ParameterSelectInner,
110
+ ParameterShell: () => import_design_system65.ParameterShell,
110
111
  ParameterShellContext: () => import_design_system14.ParameterShellContext,
111
- ParameterTextarea: () => import_design_system64.ParameterTextarea,
112
- ParameterTextareaInner: () => import_design_system64.ParameterTextareaInner,
113
- ParameterToggle: () => import_design_system64.ParameterToggle,
114
- ParameterToggleInner: () => import_design_system64.ParameterToggleInner,
112
+ ParameterTextarea: () => import_design_system65.ParameterTextarea,
113
+ ParameterTextareaInner: () => import_design_system65.ParameterTextareaInner,
114
+ ParameterToggle: () => import_design_system65.ParameterToggle,
115
+ ParameterToggleInner: () => import_design_system65.ParameterToggleInner,
115
116
  ParameterVariables: () => ParameterVariables,
116
117
  ProductPreviewList: () => ProductPreviewList,
117
118
  ProductQuery: () => ProductQuery,
@@ -132,10 +133,9 @@ __export(src_exports, {
132
133
  RequestUrlInput: () => RequestUrlInput,
133
134
  ResolvableLoadingValue: () => ResolvableLoadingValue,
134
135
  SELECT_OPERATORS: () => SELECT_OPERATORS,
135
- SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
136
136
  SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
137
- ScrollableList: () => import_design_system64.ScrollableList,
138
- ScrollableListItem: () => import_design_system64.ScrollableListItem,
137
+ ScrollableList: () => import_design_system65.ScrollableList,
138
+ ScrollableListItem: () => import_design_system65.ScrollableListItem,
139
139
  SearchAndFilter: () => SearchAndFilter,
140
140
  SearchAndFilterContext: () => SearchAndFilterContext,
141
141
  SearchAndFilterOptionsContainer: () => SearchAndFilterOptionsContainer2,
@@ -147,13 +147,13 @@ __export(src_exports, {
147
147
  SortItems: () => SortItems,
148
148
  StatusMultiEditor: () => StatusMultiEditor,
149
149
  StatusSingleEditor: () => StatusSingleEditor,
150
- Switch: () => import_design_system64.Switch,
150
+ Switch: () => import_design_system65.Switch,
151
151
  TEXTBOX_OPERATORS: () => TEXTBOX_OPERATORS,
152
152
  TextEditor: () => TextEditor,
153
153
  TextMultiChoiceEditor: () => TextMultiChoiceEditor,
154
154
  TextVariableRenderer: () => TextVariableRenderer,
155
- Textarea: () => import_design_system64.Textarea,
156
- Theme: () => import_design_system64.Theme,
155
+ Textarea: () => import_design_system65.Textarea,
156
+ Theme: () => import_design_system65.Theme,
157
157
  USER_OPERATORS: () => USER_OPERATORS,
158
158
  VariableChip: () => VariableChip,
159
159
  VariableEditor: () => VariableEditor,
@@ -194,7 +194,7 @@ __export(src_exports, {
194
194
  entrySearchSelectOption: () => entrySearchSelectOption,
195
195
  entrySearchWrapper: () => entrySearchWrapper,
196
196
  filterMapper: () => filterMapper,
197
- hasReferencedVariables: () => hasReferencedVariables,
197
+ hasReferencedVariables: () => hasReferencedVariables2,
198
198
  prettifyBindExpression: () => prettifyBindExpression,
199
199
  productSearchRowActiveIcon: () => productSearchRowActiveIcon,
200
200
  productSearchRowCategory: () => productSearchRowCategory,
@@ -229,6 +229,7 @@ __export(src_exports, {
229
229
  selectedItemIcon: () => selectedItemIcon,
230
230
  selectedItemInner: () => selectedItemInner,
231
231
  selectedItemTitle: () => selectedItemTitle,
232
+ serializeVariablesEditorSerializedState: () => serializeVariablesEditorSerializedState,
232
233
  serializeVariablesEditorState: () => serializeVariablesEditorState,
233
234
  setVariablesEditorValue: () => setVariablesEditorValue,
234
235
  urlEncodeRequestParameter: () => urlEncodeRequestParameter,
@@ -249,7 +250,7 @@ __export(src_exports, {
249
250
  useVariableEditor: () => useVariableEditor,
250
251
  useVariables: () => useVariables,
251
252
  useVariablesMenu: () => useVariablesMenu,
252
- utilityColors: () => import_design_system64.utilityColors,
253
+ utilityColors: () => import_design_system65.utilityColors,
253
254
  variableDefaultTextValue: () => variableDefaultTextValue,
254
255
  variablePrefix: () => variablePrefix,
255
256
  variableSuffix: () => variableSuffix,
@@ -1220,7 +1221,8 @@ var searchRowContainer = import_react8.css`
1220
1221
  cursor: pointer;
1221
1222
  padding: var(--spacing-sm);
1222
1223
  position: relative;
1223
- transition: background-color var(--duration-fast) var(--timing-ease-out),
1224
+ transition:
1225
+ background-color var(--duration-fast) var(--timing-ease-out),
1224
1226
  color var(--duration-fast) var(--timing-ease-out);
1225
1227
  `;
1226
1228
  var searchRowContainerWithPopover = import_react8.css`
@@ -2200,7 +2202,8 @@ var productSearchRowContainer = import_react18.css`
2200
2202
  padding: var(--spacing-sm) 0;
2201
2203
  margin-right: var(--spacing-sm);
2202
2204
  position: relative;
2203
- transition: background-color var(--duration-fast) var(--timing-ease-out),
2205
+ transition:
2206
+ background-color var(--duration-fast) var(--timing-ease-out),
2204
2207
  color var(--duration-fast) var(--timing-ease-out);
2205
2208
  `;
2206
2209
  var productSearchRowContent = import_react18.css`
@@ -3036,18 +3039,55 @@ var import_design_system14 = require("@uniformdev/design-system");
3036
3039
 
3037
3040
  // src/components/Variables/composer/ControlledValuePlugin.tsx
3038
3041
  var import_LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
3039
- var import_lite = require("dequal/lite");
3040
3042
  var import_react31 = require("react");
3041
3043
 
3042
- // src/components/Variables/util/deserializeVariablesEditorState.ts
3044
+ // src/components/Variables/util/serializeVariablesEditorState.ts
3043
3045
  var import_canvas2 = require("@uniformdev/canvas");
3044
3046
  var import_lexical = require("lexical");
3047
+
3048
+ // src/components/Variables/util/variableExpression.ts
3049
+ var variablePrefix = "${";
3050
+ var variableSuffix = "}";
3051
+
3052
+ // src/components/Variables/util/serializeVariablesEditorState.ts
3053
+ function serializeVariablesEditorState(editorState) {
3054
+ return serializeVariablesEditorSerializedState(editorState.toJSON().root);
3055
+ }
3056
+ function serializeVariablesEditorSerializedState(serializedEditorState) {
3057
+ const buf = [];
3058
+ serializeRecursive(serializedEditorState, buf);
3059
+ const result = buf.join("");
3060
+ return result.length > 0 ? result : void 0;
3061
+ }
3062
+ function serializeRecursive(node, buffer) {
3063
+ if (node.type === import_lexical.TextNode.getType()) {
3064
+ buffer.push(node.text.replace(variablePrefix, "\\${"));
3065
+ }
3066
+ if (node.type === VariableNode.getType()) {
3067
+ buffer.push((0, import_canvas2.createVariableReference)(node.reference));
3068
+ }
3069
+ if (node.type === import_lexical.LineBreakNode.getType()) {
3070
+ buffer.push("\n");
3071
+ }
3072
+ if ("children" in node && node.children) {
3073
+ for (const child of node.children) {
3074
+ serializeRecursive(child, buffer);
3075
+ }
3076
+ }
3077
+ }
3078
+
3079
+ // src/components/Variables/util/setVariablesEditorValue.ts
3080
+ var import_richtext = require("@uniformdev/richtext");
3081
+
3082
+ // src/components/Variables/util/deserializeVariablesEditorState.ts
3083
+ var import_canvas3 = require("@uniformdev/canvas");
3084
+ var import_lexical2 = require("lexical");
3045
3085
  function deserializeVariablesEditorState(serialized) {
3046
3086
  const result = [];
3047
- (0, import_canvas2.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
3087
+ (0, import_canvas3.parseVariableExpression)(serialized != null ? serialized : "", (token, type) => {
3048
3088
  if (type === "text") {
3049
3089
  const node = {
3050
- type: import_lexical.TextNode.getType(),
3090
+ type: import_lexical2.TextNode.getType(),
3051
3091
  text: token,
3052
3092
  mode: "normal",
3053
3093
  version: 1,
@@ -3089,11 +3129,11 @@ function deserializeVariablesEditorState(serialized) {
3089
3129
  }
3090
3130
 
3091
3131
  // src/components/Variables/util/refreshVariableNodeMetadata.ts
3092
- var import_lexical2 = require("lexical");
3132
+ var import_lexical3 = require("lexical");
3093
3133
  function refreshVariableNodeMetadata(editor) {
3094
3134
  setTimeout(() => {
3095
3135
  editor.update(() => {
3096
- (0, import_lexical2.$nodesOfType)(VariableNode).forEach((variableNode) => {
3136
+ (0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
3097
3137
  variableNode.markDirty();
3098
3138
  });
3099
3139
  });
@@ -3101,14 +3141,18 @@ function refreshVariableNodeMetadata(editor) {
3101
3141
  }
3102
3142
 
3103
3143
  // src/components/Variables/util/setVariablesEditorValue.ts
3104
- function setVariablesEditorValue(editor, newValue) {
3144
+ function setVariablesEditorValue(editor, newValue, tag) {
3105
3145
  if (typeof newValue === "undefined" || typeof newValue === "string") {
3106
3146
  const parsedState = editor.parseEditorState(deserializeVariablesEditorState(newValue));
3107
- editor.setEditorState(parsedState);
3147
+ editor.setEditorState(parsedState.clone(null), {
3148
+ tag
3149
+ });
3108
3150
  } else {
3109
3151
  try {
3110
3152
  const parsedState = editor.parseEditorState(newValue);
3111
- editor.setEditorState(parsedState);
3153
+ editor.setEditorState(parsedState.clone(null), {
3154
+ tag
3155
+ });
3112
3156
  } catch (e) {
3113
3157
  console.warn(
3114
3158
  "Tried to set invalid Lexical state, probably invalidly formatted state object - falling back to empty state. Invalid state attempted:",
@@ -3116,27 +3160,10 @@ function setVariablesEditorValue(editor, newValue) {
3116
3160
  "Error:",
3117
3161
  e
3118
3162
  );
3119
- const parsedState = editor.parseEditorState({
3120
- root: {
3121
- type: "root",
3122
- version: 1,
3123
- direction: null,
3124
- format: "",
3125
- indent: 0,
3126
- children: [
3127
- {
3128
- type: "paragraph",
3129
- version: 1,
3130
- format: "start",
3131
- indent: 0,
3132
- direction: null,
3133
- children: [],
3134
- textFormat: 0
3135
- }
3136
- ]
3137
- }
3163
+ const parsedState = editor.parseEditorState(import_richtext.emptyRichTextValue);
3164
+ editor.setEditorState(parsedState.clone(null), {
3165
+ tag
3138
3166
  });
3139
- editor.setEditorState(parsedState);
3140
3167
  }
3141
3168
  }
3142
3169
  refreshVariableNodeMetadata(editor);
@@ -3149,17 +3176,18 @@ function ControlledValuePlugin({
3149
3176
  extraDependencies
3150
3177
  }) {
3151
3178
  const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
3152
- const lastValueRef = (0, import_react31.useRef)(value);
3153
3179
  (0, import_react31.useEffect)(() => {
3180
+ var _a, _b;
3154
3181
  if (!enabled) {
3155
3182
  return;
3156
3183
  }
3157
- if ((0, import_lite.dequal)(lastValueRef.current, value)) {
3184
+ const currentValue = (_a = serializeVariablesEditorState(editor.getEditorState())) != null ? _a : "";
3185
+ const newValue = (_b = value !== void 0 && typeof value !== "string" ? serializeVariablesEditorSerializedState(value.root) : value) != null ? _b : "";
3186
+ if (currentValue === newValue) {
3158
3187
  return;
3159
3188
  }
3160
3189
  setTimeout(() => {
3161
3190
  if (editor) {
3162
- lastValueRef.current = value;
3163
3191
  setVariablesEditorValue(editor, value);
3164
3192
  }
3165
3193
  });
@@ -3248,9 +3276,9 @@ var import_LexicalComposerContext3 = require("@lexical/react/LexicalComposerCont
3248
3276
  var import_useLexicalNodeSelection = require("@lexical/react/useLexicalNodeSelection");
3249
3277
  var import_selection = require("@lexical/selection");
3250
3278
  var import_utils2 = require("@lexical/utils");
3251
- var import_canvas4 = require("@uniformdev/canvas");
3279
+ var import_canvas5 = require("@uniformdev/canvas");
3252
3280
  var import_design_system18 = require("@uniformdev/design-system");
3253
- var import_lexical4 = require("lexical");
3281
+ var import_lexical5 = require("lexical");
3254
3282
  var import_react40 = require("react");
3255
3283
 
3256
3284
  // src/components/Variables/util/prettifyBindExpression.tsx
@@ -3265,10 +3293,10 @@ var import_LexicalComposerContext2 = require("@lexical/react/LexicalComposerCont
3265
3293
  var import_LexicalTypeaheadMenuPlugin = require("@lexical/react/LexicalTypeaheadMenuPlugin");
3266
3294
  var import_utils = require("@lexical/utils");
3267
3295
  var import_AiFillPlusCircle = require("@react-icons/all-files/ai/AiFillPlusCircle");
3268
- var import_canvas3 = require("@uniformdev/canvas");
3296
+ var import_canvas4 = require("@uniformdev/canvas");
3269
3297
  var import_design_system17 = require("@uniformdev/design-system");
3270
- var import_lite2 = require("dequal/lite");
3271
- var import_lexical3 = require("lexical");
3298
+ var import_lite = require("dequal/lite");
3299
+ var import_lexical4 = require("lexical");
3272
3300
  var import_react39 = require("react");
3273
3301
  var import_react_dom = require("react-dom");
3274
3302
 
@@ -3723,12 +3751,12 @@ function variablesToGroupedList(variables, filterFn, context) {
3723
3751
 
3724
3752
  // src/components/Variables/composer/VariablesPlugin.tsx
3725
3753
  var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
3726
- var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:open-insert-variable");
3727
- var EDIT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:edit-variable");
3728
- var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)(
3754
+ var OPEN_INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:open-insert-variable");
3755
+ var EDIT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:edit-variable");
3756
+ var DISCONNECT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)(
3729
3757
  "uniform:disconnect-variable"
3730
3758
  );
3731
- var INSERT_VARIABLE_COMMAND = (0, import_lexical3.createCommand)("uniform:insert-variable");
3759
+ var INSERT_VARIABLE_COMMAND = (0, import_lexical4.createCommand)("uniform:insert-variable");
3732
3760
  var TRIGGER = "\\$\\$";
3733
3761
  var LENGTH_LIMIT = 20;
3734
3762
  var DollarSignVariablesRegex = new RegExp(`(^.*)(${TRIGGER}(.{0,${LENGTH_LIMIT}}))$`);
@@ -3798,7 +3826,7 @@ function useVariablesMenu({
3798
3826
  var _a;
3799
3827
  const targetVariable = variables[value];
3800
3828
  if (overwriteExistingValue) {
3801
- setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(value));
3829
+ setVariablesEditorValue(editor, (0, import_canvas4.createVariableReference)(value));
3802
3830
  return true;
3803
3831
  }
3804
3832
  const variableNode = $createVariableNode(value, {
@@ -3812,7 +3840,7 @@ function useVariablesMenu({
3812
3840
  if (nodeToReplace) {
3813
3841
  nodeToReplace.replace(variableNode);
3814
3842
  } else {
3815
- (0, import_lexical3.$insertNodes)([variableNode]);
3843
+ (0, import_lexical4.$insertNodes)([variableNode]);
3816
3844
  }
3817
3845
  });
3818
3846
  }
@@ -3895,11 +3923,11 @@ function VariablesPlugin({
3895
3923
  return;
3896
3924
  }
3897
3925
  editor.update(() => {
3898
- const selection = (0, import_lexical3.$getSelection)();
3899
- if ((0, import_lexical3.$isNodeSelection)(selection)) {
3926
+ const selection = (0, import_lexical4.$getSelection)();
3927
+ if ((0, import_lexical4.$isNodeSelection)(selection)) {
3900
3928
  const selectedNodes = selection.getNodes();
3901
3929
  if (selectedNodes.every((node) => $isVariableNode(node))) {
3902
- (0, import_lexical3.$setSelection)(null);
3930
+ (0, import_lexical4.$setSelection)(null);
3903
3931
  }
3904
3932
  }
3905
3933
  });
@@ -3915,7 +3943,7 @@ function VariablesPlugin({
3915
3943
  }
3916
3944
  return true;
3917
3945
  },
3918
- import_lexical3.COMMAND_PRIORITY_NORMAL
3946
+ import_lexical4.COMMAND_PRIORITY_NORMAL
3919
3947
  ),
3920
3948
  // disconnects a variable node from its variable value and leaves the variable's default value
3921
3949
  // as a string literal in its place. Note that single-valued binding UIs override this so that it
@@ -3925,17 +3953,17 @@ function VariablesPlugin({
3925
3953
  ({ sourceKey }) => {
3926
3954
  editor.update(() => {
3927
3955
  var _a;
3928
- const currentNode = (0, import_lexical3.$getNodeByKey)(sourceKey);
3956
+ const currentNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
3929
3957
  if (!$isVariableNode(currentNode)) {
3930
3958
  throw new Error("Cannot disconnect a non-variable node");
3931
3959
  }
3932
3960
  const currentVariableDefinition = variablesRef.current.variables[currentNode.reference];
3933
- const variableTextNode = (0, import_lexical3.$createTextNode)(
3961
+ const variableTextNode = (0, import_lexical4.$createTextNode)(
3934
3962
  variableDefaultTextValue(
3935
3963
  (_a = currentVariableDefinition == null ? void 0 : currentVariableDefinition.default) != null ? _a : currentNode.getState().displayName
3936
3964
  )
3937
3965
  );
3938
- const variableNode = (0, import_lexical3.$getNodeByKey)(sourceKey);
3966
+ const variableNode = (0, import_lexical4.$getNodeByKey)(sourceKey);
3939
3967
  if (!variableNode) {
3940
3968
  console.error("Disconnected from unknown node.");
3941
3969
  return true;
@@ -3945,7 +3973,7 @@ function VariablesPlugin({
3945
3973
  });
3946
3974
  return true;
3947
3975
  },
3948
- import_lexical3.COMMAND_PRIORITY_NORMAL
3976
+ import_lexical4.COMMAND_PRIORITY_NORMAL
3949
3977
  ),
3950
3978
  editor.registerCommand(
3951
3979
  OPEN_INSERT_VARIABLE_COMMAND,
@@ -3965,7 +3993,7 @@ function VariablesPlugin({
3965
3993
  }
3966
3994
  return true;
3967
3995
  },
3968
- import_lexical3.COMMAND_PRIORITY_NORMAL
3996
+ import_lexical4.COMMAND_PRIORITY_NORMAL
3969
3997
  ),
3970
3998
  // register the insert variable command, used to handle inserting
3971
3999
  // a variable reference from non-autocomplete menus at the current selection,
@@ -3976,27 +4004,33 @@ function VariablesPlugin({
3976
4004
  var _a, _b;
3977
4005
  if (!disableVariables) {
3978
4006
  const targetVariable = variablesRef.current.variables[reference];
3979
- if (overwriteExistingValue) {
3980
- setVariablesEditorValue(editor, (0, import_canvas3.createVariableReference)(reference));
3981
- return true;
3982
- }
3983
4007
  const variableNode = $createVariableNode(reference, {
3984
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
4008
+ displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
3985
4009
  hasClickEvent: canEditVariable(reference, targetVariable),
3986
4010
  referenceIsValid: true,
3987
4011
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
3988
4012
  isFresh: true,
3989
4013
  isLoading: false
3990
4014
  });
4015
+ if (overwriteExistingValue) {
4016
+ const pNode = (0, import_lexical4.$createParagraphNode)();
4017
+ pNode.append(variableNode);
4018
+ editor.update(() => {
4019
+ const root = (0, import_lexical4.$getRoot)();
4020
+ root.clear();
4021
+ root.append(pNode);
4022
+ });
4023
+ return true;
4024
+ }
3991
4025
  if (targetKey) {
3992
- (_b = (0, import_lexical3.$getNodeByKey)(targetKey)) == null ? void 0 : _b.replace(variableNode);
4026
+ (_b = (0, import_lexical4.$getNodeByKey)(targetKey)) == null ? void 0 : _b.replace(variableNode);
3993
4027
  } else {
3994
- (0, import_lexical3.$insertNodes)([variableNode]);
4028
+ (0, import_lexical4.$insertNodes)([variableNode]);
3995
4029
  }
3996
4030
  }
3997
4031
  return true;
3998
4032
  },
3999
- import_lexical3.COMMAND_PRIORITY_NORMAL
4033
+ import_lexical4.COMMAND_PRIORITY_NORMAL
4000
4034
  )
4001
4035
  );
4002
4036
  }, [
@@ -4023,14 +4057,14 @@ function VariablesPlugin({
4023
4057
  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;
4024
4058
  const newState = {
4025
4059
  ...currentState,
4026
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
4060
+ displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
4027
4061
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
4028
4062
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
4029
4063
  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),
4030
4064
  tooltip,
4031
4065
  isFresh: false
4032
4066
  };
4033
- if (!(0, import_lite2.dequal)(currentState, newState)) {
4067
+ if (!(0, import_lite.dequal)(currentState, newState)) {
4034
4068
  variableNode.setState(newState);
4035
4069
  }
4036
4070
  },
@@ -4038,7 +4072,7 @@ function VariablesPlugin({
4038
4072
  );
4039
4073
  (0, import_react39.useEffect)(() => {
4040
4074
  editor.update(() => {
4041
- (0, import_lexical3.$nodesOfType)(VariableNode).forEach((variableNode) => {
4075
+ (0, import_lexical4.$nodesOfType)(VariableNode).forEach((variableNode) => {
4042
4076
  updateExistingNodeIfChanged(variableNode);
4043
4077
  });
4044
4078
  });
@@ -4128,7 +4162,7 @@ function VariablesPlugin({
4128
4162
 
4129
4163
  // src/components/Variables/composer/VariableNode.tsx
4130
4164
  var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
4131
- var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
4165
+ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
4132
4166
  constructor(reference, state, key) {
4133
4167
  super(key);
4134
4168
  this.reference = reference;
@@ -4177,7 +4211,7 @@ var VariableNode = class _VariableNode extends import_lexical4.DecoratorNode {
4177
4211
  * (albeit it won't get the fancy chip-node)
4178
4212
  */
4179
4213
  getTextContent() {
4180
- return (0, import_canvas4.createVariableReference)(this.reference);
4214
+ return (0, import_canvas5.createVariableReference)(this.reference);
4181
4215
  }
4182
4216
  /** Creates the DOM wrapper that hosts the node */
4183
4217
  createDOM() {
@@ -4211,9 +4245,9 @@ function VariableNodeComponent({
4211
4245
  const readOnly = !editor.isEditable();
4212
4246
  const onDelete = (0, import_react40.useCallback)(
4213
4247
  (event) => {
4214
- if (isSelected && (0, import_lexical4.$isNodeSelection)((0, import_lexical4.$getSelection)())) {
4248
+ if (isSelected && (0, import_lexical5.$isNodeSelection)((0, import_lexical5.$getSelection)())) {
4215
4249
  event.preventDefault();
4216
- const node = (0, import_lexical4.$getNodeByKey)(nodeKey);
4250
+ const node = (0, import_lexical5.$getNodeByKey)(nodeKey);
4217
4251
  if ($isVariableNode(node)) {
4218
4252
  node.remove();
4219
4253
  }
@@ -4224,18 +4258,18 @@ function VariableNodeComponent({
4224
4258
  );
4225
4259
  (0, import_react40.useEffect)(() => {
4226
4260
  return (0, import_utils2.mergeRegister)(
4227
- editor.registerCommand(import_lexical4.KEY_DELETE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
4228
- editor.registerCommand(import_lexical4.KEY_BACKSPACE_COMMAND, onDelete, import_lexical4.COMMAND_PRIORITY_LOW),
4261
+ editor.registerCommand(import_lexical5.KEY_DELETE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
4262
+ editor.registerCommand(import_lexical5.KEY_BACKSPACE_COMMAND, onDelete, import_lexical5.COMMAND_PRIORITY_LOW),
4229
4263
  // HACK: see https://github.com/facebook/lexical/issues/4214
4230
4264
  // Copied from https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L775
4231
4265
  // Fixes selection moving into and out of this node with arrow keys and plain text plugin.
4232
4266
  // If the above bug is fixed this may be removable. It's been tested when this is used within the RTE,
4233
4267
  // and seems to work ok there. It should also unregister itself when not in the context of the node. I think?
4234
4268
  editor.registerCommand(
4235
- import_lexical4.KEY_ARROW_LEFT_COMMAND,
4269
+ import_lexical5.KEY_ARROW_LEFT_COMMAND,
4236
4270
  (event) => {
4237
- const selection = (0, import_lexical4.$getSelection)();
4238
- if ((0, import_lexical4.$isNodeSelection)(selection)) {
4271
+ const selection = (0, import_lexical5.$getSelection)();
4272
+ if ((0, import_lexical5.$isNodeSelection)(selection)) {
4239
4273
  const nodes = selection.getNodes();
4240
4274
  if (nodes.length > 0) {
4241
4275
  event.preventDefault();
@@ -4243,7 +4277,7 @@ function VariableNodeComponent({
4243
4277
  return true;
4244
4278
  }
4245
4279
  }
4246
- if (!(0, import_lexical4.$isRangeSelection)(selection)) {
4280
+ if (!(0, import_lexical5.$isRangeSelection)(selection)) {
4247
4281
  return false;
4248
4282
  }
4249
4283
  if ((0, import_selection.$shouldOverrideDefaultCharacterSelection)(selection, true)) {
@@ -4254,15 +4288,15 @@ function VariableNodeComponent({
4254
4288
  }
4255
4289
  return false;
4256
4290
  },
4257
- import_lexical4.COMMAND_PRIORITY_EDITOR
4291
+ import_lexical5.COMMAND_PRIORITY_EDITOR
4258
4292
  ),
4259
4293
  // HACK: as above
4260
4294
  // Source: https://github.com/facebook/lexical/blob/d4b192289d3714b34614b411d40e513d1f86f413/packages/lexical-rich-text/src/index.ts#L802C5-L831C7
4261
4295
  editor.registerCommand(
4262
- import_lexical4.KEY_ARROW_RIGHT_COMMAND,
4296
+ import_lexical5.KEY_ARROW_RIGHT_COMMAND,
4263
4297
  (event) => {
4264
- const selection = (0, import_lexical4.$getSelection)();
4265
- if ((0, import_lexical4.$isNodeSelection)(selection) && !$isTargetWithinDecorator(event.target)) {
4298
+ const selection = (0, import_lexical5.$getSelection)();
4299
+ if ((0, import_lexical5.$isNodeSelection)(selection) && !$isTargetWithinDecorator(event.target)) {
4266
4300
  const nodes = selection.getNodes();
4267
4301
  if (nodes.length > 0) {
4268
4302
  event.preventDefault();
@@ -4270,7 +4304,7 @@ function VariableNodeComponent({
4270
4304
  return true;
4271
4305
  }
4272
4306
  }
4273
- if (!(0, import_lexical4.$isRangeSelection)(selection)) {
4307
+ if (!(0, import_lexical5.$isRangeSelection)(selection)) {
4274
4308
  return false;
4275
4309
  }
4276
4310
  const isHoldingShift = event.shiftKey;
@@ -4281,7 +4315,7 @@ function VariableNodeComponent({
4281
4315
  }
4282
4316
  return false;
4283
4317
  },
4284
- import_lexical4.COMMAND_PRIORITY_EDITOR
4318
+ import_lexical5.COMMAND_PRIORITY_EDITOR
4285
4319
  )
4286
4320
  );
4287
4321
  }, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
@@ -4305,8 +4339,8 @@ function VariableNodeComponent({
4305
4339
  );
4306
4340
  }
4307
4341
  function $isTargetWithinDecorator(target) {
4308
- const node = (0, import_lexical4.$getNearestNodeFromDOMNode)(target);
4309
- return (0, import_lexical4.$isDecoratorNode)(node);
4342
+ const node = (0, import_lexical5.$getNearestNodeFromDOMNode)(target);
4343
+ return (0, import_lexical5.$isDecoratorNode)(node);
4310
4344
  }
4311
4345
 
4312
4346
  // src/components/Variables/InputVariables.tsx
@@ -4332,19 +4366,19 @@ function EditorRefPlugin({
4332
4366
  // src/components/Variables/composer/PasteTransformerPlugin.tsx
4333
4367
  var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
4334
4368
  var import_utils3 = require("@lexical/utils");
4335
- var import_lexical5 = require("lexical");
4369
+ var import_lexical6 = require("lexical");
4336
4370
  var import_react41 = require("react");
4337
4371
  function PasteTransformerPlugin({ transformPaste }) {
4338
4372
  const [editor] = (0, import_LexicalComposerContext5.useLexicalComposerContext)();
4339
4373
  (0, import_react41.useEffect)(() => {
4340
4374
  return (0, import_utils3.mergeRegister)(
4341
4375
  editor.registerCommand(
4342
- import_lexical5.PASTE_COMMAND,
4376
+ import_lexical6.PASTE_COMMAND,
4343
4377
  (event) => {
4344
4378
  var _a;
4345
- const selection = (0, import_lexical5.$getSelection)();
4379
+ const selection = (0, import_lexical6.$getSelection)();
4346
4380
  const pastedText = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain");
4347
- if (pastedText && transformPaste && (0, import_lexical5.$isRangeSelection)(selection)) {
4381
+ if (pastedText && transformPaste && (0, import_lexical6.$isRangeSelection)(selection)) {
4348
4382
  const result = transformPaste(pastedText);
4349
4383
  if (result !== void 0) {
4350
4384
  selection.insertText(result);
@@ -4353,7 +4387,7 @@ function PasteTransformerPlugin({ transformPaste }) {
4353
4387
  }
4354
4388
  return false;
4355
4389
  },
4356
- import_lexical5.COMMAND_PRIORITY_HIGH
4390
+ import_lexical6.COMMAND_PRIORITY_HIGH
4357
4391
  )
4358
4392
  );
4359
4393
  }, [editor, transformPaste]);
@@ -4382,9 +4416,11 @@ var input = import_react42.css`
4382
4416
  min-height: 50px;
4383
4417
  width: 100%;
4384
4418
  position: relative;
4385
- transition: background var(--duration-fast) var(--timing-ease-out),
4419
+ transition:
4420
+ background var(--duration-fast) var(--timing-ease-out),
4386
4421
  border-color var(--duration-fast) var(--timing-ease-out),
4387
- color var(--duration-fast) var(--timing-ease-out), box-shadow var(--duration-fast) var(--timing-ease-out);
4422
+ color var(--duration-fast) var(--timing-ease-out),
4423
+ box-shadow var(--duration-fast) var(--timing-ease-out);
4388
4424
 
4389
4425
  &::placeholder {
4390
4426
  color: var(--gray-400);
@@ -4448,7 +4484,8 @@ var variableBindButton = import_react43.css`
4448
4484
  display: flex;
4449
4485
  height: 1.2rem;
4450
4486
  padding: var(--spacing-2xs);
4451
- transition: background var(--duration-fast) var(--timing-ease-out),
4487
+ transition:
4488
+ background var(--duration-fast) var(--timing-ease-out),
4452
4489
  color var(--duration-fast) var(--timing-ease-out);
4453
4490
  width: 1.2rem;
4454
4491
 
@@ -4531,23 +4568,9 @@ var inputMultiLine = (lines) => import_react43.css`
4531
4568
  `;
4532
4569
 
4533
4570
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
4571
+ var import_canvas6 = require("@uniformdev/canvas");
4534
4572
  var React10 = __toESM(require("react"));
4535
4573
  var import_react44 = require("react");
4536
-
4537
- // src/components/Variables/util/hasReferencedVariables.ts
4538
- var import_canvas5 = require("@uniformdev/canvas");
4539
- function hasReferencedVariables(value) {
4540
- let result = false;
4541
- (0, import_canvas5.parseVariableExpression)(value, (token, type) => {
4542
- if (type === "variable") {
4543
- result = true;
4544
- return false;
4545
- }
4546
- });
4547
- return result;
4548
- }
4549
-
4550
- // src/components/Variables/toolbox/InputVariablesProvider.tsx
4551
4574
  function useInputVariablesState({
4552
4575
  value,
4553
4576
  onChange,
@@ -4562,20 +4585,20 @@ function useInputVariablesState({
4562
4585
  renderMenuInPortal
4563
4586
  }) {
4564
4587
  const { variables } = useVariables(true);
4565
- const hasVariablesInValue = hasReferencedVariables(value != null ? value : "");
4588
+ const variableReferenceCountInValue = (0, import_canvas6.hasReferencedVariables)(value != null ? value : "");
4566
4589
  const [lastKnownId] = React10.useState(id);
4567
- const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(hasVariablesInValue);
4590
+ const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
4568
4591
  React10.useEffect(() => {
4569
- if (hasVariablesInValue) {
4592
+ if (variableReferenceCountInValue) {
4570
4593
  setHadVariablesInValue(true);
4571
4594
  }
4572
- }, [hasVariablesInValue]);
4595
+ }, [variableReferenceCountInValue]);
4573
4596
  React10.useEffect(() => {
4574
4597
  if (id !== lastKnownId) {
4575
- setHadVariablesInValue(hasVariablesInValue);
4598
+ setHadVariablesInValue(variableReferenceCountInValue > 0);
4576
4599
  }
4577
- }, [hasVariablesInValue, id, lastKnownId]);
4578
- const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
4600
+ }, [variableReferenceCountInValue, id, lastKnownId]);
4601
+ const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
4579
4602
  const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
4580
4603
  const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
4581
4604
  const sharedMenuProps = (0, import_react44.useMemo)(
@@ -4604,7 +4627,7 @@ function useInputVariablesState({
4604
4627
  return {
4605
4628
  sharedMenuProps,
4606
4629
  disableVariablesForReals,
4607
- hasVariablesInValue,
4630
+ hasVariablesInValue: variableReferenceCountInValue > 0,
4608
4631
  hadVariablesInValue: hadVariablesInValueForReals,
4609
4632
  setHadVariablesInValue
4610
4633
  };
@@ -4627,7 +4650,8 @@ var variableBindButton2 = import_react45.css`
4627
4650
  display: flex;
4628
4651
  height: 1.2rem;
4629
4652
  padding: var(--spacing-2xs);
4630
- transition: background var(--duration-fast) var(--timing-ease-out),
4653
+ transition:
4654
+ background var(--duration-fast) var(--timing-ease-out),
4631
4655
  color var(--duration-fast) var(--timing-ease-out);
4632
4656
  width: 1.2rem;
4633
4657
 
@@ -4645,7 +4669,7 @@ var variableBindButton2 = import_react45.css`
4645
4669
 
4646
4670
  // src/components/Variables/toolbox/VariablesComposerVariableMenu.tsx
4647
4671
  var import_LexicalComposerContext6 = require("@lexical/react/LexicalComposerContext");
4648
- var import_lexical6 = require("lexical");
4672
+ var import_lexical7 = require("lexical");
4649
4673
 
4650
4674
  // src/components/Variables/toolbox/SelectVariableMenu.tsx
4651
4675
  var import_BsFillPlusCircleFill = require("@react-icons/all-files/bs/BsFillPlusCircleFill");
@@ -4753,7 +4777,7 @@ function VariablesComposerVariableMenu(props) {
4753
4777
  };
4754
4778
  const onResetVariable = () => {
4755
4779
  var _a;
4756
- editor.dispatchCommand(import_lexical6.CLEAR_EDITOR_COMMAND, void 0);
4780
+ editor.dispatchCommand(import_lexical7.CLEAR_EDITOR_COMMAND, void 0);
4757
4781
  (_a = props.onResetVariables) == null ? void 0 : _a.call(props);
4758
4782
  };
4759
4783
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -4815,50 +4839,18 @@ function DisablePlugin({ disabled }) {
4815
4839
 
4816
4840
  // src/components/Variables/composer/SingleLineTextPlugin.tsx
4817
4841
  var import_LexicalComposerContext8 = require("@lexical/react/LexicalComposerContext");
4818
- var import_lexical7 = require("lexical");
4842
+ var import_lexical8 = require("lexical");
4819
4843
  var import_react48 = require("react");
4820
4844
  function SingleLineTextPlugin() {
4821
4845
  const [editor] = (0, import_LexicalComposerContext8.useLexicalComposerContext)();
4822
4846
  (0, import_react48.useEffect)(() => {
4823
- editor.registerNodeTransform(import_lexical7.LineBreakNode, (node) => {
4847
+ editor.registerNodeTransform(import_lexical8.LineBreakNode, (node) => {
4824
4848
  node.remove();
4825
4849
  });
4826
4850
  }, [editor]);
4827
4851
  return null;
4828
4852
  }
4829
4853
 
4830
- // src/components/Variables/util/serializeVariablesEditorState.ts
4831
- var import_canvas6 = require("@uniformdev/canvas");
4832
- var import_lexical8 = require("lexical");
4833
-
4834
- // src/components/Variables/util/variableExpression.ts
4835
- var variablePrefix = "${";
4836
- var variableSuffix = "}";
4837
-
4838
- // src/components/Variables/util/serializeVariablesEditorState.ts
4839
- function serializeVariablesEditorState(editorState) {
4840
- const buf = [];
4841
- serializeRecursive(editorState.toJSON().root, buf);
4842
- const result = buf.join("");
4843
- return result.length > 0 ? result : void 0;
4844
- }
4845
- function serializeRecursive(node, buffer) {
4846
- if (node.type === import_lexical8.TextNode.getType()) {
4847
- buffer.push(node.text.replace(variablePrefix, "\\${"));
4848
- }
4849
- if (node.type === VariableNode.getType()) {
4850
- buffer.push((0, import_canvas6.createVariableReference)(node.reference));
4851
- }
4852
- if (node.type === import_lexical8.LineBreakNode.getType()) {
4853
- buffer.push("\n");
4854
- }
4855
- if ("children" in node && node.children) {
4856
- for (const child of node.children) {
4857
- serializeRecursive(child, buffer);
4858
- }
4859
- }
4860
- }
4861
-
4862
4854
  // src/components/Variables/toolbox/VariablesComposer.tsx
4863
4855
  var import_jsx_runtime38 = require("@emotion/react/jsx-runtime");
4864
4856
  function VariablesComposer(props) {
@@ -5053,7 +5045,8 @@ function InputVariables(props) {
5053
5045
  filterVariable,
5054
5046
  styleVariant = "default",
5055
5047
  renderMenuInPortal,
5056
- disableDismissEditorOnChange
5048
+ disableDismissEditorOnChange,
5049
+ singleTokenMode
5057
5050
  } = props;
5058
5051
  const [finalId] = (0, import_react52.useState)(id != null ? id : () => (0, import_uuid2.v4)());
5059
5052
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -5118,7 +5111,7 @@ function InputVariables(props) {
5118
5111
  buttonCss: variableBindButton,
5119
5112
  tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
5120
5113
  buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
5121
- replaceValueOnVariableInsert: useInputWithNoVariables
5114
+ replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
5122
5115
  }
5123
5116
  )
5124
5117
  ]
@@ -5158,13 +5151,13 @@ function InputVariables(props) {
5158
5151
  showAddVariableMenuOption,
5159
5152
  enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
5160
5153
  getEditorContext,
5161
- disabled,
5154
+ disabled: disabled || singleTokenMode,
5162
5155
  replaceValueOnVariableInsert: useInputWithNoVariables,
5163
5156
  autoFocus,
5164
5157
  filterVariable,
5165
5158
  children: [
5166
5159
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PasteTransformerPlugin, { transformPaste }),
5167
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
5160
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
5168
5161
  editorRef ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorRefPlugin, { editorRef }) : null,
5169
5162
  body
5170
5163
  ]
@@ -5222,7 +5215,7 @@ function ParameterConnectionIndicator({
5222
5215
  return result;
5223
5216
  }, [value]);
5224
5217
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system22.HorizontalRhythm, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5225
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: { flex: 1 }, children }),
5218
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { css: { flex: 1, maxWidth: "100%" }, children }),
5226
5219
  disabled ? null : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5227
5220
  import_design_system22.Menu,
5228
5221
  {
@@ -5460,8 +5453,15 @@ ${prettifyBindExpression(bindExpression)}`
5460
5453
  };
5461
5454
  }
5462
5455
 
5456
+ // src/components/Variables/util/hasReferencedVariables.ts
5457
+ var import_canvas8 = require("@uniformdev/canvas");
5458
+ function hasReferencedVariables2(value) {
5459
+ return (0, import_canvas8.hasReferencedVariables)(value) > 0;
5460
+ }
5461
+
5463
5462
  // src/components/Variables/VariablesList.tsx
5464
5463
  var import_react58 = require("@emotion/react");
5464
+ var import_CgTrash = require("@react-icons/all-files/cg/CgTrash");
5465
5465
  var import_design_system25 = require("@uniformdev/design-system");
5466
5466
  var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
5467
5467
 
@@ -5586,7 +5586,7 @@ function VariablesList() {
5586
5586
  ],
5587
5587
  "aria-controls": text,
5588
5588
  onClick: () => dispatch({ type: "remove", variable: name }),
5589
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.Icon, { icon: "trash", iconColor: "red" })
5589
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system25.Icon, { icon: import_CgTrash.CgTrash, iconColor: "red" })
5590
5590
  }
5591
5591
  ) })
5592
5592
  ]
@@ -6488,11 +6488,11 @@ var DataRefreshButton = ({
6488
6488
 
6489
6489
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
6490
6490
  var import_react68 = require("@emotion/react");
6491
- var import_canvas9 = require("@uniformdev/canvas");
6491
+ var import_canvas10 = require("@uniformdev/canvas");
6492
6492
  var import_design_system35 = require("@uniformdev/design-system");
6493
6493
 
6494
6494
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
6495
- var import_canvas8 = require("@uniformdev/canvas");
6495
+ var import_canvas9 = require("@uniformdev/canvas");
6496
6496
  var import_react66 = require("react");
6497
6497
  var import_jsx_runtime59 = require("@emotion/react/jsx-runtime");
6498
6498
  var ObjectSearchContext = (0, import_react66.createContext)({
@@ -6591,7 +6591,7 @@ function useObjectSearchContext() {
6591
6591
  return (0, import_react66.useContext)(ObjectSearchContext);
6592
6592
  }
6593
6593
  function bindQuery(query, inputs) {
6594
- const { result, errors } = (0, import_canvas8.bindVariablesToObject)({
6594
+ const { result, errors } = (0, import_canvas9.bindVariablesToObject)({
6595
6595
  value: query,
6596
6596
  variables: inputs,
6597
6597
  errorPrefix: "Dynamic input"
@@ -6780,7 +6780,7 @@ var ObjectSearchContainer = ({
6780
6780
  onSelectItem([]);
6781
6781
  return;
6782
6782
  }
6783
- const { result, errors } = (0, import_canvas9.bindVariables)({
6783
+ const { result, errors } = (0, import_canvas10.bindVariables)({
6784
6784
  value: selectedValue,
6785
6785
  variables: flatVariables,
6786
6786
  errorPrefix: "Dynamic input"
@@ -6801,7 +6801,7 @@ var ObjectSearchContainer = ({
6801
6801
  }
6802
6802
  ]);
6803
6803
  };
6804
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.IconsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
6804
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_design_system35.VerticalRhythm, { children: [
6805
6805
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_design_system35.Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
6806
6806
  InputVariables,
6807
6807
  {
@@ -6818,7 +6818,7 @@ var ObjectSearchContainer = ({
6818
6818
  }
6819
6819
  ) : body }),
6820
6820
  children
6821
- ] }) });
6821
+ ] });
6822
6822
  };
6823
6823
  var DefaultResultList = () => {
6824
6824
  var _a;
@@ -6947,7 +6947,8 @@ var ButtonStyles = import_react71.css`
6947
6947
  font-size: var(--fs-sm);
6948
6948
  line-height: 1;
6949
6949
  gap: var(--spacing-xs);
6950
- transition: border-color var(--duration-fast) var(--timing-ease-out),
6950
+ transition:
6951
+ border-color var(--duration-fast) var(--timing-ease-out),
6951
6952
  background-color var(--duration-fast) var(--timing-ease-out);
6952
6953
 
6953
6954
  &:hover {
@@ -7463,371 +7464,445 @@ var JsonMeshVariableEditor = ({
7463
7464
  var NUMBER_OPERATORS = [
7464
7465
  {
7465
7466
  label: "equals...",
7466
- symbol: "=",
7467
7467
  value: "eq",
7468
- editorType: "number"
7468
+ editorType: "number",
7469
+ expectedValueType: "single"
7469
7470
  },
7470
7471
  {
7471
7472
  label: "does not equal...",
7472
- symbol: "\u2260",
7473
7473
  value: "neq",
7474
- editorType: "number"
7474
+ editorType: "number",
7475
+ expectedValueType: "single"
7475
7476
  },
7476
7477
  {
7477
7478
  label: "greater than...",
7478
- symbol: ">",
7479
7479
  value: "gt",
7480
- editorType: "number"
7480
+ editorType: "number",
7481
+ expectedValueType: "single"
7481
7482
  },
7482
7483
  {
7483
7484
  label: "greater than or equal to...",
7484
- symbol: "\u2265",
7485
7485
  value: "gte",
7486
- editorType: "number"
7486
+ editorType: "number",
7487
+ expectedValueType: "single"
7487
7488
  },
7488
7489
  {
7489
7490
  label: "less than...",
7490
- symbol: "<",
7491
7491
  value: "lt",
7492
- editorType: "number"
7492
+ editorType: "number",
7493
+ expectedValueType: "single"
7493
7494
  },
7494
7495
  {
7495
7496
  label: "less than or equal to...",
7496
- symbol: "\u2264",
7497
7497
  value: "lte",
7498
- editorType: "number"
7498
+ editorType: "number",
7499
+ expectedValueType: "single"
7499
7500
  },
7500
7501
  {
7501
7502
  label: "is empty",
7502
7503
  value: "ndef",
7503
- editorType: "empty"
7504
+ editorType: "empty",
7505
+ expectedValueType: "false"
7504
7506
  },
7505
7507
  {
7506
7508
  label: "is between...",
7507
7509
  value: "between",
7508
- editorType: "numberRange"
7510
+ editorType: "numberRange",
7511
+ expectedValueType: "between"
7509
7512
  },
7510
7513
  {
7511
7514
  label: "is not empty",
7512
7515
  value: "def",
7513
- editorType: "empty"
7516
+ editorType: "empty",
7517
+ expectedValueType: "true"
7514
7518
  }
7515
7519
  ];
7516
7520
  var DATE_OPERATORS = [
7517
7521
  {
7518
7522
  label: "is",
7519
7523
  value: "eq",
7520
- editorType: "date"
7524
+ editorType: "date",
7525
+ expectedValueType: "single"
7521
7526
  },
7522
7527
  {
7523
7528
  label: "is between...",
7524
7529
  value: "between",
7525
- editorType: "dateRange"
7530
+ editorType: "dateRange",
7531
+ expectedValueType: "between"
7526
7532
  },
7527
7533
  {
7528
7534
  label: "is before...",
7529
7535
  value: "lt",
7530
- editorType: "date"
7536
+ editorType: "date",
7537
+ expectedValueType: "single"
7531
7538
  },
7532
7539
  {
7533
7540
  label: "is after...",
7534
7541
  value: "gt",
7535
- editorType: "date"
7542
+ editorType: "date",
7543
+ expectedValueType: "single"
7536
7544
  },
7537
7545
  {
7538
7546
  label: "is on or before...",
7539
7547
  value: "lte",
7540
- editorType: "date"
7548
+ editorType: "date",
7549
+ expectedValueType: "single"
7541
7550
  },
7542
7551
  {
7543
7552
  label: "is on or after...",
7544
7553
  value: "gte",
7545
- editorType: "date"
7554
+ editorType: "date",
7555
+ expectedValueType: "single"
7546
7556
  },
7547
7557
  {
7548
7558
  label: "is empty",
7549
7559
  value: "ndef",
7550
- editorType: "empty"
7560
+ editorType: "empty",
7561
+ expectedValueType: "false"
7551
7562
  },
7552
7563
  {
7553
7564
  label: "is not",
7554
7565
  value: "neq",
7555
- editorType: "date"
7566
+ editorType: "date",
7567
+ expectedValueType: "single"
7556
7568
  },
7557
7569
  {
7558
7570
  label: "is not empty",
7559
7571
  value: "def",
7560
- editorType: "empty"
7572
+ editorType: "empty",
7573
+ expectedValueType: "true"
7561
7574
  }
7562
7575
  ];
7563
7576
  var TEXTBOX_OPERATORS = [
7564
7577
  {
7565
7578
  label: "contains...",
7566
7579
  value: "match",
7567
- editorType: "text"
7580
+ editorType: "text",
7581
+ expectedValueType: "single"
7568
7582
  },
7569
7583
  {
7570
7584
  label: "is",
7571
7585
  value: "eq",
7572
- editorType: "text"
7586
+ editorType: "text",
7587
+ expectedValueType: "single"
7573
7588
  },
7574
7589
  {
7575
7590
  label: "is empty",
7576
7591
  value: "ndef",
7577
- editorType: "empty"
7592
+ editorType: "empty",
7593
+ expectedValueType: "false"
7578
7594
  },
7579
7595
  {
7580
7596
  label: "starts with...",
7581
7597
  value: "starts",
7582
- editorType: "text"
7598
+ editorType: "text",
7599
+ expectedValueType: "single"
7583
7600
  },
7584
7601
  {
7585
7602
  label: "is not",
7586
7603
  value: "neq",
7587
- editorType: "text"
7604
+ editorType: "text",
7605
+ expectedValueType: "single"
7588
7606
  },
7589
7607
  {
7590
7608
  label: "is not empty",
7591
7609
  value: "def",
7592
- editorType: "empty"
7610
+ editorType: "empty",
7611
+ expectedValueType: "true"
7593
7612
  }
7594
7613
  ];
7595
7614
  var USER_OPERATORS = [
7596
7615
  {
7597
7616
  label: "contains...",
7598
7617
  value: "match",
7599
- editorType: "text"
7618
+ editorType: "text",
7619
+ expectedValueType: "single"
7600
7620
  },
7601
7621
  {
7602
7622
  label: "is",
7603
7623
  value: "eq",
7604
- editorType: "text"
7624
+ editorType: "text",
7625
+ expectedValueType: "single"
7605
7626
  },
7606
7627
  {
7607
7628
  label: "starts with...",
7608
7629
  value: "starts",
7609
- editorType: "text"
7630
+ editorType: "text",
7631
+ expectedValueType: "single"
7610
7632
  },
7611
7633
  {
7612
7634
  label: "is not",
7613
7635
  value: "neq",
7614
- editorType: "text"
7636
+ editorType: "text",
7637
+ expectedValueType: "single"
7615
7638
  }
7616
7639
  ];
7617
- var SYSTEM_DATE_OPERATORS = [
7640
+ var DATE_TIME_OPERATORS = [
7618
7641
  {
7619
7642
  label: "is",
7620
7643
  value: "sys-date-eq",
7621
- editorType: "date"
7644
+ editorType: "date",
7645
+ expectedValueType: "single"
7622
7646
  },
7623
7647
  {
7624
7648
  label: "is between...",
7625
7649
  value: "sys-date-between",
7626
- editorType: "dateRange"
7650
+ editorType: "dateRange",
7651
+ expectedValueType: "between"
7627
7652
  },
7628
7653
  {
7629
7654
  label: "is before...",
7630
7655
  value: "sys-date-lt",
7631
- editorType: "date"
7656
+ editorType: "date",
7657
+ expectedValueType: "single"
7632
7658
  },
7633
7659
  {
7634
7660
  label: "is after...",
7635
7661
  value: "sys-date-gt",
7636
- editorType: "date"
7662
+ editorType: "date",
7663
+ expectedValueType: "single"
7637
7664
  },
7638
7665
  {
7639
7666
  label: "is on or before...",
7640
7667
  value: "sys-date-lte",
7641
- editorType: "date"
7668
+ editorType: "date",
7669
+ expectedValueType: "single"
7642
7670
  },
7643
7671
  {
7644
7672
  label: "is on or after...",
7645
7673
  value: "sys-date-gte",
7646
- editorType: "date"
7674
+ editorType: "date",
7675
+ expectedValueType: "single"
7676
+ },
7677
+ {
7678
+ label: "is empty",
7679
+ value: "ndef",
7680
+ editorType: "empty",
7681
+ expectedValueType: "false"
7682
+ },
7683
+ {
7684
+ label: "is not empty",
7685
+ value: "def",
7686
+ editorType: "empty",
7687
+ expectedValueType: "true"
7647
7688
  }
7648
7689
  ];
7649
7690
  var RICHTEXT_OPERATORS = [
7650
7691
  {
7651
7692
  label: "contains...",
7652
7693
  value: "match",
7653
- editorType: "text"
7694
+ editorType: "text",
7695
+ expectedValueType: "single"
7654
7696
  },
7655
7697
  {
7656
7698
  label: "is empty",
7657
7699
  value: "ndef",
7658
- editorType: "empty"
7700
+ editorType: "empty",
7701
+ expectedValueType: "false"
7659
7702
  },
7660
7703
  {
7661
7704
  label: "starts with...",
7662
7705
  value: "starts",
7663
- editorType: "text"
7706
+ editorType: "text",
7707
+ expectedValueType: "single"
7664
7708
  },
7665
7709
  {
7666
7710
  label: "is not empty",
7667
7711
  value: "def",
7668
- editorType: "empty"
7712
+ editorType: "empty",
7713
+ expectedValueType: "true"
7669
7714
  }
7670
7715
  ];
7671
7716
  var CHECKBOX_OPERATORS = [
7672
7717
  {
7673
7718
  label: "is checked",
7674
7719
  value: "def",
7675
- editorType: "empty"
7720
+ editorType: "empty",
7721
+ expectedValueType: "true"
7676
7722
  },
7677
7723
  {
7678
7724
  label: "is not checked",
7679
7725
  value: "ndef",
7680
- editorType: "empty"
7726
+ editorType: "empty",
7727
+ expectedValueType: "false"
7681
7728
  }
7682
7729
  ];
7683
7730
  var SYSTEM_FIELD_OPERATORS = [
7684
7731
  {
7685
7732
  label: "is",
7686
7733
  value: "eq",
7687
- editorType: "singleChoice"
7734
+ editorType: "singleChoice",
7735
+ expectedValueType: "single"
7688
7736
  },
7689
7737
  {
7690
7738
  label: "is any of...",
7691
7739
  value: "in",
7692
- editorType: "multiChoice"
7740
+ editorType: "multiChoice",
7741
+ expectedValueType: "array"
7693
7742
  },
7694
7743
  {
7695
7744
  label: "is not",
7696
7745
  value: "neq",
7697
- editorType: "singleChoice"
7746
+ editorType: "singleChoice",
7747
+ expectedValueType: "single"
7698
7748
  },
7699
7749
  {
7700
7750
  label: "is none of...",
7701
7751
  value: "nin",
7702
- editorType: "multiChoice"
7752
+ editorType: "multiChoice",
7753
+ expectedValueType: "array"
7703
7754
  }
7704
7755
  ];
7705
7756
  var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
7706
7757
  {
7707
7758
  label: "is",
7708
7759
  value: "eq",
7709
- editorType: "singleChoice"
7760
+ editorType: "singleChoice",
7761
+ expectedValueType: "single"
7710
7762
  },
7711
7763
  {
7712
7764
  label: "is any of...",
7713
7765
  value: "in",
7714
- editorType: "multiChoice"
7766
+ editorType: "multiChoice",
7767
+ expectedValueType: "array"
7715
7768
  },
7716
7769
  {
7717
7770
  label: "is empty",
7718
7771
  value: "ndef",
7719
- editorType: "empty"
7772
+ editorType: "empty",
7773
+ expectedValueType: "false"
7720
7774
  },
7721
7775
  {
7722
7776
  label: "is not",
7723
7777
  value: "neq",
7724
- editorType: "singleChoice"
7778
+ editorType: "singleChoice",
7779
+ expectedValueType: "single"
7725
7780
  },
7726
7781
  {
7727
7782
  label: "is none of...",
7728
7783
  value: "nin",
7729
- editorType: "multiChoice"
7784
+ editorType: "multiChoice",
7785
+ expectedValueType: "array"
7730
7786
  },
7731
7787
  {
7732
7788
  label: "is not empty",
7733
7789
  value: "def",
7734
- editorType: "empty"
7790
+ editorType: "empty",
7791
+ expectedValueType: "true"
7735
7792
  }
7736
7793
  ];
7737
7794
  var PUBLISH_STATUS_FIELD_OPERATORS = [
7738
7795
  {
7739
7796
  label: "is",
7740
7797
  value: "eq",
7741
- editorType: "statusSingleChoice"
7798
+ editorType: "statusSingleChoice",
7799
+ expectedValueType: "single"
7742
7800
  },
7743
7801
  {
7744
7802
  label: "is any of...",
7745
7803
  value: "in",
7746
- editorType: "statusMultiChoice"
7804
+ editorType: "statusMultiChoice",
7805
+ expectedValueType: "array"
7747
7806
  },
7748
7807
  {
7749
7808
  label: "is not",
7750
7809
  value: "neq",
7751
- editorType: "statusSingleChoice"
7810
+ editorType: "statusSingleChoice",
7811
+ expectedValueType: "single"
7752
7812
  },
7753
7813
  {
7754
7814
  label: "is none of...",
7755
7815
  value: "nin",
7756
- editorType: "statusMultiChoice"
7816
+ editorType: "statusMultiChoice",
7817
+ expectedValueType: "array"
7757
7818
  }
7758
7819
  ];
7759
7820
  var SELECT_OPERATORS = [
7760
7821
  {
7761
7822
  label: "is",
7762
7823
  value: "eq",
7763
- editorType: "singleChoice"
7824
+ editorType: "singleChoice",
7825
+ expectedValueType: "single"
7764
7826
  },
7765
7827
  {
7766
7828
  label: "is any of...",
7767
7829
  value: "in",
7768
- editorType: "multiChoice"
7830
+ editorType: "multiChoice",
7831
+ expectedValueType: "array"
7769
7832
  },
7770
7833
  {
7771
7834
  label: "is empty",
7772
7835
  value: "ndef",
7773
- editorType: "empty"
7836
+ editorType: "empty",
7837
+ expectedValueType: "false"
7774
7838
  },
7775
7839
  {
7776
7840
  label: "contains...",
7777
7841
  value: "match",
7778
- editorType: "text"
7842
+ editorType: "text",
7843
+ expectedValueType: "single"
7779
7844
  },
7780
7845
  {
7781
7846
  label: "starts with...",
7782
7847
  value: "starts",
7783
- editorType: "text"
7848
+ editorType: "text",
7849
+ expectedValueType: "single"
7784
7850
  },
7785
7851
  {
7786
7852
  label: "is not",
7787
7853
  value: "neq",
7788
- editorType: "singleChoice"
7854
+ editorType: "singleChoice",
7855
+ expectedValueType: "single"
7789
7856
  },
7790
7857
  {
7791
7858
  label: "is none of...",
7792
7859
  value: "nin",
7793
- editorType: "multiChoice"
7860
+ editorType: "multiChoice",
7861
+ expectedValueType: "array"
7794
7862
  },
7795
7863
  {
7796
7864
  label: "is not empty",
7797
7865
  value: "def",
7798
- editorType: "empty"
7866
+ editorType: "empty",
7867
+ expectedValueType: "true"
7799
7868
  }
7800
7869
  ];
7801
7870
  var MULTI_SELECT_OPERATORS = [
7802
7871
  {
7803
7872
  label: "is",
7804
7873
  value: "eq",
7805
- editorType: "singleChoice"
7874
+ editorType: "singleChoice",
7875
+ expectedValueType: "single"
7806
7876
  },
7807
7877
  {
7808
7878
  label: "is any of...",
7809
7879
  value: "in",
7810
- editorType: "multiChoice"
7880
+ editorType: "multiChoice",
7881
+ expectedValueType: "array"
7811
7882
  },
7812
7883
  {
7813
7884
  label: "is empty",
7814
7885
  value: "ndef",
7815
- editorType: "empty"
7886
+ editorType: "empty",
7887
+ expectedValueType: "false"
7816
7888
  },
7817
7889
  {
7818
7890
  label: "is not",
7819
7891
  value: "neq",
7820
- editorType: "singleChoice"
7892
+ editorType: "singleChoice",
7893
+ expectedValueType: "single"
7821
7894
  },
7822
7895
  {
7823
7896
  label: "is none of...",
7824
7897
  value: "nin",
7825
- editorType: "multiChoice"
7898
+ editorType: "multiChoice",
7899
+ expectedValueType: "array"
7826
7900
  },
7827
7901
  {
7828
7902
  label: "is not empty",
7829
7903
  value: "def",
7830
- editorType: "empty"
7904
+ editorType: "empty",
7905
+ expectedValueType: "true"
7831
7906
  }
7832
7907
  ];
7833
7908
 
@@ -8459,13 +8534,16 @@ var ConditionalInputRow = import_react86.css`
8459
8534
  ${(0, import_design_system53.cq)("764px")} {
8460
8535
  align-items: flex-start;
8461
8536
  display: grid;
8462
- grid-template-columns: 200px 160px 1fr 32px;
8537
+ grid-template-columns: 250px 160px 1fr 32px;
8463
8538
 
8464
8539
  & > div:nth-child(n) {
8465
8540
  width: auto;
8466
8541
  }
8467
8542
  }
8468
8543
  `;
8544
+ var ConditionalInputRowEmpty = import_react86.css`
8545
+ flex-wrap: nowrap;
8546
+ `;
8469
8547
  var SearchInput = import_react86.css`
8470
8548
  max-height: 40px;
8471
8549
  min-height: unset;
@@ -8508,7 +8586,8 @@ var FilterButton = import_react86.css`
8508
8586
  gap: var(--spacing-sm);
8509
8587
  padding: var(--spacing-sm) var(--spacing-base);
8510
8588
  max-height: 40px;
8511
- transition: color var(--duration-fast) var(--timing-ease-out),
8589
+ transition:
8590
+ color var(--duration-fast) var(--timing-ease-out),
8512
8591
  background-color var(--duration-fast) var(--timing-ease-out),
8513
8592
  border-color var(--duration-fast) var(--timing-ease-out),
8514
8593
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -8603,6 +8682,9 @@ var ResetConditionsBtn = import_react86.css`
8603
8682
  &:focus {
8604
8683
  color: var(--action-destructive-hover);
8605
8684
  }
8685
+ &:disabled {
8686
+ color: var(--gray-400);
8687
+ }
8606
8688
  `;
8607
8689
  var IconBtn = import_react86.css`
8608
8690
  align-self: center;
@@ -8638,7 +8720,7 @@ var SearchAndFilterButtonGroup = import_react86.css`
8638
8720
  var import_jsx_runtime81 = require("@emotion/react/jsx-runtime");
8639
8721
  var FilterButton2 = ({
8640
8722
  text = "Filters",
8641
- icon = "filter-add",
8723
+ icon = import_design_system54.customIcons["filter-add"],
8642
8724
  filterCount,
8643
8725
  hasSelectedValue,
8644
8726
  dataTestId,
@@ -8666,6 +8748,7 @@ var FilterButton2 = ({
8666
8748
 
8667
8749
  // src/components/SearchAndFilter/FilterControls.tsx
8668
8750
  var import_CgClose5 = require("@react-icons/all-files/cg/CgClose");
8751
+ var import_canvas11 = require("@uniformdev/canvas");
8669
8752
  var import_design_system56 = require("@uniformdev/design-system");
8670
8753
  var import_lexical11 = require("lexical");
8671
8754
  var import_react88 = require("react");
@@ -8699,7 +8782,7 @@ var filterMapper = {
8699
8782
  statusSingleChoice: StatusSingleEditor,
8700
8783
  empty: null
8701
8784
  };
8702
- function withInputVariables(WrappedComponent) {
8785
+ function withInputVariables(WrappedComponent, noSwapping = false) {
8703
8786
  const WithInputVariables = (props) => {
8704
8787
  if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8705
8788
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props });
@@ -8712,7 +8795,7 @@ function withInputVariables(WrappedComponent) {
8712
8795
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8713
8796
  value: props.value,
8714
8797
  disabled: props.disabled,
8715
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props })
8798
+ inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(WrappedComponent, { ...props })
8716
8799
  }
8717
8800
  );
8718
8801
  };
@@ -8742,7 +8825,7 @@ var bindableFiltersMapper = {
8742
8825
  multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
8743
8826
  singleChoice: withInputVariables(FilterSingleChoiceEditor),
8744
8827
  date: withInputVariables(DateEditor),
8745
- text: withInputVariables(TextEditor),
8828
+ text: withInputVariables(TextEditor, true),
8746
8829
  number: withInputVariables(NumberEditor)
8747
8830
  };
8748
8831
 
@@ -8774,6 +8857,7 @@ var SearchAndFilterProvider = ({
8774
8857
  filters,
8775
8858
  filterOptions,
8776
8859
  filterVisible = false,
8860
+ alwaysVisible = false,
8777
8861
  defaultSearchTerm = "",
8778
8862
  onSearchChange,
8779
8863
  onChange,
@@ -8785,7 +8869,7 @@ var SearchAndFilterProvider = ({
8785
8869
  }) => {
8786
8870
  const [searchTerm, setSearchTerm] = (0, import_react87.useState)(defaultSearchTerm);
8787
8871
  const deferredSearchTerm = (0, import_react87.useDeferredValue)(searchTerm);
8788
- const [filterVisibility, setFilterVisibility] = (0, import_react87.useState)(filterVisible);
8872
+ const [filterVisibility, setFilterVisibility] = (0, import_react87.useState)(alwaysVisible || filterVisible);
8789
8873
  const handleSearchTerm = (0, import_react87.useCallback)(
8790
8874
  (term) => {
8791
8875
  setSearchTerm(term);
@@ -8794,8 +8878,13 @@ var SearchAndFilterProvider = ({
8794
8878
  [setSearchTerm, onSearchChange]
8795
8879
  );
8796
8880
  const handleToggleFilterVisibility = (0, import_react87.useCallback)(
8797
- (visible) => setFilterVisibility(visible),
8798
- [setFilterVisibility]
8881
+ (visible) => {
8882
+ if (alwaysVisible) {
8883
+ return;
8884
+ }
8885
+ setFilterVisibility(visible);
8886
+ },
8887
+ [alwaysVisible]
8799
8888
  );
8800
8889
  const handleAddFilter = (0, import_react87.useCallback)(() => {
8801
8890
  onChange([...filters, { field: "", operator: "", value: "" }]);
@@ -8821,7 +8910,7 @@ var SearchAndFilterProvider = ({
8821
8910
  if (filterVisibility) {
8822
8911
  const handleEscKeyFilterClose = (e) => {
8823
8912
  if (e.key === "Escape") {
8824
- setFilterVisibility(false);
8913
+ handleToggleFilterVisibility(false);
8825
8914
  }
8826
8915
  };
8827
8916
  document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
@@ -8829,7 +8918,7 @@ var SearchAndFilterProvider = ({
8829
8918
  document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8830
8919
  };
8831
8920
  }
8832
- }, [filterVisibility]);
8921
+ }, [filterVisibility, handleToggleFilterVisibility]);
8833
8922
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
8834
8923
  SearchAndFilterContext.Provider,
8835
8924
  {
@@ -8873,7 +8962,7 @@ var FilterControls = ({
8873
8962
  allowBindingSearchTerm
8874
8963
  } = useSearchAndFilter();
8875
8964
  const editorRef = (0, import_react88.useRef)(null);
8876
- const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8965
+ const variableRefernceCountInSearchTerm = (0, import_canvas11.hasReferencedVariables)(searchTerm);
8877
8966
  const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react88.useState)("data-resource-search-term-input");
8878
8967
  const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react88.useState)(searchTerm);
8879
8968
  (0, import_react_use10.useDebounce)(
@@ -8927,7 +9016,7 @@ var FilterControls = ({
8927
9016
  )
8928
9017
  }
8929
9018
  ),
8930
- hasVariableInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
9019
+ variableRefernceCountInSearchTerm ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8931
9020
  "button",
8932
9021
  {
8933
9022
  css: ClearSearchButtonStyles,
@@ -8950,89 +9039,28 @@ var FilterControls = ({
8950
9039
  };
8951
9040
 
8952
9041
  // src/components/SearchAndFilter/FilterItem.tsx
8953
- var import_design_system58 = require("@uniformdev/design-system");
8954
- var import_react90 = require("react");
8955
-
8956
- // src/components/SearchAndFilter/FilterMenu.tsx
9042
+ var import_CgTrash2 = require("@react-icons/all-files/cg/CgTrash");
8957
9043
  var import_design_system57 = require("@uniformdev/design-system");
8958
- var import_react89 = __toESM(require("react"));
8959
- var import_jsx_runtime85 = require("@emotion/react/jsx-runtime");
8960
- var SearchAndFilterOptionsContainer2 = ({
8961
- buttonRow,
8962
- additionalFiltersContainer,
8963
- children
8964
- }) => {
8965
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
8966
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8967
- buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
8968
- import_design_system57.HorizontalRhythm,
8969
- {
8970
- css: SearchAndFilterButtonGroup,
8971
- gap: "sm",
8972
- align: "center",
8973
- justify: "space-between",
8974
- children: buttonRow
8975
- }
8976
- ) : null,
8977
- additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { children: additionalFiltersContainer }) : null
8978
- ] });
8979
- };
8980
- var FilterMenu = ({
8981
- id,
8982
- filterTitle = "Show results",
8983
- menuControls,
8984
- additionalFiltersContainer,
8985
- children,
8986
- dataTestId,
8987
- resetButtonText = "reset"
8988
- }) => {
8989
- const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
8990
- const innerMenuRef = import_react89.default.useRef(null);
8991
- (0, import_react89.useEffect)(() => {
8992
- var _a;
8993
- if (filterVisibility) {
8994
- (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
8995
- }
8996
- }, [filterVisibility]);
8997
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_design_system57.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
8998
- SearchAndFilterOptionsContainer2,
8999
- {
9000
- buttonRow: menuControls,
9001
- additionalFiltersContainer,
9002
- children: [
9003
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_design_system57.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
9004
- filterTitle ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
9005
- (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9006
- "button",
9007
- {
9008
- type: "button",
9009
- css: ResetConditionsBtn,
9010
- onClick: () => {
9011
- handleResetFilters();
9012
- setFilterVisibility(false);
9013
- },
9014
- "data-testid": "reset-filters",
9015
- children: resetButtonText
9016
- }
9017
- ) : null
9018
- ] }),
9019
- children
9020
- ]
9021
- }
9022
- ) : null });
9023
- };
9044
+ var import_react89 = require("react");
9045
+
9046
+ // src/components/SearchAndFilter/util/isFilterBindable.ts
9047
+ function isFilterBindable(filter, operator) {
9048
+ var _a, _b;
9049
+ return (_b = (_a = operator == null ? void 0 : operator.bindable) != null ? _a : filter == null ? void 0 : filter.bindable) != null ? _b : false;
9050
+ }
9024
9051
 
9025
9052
  // src/components/SearchAndFilter/FilterItem.tsx
9026
- var import_jsx_runtime86 = require("@emotion/react/jsx-runtime");
9053
+ var import_jsx_runtime85 = require("@emotion/react/jsx-runtime");
9027
9054
  var FilterItem = ({
9028
9055
  index,
9029
- paramOptions,
9030
9056
  operatorOptions,
9031
9057
  valueOptions,
9032
- onParamChange,
9058
+ onFilterOptionChange,
9059
+ onFilterDynamicChange,
9033
9060
  onOperatorChange,
9034
9061
  onValueChange,
9035
- initialCriteriaTitle = "Where"
9062
+ initialCriteriaTitle = "Where",
9063
+ criteriaGroupOperator = "and"
9036
9064
  }) => {
9037
9065
  var _a, _b;
9038
9066
  const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
@@ -9040,25 +9068,26 @@ var FilterItem = ({
9040
9068
  const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
9041
9069
  const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
9042
9070
  const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
9043
- const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react90.useMemo)(() => {
9071
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react89.useMemo)(() => {
9044
9072
  var _a2;
9045
- const currentSelectedFilter = filterOptions.find((item) => {
9073
+ const currentSelectedFilterGroup = filterOptions.find((item) => {
9046
9074
  var _a3;
9047
9075
  return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
9048
9076
  });
9049
- const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
9077
+ const selectedFilterOption = (_a2 = currentSelectedFilterGroup == null ? void 0 : currentSelectedFilterGroup.options) == null ? void 0 : _a2.find((item) => {
9050
9078
  return filters[index].field === item.value;
9051
9079
  });
9052
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
9080
+ const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
9053
9081
  const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
9054
9082
  return filters[index].operator === item.value;
9055
9083
  });
9084
+ const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
9056
9085
  return {
9057
- selectedFieldValue: selectedFieldValue2,
9086
+ selectedFieldValue: selectedFilterOption,
9058
9087
  selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
9059
9088
  selectedMetaValue: filters[index].value,
9060
9089
  readOnly: isCurrentFieldReadOnly,
9061
- bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
9090
+ bindable: bindable2
9062
9091
  };
9063
9092
  }, [filters, filterOptions, index, operatorOptions]);
9064
9093
  const readOnlyProps = readOnly ? {
@@ -9067,17 +9096,29 @@ var FilterItem = ({
9067
9096
  menuIsOpen: false,
9068
9097
  isClearable: false
9069
9098
  } : {};
9070
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
9071
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { children: index === 0 ? initialCriteriaTitle : "and" }),
9072
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { css: ConditionalInputRow, children: [
9073
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9074
- import_design_system58.InputComboBox,
9099
+ const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
9100
+ const isEmptyOperator = metaDataPossibleOptions === "empty";
9101
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
9102
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
9103
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { css: [ConditionalInputRow, isEmptyOperator ? ConditionalInputRowEmpty : null], children: [
9104
+ CustomLeftHandComponent ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9105
+ CustomLeftHandComponent,
9106
+ {
9107
+ filterOption: selectedFieldValue,
9108
+ filter: filters[index],
9109
+ setFilterDynamicValue: onFilterDynamicChange,
9110
+ deselectFilterOption: () => {
9111
+ onFilterOptionChange("");
9112
+ }
9113
+ }
9114
+ ) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9115
+ import_design_system57.InputComboBox,
9075
9116
  {
9076
9117
  "aria-label": label,
9077
- options: paramOptions,
9118
+ options: filterOptions,
9078
9119
  onChange: (e) => {
9079
9120
  var _a2;
9080
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
9121
+ onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
9081
9122
  },
9082
9123
  isOptionDisabled: (option) => {
9083
9124
  var _a2;
@@ -9097,8 +9138,8 @@ var FilterItem = ({
9097
9138
  name: `filter-field-${index}`
9098
9139
  }
9099
9140
  ),
9100
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9101
- import_design_system58.InputComboBox,
9141
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9142
+ import_design_system57.InputComboBox,
9102
9143
  {
9103
9144
  "aria-label": operatorLabel,
9104
9145
  options: operatorOptions,
@@ -9121,7 +9162,7 @@ var FilterItem = ({
9121
9162
  name: `filter-operator-${index}`
9122
9163
  }
9123
9164
  ),
9124
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9165
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9125
9166
  FilterEditorRenderer,
9126
9167
  {
9127
9168
  "aria-label": metaDataLabel,
@@ -9135,7 +9176,7 @@ var FilterItem = ({
9135
9176
  valueTestId: "filter-value"
9136
9177
  }
9137
9178
  ),
9138
- readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9179
+ readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
9139
9180
  "button",
9140
9181
  {
9141
9182
  type: "button",
@@ -9144,35 +9185,185 @@ var FilterItem = ({
9144
9185
  css: IconBtn,
9145
9186
  "data-testid": "delete-filter",
9146
9187
  disabled: filters.length === 1,
9147
- children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_design_system58.Icon, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
9188
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_design_system57.Icon, { icon: import_CgTrash2.CgTrash, iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
9148
9189
  }
9149
9190
  )
9150
9191
  ] })
9151
9192
  ] });
9152
9193
  };
9153
- var singleValuedOperators = /* @__PURE__ */ new Set([
9154
- "eq",
9155
- "neq",
9156
- "lt",
9157
- "gt",
9158
- "is",
9159
- "!is",
9160
- "has",
9161
- "!has",
9162
- "startswith",
9163
- "!startswith",
9164
- "endswith",
9165
- "!endswith"
9166
- ]);
9167
- var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
9168
- var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
9169
- var noValueOperators = /* @__PURE__ */ new Set(["empty", "!empty"]);
9194
+
9195
+ // src/components/SearchAndFilter/FilterItems.tsx
9196
+ var import_CgMathPlus = require("@react-icons/all-files/cg/CgMathPlus");
9197
+ var import_design_system59 = require("@uniformdev/design-system");
9198
+
9199
+ // src/components/SearchAndFilter/FilterMenu.tsx
9200
+ var import_design_system58 = require("@uniformdev/design-system");
9201
+ var import_react90 = __toESM(require("react"));
9202
+ var import_jsx_runtime86 = require("@emotion/react/jsx-runtime");
9203
+ var SearchAndFilterOptionsContainer2 = ({
9204
+ buttonRow,
9205
+ additionalFiltersContainer,
9206
+ children
9207
+ }) => {
9208
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
9209
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
9210
+ buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9211
+ import_design_system58.HorizontalRhythm,
9212
+ {
9213
+ css: SearchAndFilterButtonGroup,
9214
+ gap: "sm",
9215
+ align: "center",
9216
+ justify: "space-between",
9217
+ children: buttonRow
9218
+ }
9219
+ ) : null,
9220
+ additionalFiltersContainer ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { children: additionalFiltersContainer }) : null
9221
+ ] });
9222
+ };
9223
+ var FilterMenu = ({
9224
+ id,
9225
+ filterTitle = "Show results",
9226
+ menuControls,
9227
+ additionalFiltersContainer,
9228
+ children,
9229
+ dataTestId,
9230
+ resetButtonText = "reset"
9231
+ }) => {
9232
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
9233
+ const innerMenuRef = import_react90.default.useRef(null);
9234
+ (0, import_react90.useEffect)(() => {
9235
+ var _a;
9236
+ if (filterVisibility) {
9237
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
9238
+ }
9239
+ }, [filterVisibility]);
9240
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_design_system58.VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
9241
+ SearchAndFilterOptionsContainer2,
9242
+ {
9243
+ buttonRow: menuControls,
9244
+ additionalFiltersContainer,
9245
+ children: [
9246
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_design_system58.HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
9247
+ filterTitle ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
9248
+ (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9249
+ "button",
9250
+ {
9251
+ type: "button",
9252
+ css: ResetConditionsBtn,
9253
+ disabled: filters.every((f) => !f.field),
9254
+ onClick: () => {
9255
+ handleResetFilters();
9256
+ setFilterVisibility(false);
9257
+ },
9258
+ "data-testid": "reset-filters",
9259
+ children: resetButtonText
9260
+ }
9261
+ ) : null
9262
+ ] }),
9263
+ children
9264
+ ]
9265
+ }
9266
+ ) : null });
9267
+ };
9268
+
9269
+ // src/components/SearchAndFilter/util/getNewFilterValueAfterOperatorChange.ts
9270
+ var import_canvas12 = require("@uniformdev/canvas");
9271
+ function getNewFilterValueAfterOperatorChange({
9272
+ newOperatorId,
9273
+ currentFilter,
9274
+ filterOptions
9275
+ }) {
9276
+ var _a, _b, _c;
9277
+ if (Array.isArray(newOperatorId)) {
9278
+ throw new Error("Operator value must be a single string");
9279
+ }
9280
+ const result = {
9281
+ ...currentFilter,
9282
+ operator: newOperatorId,
9283
+ value: ""
9284
+ };
9285
+ const currentOperatorId = currentFilter.operator;
9286
+ let currentValue = currentFilter.value;
9287
+ const currentFieldDefinition = filterOptions.flatMap((group) => {
9288
+ var _a2;
9289
+ return (_a2 = group.options) != null ? _a2 : [];
9290
+ }).find((filter) => filter.value === currentFilter.field);
9291
+ const currentOperator = (_a = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _a.find(
9292
+ (op) => op.value === currentOperatorId
9293
+ );
9294
+ const newOperator = (_b = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _b.find((op) => op.value === newOperatorId);
9295
+ if (!currentOperator || !newOperator) {
9296
+ result.value = "";
9297
+ return result;
9298
+ } else {
9299
+ const currentOperatorValueType = currentOperator.expectedValueType;
9300
+ const newOperatorValueType = newOperator.expectedValueType;
9301
+ if (!isFilterBindable(currentFieldDefinition, newOperator) && hasBindings(currentValue)) {
9302
+ currentValue = "";
9303
+ }
9304
+ if (isHardcodedOperatorValue(currentOperatorValueType)) {
9305
+ result.value = isHardcodedOperatorValue(newOperatorValueType) ? newOperatorValueType : "";
9306
+ return result;
9307
+ }
9308
+ switch (newOperatorValueType) {
9309
+ case "single":
9310
+ if (Array.isArray(currentValue)) {
9311
+ if (currentOperatorValueType === "between") {
9312
+ result.value = "";
9313
+ } else {
9314
+ result.value = (_c = currentValue[0]) != null ? _c : "";
9315
+ }
9316
+ } else {
9317
+ result.value = currentValue;
9318
+ }
9319
+ return result;
9320
+ case "array":
9321
+ if (currentOperatorValueType === "between") {
9322
+ result.value = "";
9323
+ } else if (Array.isArray(currentValue)) {
9324
+ result.value = currentValue;
9325
+ } else {
9326
+ result.value = currentValue ? [currentValue] : [];
9327
+ }
9328
+ return result;
9329
+ case "between":
9330
+ if (Array.isArray(currentValue)) {
9331
+ result.value = "";
9332
+ } else {
9333
+ result.value = [currentValue, ""];
9334
+ }
9335
+ return result;
9336
+ case "none":
9337
+ result.value = "";
9338
+ return result;
9339
+ default:
9340
+ result.value = newOperatorValueType;
9341
+ return result;
9342
+ }
9343
+ }
9344
+ }
9345
+ function isHardcodedOperatorValue(valueType) {
9346
+ return valueType !== void 0 && valueType !== "array" && valueType !== "between" && valueType !== "none" && valueType !== "single";
9347
+ }
9348
+ function hasBindings(currentValue) {
9349
+ if (currentValue === void 0) {
9350
+ return false;
9351
+ }
9352
+ if (Array.isArray(currentValue)) {
9353
+ return currentValue.some((value) => (0, import_canvas12.hasReferencedVariables)(value));
9354
+ }
9355
+ return (0, import_canvas12.hasReferencedVariables)(currentValue) > 0;
9356
+ }
9357
+
9358
+ // src/components/SearchAndFilter/FilterItems.tsx
9359
+ var import_jsx_runtime87 = require("@emotion/react/jsx-runtime");
9170
9360
  var FilterItems = ({
9171
9361
  addButtonText = "add condition",
9172
9362
  additionalFiltersContainer,
9173
9363
  filterTitle,
9174
9364
  resetButtonText,
9175
- initialCriteriaTitle
9365
+ initialCriteriaTitle,
9366
+ criteriaGroupOperator
9176
9367
  }) => {
9177
9368
  const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
9178
9369
  const handleUpdateFilter = (index, prop, value) => {
@@ -9180,32 +9371,16 @@ var FilterItems = ({
9180
9371
  const next = [...filters];
9181
9372
  next[index] = { ...next[index], [prop]: value };
9182
9373
  if (prop === "operator") {
9183
- const newOperator = value;
9184
- const currentValue = next[index].value;
9185
- if (Array.isArray(newOperator)) {
9186
- throw new Error("Operator value must be a single string");
9187
- }
9188
- if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
9189
- next[index].value = next[index].value[0];
9190
- }
9191
- if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
9192
- next[index].value = currentValue ? [currentValue] : [];
9193
- }
9194
- if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
9195
- next[index].value = "";
9196
- }
9197
- if (noValueOperators.has(newOperator)) {
9198
- next[index].value = "";
9199
- }
9200
- if (newOperator === "between" && Array.isArray(currentValue) === false) {
9201
- next[index].value = [currentValue, ""];
9202
- }
9203
- if (value === "def" || value === "true") {
9204
- next[index].value = "true";
9205
- }
9206
- if (value === "ndef" || value === "false") {
9207
- next[index].value = "false";
9374
+ const newOperatorId = value;
9375
+ const currentFilter = next[index];
9376
+ if (!newOperatorId) {
9377
+ throw new Error("you bad");
9208
9378
  }
9379
+ next[index] = getNewFilterValueAfterOperatorChange({
9380
+ newOperatorId,
9381
+ currentFilter,
9382
+ filterOptions
9383
+ });
9209
9384
  }
9210
9385
  if (prop === "field") {
9211
9386
  const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
@@ -9214,15 +9389,16 @@ var FilterItems = ({
9214
9389
  })) == 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";
9215
9390
  next[index].operator = firstOperatorInAvailableOperators;
9216
9391
  next[index].value = "";
9392
+ next[index].dynamicField = void 0;
9217
9393
  }
9218
9394
  setFilters(next);
9219
9395
  };
9220
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9396
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9221
9397
  FilterMenu,
9222
9398
  {
9223
9399
  id: "search-and-filter-options",
9224
9400
  dataTestId: "search-and-filter-options",
9225
- menuControls: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
9401
+ menuControls: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
9226
9402
  "button",
9227
9403
  {
9228
9404
  type: "button",
@@ -9230,7 +9406,7 @@ var FilterItems = ({
9230
9406
  onClick: handleAddFilter,
9231
9407
  "data-testid": "add-filter",
9232
9408
  children: [
9233
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_design_system58.Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9409
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_design_system59.Icon, { icon: import_CgMathPlus.CgMathPlus, iconColor: "currentColor", size: "1rem" }),
9234
9410
  addButtonText
9235
9411
  ]
9236
9412
  }
@@ -9246,17 +9422,18 @@ var FilterItems = ({
9246
9422
  })) == null ? void 0 : _a.options) != null ? _b : [];
9247
9423
  const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
9248
9424
  const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
9249
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
9425
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9250
9426
  FilterItem,
9251
9427
  {
9252
9428
  index: i,
9253
- paramOptions: filterOptions,
9254
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
9429
+ onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
9255
9430
  operatorOptions: possibleOperators,
9256
9431
  onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
9257
9432
  onValueChange: (e) => handleUpdateFilter(i, "value", e),
9433
+ onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
9258
9434
  valueOptions: possibleValueOptions,
9259
- initialCriteriaTitle
9435
+ initialCriteriaTitle,
9436
+ criteriaGroupOperator
9260
9437
  },
9261
9438
  i
9262
9439
  );
@@ -9266,11 +9443,11 @@ var FilterItems = ({
9266
9443
  };
9267
9444
 
9268
9445
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9269
- var import_design_system60 = require("@uniformdev/design-system");
9446
+ var import_design_system61 = require("@uniformdev/design-system");
9270
9447
 
9271
9448
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9272
- var import_design_system59 = require("@uniformdev/design-system");
9273
- var import_jsx_runtime87 = require("@emotion/react/jsx-runtime");
9449
+ var import_design_system60 = require("@uniformdev/design-system");
9450
+ var import_jsx_runtime88 = require("@emotion/react/jsx-runtime");
9274
9451
  var SearchAndFilterResultContainer = ({
9275
9452
  buttonText,
9276
9453
  clearButtonLabel = "clear",
@@ -9300,19 +9477,19 @@ var SearchAndFilterResultContainer = ({
9300
9477
  handleResetFilters();
9301
9478
  }
9302
9479
  };
9303
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
9304
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_design_system59.HorizontalRhythm, { children: [
9305
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { children: [
9480
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
9481
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system60.HorizontalRhythm, { children: [
9482
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { children: [
9306
9483
  totalResults,
9307
9484
  " results ",
9308
9485
  searchTerm ? `for "${searchTerm}"` : null
9309
9486
  ] }),
9310
- !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_design_system59.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9487
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_design_system60.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9311
9488
  ] }),
9312
- totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_design_system59.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9313
- calloutText ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_design_system59.Paragraph, { children: calloutText }) : null,
9314
- hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
9315
- import_design_system59.Button,
9489
+ totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system60.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9490
+ calloutText ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_design_system60.Paragraph, { children: calloutText }) : null,
9491
+ hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9492
+ import_design_system60.Button,
9316
9493
  {
9317
9494
  buttonType: "tertiaryOutline",
9318
9495
  size: "xs",
@@ -9326,14 +9503,14 @@ var SearchAndFilterResultContainer = ({
9326
9503
  };
9327
9504
 
9328
9505
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9329
- var import_jsx_runtime88 = require("@emotion/react/jsx-runtime");
9506
+ var import_jsx_runtime89 = require("@emotion/react/jsx-runtime");
9330
9507
  var SearchAndFilter = ({
9331
9508
  filters,
9332
9509
  filterOptions,
9333
9510
  filterVisible,
9334
9511
  filterControls,
9335
9512
  viewSwitchControls,
9336
- resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(SearchAndFilterResultContainer, {}),
9513
+ resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SearchAndFilterResultContainer, {}),
9337
9514
  filterMapper: filterMapper2 = filterMapper,
9338
9515
  additionalFiltersContainer,
9339
9516
  onChange,
@@ -9343,7 +9520,7 @@ var SearchAndFilter = ({
9343
9520
  allowBindingSearchTerm = false,
9344
9521
  resetFilterValues = []
9345
9522
  }) => {
9346
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9523
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9347
9524
  SearchAndFilterProvider,
9348
9525
  {
9349
9526
  filters,
@@ -9356,18 +9533,18 @@ var SearchAndFilter = ({
9356
9533
  resetFilterValues,
9357
9534
  filterMapper: filterMapper2,
9358
9535
  allowBindingSearchTerm,
9359
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_design_system60.VerticalRhythm, { "data-testid": "search-and-filter", children: [
9360
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9361
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
9536
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_design_system61.VerticalRhythm, { "data-testid": "search-and-filter", children: [
9537
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9538
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9362
9539
  "div",
9363
9540
  {
9364
9541
  css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9365
- children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9542
+ children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9366
9543
  }
9367
9544
  ),
9368
9545
  viewSwitchControls
9369
9546
  ] }),
9370
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(FilterItems, { additionalFiltersContainer }),
9547
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FilterItems, { additionalFiltersContainer }),
9371
9548
  resultsContainerView
9372
9549
  ] })
9373
9550
  }
@@ -9375,10 +9552,10 @@ var SearchAndFilter = ({
9375
9552
  };
9376
9553
 
9377
9554
  // src/components/SearchAndFilter/SearchOnlyFilter.tsx
9378
- var import_design_system61 = require("@uniformdev/design-system");
9555
+ var import_design_system62 = require("@uniformdev/design-system");
9379
9556
  var import_react91 = require("react");
9380
9557
  var import_react_use11 = require("react-use");
9381
- var import_jsx_runtime89 = require("@emotion/react/jsx-runtime");
9558
+ var import_jsx_runtime90 = require("@emotion/react/jsx-runtime");
9382
9559
  var SearchOnlyContext = (0, import_react91.createContext)({
9383
9560
  searchTerm: "",
9384
9561
  setSearchTerm: () => {
@@ -9395,15 +9572,15 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9395
9572
  300,
9396
9573
  [localeSearchTerm]
9397
9574
  );
9398
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9575
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9399
9576
  SearchOnlyContext.Provider,
9400
9577
  {
9401
9578
  value: {
9402
9579
  searchTerm,
9403
9580
  setSearchTerm: setLocaleSearchTerm
9404
9581
  },
9405
- children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
9406
- import_design_system61.InputKeywordSearch,
9582
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9583
+ import_design_system62.InputKeywordSearch,
9407
9584
  {
9408
9585
  placeholder: "Search...",
9409
9586
  onSearchTextChanged: (e) => setLocaleSearchTerm(e),
@@ -9417,18 +9594,18 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9417
9594
  };
9418
9595
 
9419
9596
  // src/components/SearchAndFilter/SortItems.tsx
9420
- var import_design_system63 = require("@uniformdev/design-system");
9597
+ var import_design_system64 = require("@uniformdev/design-system");
9421
9598
 
9422
9599
  // src/components/SearchAndFilter/styles/SortItems.styles.ts
9423
9600
  var import_react92 = require("@emotion/react");
9424
- var import_design_system62 = require("@uniformdev/design-system");
9601
+ var import_design_system63 = require("@uniformdev/design-system");
9425
9602
  var ConditionalFilterRow2 = import_react92.css`
9426
9603
  display: grid;
9427
9604
  grid-template-columns: 35px 1fr;
9428
9605
  gap: var(--spacing-sm);
9429
9606
  margin-left: var(--spacing-base);
9430
9607
 
9431
- ${(0, import_design_system62.cq)("380px")} {
9608
+ ${(0, import_design_system63.cq)("380px")} {
9432
9609
  align-items: center;
9433
9610
 
9434
9611
  &:after {
@@ -9449,14 +9626,14 @@ var ConditionalFilterRow2 = import_react92.css`
9449
9626
  grid-template-columns: 50px 1fr;
9450
9627
  }
9451
9628
 
9452
- ${(0, import_design_system62.cq)("580px")} {
9629
+ ${(0, import_design_system63.cq)("580px")} {
9453
9630
  &:after {
9454
9631
  display: none;
9455
9632
  }
9456
9633
  }
9457
9634
 
9458
9635
  @media (prefers-reduced-motion: no-preference) {
9459
- animation: ${import_design_system62.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
9636
+ animation: ${import_design_system63.fadeInLtr} var(--duration-fast) var(--timing-ease-out);
9460
9637
  }
9461
9638
  `;
9462
9639
  var ConditionalInputRow2 = import_react92.css`
@@ -9464,7 +9641,7 @@ var ConditionalInputRow2 = import_react92.css`
9464
9641
  gap: var(--spacing-sm);
9465
9642
  flex-wrap: wrap;
9466
9643
 
9467
- ${(0, import_design_system62.cq)("380px")} {
9644
+ ${(0, import_design_system63.cq)("380px")} {
9468
9645
  & > div:nth-child(-n + 2) {
9469
9646
  width: calc(50% - var(--spacing-sm));
9470
9647
  }
@@ -9473,7 +9650,7 @@ var ConditionalInputRow2 = import_react92.css`
9473
9650
  width: calc(100% - 48px);
9474
9651
  }
9475
9652
  }
9476
- ${(0, import_design_system62.cq)("580px")} {
9653
+ ${(0, import_design_system63.cq)("580px")} {
9477
9654
  display: grid;
9478
9655
  grid-template-columns: 200px 160px 1fr 32px;
9479
9656
 
@@ -9497,7 +9674,8 @@ var FilterButton3 = import_react92.css`
9497
9674
  gap: var(--spacing-sm);
9498
9675
  padding: var(--spacing-sm) var(--spacing-base);
9499
9676
  max-height: 40px;
9500
- transition: color var(--duration-fast) var(--timing-ease-out),
9677
+ transition:
9678
+ color var(--duration-fast) var(--timing-ease-out),
9501
9679
  background-color var(--duration-fast) var(--timing-ease-out),
9502
9680
  border-color var(--duration-fast) var(--timing-ease-out),
9503
9681
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -9631,7 +9809,7 @@ var SortFilterWrapper = (hiddenLocaleInput) => import_react92.css`
9631
9809
  position: relative;
9632
9810
  z-index: 0;
9633
9811
 
9634
- ${(0, import_design_system62.cq)("420px")} {
9812
+ ${(0, import_design_system63.cq)("420px")} {
9635
9813
  display: grid;
9636
9814
  grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
9637
9815
  }
@@ -9653,7 +9831,7 @@ var InputVariableWrapper = import_react92.css`
9653
9831
  `;
9654
9832
 
9655
9833
  // src/components/SearchAndFilter/SortItems.tsx
9656
- var import_jsx_runtime90 = require("@emotion/react/jsx-runtime");
9834
+ var import_jsx_runtime91 = require("@emotion/react/jsx-runtime");
9657
9835
  var SortItems = ({
9658
9836
  sortByLabel = "Sort by",
9659
9837
  localeLabel = "Show locale",
@@ -9675,11 +9853,11 @@ var SortItems = ({
9675
9853
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9676
9854
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9677
9855
  const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9678
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9679
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_design_system63.VerticalRhythm, { gap: "xs", children: [
9680
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { css: Title2, children: sortByLabel }),
9681
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { css: SortFilterInputRow, children: [
9682
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9856
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9857
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_design_system64.VerticalRhythm, { gap: "xs", children: [
9858
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { css: Title2, children: sortByLabel }),
9859
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { css: SortFilterInputRow, children: [
9860
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9683
9861
  InputVariables,
9684
9862
  {
9685
9863
  disableInlineMenu: disableSortBinding,
@@ -9687,8 +9865,8 @@ var SortItems = ({
9687
9865
  value: sortField,
9688
9866
  valueToResetTo: "created_at",
9689
9867
  onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9690
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9691
- import_design_system63.InputComboBox,
9868
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9869
+ import_design_system64.InputComboBox,
9692
9870
  {
9693
9871
  id: "sort-by-field",
9694
9872
  "aria-label": "Sort by",
@@ -9710,7 +9888,7 @@ var SortItems = ({
9710
9888
  )
9711
9889
  }
9712
9890
  ),
9713
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9891
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9714
9892
  InputVariables,
9715
9893
  {
9716
9894
  disableInlineMenu: disableSortBinding,
@@ -9718,8 +9896,8 @@ var SortItems = ({
9718
9896
  valueToResetTo: "DESC",
9719
9897
  showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9720
9898
  onChange: (e) => onSortChange(`${sortField}_${e}`),
9721
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9722
- import_design_system63.SegmentedControl,
9899
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9900
+ import_design_system64.SegmentedControl,
9723
9901
  {
9724
9902
  noCheckmark: true,
9725
9903
  name: "sortBy",
@@ -9750,15 +9928,15 @@ var SortItems = ({
9750
9928
  )
9751
9929
  ] })
9752
9930
  ] }),
9753
- hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_design_system63.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9931
+ hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_design_system64.VerticalRhythm, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9754
9932
  InputVariables,
9755
9933
  {
9756
9934
  label: localeLabelValue,
9757
9935
  value: localeValue,
9758
9936
  showMenuPosition: "inline-right",
9759
9937
  onChange: (e) => onLocaleChange(e != null ? e : ""),
9760
- inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9761
- import_design_system63.InputSelect,
9938
+ inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9939
+ import_design_system64.InputSelect,
9762
9940
  {
9763
9941
  name: "localeReturned",
9764
9942
  "aria-label": localeLabelValue,
@@ -9787,7 +9965,7 @@ function createLocationValidator(setValue, validate) {
9787
9965
  }
9788
9966
 
9789
9967
  // src/utils/useContentDataResourceLocaleInfo.ts
9790
- var import_canvas10 = require("@uniformdev/canvas");
9968
+ var import_canvas13 = require("@uniformdev/canvas");
9791
9969
  var import_react93 = require("react");
9792
9970
  function useContentDataResourceLocaleInfo({
9793
9971
  locale,
@@ -9798,18 +9976,18 @@ function useContentDataResourceLocaleInfo({
9798
9976
  const setLocaleRef = (0, import_react93.useRef)(setLocale);
9799
9977
  setLocaleRef.current = setLocale;
9800
9978
  const { flatVariables } = useVariables();
9801
- const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas10.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME) : "";
9802
- const boundLocale = (_a = (0, import_canvas10.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
9979
+ const effectiveLocale = locale != null ? locale : dynamicInputs[import_canvas13.LOCALE_DYNAMIC_INPUT_NAME] ? (0, import_canvas13.createVariableReference)(import_canvas13.LOCALE_DYNAMIC_INPUT_NAME) : "";
9980
+ const boundLocale = (_a = (0, import_canvas13.bindVariables)({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
9803
9981
  (0, import_react93.useEffect)(() => {
9804
9982
  if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
9805
- setLocaleRef.current((0, import_canvas10.createVariableReference)(import_canvas10.LOCALE_DYNAMIC_INPUT_NAME));
9983
+ setLocaleRef.current((0, import_canvas13.createVariableReference)(import_canvas13.LOCALE_DYNAMIC_INPUT_NAME));
9806
9984
  }
9807
9985
  }, [locale, effectiveLocale]);
9808
9986
  return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
9809
9987
  }
9810
9988
 
9811
9989
  // src/index.ts
9812
- var import_design_system64 = require("@uniformdev/design-system");
9990
+ var import_design_system65 = require("@uniformdev/design-system");
9813
9991
  __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9814
9992
  // Annotate the CommonJS export names for ESM import in node:
9815
9993
  0 && (module.exports = {
@@ -9821,6 +9999,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9821
9999
  Callout,
9822
10000
  ControlledValuePlugin,
9823
10001
  DATE_OPERATORS,
10002
+ DATE_TIME_OPERATORS,
9824
10003
  DISCONNECT_VARIABLE_COMMAND,
9825
10004
  DamSelectedItem,
9826
10005
  DataRefreshButton,
@@ -9914,7 +10093,6 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
9914
10093
  RequestUrlInput,
9915
10094
  ResolvableLoadingValue,
9916
10095
  SELECT_OPERATORS,
9917
- SYSTEM_DATE_OPERATORS,
9918
10096
  SYSTEM_FIELD_OPERATORS,
9919
10097
  ScrollableList,
9920
10098
  ScrollableListItem,
@@ -10011,6 +10189,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
10011
10189
  selectedItemIcon,
10012
10190
  selectedItemInner,
10013
10191
  selectedItemTitle,
10192
+ serializeVariablesEditorSerializedState,
10014
10193
  serializeVariablesEditorState,
10015
10194
  setVariablesEditorValue,
10016
10195
  urlEncodeRequestParameter,