@uniformdev/mesh-sdk-react 19.178.2-alpha.25 → 19.179.2-alpha.22

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.mjs CHANGED
@@ -966,7 +966,8 @@ var searchRowContainer = css6`
966
966
  cursor: pointer;
967
967
  padding: var(--spacing-sm);
968
968
  position: relative;
969
- transition: background-color var(--duration-fast) var(--timing-ease-out),
969
+ transition:
970
+ background-color var(--duration-fast) var(--timing-ease-out),
970
971
  color var(--duration-fast) var(--timing-ease-out);
971
972
  `;
972
973
  var searchRowContainerWithPopover = css6`
@@ -1956,7 +1957,8 @@ var productSearchRowContainer = css12`
1956
1957
  padding: var(--spacing-sm) 0;
1957
1958
  margin-right: var(--spacing-sm);
1958
1959
  position: relative;
1959
- transition: background-color var(--duration-fast) var(--timing-ease-out),
1960
+ transition:
1961
+ background-color var(--duration-fast) var(--timing-ease-out),
1960
1962
  color var(--duration-fast) var(--timing-ease-out);
1961
1963
  `;
1962
1964
  var productSearchRowContent = css12`
@@ -2792,21 +2794,55 @@ import { ParameterShellContext, useParameterShell } from "@uniformdev/design-sys
2792
2794
 
2793
2795
  // src/components/Variables/composer/ControlledValuePlugin.tsx
2794
2796
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
2795
- import { dequal } from "dequal/lite";
2796
- import { useEffect as useEffect5, useRef as useRef8 } from "react";
2797
+ import { useEffect as useEffect5 } from "react";
2797
2798
 
2798
- // src/components/Variables/util/setVariablesEditorValue.ts
2799
- import { emptyRichTextValue } from "@uniformdev/richtext";
2799
+ // src/components/Variables/util/serializeVariablesEditorState.ts
2800
+ import { createVariableReference } from "@uniformdev/canvas";
2801
+ import {
2802
+ LineBreakNode,
2803
+ TextNode
2804
+ } from "lexical";
2805
+
2806
+ // src/components/Variables/util/variableExpression.ts
2807
+ var variablePrefix = "${";
2808
+ var variableSuffix = "}";
2809
+
2810
+ // src/components/Variables/util/serializeVariablesEditorState.ts
2811
+ function serializeVariablesEditorState(editorState) {
2812
+ return serializeVariablesEditorSerializedState(editorState.toJSON().root);
2813
+ }
2814
+ function serializeVariablesEditorSerializedState(serializedEditorState) {
2815
+ const buf = [];
2816
+ serializeRecursive(serializedEditorState, buf);
2817
+ const result = buf.join("");
2818
+ return result.length > 0 ? result : void 0;
2819
+ }
2820
+ function serializeRecursive(node, buffer) {
2821
+ if (node.type === TextNode.getType()) {
2822
+ buffer.push(node.text.replace(variablePrefix, "\\${"));
2823
+ }
2824
+ if (node.type === VariableNode.getType()) {
2825
+ buffer.push(createVariableReference(node.reference));
2826
+ }
2827
+ if (node.type === LineBreakNode.getType()) {
2828
+ buffer.push("\n");
2829
+ }
2830
+ if ("children" in node && node.children) {
2831
+ for (const child of node.children) {
2832
+ serializeRecursive(child, buffer);
2833
+ }
2834
+ }
2835
+ }
2800
2836
 
2801
2837
  // src/components/Variables/util/deserializeVariablesEditorState.ts
2802
2838
  import { parseVariableExpression } from "@uniformdev/canvas";
2803
- import { TextNode } from "lexical";
2839
+ import { TextNode as TextNode2 } from "lexical";
2804
2840
  function deserializeVariablesEditorState(serialized) {
2805
2841
  const result = [];
2806
2842
  parseVariableExpression(serialized != null ? serialized : "", (token, type) => {
2807
2843
  if (type === "text") {
2808
2844
  const node = {
2809
- type: TextNode.getType(),
2845
+ type: TextNode2.getType(),
2810
2846
  text: token,
2811
2847
  mode: "normal",
2812
2848
  version: 1,
@@ -2875,7 +2911,27 @@ function setVariablesEditorValue(editor, newValue) {
2875
2911
  "Error:",
2876
2912
  e
2877
2913
  );
2878
- const parsedState = editor.parseEditorState(emptyRichTextValue);
2914
+ const parsedState = editor.parseEditorState({
2915
+ root: {
2916
+ type: "root",
2917
+ version: 1,
2918
+ direction: null,
2919
+ format: "",
2920
+ indent: 0,
2921
+ children: [
2922
+ {
2923
+ type: "paragraph",
2924
+ version: 1,
2925
+ format: "start",
2926
+ indent: 0,
2927
+ direction: null,
2928
+ children: [],
2929
+ textFormat: 0,
2930
+ textStyle: ""
2931
+ }
2932
+ ]
2933
+ }
2934
+ });
2879
2935
  editor.setEditorState(parsedState);
2880
2936
  }
2881
2937
  }
@@ -2889,17 +2945,18 @@ function ControlledValuePlugin({
2889
2945
  extraDependencies
2890
2946
  }) {
2891
2947
  const [editor] = useLexicalComposerContext();
2892
- const lastValueRef = useRef8(value);
2893
2948
  useEffect5(() => {
2949
+ var _a, _b;
2894
2950
  if (!enabled) {
2895
2951
  return;
2896
2952
  }
2897
- if (dequal(lastValueRef.current, value)) {
2953
+ const currentValue = (_a = serializeVariablesEditorState(editor.getEditorState())) != null ? _a : "";
2954
+ const newValue = (_b = value !== void 0 && typeof value !== "string" ? serializeVariablesEditorSerializedState(value.root) : value) != null ? _b : "";
2955
+ if (currentValue === newValue) {
2898
2956
  return;
2899
2957
  }
2900
2958
  setTimeout(() => {
2901
2959
  if (editor) {
2902
- lastValueRef.current = value;
2903
2960
  setVariablesEditorValue(editor, value);
2904
2961
  }
2905
2962
  });
@@ -2988,7 +3045,7 @@ import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexica
2988
3045
  import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
2989
3046
  import { $moveCharacter, $shouldOverrideDefaultCharacterSelection } from "@lexical/selection";
2990
3047
  import { mergeRegister as mergeRegister2 } from "@lexical/utils";
2991
- import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
3048
+ import { createVariableReference as createVariableReference3 } from "@uniformdev/canvas";
2992
3049
  import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
2993
3050
  import {
2994
3051
  $getNearestNodeFromDOMNode,
@@ -3022,12 +3079,14 @@ import {
3022
3079
  } from "@lexical/react/LexicalTypeaheadMenuPlugin";
3023
3080
  import { mergeRegister } from "@lexical/utils";
3024
3081
  import { AiFillPlusCircle } from "@react-icons/all-files/ai/AiFillPlusCircle";
3025
- import { createVariableReference } from "@uniformdev/canvas";
3082
+ import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
3026
3083
  import { HorizontalRhythm as HorizontalRhythm2, MenuGroup, MenuItemInner, MenuItemSeparator } from "@uniformdev/design-system";
3027
- import { dequal as dequal2 } from "dequal/lite";
3084
+ import { dequal } from "dequal/lite";
3028
3085
  import {
3086
+ $createParagraphNode,
3029
3087
  $createTextNode,
3030
3088
  $getNodeByKey,
3089
+ $getRoot,
3031
3090
  $getSelection,
3032
3091
  $insertNodes,
3033
3092
  $isNodeSelection,
@@ -3036,7 +3095,7 @@ import {
3036
3095
  COMMAND_PRIORITY_NORMAL,
3037
3096
  createCommand
3038
3097
  } from "lexical";
3039
- import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3098
+ import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef9, useState as useState10 } from "react";
3040
3099
  import { createPortal } from "react-dom";
3041
3100
 
3042
3101
  // src/components/Variables/toolbox/SelectVariableMenu.styles.ts
@@ -3122,7 +3181,7 @@ function useVariableEditTransaction({
3122
3181
  // src/components/Variables/VariableEditor.tsx
3123
3182
  import { zodResolver } from "@hookform/resolvers/zod";
3124
3183
  import { Button as Button2, Callout as Callout3, HorizontalRhythm, Input as Input2, useShortcut } from "@uniformdev/design-system";
3125
- import { useLayoutEffect, useRef as useRef9 } from "react";
3184
+ import { useLayoutEffect, useRef as useRef8 } from "react";
3126
3185
  import { useForm } from "react-hook-form";
3127
3186
  import { z } from "zod";
3128
3187
 
@@ -3181,7 +3240,7 @@ function VariableEditor({
3181
3240
  },
3182
3241
  activeWhenEditing: true
3183
3242
  });
3184
- const nameRef = useRef9(null);
3243
+ const nameRef = useRef8(null);
3185
3244
  const { ref, ...nameRegister } = register("name");
3186
3245
  useLayoutEffect(() => {
3187
3246
  if (nameRef.current && !nameRef.current.value) {
@@ -3565,7 +3624,7 @@ function useVariablesMenu({
3565
3624
  var _a;
3566
3625
  const targetVariable = variables[value];
3567
3626
  if (overwriteExistingValue) {
3568
- setVariablesEditorValue(editor, createVariableReference(value));
3627
+ setVariablesEditorValue(editor, createVariableReference2(value));
3569
3628
  return true;
3570
3629
  }
3571
3630
  const variableNode = $createVariableNode(value, {
@@ -3598,7 +3657,7 @@ function VariablesPlugin({
3598
3657
  }) {
3599
3658
  const [editor] = useLexicalComposerContext2();
3600
3659
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
3601
- const variablesRef = useRef10({ variables, knownUndefinedValues, isLoading });
3660
+ const variablesRef = useRef9({ variables, knownUndefinedValues, isLoading });
3602
3661
  variablesRef.current = { variables, knownUndefinedValues, isLoading };
3603
3662
  const canEditVariable = useCallback2(
3604
3663
  (name, variable) => (
@@ -3743,18 +3802,24 @@ function VariablesPlugin({
3743
3802
  var _a, _b;
3744
3803
  if (!disableVariables) {
3745
3804
  const targetVariable = variablesRef.current.variables[reference];
3746
- if (overwriteExistingValue) {
3747
- setVariablesEditorValue(editor, createVariableReference(reference));
3748
- return true;
3749
- }
3750
3805
  const variableNode = $createVariableNode(reference, {
3751
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
3806
+ displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
3752
3807
  hasClickEvent: canEditVariable(reference, targetVariable),
3753
3808
  referenceIsValid: true,
3754
3809
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
3755
3810
  isFresh: true,
3756
3811
  isLoading: false
3757
3812
  });
3813
+ if (overwriteExistingValue) {
3814
+ const pNode = $createParagraphNode();
3815
+ pNode.append(variableNode);
3816
+ editor.update(() => {
3817
+ const root = $getRoot();
3818
+ root.clear();
3819
+ root.append(pNode);
3820
+ });
3821
+ return true;
3822
+ }
3758
3823
  if (targetKey) {
3759
3824
  (_b = $getNodeByKey(targetKey)) == null ? void 0 : _b.replace(variableNode);
3760
3825
  } else {
@@ -3790,14 +3855,14 @@ function VariablesPlugin({
3790
3855
  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;
3791
3856
  const newState = {
3792
3857
  ...currentState,
3793
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
3858
+ displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
3794
3859
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
3795
3860
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
3796
3861
  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),
3797
3862
  tooltip,
3798
3863
  isFresh: false
3799
3864
  };
3800
- if (!dequal2(currentState, newState)) {
3865
+ if (!dequal(currentState, newState)) {
3801
3866
  variableNode.setState(newState);
3802
3867
  }
3803
3868
  },
@@ -3944,7 +4009,7 @@ var VariableNode = class _VariableNode extends DecoratorNode {
3944
4009
  * (albeit it won't get the fancy chip-node)
3945
4010
  */
3946
4011
  getTextContent() {
3947
- return createVariableReference2(this.reference);
4012
+ return createVariableReference3(this.reference);
3948
4013
  }
3949
4014
  /** Creates the DOM wrapper that hosts the node */
3950
4015
  createDOM() {
@@ -4155,9 +4220,11 @@ var input = css21`
4155
4220
  min-height: 50px;
4156
4221
  width: 100%;
4157
4222
  position: relative;
4158
- transition: background var(--duration-fast) var(--timing-ease-out),
4223
+ transition:
4224
+ background var(--duration-fast) var(--timing-ease-out),
4159
4225
  border-color var(--duration-fast) var(--timing-ease-out),
4160
- color var(--duration-fast) var(--timing-ease-out), box-shadow var(--duration-fast) var(--timing-ease-out);
4226
+ color var(--duration-fast) var(--timing-ease-out),
4227
+ box-shadow var(--duration-fast) var(--timing-ease-out);
4161
4228
 
4162
4229
  &::placeholder {
4163
4230
  color: var(--gray-400);
@@ -4221,7 +4288,8 @@ var variableBindButton = css22`
4221
4288
  display: flex;
4222
4289
  height: 1.2rem;
4223
4290
  padding: var(--spacing-2xs);
4224
- transition: background var(--duration-fast) var(--timing-ease-out),
4291
+ transition:
4292
+ background var(--duration-fast) var(--timing-ease-out),
4225
4293
  color var(--duration-fast) var(--timing-ease-out);
4226
4294
  width: 1.2rem;
4227
4295
 
@@ -4304,23 +4372,9 @@ var inputMultiLine = (lines) => css22`
4304
4372
  `;
4305
4373
 
4306
4374
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
4375
+ import { hasReferencedVariables } from "@uniformdev/canvas";
4307
4376
  import * as React10 from "react";
4308
4377
  import { useMemo as useMemo9 } from "react";
4309
-
4310
- // src/components/Variables/util/hasReferencedVariables.ts
4311
- import { parseVariableExpression as parseVariableExpression2 } from "@uniformdev/canvas";
4312
- function hasReferencedVariables(value) {
4313
- let result = false;
4314
- parseVariableExpression2(value, (token, type) => {
4315
- if (type === "variable") {
4316
- result = true;
4317
- return false;
4318
- }
4319
- });
4320
- return result;
4321
- }
4322
-
4323
- // src/components/Variables/toolbox/InputVariablesProvider.tsx
4324
4378
  function useInputVariablesState({
4325
4379
  value,
4326
4380
  onChange,
@@ -4335,20 +4389,20 @@ function useInputVariablesState({
4335
4389
  renderMenuInPortal
4336
4390
  }) {
4337
4391
  const { variables } = useVariables(true);
4338
- const hasVariablesInValue = hasReferencedVariables(value != null ? value : "");
4392
+ const variableReferenceCountInValue = hasReferencedVariables(value != null ? value : "");
4339
4393
  const [lastKnownId] = React10.useState(id);
4340
- const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(hasVariablesInValue);
4394
+ const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
4341
4395
  React10.useEffect(() => {
4342
- if (hasVariablesInValue) {
4396
+ if (variableReferenceCountInValue) {
4343
4397
  setHadVariablesInValue(true);
4344
4398
  }
4345
- }, [hasVariablesInValue]);
4399
+ }, [variableReferenceCountInValue]);
4346
4400
  React10.useEffect(() => {
4347
4401
  if (id !== lastKnownId) {
4348
- setHadVariablesInValue(hasVariablesInValue);
4402
+ setHadVariablesInValue(variableReferenceCountInValue > 0);
4349
4403
  }
4350
- }, [hasVariablesInValue, id, lastKnownId]);
4351
- const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
4404
+ }, [variableReferenceCountInValue, id, lastKnownId]);
4405
+ const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
4352
4406
  const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
4353
4407
  const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
4354
4408
  const sharedMenuProps = useMemo9(
@@ -4377,7 +4431,7 @@ function useInputVariablesState({
4377
4431
  return {
4378
4432
  sharedMenuProps,
4379
4433
  disableVariablesForReals,
4380
- hasVariablesInValue,
4434
+ hasVariablesInValue: variableReferenceCountInValue > 0,
4381
4435
  hadVariablesInValue: hadVariablesInValueForReals,
4382
4436
  setHadVariablesInValue
4383
4437
  };
@@ -4400,7 +4454,8 @@ var variableBindButton2 = css23`
4400
4454
  display: flex;
4401
4455
  height: 1.2rem;
4402
4456
  padding: var(--spacing-2xs);
4403
- transition: background var(--duration-fast) var(--timing-ease-out),
4457
+ transition:
4458
+ background var(--duration-fast) var(--timing-ease-out),
4404
4459
  color var(--duration-fast) var(--timing-ease-out);
4405
4460
  width: 1.2rem;
4406
4461
 
@@ -4424,7 +4479,7 @@ import { CLEAR_EDITOR_COMMAND } from "lexical";
4424
4479
  import { BsFillPlusCircleFill } from "@react-icons/all-files/bs/BsFillPlusCircleFill";
4425
4480
  import { CgUsbC } from "@react-icons/all-files/cg/CgUsbC";
4426
4481
  import { HorizontalRhythm as HorizontalRhythm3, Menu as Menu2, MenuGroup as MenuGroup2, MenuItem as MenuItem2, MenuItemSeparator as MenuItemSeparator2 } from "@uniformdev/design-system";
4427
- import { useRef as useRef11 } from "react";
4482
+ import { useRef as useRef10 } from "react";
4428
4483
  import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
4429
4484
  function SelectVariableMenu({
4430
4485
  onSelectVariable,
@@ -4439,7 +4494,7 @@ function SelectVariableMenu({
4439
4494
  filterVariable
4440
4495
  }) {
4441
4496
  const { variables, canDispatch, readOnly } = useVariables(true);
4442
- const btnRef = useRef11(null);
4497
+ const btnRef = useRef10(null);
4443
4498
  const { editVariable } = useVariableEditor();
4444
4499
  const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
4445
4500
  const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
@@ -4573,7 +4628,7 @@ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
4573
4628
  import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
4574
4629
  import { LexicalComposer } from "@lexical/react/LexicalComposer";
4575
4630
  import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
4576
- import { useMemo as useMemo10, useRef as useRef12, useState as useState12 } from "react";
4631
+ import { useMemo as useMemo10, useRef as useRef11, useState as useState12 } from "react";
4577
4632
 
4578
4633
  // src/components/Variables/composer/DisablePlugin.tsx
4579
4634
  import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
@@ -4588,50 +4643,18 @@ function DisablePlugin({ disabled }) {
4588
4643
 
4589
4644
  // src/components/Variables/composer/SingleLineTextPlugin.tsx
4590
4645
  import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
4591
- import { LineBreakNode } from "lexical";
4646
+ import { LineBreakNode as LineBreakNode2 } from "lexical";
4592
4647
  import { useEffect as useEffect13 } from "react";
4593
4648
  function SingleLineTextPlugin() {
4594
4649
  const [editor] = useLexicalComposerContext8();
4595
4650
  useEffect13(() => {
4596
- editor.registerNodeTransform(LineBreakNode, (node) => {
4651
+ editor.registerNodeTransform(LineBreakNode2, (node) => {
4597
4652
  node.remove();
4598
4653
  });
4599
4654
  }, [editor]);
4600
4655
  return null;
4601
4656
  }
4602
4657
 
4603
- // src/components/Variables/util/serializeVariablesEditorState.ts
4604
- import { createVariableReference as createVariableReference3 } from "@uniformdev/canvas";
4605
- import { LineBreakNode as LineBreakNode2, TextNode as TextNode3 } from "lexical";
4606
-
4607
- // src/components/Variables/util/variableExpression.ts
4608
- var variablePrefix = "${";
4609
- var variableSuffix = "}";
4610
-
4611
- // src/components/Variables/util/serializeVariablesEditorState.ts
4612
- function serializeVariablesEditorState(editorState) {
4613
- const buf = [];
4614
- serializeRecursive(editorState.toJSON().root, buf);
4615
- const result = buf.join("");
4616
- return result.length > 0 ? result : void 0;
4617
- }
4618
- function serializeRecursive(node, buffer) {
4619
- if (node.type === TextNode3.getType()) {
4620
- buffer.push(node.text.replace(variablePrefix, "\\${"));
4621
- }
4622
- if (node.type === VariableNode.getType()) {
4623
- buffer.push(createVariableReference3(node.reference));
4624
- }
4625
- if (node.type === LineBreakNode2.getType()) {
4626
- buffer.push("\n");
4627
- }
4628
- if ("children" in node && node.children) {
4629
- for (const child of node.children) {
4630
- serializeRecursive(child, buffer);
4631
- }
4632
- }
4633
- }
4634
-
4635
4658
  // src/components/Variables/toolbox/VariablesComposer.tsx
4636
4659
  import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
4637
4660
  function VariablesComposer(props) {
@@ -4658,8 +4681,8 @@ function VariablesComposer(props) {
4658
4681
  // eslint-disable-next-line react-hooks/exhaustive-deps
4659
4682
  []
4660
4683
  );
4661
- const editorState = useRef12();
4662
- const updateTimeout = useRef12();
4684
+ const editorState = useRef11();
4685
+ const updateTimeout = useRef11();
4663
4686
  if (typeof document === "undefined") return null;
4664
4687
  return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
4665
4688
  /* @__PURE__ */ jsx38(
@@ -4838,7 +4861,8 @@ function InputVariables(props) {
4838
4861
  filterVariable,
4839
4862
  styleVariant = "default",
4840
4863
  renderMenuInPortal,
4841
- disableDismissEditorOnChange
4864
+ disableDismissEditorOnChange,
4865
+ singleTokenMode
4842
4866
  } = props;
4843
4867
  const [finalId] = useState13(id != null ? id : () => v42());
4844
4868
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -4903,7 +4927,7 @@ function InputVariables(props) {
4903
4927
  buttonCss: variableBindButton,
4904
4928
  tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
4905
4929
  buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
4906
- replaceValueOnVariableInsert: useInputWithNoVariables
4930
+ replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
4907
4931
  }
4908
4932
  )
4909
4933
  ]
@@ -4943,13 +4967,13 @@ function InputVariables(props) {
4943
4967
  showAddVariableMenuOption,
4944
4968
  enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
4945
4969
  getEditorContext,
4946
- disabled,
4970
+ disabled: disabled || singleTokenMode,
4947
4971
  replaceValueOnVariableInsert: useInputWithNoVariables,
4948
4972
  autoFocus,
4949
4973
  filterVariable,
4950
4974
  children: [
4951
4975
  /* @__PURE__ */ jsx40(PasteTransformerPlugin, { transformPaste }),
4952
- /* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
4976
+ /* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
4953
4977
  editorRef ? /* @__PURE__ */ jsx40(EditorRefPlugin, { editorRef }) : null,
4954
4978
  body
4955
4979
  ]
@@ -5007,7 +5031,7 @@ function ParameterConnectionIndicator({
5007
5031
  return result;
5008
5032
  }, [value]);
5009
5033
  return /* @__PURE__ */ jsxs24(HorizontalRhythm5, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5010
- /* @__PURE__ */ jsx41("div", { css: { flex: 1, maxWidth: "100%" }, children }),
5034
+ /* @__PURE__ */ jsx41("div", { css: { flex: 1 }, children }),
5011
5035
  disabled ? null : /* @__PURE__ */ jsx41(
5012
5036
  Menu3,
5013
5037
  {
@@ -5046,13 +5070,13 @@ import { useCallback as useCallback4 } from "react";
5046
5070
  import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
5047
5071
  import { mergeRegister as mergeRegister5 } from "@lexical/utils";
5048
5072
  import { $getNodeByKey as $getNodeByKey3, COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH3 } from "lexical";
5049
- import { useEffect as useEffect15, useRef as useRef13 } from "react";
5073
+ import { useEffect as useEffect15, useRef as useRef12 } from "react";
5050
5074
  function OnDisconnectPlugin({
5051
5075
  onDisconnect
5052
5076
  }) {
5053
5077
  const [editor] = useLexicalComposerContext10();
5054
5078
  const { variables } = useVariables(true);
5055
- const variablesRef = useRef13(variables);
5079
+ const variablesRef = useRef12(variables);
5056
5080
  variablesRef.current = variables;
5057
5081
  useEffect15(() => {
5058
5082
  return mergeRegister5(
@@ -5245,6 +5269,12 @@ ${prettifyBindExpression(bindExpression)}`
5245
5269
  };
5246
5270
  }
5247
5271
 
5272
+ // src/components/Variables/util/hasReferencedVariables.ts
5273
+ import { hasReferencedVariables as canvasHasReferencedVariables } from "@uniformdev/canvas";
5274
+ function hasReferencedVariables2(value) {
5275
+ return canvasHasReferencedVariables(value) > 0;
5276
+ }
5277
+
5248
5278
  // src/components/Variables/VariablesList.tsx
5249
5279
  import { css as css27 } from "@emotion/react";
5250
5280
  import {
@@ -6216,11 +6246,11 @@ import { LoadingIndicator as LoadingIndicator3, Theme as Theme2 } from "@uniform
6216
6246
 
6217
6247
  // src/hooks/useInitializeUniformMeshSdk.ts
6218
6248
  import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
6219
- import { useEffect as useEffect16, useRef as useRef14, useState as useState15 } from "react";
6249
+ import { useEffect as useEffect16, useRef as useRef13, useState as useState15 } from "react";
6220
6250
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
6221
6251
  const [error, setError] = useState15();
6222
6252
  const [sdk, setSdk] = useState15();
6223
- const initializationInProgress = useRef14(false);
6253
+ const initializationInProgress = useRef13(false);
6224
6254
  useEffect16(
6225
6255
  () => {
6226
6256
  if (typeof window === "undefined" || sdk) {
@@ -6769,7 +6799,8 @@ var ButtonStyles = css35`
6769
6799
  font-size: var(--fs-sm);
6770
6800
  line-height: 1;
6771
6801
  gap: var(--spacing-xs);
6772
- transition: border-color var(--duration-fast) var(--timing-ease-out),
6802
+ transition:
6803
+ border-color var(--duration-fast) var(--timing-ease-out),
6773
6804
  background-color var(--duration-fast) var(--timing-ease-out);
6774
6805
 
6775
6806
  &:hover {
@@ -7229,7 +7260,7 @@ var QueryFilter = ({
7229
7260
  };
7230
7261
 
7231
7262
  // src/components/ParamTypeDynamicDataProvider.tsx
7232
- import { useEffect as useEffect18, useMemo as useMemo16, useRef as useRef15 } from "react";
7263
+ import { useEffect as useEffect18, useMemo as useMemo16, useRef as useRef14 } from "react";
7233
7264
  import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
7234
7265
  function ParamTypeDynamicDataProvider(props) {
7235
7266
  const { children } = props;
@@ -7251,7 +7282,7 @@ var JsonMeshVariableEditor = ({
7251
7282
  variable,
7252
7283
  context
7253
7284
  }) => {
7254
- const sillyRef = useRef15(false);
7285
+ const sillyRef = useRef14(false);
7255
7286
  const { editConnectedData } = useMeshLocation("paramType");
7256
7287
  useEffect18(() => {
7257
7288
  if (sillyRef.current) {
@@ -7285,371 +7316,445 @@ var JsonMeshVariableEditor = ({
7285
7316
  var NUMBER_OPERATORS = [
7286
7317
  {
7287
7318
  label: "equals...",
7288
- symbol: "=",
7289
7319
  value: "eq",
7290
- editorType: "number"
7320
+ editorType: "number",
7321
+ expectedValueType: "single"
7291
7322
  },
7292
7323
  {
7293
7324
  label: "does not equal...",
7294
- symbol: "\u2260",
7295
7325
  value: "neq",
7296
- editorType: "number"
7326
+ editorType: "number",
7327
+ expectedValueType: "single"
7297
7328
  },
7298
7329
  {
7299
7330
  label: "greater than...",
7300
- symbol: ">",
7301
7331
  value: "gt",
7302
- editorType: "number"
7332
+ editorType: "number",
7333
+ expectedValueType: "single"
7303
7334
  },
7304
7335
  {
7305
7336
  label: "greater than or equal to...",
7306
- symbol: "\u2265",
7307
7337
  value: "gte",
7308
- editorType: "number"
7338
+ editorType: "number",
7339
+ expectedValueType: "single"
7309
7340
  },
7310
7341
  {
7311
7342
  label: "less than...",
7312
- symbol: "<",
7313
7343
  value: "lt",
7314
- editorType: "number"
7344
+ editorType: "number",
7345
+ expectedValueType: "single"
7315
7346
  },
7316
7347
  {
7317
7348
  label: "less than or equal to...",
7318
- symbol: "\u2264",
7319
7349
  value: "lte",
7320
- editorType: "number"
7350
+ editorType: "number",
7351
+ expectedValueType: "single"
7321
7352
  },
7322
7353
  {
7323
7354
  label: "is empty",
7324
7355
  value: "ndef",
7325
- editorType: "empty"
7356
+ editorType: "empty",
7357
+ expectedValueType: "false"
7326
7358
  },
7327
7359
  {
7328
7360
  label: "is between...",
7329
7361
  value: "between",
7330
- editorType: "numberRange"
7362
+ editorType: "numberRange",
7363
+ expectedValueType: "between"
7331
7364
  },
7332
7365
  {
7333
7366
  label: "is not empty",
7334
7367
  value: "def",
7335
- editorType: "empty"
7368
+ editorType: "empty",
7369
+ expectedValueType: "true"
7336
7370
  }
7337
7371
  ];
7338
7372
  var DATE_OPERATORS = [
7339
7373
  {
7340
7374
  label: "is",
7341
7375
  value: "eq",
7342
- editorType: "date"
7376
+ editorType: "date",
7377
+ expectedValueType: "single"
7343
7378
  },
7344
7379
  {
7345
7380
  label: "is between...",
7346
7381
  value: "between",
7347
- editorType: "dateRange"
7382
+ editorType: "dateRange",
7383
+ expectedValueType: "between"
7348
7384
  },
7349
7385
  {
7350
7386
  label: "is before...",
7351
7387
  value: "lt",
7352
- editorType: "date"
7388
+ editorType: "date",
7389
+ expectedValueType: "single"
7353
7390
  },
7354
7391
  {
7355
7392
  label: "is after...",
7356
7393
  value: "gt",
7357
- editorType: "date"
7394
+ editorType: "date",
7395
+ expectedValueType: "single"
7358
7396
  },
7359
7397
  {
7360
7398
  label: "is on or before...",
7361
7399
  value: "lte",
7362
- editorType: "date"
7400
+ editorType: "date",
7401
+ expectedValueType: "single"
7363
7402
  },
7364
7403
  {
7365
7404
  label: "is on or after...",
7366
7405
  value: "gte",
7367
- editorType: "date"
7406
+ editorType: "date",
7407
+ expectedValueType: "single"
7368
7408
  },
7369
7409
  {
7370
7410
  label: "is empty",
7371
7411
  value: "ndef",
7372
- editorType: "empty"
7412
+ editorType: "empty",
7413
+ expectedValueType: "false"
7373
7414
  },
7374
7415
  {
7375
7416
  label: "is not",
7376
7417
  value: "neq",
7377
- editorType: "date"
7418
+ editorType: "date",
7419
+ expectedValueType: "single"
7378
7420
  },
7379
7421
  {
7380
7422
  label: "is not empty",
7381
7423
  value: "def",
7382
- editorType: "empty"
7424
+ editorType: "empty",
7425
+ expectedValueType: "true"
7383
7426
  }
7384
7427
  ];
7385
7428
  var TEXTBOX_OPERATORS = [
7386
7429
  {
7387
7430
  label: "contains...",
7388
7431
  value: "match",
7389
- editorType: "text"
7432
+ editorType: "text",
7433
+ expectedValueType: "single"
7390
7434
  },
7391
7435
  {
7392
7436
  label: "is",
7393
7437
  value: "eq",
7394
- editorType: "text"
7438
+ editorType: "text",
7439
+ expectedValueType: "single"
7395
7440
  },
7396
7441
  {
7397
7442
  label: "is empty",
7398
7443
  value: "ndef",
7399
- editorType: "empty"
7444
+ editorType: "empty",
7445
+ expectedValueType: "false"
7400
7446
  },
7401
7447
  {
7402
7448
  label: "starts with...",
7403
7449
  value: "starts",
7404
- editorType: "text"
7450
+ editorType: "text",
7451
+ expectedValueType: "single"
7405
7452
  },
7406
7453
  {
7407
7454
  label: "is not",
7408
7455
  value: "neq",
7409
- editorType: "text"
7456
+ editorType: "text",
7457
+ expectedValueType: "single"
7410
7458
  },
7411
7459
  {
7412
7460
  label: "is not empty",
7413
7461
  value: "def",
7414
- editorType: "empty"
7462
+ editorType: "empty",
7463
+ expectedValueType: "true"
7415
7464
  }
7416
7465
  ];
7417
7466
  var USER_OPERATORS = [
7418
7467
  {
7419
7468
  label: "contains...",
7420
7469
  value: "match",
7421
- editorType: "text"
7470
+ editorType: "text",
7471
+ expectedValueType: "single"
7422
7472
  },
7423
7473
  {
7424
7474
  label: "is",
7425
7475
  value: "eq",
7426
- editorType: "text"
7476
+ editorType: "text",
7477
+ expectedValueType: "single"
7427
7478
  },
7428
7479
  {
7429
7480
  label: "starts with...",
7430
7481
  value: "starts",
7431
- editorType: "text"
7482
+ editorType: "text",
7483
+ expectedValueType: "single"
7432
7484
  },
7433
7485
  {
7434
7486
  label: "is not",
7435
7487
  value: "neq",
7436
- editorType: "text"
7488
+ editorType: "text",
7489
+ expectedValueType: "single"
7437
7490
  }
7438
7491
  ];
7439
- var SYSTEM_DATE_OPERATORS = [
7492
+ var DATE_TIME_OPERATORS = [
7440
7493
  {
7441
7494
  label: "is",
7442
7495
  value: "sys-date-eq",
7443
- editorType: "date"
7496
+ editorType: "date",
7497
+ expectedValueType: "single"
7444
7498
  },
7445
7499
  {
7446
7500
  label: "is between...",
7447
7501
  value: "sys-date-between",
7448
- editorType: "dateRange"
7502
+ editorType: "dateRange",
7503
+ expectedValueType: "between"
7449
7504
  },
7450
7505
  {
7451
7506
  label: "is before...",
7452
7507
  value: "sys-date-lt",
7453
- editorType: "date"
7508
+ editorType: "date",
7509
+ expectedValueType: "single"
7454
7510
  },
7455
7511
  {
7456
7512
  label: "is after...",
7457
7513
  value: "sys-date-gt",
7458
- editorType: "date"
7514
+ editorType: "date",
7515
+ expectedValueType: "single"
7459
7516
  },
7460
7517
  {
7461
7518
  label: "is on or before...",
7462
7519
  value: "sys-date-lte",
7463
- editorType: "date"
7520
+ editorType: "date",
7521
+ expectedValueType: "single"
7464
7522
  },
7465
7523
  {
7466
7524
  label: "is on or after...",
7467
7525
  value: "sys-date-gte",
7468
- editorType: "date"
7526
+ editorType: "date",
7527
+ expectedValueType: "single"
7528
+ },
7529
+ {
7530
+ label: "is empty",
7531
+ value: "ndef",
7532
+ editorType: "empty",
7533
+ expectedValueType: "false"
7534
+ },
7535
+ {
7536
+ label: "is not empty",
7537
+ value: "def",
7538
+ editorType: "empty",
7539
+ expectedValueType: "true"
7469
7540
  }
7470
7541
  ];
7471
7542
  var RICHTEXT_OPERATORS = [
7472
7543
  {
7473
7544
  label: "contains...",
7474
7545
  value: "match",
7475
- editorType: "text"
7546
+ editorType: "text",
7547
+ expectedValueType: "single"
7476
7548
  },
7477
7549
  {
7478
7550
  label: "is empty",
7479
7551
  value: "ndef",
7480
- editorType: "empty"
7552
+ editorType: "empty",
7553
+ expectedValueType: "false"
7481
7554
  },
7482
7555
  {
7483
7556
  label: "starts with...",
7484
7557
  value: "starts",
7485
- editorType: "text"
7558
+ editorType: "text",
7559
+ expectedValueType: "single"
7486
7560
  },
7487
7561
  {
7488
7562
  label: "is not empty",
7489
7563
  value: "def",
7490
- editorType: "empty"
7564
+ editorType: "empty",
7565
+ expectedValueType: "true"
7491
7566
  }
7492
7567
  ];
7493
7568
  var CHECKBOX_OPERATORS = [
7494
7569
  {
7495
7570
  label: "is checked",
7496
7571
  value: "def",
7497
- editorType: "empty"
7572
+ editorType: "empty",
7573
+ expectedValueType: "true"
7498
7574
  },
7499
7575
  {
7500
7576
  label: "is not checked",
7501
7577
  value: "ndef",
7502
- editorType: "empty"
7578
+ editorType: "empty",
7579
+ expectedValueType: "false"
7503
7580
  }
7504
7581
  ];
7505
7582
  var SYSTEM_FIELD_OPERATORS = [
7506
7583
  {
7507
7584
  label: "is",
7508
7585
  value: "eq",
7509
- editorType: "singleChoice"
7586
+ editorType: "singleChoice",
7587
+ expectedValueType: "single"
7510
7588
  },
7511
7589
  {
7512
7590
  label: "is any of...",
7513
7591
  value: "in",
7514
- editorType: "multiChoice"
7592
+ editorType: "multiChoice",
7593
+ expectedValueType: "array"
7515
7594
  },
7516
7595
  {
7517
7596
  label: "is not",
7518
7597
  value: "neq",
7519
- editorType: "singleChoice"
7598
+ editorType: "singleChoice",
7599
+ expectedValueType: "single"
7520
7600
  },
7521
7601
  {
7522
7602
  label: "is none of...",
7523
7603
  value: "nin",
7524
- editorType: "multiChoice"
7604
+ editorType: "multiChoice",
7605
+ expectedValueType: "array"
7525
7606
  }
7526
7607
  ];
7527
7608
  var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
7528
7609
  {
7529
7610
  label: "is",
7530
7611
  value: "eq",
7531
- editorType: "singleChoice"
7612
+ editorType: "singleChoice",
7613
+ expectedValueType: "single"
7532
7614
  },
7533
7615
  {
7534
7616
  label: "is any of...",
7535
7617
  value: "in",
7536
- editorType: "multiChoice"
7618
+ editorType: "multiChoice",
7619
+ expectedValueType: "array"
7537
7620
  },
7538
7621
  {
7539
7622
  label: "is empty",
7540
7623
  value: "ndef",
7541
- editorType: "empty"
7624
+ editorType: "empty",
7625
+ expectedValueType: "false"
7542
7626
  },
7543
7627
  {
7544
7628
  label: "is not",
7545
7629
  value: "neq",
7546
- editorType: "singleChoice"
7630
+ editorType: "singleChoice",
7631
+ expectedValueType: "single"
7547
7632
  },
7548
7633
  {
7549
7634
  label: "is none of...",
7550
7635
  value: "nin",
7551
- editorType: "multiChoice"
7636
+ editorType: "multiChoice",
7637
+ expectedValueType: "array"
7552
7638
  },
7553
7639
  {
7554
7640
  label: "is not empty",
7555
7641
  value: "def",
7556
- editorType: "empty"
7642
+ editorType: "empty",
7643
+ expectedValueType: "true"
7557
7644
  }
7558
7645
  ];
7559
7646
  var PUBLISH_STATUS_FIELD_OPERATORS = [
7560
7647
  {
7561
7648
  label: "is",
7562
7649
  value: "eq",
7563
- editorType: "statusSingleChoice"
7650
+ editorType: "statusSingleChoice",
7651
+ expectedValueType: "single"
7564
7652
  },
7565
7653
  {
7566
7654
  label: "is any of...",
7567
7655
  value: "in",
7568
- editorType: "statusMultiChoice"
7656
+ editorType: "statusMultiChoice",
7657
+ expectedValueType: "array"
7569
7658
  },
7570
7659
  {
7571
7660
  label: "is not",
7572
7661
  value: "neq",
7573
- editorType: "statusSingleChoice"
7662
+ editorType: "statusSingleChoice",
7663
+ expectedValueType: "single"
7574
7664
  },
7575
7665
  {
7576
7666
  label: "is none of...",
7577
7667
  value: "nin",
7578
- editorType: "statusMultiChoice"
7668
+ editorType: "statusMultiChoice",
7669
+ expectedValueType: "array"
7579
7670
  }
7580
7671
  ];
7581
7672
  var SELECT_OPERATORS = [
7582
7673
  {
7583
7674
  label: "is",
7584
7675
  value: "eq",
7585
- editorType: "singleChoice"
7676
+ editorType: "singleChoice",
7677
+ expectedValueType: "single"
7586
7678
  },
7587
7679
  {
7588
7680
  label: "is any of...",
7589
7681
  value: "in",
7590
- editorType: "multiChoice"
7682
+ editorType: "multiChoice",
7683
+ expectedValueType: "array"
7591
7684
  },
7592
7685
  {
7593
7686
  label: "is empty",
7594
7687
  value: "ndef",
7595
- editorType: "empty"
7688
+ editorType: "empty",
7689
+ expectedValueType: "false"
7596
7690
  },
7597
7691
  {
7598
7692
  label: "contains...",
7599
7693
  value: "match",
7600
- editorType: "text"
7694
+ editorType: "text",
7695
+ expectedValueType: "single"
7601
7696
  },
7602
7697
  {
7603
7698
  label: "starts with...",
7604
7699
  value: "starts",
7605
- editorType: "text"
7700
+ editorType: "text",
7701
+ expectedValueType: "single"
7606
7702
  },
7607
7703
  {
7608
7704
  label: "is not",
7609
7705
  value: "neq",
7610
- editorType: "singleChoice"
7706
+ editorType: "singleChoice",
7707
+ expectedValueType: "single"
7611
7708
  },
7612
7709
  {
7613
7710
  label: "is none of...",
7614
7711
  value: "nin",
7615
- editorType: "multiChoice"
7712
+ editorType: "multiChoice",
7713
+ expectedValueType: "array"
7616
7714
  },
7617
7715
  {
7618
7716
  label: "is not empty",
7619
7717
  value: "def",
7620
- editorType: "empty"
7718
+ editorType: "empty",
7719
+ expectedValueType: "true"
7621
7720
  }
7622
7721
  ];
7623
7722
  var MULTI_SELECT_OPERATORS = [
7624
7723
  {
7625
7724
  label: "is",
7626
7725
  value: "eq",
7627
- editorType: "singleChoice"
7726
+ editorType: "singleChoice",
7727
+ expectedValueType: "single"
7628
7728
  },
7629
7729
  {
7630
7730
  label: "is any of...",
7631
7731
  value: "in",
7632
- editorType: "multiChoice"
7732
+ editorType: "multiChoice",
7733
+ expectedValueType: "array"
7633
7734
  },
7634
7735
  {
7635
7736
  label: "is empty",
7636
7737
  value: "ndef",
7637
- editorType: "empty"
7738
+ editorType: "empty",
7739
+ expectedValueType: "false"
7638
7740
  },
7639
7741
  {
7640
7742
  label: "is not",
7641
7743
  value: "neq",
7642
- editorType: "singleChoice"
7744
+ editorType: "singleChoice",
7745
+ expectedValueType: "single"
7643
7746
  },
7644
7747
  {
7645
7748
  label: "is none of...",
7646
7749
  value: "nin",
7647
- editorType: "multiChoice"
7750
+ editorType: "multiChoice",
7751
+ expectedValueType: "array"
7648
7752
  },
7649
7753
  {
7650
7754
  label: "is not empty",
7651
7755
  value: "def",
7652
- editorType: "empty"
7756
+ editorType: "empty",
7757
+ expectedValueType: "true"
7653
7758
  }
7654
7759
  ];
7655
7760
 
@@ -8299,7 +8404,7 @@ var ConditionalInputRow = css38`
8299
8404
  ${cq("764px")} {
8300
8405
  align-items: flex-start;
8301
8406
  display: grid;
8302
- grid-template-columns: 200px 160px 1fr 32px;
8407
+ grid-template-columns: 250px 160px 1fr 32px;
8303
8408
 
8304
8409
  & > div:nth-child(n) {
8305
8410
  width: auto;
@@ -8348,7 +8453,8 @@ var FilterButton = css38`
8348
8453
  gap: var(--spacing-sm);
8349
8454
  padding: var(--spacing-sm) var(--spacing-base);
8350
8455
  max-height: 40px;
8351
- transition: color var(--duration-fast) var(--timing-ease-out),
8456
+ transition:
8457
+ color var(--duration-fast) var(--timing-ease-out),
8352
8458
  background-color var(--duration-fast) var(--timing-ease-out),
8353
8459
  border-color var(--duration-fast) var(--timing-ease-out),
8354
8460
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -8443,6 +8549,9 @@ var ResetConditionsBtn = css38`
8443
8549
  &:focus {
8444
8550
  color: var(--action-destructive-hover);
8445
8551
  }
8552
+ &:disabled {
8553
+ color: var(--gray-400);
8554
+ }
8446
8555
  `;
8447
8556
  var IconBtn = css38`
8448
8557
  align-self: center;
@@ -8506,9 +8615,10 @@ var FilterButton2 = ({
8506
8615
 
8507
8616
  // src/components/SearchAndFilter/FilterControls.tsx
8508
8617
  import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
8618
+ import { hasReferencedVariables as hasReferencedVariables3 } from "@uniformdev/canvas";
8509
8619
  import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
8510
8620
  import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
8511
- import { useEffect as useEffect22, useRef as useRef16, useState as useState25 } from "react";
8621
+ import { useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
8512
8622
  import { useDebounce as useDebounce9 } from "react-use";
8513
8623
  import { v4 as v43 } from "uuid";
8514
8624
 
@@ -8547,7 +8657,7 @@ var filterMapper = {
8547
8657
  statusSingleChoice: StatusSingleEditor,
8548
8658
  empty: null
8549
8659
  };
8550
- function withInputVariables(WrappedComponent) {
8660
+ function withInputVariables(WrappedComponent, noSwapping = false) {
8551
8661
  const WithInputVariables = (props) => {
8552
8662
  if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8553
8663
  return /* @__PURE__ */ jsx82(WrappedComponent, { ...props });
@@ -8560,7 +8670,7 @@ function withInputVariables(WrappedComponent) {
8560
8670
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8561
8671
  value: props.value,
8562
8672
  disabled: props.disabled,
8563
- inputWhenNoVariables: /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8673
+ inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8564
8674
  }
8565
8675
  );
8566
8676
  };
@@ -8590,7 +8700,7 @@ var bindableFiltersMapper = {
8590
8700
  multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
8591
8701
  singleChoice: withInputVariables(FilterSingleChoiceEditor),
8592
8702
  date: withInputVariables(DateEditor),
8593
- text: withInputVariables(TextEditor),
8703
+ text: withInputVariables(TextEditor, true),
8594
8704
  number: withInputVariables(NumberEditor)
8595
8705
  };
8596
8706
 
@@ -8622,6 +8732,7 @@ var SearchAndFilterProvider = ({
8622
8732
  filters,
8623
8733
  filterOptions,
8624
8734
  filterVisible = false,
8735
+ alwaysVisible = false,
8625
8736
  defaultSearchTerm = "",
8626
8737
  onSearchChange,
8627
8738
  onChange,
@@ -8633,7 +8744,7 @@ var SearchAndFilterProvider = ({
8633
8744
  }) => {
8634
8745
  const [searchTerm, setSearchTerm] = useState24(defaultSearchTerm);
8635
8746
  const deferredSearchTerm = useDeferredValue2(searchTerm);
8636
- const [filterVisibility, setFilterVisibility] = useState24(filterVisible);
8747
+ const [filterVisibility, setFilterVisibility] = useState24(alwaysVisible || filterVisible);
8637
8748
  const handleSearchTerm = useCallback6(
8638
8749
  (term) => {
8639
8750
  setSearchTerm(term);
@@ -8642,8 +8753,13 @@ var SearchAndFilterProvider = ({
8642
8753
  [setSearchTerm, onSearchChange]
8643
8754
  );
8644
8755
  const handleToggleFilterVisibility = useCallback6(
8645
- (visible) => setFilterVisibility(visible),
8646
- [setFilterVisibility]
8756
+ (visible) => {
8757
+ if (alwaysVisible) {
8758
+ return;
8759
+ }
8760
+ setFilterVisibility(visible);
8761
+ },
8762
+ [alwaysVisible]
8647
8763
  );
8648
8764
  const handleAddFilter = useCallback6(() => {
8649
8765
  onChange([...filters, { field: "", operator: "", value: "" }]);
@@ -8669,7 +8785,7 @@ var SearchAndFilterProvider = ({
8669
8785
  if (filterVisibility) {
8670
8786
  const handleEscKeyFilterClose = (e) => {
8671
8787
  if (e.key === "Escape") {
8672
- setFilterVisibility(false);
8788
+ handleToggleFilterVisibility(false);
8673
8789
  }
8674
8790
  };
8675
8791
  document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
@@ -8677,7 +8793,7 @@ var SearchAndFilterProvider = ({
8677
8793
  document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8678
8794
  };
8679
8795
  }
8680
- }, [filterVisibility]);
8796
+ }, [filterVisibility, handleToggleFilterVisibility]);
8681
8797
  return /* @__PURE__ */ jsx83(
8682
8798
  SearchAndFilterContext.Provider,
8683
8799
  {
@@ -8720,8 +8836,8 @@ var FilterControls = ({
8720
8836
  searchTerm,
8721
8837
  allowBindingSearchTerm
8722
8838
  } = useSearchAndFilter();
8723
- const editorRef = useRef16(null);
8724
- const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8839
+ const editorRef = useRef15(null);
8840
+ const variableRefernceCountInSearchTerm = hasReferencedVariables3(searchTerm);
8725
8841
  const [idToResetInputVariables, setIdToResetInputVariables] = useState25("data-resource-search-term-input");
8726
8842
  const [localeSearchTerm, setLocaleSearchTerm] = useState25(searchTerm);
8727
8843
  useDebounce9(
@@ -8775,7 +8891,7 @@ var FilterControls = ({
8775
8891
  )
8776
8892
  }
8777
8893
  ),
8778
- hasVariableInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
8894
+ variableRefernceCountInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
8779
8895
  "button",
8780
8896
  {
8781
8897
  css: ClearSearchButtonStyles,
@@ -8801,86 +8917,24 @@ var FilterControls = ({
8801
8917
  import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
8802
8918
  import { useMemo as useMemo23 } from "react";
8803
8919
 
8804
- // src/components/SearchAndFilter/FilterMenu.tsx
8805
- import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
8806
- import React13, { useEffect as useEffect23 } from "react";
8807
- import { jsx as jsx85, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8808
- var SearchAndFilterOptionsContainer2 = ({
8809
- buttonRow,
8810
- additionalFiltersContainer,
8811
- children
8812
- }) => {
8813
- return /* @__PURE__ */ jsxs46("div", { css: SearchAndFilterOptionsContainer, children: [
8814
- /* @__PURE__ */ jsx85("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8815
- buttonRow ? /* @__PURE__ */ jsx85(
8816
- HorizontalRhythm8,
8817
- {
8818
- css: SearchAndFilterButtonGroup,
8819
- gap: "sm",
8820
- align: "center",
8821
- justify: "space-between",
8822
- children: buttonRow
8823
- }
8824
- ) : null,
8825
- additionalFiltersContainer ? /* @__PURE__ */ jsx85("div", { children: additionalFiltersContainer }) : null
8826
- ] });
8827
- };
8828
- var FilterMenu = ({
8829
- id,
8830
- filterTitle = "Show results",
8831
- menuControls,
8832
- additionalFiltersContainer,
8833
- children,
8834
- dataTestId,
8835
- resetButtonText = "reset"
8836
- }) => {
8837
- const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
8838
- const innerMenuRef = React13.useRef(null);
8839
- useEffect23(() => {
8840
- var _a;
8841
- if (filterVisibility) {
8842
- (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
8843
- }
8844
- }, [filterVisibility]);
8845
- return /* @__PURE__ */ jsx85(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs46(
8846
- SearchAndFilterOptionsContainer2,
8847
- {
8848
- buttonRow: menuControls,
8849
- additionalFiltersContainer,
8850
- children: [
8851
- /* @__PURE__ */ jsxs46(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
8852
- filterTitle ? /* @__PURE__ */ jsx85("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
8853
- (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx85(
8854
- "button",
8855
- {
8856
- type: "button",
8857
- css: ResetConditionsBtn,
8858
- onClick: () => {
8859
- handleResetFilters();
8860
- setFilterVisibility(false);
8861
- },
8862
- "data-testid": "reset-filters",
8863
- children: resetButtonText
8864
- }
8865
- ) : null
8866
- ] }),
8867
- children
8868
- ]
8869
- }
8870
- ) : null });
8871
- };
8920
+ // src/components/SearchAndFilter/util/isFilterBindable.ts
8921
+ function isFilterBindable(filter, operator) {
8922
+ var _a, _b;
8923
+ return (_b = (_a = operator == null ? void 0 : operator.bindable) != null ? _a : filter == null ? void 0 : filter.bindable) != null ? _b : false;
8924
+ }
8872
8925
 
8873
8926
  // src/components/SearchAndFilter/FilterItem.tsx
8874
- import { jsx as jsx86, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
8927
+ import { jsx as jsx85, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8875
8928
  var FilterItem = ({
8876
8929
  index,
8877
- paramOptions,
8878
8930
  operatorOptions,
8879
8931
  valueOptions,
8880
- onParamChange,
8932
+ onFilterOptionChange,
8933
+ onFilterDynamicChange,
8881
8934
  onOperatorChange,
8882
8935
  onValueChange,
8883
- initialCriteriaTitle = "Where"
8936
+ initialCriteriaTitle = "Where",
8937
+ criteriaGroupOperator = "and"
8884
8938
  }) => {
8885
8939
  var _a, _b;
8886
8940
  const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
@@ -8890,23 +8944,24 @@ var FilterItem = ({
8890
8944
  const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
8891
8945
  const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo23(() => {
8892
8946
  var _a2;
8893
- const currentSelectedFilter = filterOptions.find((item) => {
8947
+ const currentSelectedFilterGroup = filterOptions.find((item) => {
8894
8948
  var _a3;
8895
8949
  return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
8896
8950
  });
8897
- const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
8951
+ const selectedFilterOption = (_a2 = currentSelectedFilterGroup == null ? void 0 : currentSelectedFilterGroup.options) == null ? void 0 : _a2.find((item) => {
8898
8952
  return filters[index].field === item.value;
8899
8953
  });
8900
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
8954
+ const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
8901
8955
  const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
8902
8956
  return filters[index].operator === item.value;
8903
8957
  });
8958
+ const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
8904
8959
  return {
8905
- selectedFieldValue: selectedFieldValue2,
8960
+ selectedFieldValue: selectedFilterOption,
8906
8961
  selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
8907
8962
  selectedMetaValue: filters[index].value,
8908
8963
  readOnly: isCurrentFieldReadOnly,
8909
- bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
8964
+ bindable: bindable2
8910
8965
  };
8911
8966
  }, [filters, filterOptions, index, operatorOptions]);
8912
8967
  const readOnlyProps = readOnly ? {
@@ -8915,17 +8970,28 @@ var FilterItem = ({
8915
8970
  menuIsOpen: false,
8916
8971
  isClearable: false
8917
8972
  } : {};
8918
- return /* @__PURE__ */ jsxs47("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8919
- /* @__PURE__ */ jsx86("span", { children: index === 0 ? initialCriteriaTitle : "and" }),
8920
- /* @__PURE__ */ jsxs47("div", { css: ConditionalInputRow, children: [
8921
- /* @__PURE__ */ jsx86(
8973
+ const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
8974
+ return /* @__PURE__ */ jsxs46("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8975
+ /* @__PURE__ */ jsx85("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
8976
+ /* @__PURE__ */ jsxs46("div", { css: ConditionalInputRow, children: [
8977
+ CustomLeftHandComponent ? /* @__PURE__ */ jsx85(
8978
+ CustomLeftHandComponent,
8979
+ {
8980
+ filterOption: selectedFieldValue,
8981
+ filter: filters[index],
8982
+ setFilterDynamicValue: onFilterDynamicChange,
8983
+ deselectFilterOption: () => {
8984
+ onFilterOptionChange("");
8985
+ }
8986
+ }
8987
+ ) : /* @__PURE__ */ jsx85(
8922
8988
  InputComboBox5,
8923
8989
  {
8924
8990
  "aria-label": label,
8925
- options: paramOptions,
8991
+ options: filterOptions,
8926
8992
  onChange: (e) => {
8927
8993
  var _a2;
8928
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8994
+ onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8929
8995
  },
8930
8996
  isOptionDisabled: (option) => {
8931
8997
  var _a2;
@@ -8945,7 +9011,7 @@ var FilterItem = ({
8945
9011
  name: `filter-field-${index}`
8946
9012
  }
8947
9013
  ),
8948
- /* @__PURE__ */ jsx86(
9014
+ /* @__PURE__ */ jsx85(
8949
9015
  InputComboBox5,
8950
9016
  {
8951
9017
  "aria-label": operatorLabel,
@@ -8969,7 +9035,7 @@ var FilterItem = ({
8969
9035
  name: `filter-operator-${index}`
8970
9036
  }
8971
9037
  ),
8972
- /* @__PURE__ */ jsx86(
9038
+ /* @__PURE__ */ jsx85(
8973
9039
  FilterEditorRenderer,
8974
9040
  {
8975
9041
  "aria-label": metaDataLabel,
@@ -8983,7 +9049,7 @@ var FilterItem = ({
8983
9049
  valueTestId: "filter-value"
8984
9050
  }
8985
9051
  ),
8986
- readOnly ? null : /* @__PURE__ */ jsx86(
9052
+ readOnly ? null : /* @__PURE__ */ jsx85(
8987
9053
  "button",
8988
9054
  {
8989
9055
  type: "button",
@@ -8992,35 +9058,184 @@ var FilterItem = ({
8992
9058
  css: IconBtn,
8993
9059
  "data-testid": "delete-filter",
8994
9060
  disabled: filters.length === 1,
8995
- children: /* @__PURE__ */ jsx86(Icon8, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
9061
+ children: /* @__PURE__ */ jsx85(Icon8, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
8996
9062
  }
8997
9063
  )
8998
9064
  ] })
8999
9065
  ] });
9000
9066
  };
9001
- var singleValuedOperators = /* @__PURE__ */ new Set([
9002
- "eq",
9003
- "neq",
9004
- "lt",
9005
- "gt",
9006
- "is",
9007
- "!is",
9008
- "has",
9009
- "!has",
9010
- "startswith",
9011
- "!startswith",
9012
- "endswith",
9013
- "!endswith"
9014
- ]);
9015
- var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
9016
- var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
9017
- var noValueOperators = /* @__PURE__ */ new Set(["empty", "!empty"]);
9067
+
9068
+ // src/components/SearchAndFilter/FilterItems.tsx
9069
+ import { Icon as Icon9 } from "@uniformdev/design-system";
9070
+
9071
+ // src/components/SearchAndFilter/FilterMenu.tsx
9072
+ import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
9073
+ import React13, { useEffect as useEffect23 } from "react";
9074
+ import { jsx as jsx86, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
9075
+ var SearchAndFilterOptionsContainer2 = ({
9076
+ buttonRow,
9077
+ additionalFiltersContainer,
9078
+ children
9079
+ }) => {
9080
+ return /* @__PURE__ */ jsxs47("div", { css: SearchAndFilterOptionsContainer, children: [
9081
+ /* @__PURE__ */ jsx86("div", { css: SearchAndFilterOptionsInnerContainer, children }),
9082
+ buttonRow ? /* @__PURE__ */ jsx86(
9083
+ HorizontalRhythm8,
9084
+ {
9085
+ css: SearchAndFilterButtonGroup,
9086
+ gap: "sm",
9087
+ align: "center",
9088
+ justify: "space-between",
9089
+ children: buttonRow
9090
+ }
9091
+ ) : null,
9092
+ additionalFiltersContainer ? /* @__PURE__ */ jsx86("div", { children: additionalFiltersContainer }) : null
9093
+ ] });
9094
+ };
9095
+ var FilterMenu = ({
9096
+ id,
9097
+ filterTitle = "Show results",
9098
+ menuControls,
9099
+ additionalFiltersContainer,
9100
+ children,
9101
+ dataTestId,
9102
+ resetButtonText = "reset"
9103
+ }) => {
9104
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
9105
+ const innerMenuRef = React13.useRef(null);
9106
+ useEffect23(() => {
9107
+ var _a;
9108
+ if (filterVisibility) {
9109
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
9110
+ }
9111
+ }, [filterVisibility]);
9112
+ return /* @__PURE__ */ jsx86(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs47(
9113
+ SearchAndFilterOptionsContainer2,
9114
+ {
9115
+ buttonRow: menuControls,
9116
+ additionalFiltersContainer,
9117
+ children: [
9118
+ /* @__PURE__ */ jsxs47(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
9119
+ filterTitle ? /* @__PURE__ */ jsx86("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
9120
+ (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx86(
9121
+ "button",
9122
+ {
9123
+ type: "button",
9124
+ css: ResetConditionsBtn,
9125
+ disabled: filters.every((f) => !f.field),
9126
+ onClick: () => {
9127
+ handleResetFilters();
9128
+ setFilterVisibility(false);
9129
+ },
9130
+ "data-testid": "reset-filters",
9131
+ children: resetButtonText
9132
+ }
9133
+ ) : null
9134
+ ] }),
9135
+ children
9136
+ ]
9137
+ }
9138
+ ) : null });
9139
+ };
9140
+
9141
+ // src/components/SearchAndFilter/util/getNewFilterValueAfterOperatorChange.ts
9142
+ import { hasReferencedVariables as hasReferencedVariables4 } from "@uniformdev/canvas";
9143
+ function getNewFilterValueAfterOperatorChange({
9144
+ newOperatorId,
9145
+ currentFilter,
9146
+ filterOptions
9147
+ }) {
9148
+ var _a, _b, _c;
9149
+ if (Array.isArray(newOperatorId)) {
9150
+ throw new Error("Operator value must be a single string");
9151
+ }
9152
+ const result = {
9153
+ ...currentFilter,
9154
+ operator: newOperatorId,
9155
+ value: ""
9156
+ };
9157
+ const currentOperatorId = currentFilter.operator;
9158
+ let currentValue = currentFilter.value;
9159
+ const currentFieldDefinition = filterOptions.flatMap((group) => {
9160
+ var _a2;
9161
+ return (_a2 = group.options) != null ? _a2 : [];
9162
+ }).find((filter) => filter.value === currentFilter.field);
9163
+ const currentOperator = (_a = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _a.find(
9164
+ (op) => op.value === currentOperatorId
9165
+ );
9166
+ const newOperator = (_b = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _b.find((op) => op.value === newOperatorId);
9167
+ if (!currentOperator || !newOperator) {
9168
+ result.value = "";
9169
+ return result;
9170
+ } else {
9171
+ const currentOperatorValueType = currentOperator.expectedValueType;
9172
+ const newOperatorValueType = newOperator.expectedValueType;
9173
+ if (!isFilterBindable(currentFieldDefinition, newOperator) && hasBindings(currentValue)) {
9174
+ currentValue = "";
9175
+ }
9176
+ if (isHardcodedOperatorValue(currentOperatorValueType)) {
9177
+ result.value = isHardcodedOperatorValue(newOperatorValueType) ? newOperatorValueType : "";
9178
+ return result;
9179
+ }
9180
+ switch (newOperatorValueType) {
9181
+ case "single":
9182
+ if (Array.isArray(currentValue)) {
9183
+ if (currentOperatorValueType === "between") {
9184
+ result.value = "";
9185
+ } else {
9186
+ result.value = (_c = currentValue[0]) != null ? _c : "";
9187
+ }
9188
+ } else {
9189
+ result.value = currentValue;
9190
+ }
9191
+ return result;
9192
+ case "array":
9193
+ if (currentOperatorValueType === "between") {
9194
+ result.value = "";
9195
+ } else if (Array.isArray(currentValue)) {
9196
+ result.value = currentValue;
9197
+ } else {
9198
+ result.value = currentValue ? [currentValue] : [];
9199
+ }
9200
+ return result;
9201
+ case "between":
9202
+ if (Array.isArray(currentValue)) {
9203
+ result.value = "";
9204
+ } else {
9205
+ result.value = [currentValue, ""];
9206
+ }
9207
+ return result;
9208
+ case "none":
9209
+ result.value = "";
9210
+ return result;
9211
+ default:
9212
+ result.value = newOperatorValueType;
9213
+ return result;
9214
+ }
9215
+ }
9216
+ }
9217
+ function isHardcodedOperatorValue(valueType) {
9218
+ return valueType !== void 0 && valueType !== "array" && valueType !== "between" && valueType !== "none" && valueType !== "single";
9219
+ }
9220
+ function hasBindings(currentValue) {
9221
+ if (currentValue === void 0) {
9222
+ return false;
9223
+ }
9224
+ if (Array.isArray(currentValue)) {
9225
+ return currentValue.some((value) => hasReferencedVariables4(value));
9226
+ }
9227
+ return hasReferencedVariables4(currentValue) > 0;
9228
+ }
9229
+
9230
+ // src/components/SearchAndFilter/FilterItems.tsx
9231
+ import { jsx as jsx87, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
9018
9232
  var FilterItems = ({
9019
9233
  addButtonText = "add condition",
9020
9234
  additionalFiltersContainer,
9021
9235
  filterTitle,
9022
9236
  resetButtonText,
9023
- initialCriteriaTitle
9237
+ initialCriteriaTitle,
9238
+ criteriaGroupOperator
9024
9239
  }) => {
9025
9240
  const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
9026
9241
  const handleUpdateFilter = (index, prop, value) => {
@@ -9028,32 +9243,16 @@ var FilterItems = ({
9028
9243
  const next = [...filters];
9029
9244
  next[index] = { ...next[index], [prop]: value };
9030
9245
  if (prop === "operator") {
9031
- const newOperator = value;
9032
- const currentValue = next[index].value;
9033
- if (Array.isArray(newOperator)) {
9034
- throw new Error("Operator value must be a single string");
9035
- }
9036
- if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
9037
- next[index].value = next[index].value[0];
9038
- }
9039
- if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
9040
- next[index].value = currentValue ? [currentValue] : [];
9041
- }
9042
- if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
9043
- next[index].value = "";
9044
- }
9045
- if (noValueOperators.has(newOperator)) {
9046
- next[index].value = "";
9047
- }
9048
- if (newOperator === "between" && Array.isArray(currentValue) === false) {
9049
- next[index].value = [currentValue, ""];
9050
- }
9051
- if (value === "def" || value === "true") {
9052
- next[index].value = "true";
9053
- }
9054
- if (value === "ndef" || value === "false") {
9055
- next[index].value = "false";
9246
+ const newOperatorId = value;
9247
+ const currentFilter = next[index];
9248
+ if (!newOperatorId) {
9249
+ throw new Error("you bad");
9056
9250
  }
9251
+ next[index] = getNewFilterValueAfterOperatorChange({
9252
+ newOperatorId,
9253
+ currentFilter,
9254
+ filterOptions
9255
+ });
9057
9256
  }
9058
9257
  if (prop === "field") {
9059
9258
  const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
@@ -9062,15 +9261,16 @@ var FilterItems = ({
9062
9261
  })) == 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";
9063
9262
  next[index].operator = firstOperatorInAvailableOperators;
9064
9263
  next[index].value = "";
9264
+ next[index].dynamicField = void 0;
9065
9265
  }
9066
9266
  setFilters(next);
9067
9267
  };
9068
- return /* @__PURE__ */ jsx86(
9268
+ return /* @__PURE__ */ jsx87(
9069
9269
  FilterMenu,
9070
9270
  {
9071
9271
  id: "search-and-filter-options",
9072
9272
  dataTestId: "search-and-filter-options",
9073
- menuControls: /* @__PURE__ */ jsxs47(
9273
+ menuControls: /* @__PURE__ */ jsxs48(
9074
9274
  "button",
9075
9275
  {
9076
9276
  type: "button",
@@ -9078,7 +9278,7 @@ var FilterItems = ({
9078
9278
  onClick: handleAddFilter,
9079
9279
  "data-testid": "add-filter",
9080
9280
  children: [
9081
- /* @__PURE__ */ jsx86(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9281
+ /* @__PURE__ */ jsx87(Icon9, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9082
9282
  addButtonText
9083
9283
  ]
9084
9284
  }
@@ -9094,17 +9294,18 @@ var FilterItems = ({
9094
9294
  })) == null ? void 0 : _a.options) != null ? _b : [];
9095
9295
  const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
9096
9296
  const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
9097
- return /* @__PURE__ */ jsx86(
9297
+ return /* @__PURE__ */ jsx87(
9098
9298
  FilterItem,
9099
9299
  {
9100
9300
  index: i,
9101
- paramOptions: filterOptions,
9102
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
9301
+ onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
9103
9302
  operatorOptions: possibleOperators,
9104
9303
  onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
9105
9304
  onValueChange: (e) => handleUpdateFilter(i, "value", e),
9305
+ onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
9106
9306
  valueOptions: possibleValueOptions,
9107
- initialCriteriaTitle
9307
+ initialCriteriaTitle,
9308
+ criteriaGroupOperator
9108
9309
  },
9109
9310
  i
9110
9311
  );
@@ -9118,7 +9319,7 @@ import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
9118
9319
 
9119
9320
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9120
9321
  import { Button as Button6, Callout as Callout6, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
9121
- import { Fragment as Fragment17, jsx as jsx87, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
9322
+ import { Fragment as Fragment17, jsx as jsx88, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9122
9323
  var SearchAndFilterResultContainer = ({
9123
9324
  buttonText,
9124
9325
  clearButtonLabel = "clear",
@@ -9148,18 +9349,18 @@ var SearchAndFilterResultContainer = ({
9148
9349
  handleResetFilters();
9149
9350
  }
9150
9351
  };
9151
- return /* @__PURE__ */ jsxs48(Fragment17, { children: [
9152
- /* @__PURE__ */ jsxs48(HorizontalRhythm9, { children: [
9153
- /* @__PURE__ */ jsxs48("span", { children: [
9352
+ return /* @__PURE__ */ jsxs49(Fragment17, { children: [
9353
+ /* @__PURE__ */ jsxs49(HorizontalRhythm9, { children: [
9354
+ /* @__PURE__ */ jsxs49("span", { children: [
9154
9355
  totalResults,
9155
9356
  " results ",
9156
9357
  searchTerm ? `for "${searchTerm}"` : null
9157
9358
  ] }),
9158
- !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx87(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9359
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx88(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9159
9360
  ] }),
9160
- totalResults === 0 ? /* @__PURE__ */ jsxs48(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9161
- calloutText ? /* @__PURE__ */ jsx87(Paragraph, { children: calloutText }) : null,
9162
- hideClearButton ? null : /* @__PURE__ */ jsx87(
9361
+ totalResults === 0 ? /* @__PURE__ */ jsxs49(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9362
+ calloutText ? /* @__PURE__ */ jsx88(Paragraph, { children: calloutText }) : null,
9363
+ hideClearButton ? null : /* @__PURE__ */ jsx88(
9163
9364
  Button6,
9164
9365
  {
9165
9366
  buttonType: "tertiaryOutline",
@@ -9174,14 +9375,14 @@ var SearchAndFilterResultContainer = ({
9174
9375
  };
9175
9376
 
9176
9377
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9177
- import { jsx as jsx88, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9378
+ import { jsx as jsx89, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
9178
9379
  var SearchAndFilter = ({
9179
9380
  filters,
9180
9381
  filterOptions,
9181
9382
  filterVisible,
9182
9383
  filterControls,
9183
9384
  viewSwitchControls,
9184
- resultsContainerView = /* @__PURE__ */ jsx88(SearchAndFilterResultContainer, {}),
9385
+ resultsContainerView = /* @__PURE__ */ jsx89(SearchAndFilterResultContainer, {}),
9185
9386
  filterMapper: filterMapper2 = filterMapper,
9186
9387
  additionalFiltersContainer,
9187
9388
  onChange,
@@ -9191,7 +9392,7 @@ var SearchAndFilter = ({
9191
9392
  allowBindingSearchTerm = false,
9192
9393
  resetFilterValues = []
9193
9394
  }) => {
9194
- return /* @__PURE__ */ jsx88(
9395
+ return /* @__PURE__ */ jsx89(
9195
9396
  SearchAndFilterProvider,
9196
9397
  {
9197
9398
  filters,
@@ -9204,18 +9405,18 @@ var SearchAndFilter = ({
9204
9405
  resetFilterValues,
9205
9406
  filterMapper: filterMapper2,
9206
9407
  allowBindingSearchTerm,
9207
- children: /* @__PURE__ */ jsxs49(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
9208
- /* @__PURE__ */ jsxs49("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9209
- /* @__PURE__ */ jsx88(
9408
+ children: /* @__PURE__ */ jsxs50(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
9409
+ /* @__PURE__ */ jsxs50("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9410
+ /* @__PURE__ */ jsx89(
9210
9411
  "div",
9211
9412
  {
9212
9413
  css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9213
- children: !filterControls ? /* @__PURE__ */ jsx88(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9414
+ children: !filterControls ? /* @__PURE__ */ jsx89(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9214
9415
  }
9215
9416
  ),
9216
9417
  viewSwitchControls
9217
9418
  ] }),
9218
- /* @__PURE__ */ jsx88(FilterItems, { additionalFiltersContainer }),
9419
+ /* @__PURE__ */ jsx89(FilterItems, { additionalFiltersContainer }),
9219
9420
  resultsContainerView
9220
9421
  ] })
9221
9422
  }
@@ -9226,7 +9427,7 @@ var SearchAndFilter = ({
9226
9427
  import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
9227
9428
  import { createContext as createContext7, useState as useState26 } from "react";
9228
9429
  import { useDebounce as useDebounce10 } from "react-use";
9229
- import { jsx as jsx89 } from "@emotion/react/jsx-runtime";
9430
+ import { jsx as jsx90 } from "@emotion/react/jsx-runtime";
9230
9431
  var SearchOnlyContext = createContext7({
9231
9432
  searchTerm: "",
9232
9433
  setSearchTerm: () => {
@@ -9243,14 +9444,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9243
9444
  300,
9244
9445
  [localeSearchTerm]
9245
9446
  );
9246
- return /* @__PURE__ */ jsx89(
9447
+ return /* @__PURE__ */ jsx90(
9247
9448
  SearchOnlyContext.Provider,
9248
9449
  {
9249
9450
  value: {
9250
9451
  searchTerm,
9251
9452
  setSearchTerm: setLocaleSearchTerm
9252
9453
  },
9253
- children: /* @__PURE__ */ jsx89("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx89(
9454
+ children: /* @__PURE__ */ jsx90("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx90(
9254
9455
  InputKeywordSearch3,
9255
9456
  {
9256
9457
  placeholder: "Search...",
@@ -9345,7 +9546,8 @@ var FilterButton3 = css39`
9345
9546
  gap: var(--spacing-sm);
9346
9547
  padding: var(--spacing-sm) var(--spacing-base);
9347
9548
  max-height: 40px;
9348
- transition: color var(--duration-fast) var(--timing-ease-out),
9549
+ transition:
9550
+ color var(--duration-fast) var(--timing-ease-out),
9349
9551
  background-color var(--duration-fast) var(--timing-ease-out),
9350
9552
  border-color var(--duration-fast) var(--timing-ease-out),
9351
9553
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -9501,7 +9703,7 @@ var InputVariableWrapper = css39`
9501
9703
  `;
9502
9704
 
9503
9705
  // src/components/SearchAndFilter/SortItems.tsx
9504
- import { jsx as jsx90, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
9706
+ import { jsx as jsx91, jsxs as jsxs51 } from "@emotion/react/jsx-runtime";
9505
9707
  var SortItems = ({
9506
9708
  sortByLabel = "Sort by",
9507
9709
  localeLabel = "Show locale",
@@ -9523,11 +9725,11 @@ var SortItems = ({
9523
9725
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9524
9726
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9525
9727
  const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9526
- return /* @__PURE__ */ jsxs50("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9527
- /* @__PURE__ */ jsxs50(VerticalRhythm8, { gap: "xs", children: [
9528
- /* @__PURE__ */ jsx90("span", { css: Title2, children: sortByLabel }),
9529
- /* @__PURE__ */ jsxs50("div", { css: SortFilterInputRow, children: [
9530
- /* @__PURE__ */ jsx90(
9728
+ return /* @__PURE__ */ jsxs51("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9729
+ /* @__PURE__ */ jsxs51(VerticalRhythm8, { gap: "xs", children: [
9730
+ /* @__PURE__ */ jsx91("span", { css: Title2, children: sortByLabel }),
9731
+ /* @__PURE__ */ jsxs51("div", { css: SortFilterInputRow, children: [
9732
+ /* @__PURE__ */ jsx91(
9531
9733
  InputVariables,
9532
9734
  {
9533
9735
  disableInlineMenu: disableSortBinding,
@@ -9535,7 +9737,7 @@ var SortItems = ({
9535
9737
  value: sortField,
9536
9738
  valueToResetTo: "created_at",
9537
9739
  onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9538
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9740
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9539
9741
  InputComboBox6,
9540
9742
  {
9541
9743
  id: "sort-by-field",
@@ -9558,7 +9760,7 @@ var SortItems = ({
9558
9760
  )
9559
9761
  }
9560
9762
  ),
9561
- /* @__PURE__ */ jsx90(
9763
+ /* @__PURE__ */ jsx91(
9562
9764
  InputVariables,
9563
9765
  {
9564
9766
  disableInlineMenu: disableSortBinding,
@@ -9566,7 +9768,7 @@ var SortItems = ({
9566
9768
  valueToResetTo: "DESC",
9567
9769
  showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9568
9770
  onChange: (e) => onSortChange(`${sortField}_${e}`),
9569
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9771
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9570
9772
  SegmentedControl,
9571
9773
  {
9572
9774
  noCheckmark: true,
@@ -9598,14 +9800,14 @@ var SortItems = ({
9598
9800
  )
9599
9801
  ] })
9600
9802
  ] }),
9601
- hideLocaleOptions ? null : /* @__PURE__ */ jsx90(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx90(
9803
+ hideLocaleOptions ? null : /* @__PURE__ */ jsx91(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx91(
9602
9804
  InputVariables,
9603
9805
  {
9604
9806
  label: localeLabelValue,
9605
9807
  value: localeValue,
9606
9808
  showMenuPosition: "inline-right",
9607
9809
  onChange: (e) => onLocaleChange(e != null ? e : ""),
9608
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9810
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9609
9811
  InputSelect8,
9610
9812
  {
9611
9813
  name: "localeReturned",
@@ -9636,14 +9838,14 @@ function createLocationValidator(setValue, validate) {
9636
9838
 
9637
9839
  // src/utils/useContentDataResourceLocaleInfo.ts
9638
9840
  import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
9639
- import { useEffect as useEffect24, useRef as useRef17 } from "react";
9841
+ import { useEffect as useEffect24, useRef as useRef16 } from "react";
9640
9842
  function useContentDataResourceLocaleInfo({
9641
9843
  locale,
9642
9844
  setLocale,
9643
9845
  dynamicInputs
9644
9846
  }) {
9645
9847
  var _a;
9646
- const setLocaleRef = useRef17(setLocale);
9848
+ const setLocaleRef = useRef16(setLocale);
9647
9849
  setLocaleRef.current = setLocale;
9648
9850
  const { flatVariables } = useVariables();
9649
9851
  const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
@@ -9704,6 +9906,7 @@ export {
9704
9906
  Callout7 as Callout,
9705
9907
  ControlledValuePlugin,
9706
9908
  DATE_OPERATORS,
9909
+ DATE_TIME_OPERATORS,
9707
9910
  DISCONNECT_VARIABLE_COMMAND,
9708
9911
  DamSelectedItem,
9709
9912
  DataRefreshButton,
@@ -9797,7 +10000,6 @@ export {
9797
10000
  RequestUrlInput,
9798
10001
  ResolvableLoadingValue,
9799
10002
  SELECT_OPERATORS,
9800
- SYSTEM_DATE_OPERATORS,
9801
10003
  SYSTEM_FIELD_OPERATORS,
9802
10004
  ScrollableList2 as ScrollableList,
9803
10005
  ScrollableListItem,
@@ -9859,7 +10061,7 @@ export {
9859
10061
  entrySearchSelectOption,
9860
10062
  entrySearchWrapper,
9861
10063
  filterMapper,
9862
- hasReferencedVariables,
10064
+ hasReferencedVariables2 as hasReferencedVariables,
9863
10065
  prettifyBindExpression,
9864
10066
  productSearchRowActiveIcon,
9865
10067
  productSearchRowCategory,
@@ -9894,6 +10096,7 @@ export {
9894
10096
  selectedItemIcon,
9895
10097
  selectedItemInner,
9896
10098
  selectedItemTitle,
10099
+ serializeVariablesEditorSerializedState,
9897
10100
  serializeVariablesEditorState,
9898
10101
  setVariablesEditorValue,
9899
10102
  urlEncodeRequestParameter,