@uniformdev/mesh-sdk-react 19.179.1-alpha.1 → 19.179.2-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -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,18 +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";
2798
+
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
+ }
2797
2836
 
2798
2837
  // src/components/Variables/util/deserializeVariablesEditorState.ts
2799
2838
  import { parseVariableExpression } from "@uniformdev/canvas";
2800
- import { TextNode } from "lexical";
2839
+ import { TextNode as TextNode2 } from "lexical";
2801
2840
  function deserializeVariablesEditorState(serialized) {
2802
2841
  const result = [];
2803
2842
  parseVariableExpression(serialized != null ? serialized : "", (token, type) => {
2804
2843
  if (type === "text") {
2805
2844
  const node = {
2806
- type: TextNode.getType(),
2845
+ type: TextNode2.getType(),
2807
2846
  text: token,
2808
2847
  mode: "normal",
2809
2848
  version: 1,
@@ -2887,7 +2926,8 @@ function setVariablesEditorValue(editor, newValue) {
2887
2926
  indent: 0,
2888
2927
  direction: null,
2889
2928
  children: [],
2890
- textFormat: 0
2929
+ textFormat: 0,
2930
+ textStyle: ""
2891
2931
  }
2892
2932
  ]
2893
2933
  }
@@ -2905,17 +2945,18 @@ function ControlledValuePlugin({
2905
2945
  extraDependencies
2906
2946
  }) {
2907
2947
  const [editor] = useLexicalComposerContext();
2908
- const lastValueRef = useRef8(value);
2909
2948
  useEffect5(() => {
2949
+ var _a, _b;
2910
2950
  if (!enabled) {
2911
2951
  return;
2912
2952
  }
2913
- 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) {
2914
2956
  return;
2915
2957
  }
2916
2958
  setTimeout(() => {
2917
2959
  if (editor) {
2918
- lastValueRef.current = value;
2919
2960
  setVariablesEditorValue(editor, value);
2920
2961
  }
2921
2962
  });
@@ -3004,7 +3045,7 @@ import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexica
3004
3045
  import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
3005
3046
  import { $moveCharacter, $shouldOverrideDefaultCharacterSelection } from "@lexical/selection";
3006
3047
  import { mergeRegister as mergeRegister2 } from "@lexical/utils";
3007
- import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
3048
+ import { createVariableReference as createVariableReference3 } from "@uniformdev/canvas";
3008
3049
  import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
3009
3050
  import {
3010
3051
  $getNearestNodeFromDOMNode,
@@ -3038,12 +3079,14 @@ import {
3038
3079
  } from "@lexical/react/LexicalTypeaheadMenuPlugin";
3039
3080
  import { mergeRegister } from "@lexical/utils";
3040
3081
  import { AiFillPlusCircle } from "@react-icons/all-files/ai/AiFillPlusCircle";
3041
- import { createVariableReference } from "@uniformdev/canvas";
3082
+ import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
3042
3083
  import { HorizontalRhythm as HorizontalRhythm2, MenuGroup, MenuItemInner, MenuItemSeparator } from "@uniformdev/design-system";
3043
- import { dequal as dequal2 } from "dequal/lite";
3084
+ import { dequal } from "dequal/lite";
3044
3085
  import {
3086
+ $createParagraphNode,
3045
3087
  $createTextNode,
3046
3088
  $getNodeByKey,
3089
+ $getRoot,
3047
3090
  $getSelection,
3048
3091
  $insertNodes,
3049
3092
  $isNodeSelection,
@@ -3052,7 +3095,7 @@ import {
3052
3095
  COMMAND_PRIORITY_NORMAL,
3053
3096
  createCommand
3054
3097
  } from "lexical";
3055
- 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";
3056
3099
  import { createPortal } from "react-dom";
3057
3100
 
3058
3101
  // src/components/Variables/toolbox/SelectVariableMenu.styles.ts
@@ -3138,7 +3181,7 @@ function useVariableEditTransaction({
3138
3181
  // src/components/Variables/VariableEditor.tsx
3139
3182
  import { zodResolver } from "@hookform/resolvers/zod";
3140
3183
  import { Button as Button2, Callout as Callout3, HorizontalRhythm, Input as Input2, useShortcut } from "@uniformdev/design-system";
3141
- import { useLayoutEffect, useRef as useRef9 } from "react";
3184
+ import { useLayoutEffect, useRef as useRef8 } from "react";
3142
3185
  import { useForm } from "react-hook-form";
3143
3186
  import { z } from "zod";
3144
3187
 
@@ -3197,7 +3240,7 @@ function VariableEditor({
3197
3240
  },
3198
3241
  activeWhenEditing: true
3199
3242
  });
3200
- const nameRef = useRef9(null);
3243
+ const nameRef = useRef8(null);
3201
3244
  const { ref, ...nameRegister } = register("name");
3202
3245
  useLayoutEffect(() => {
3203
3246
  if (nameRef.current && !nameRef.current.value) {
@@ -3581,7 +3624,7 @@ function useVariablesMenu({
3581
3624
  var _a;
3582
3625
  const targetVariable = variables[value];
3583
3626
  if (overwriteExistingValue) {
3584
- setVariablesEditorValue(editor, createVariableReference(value));
3627
+ setVariablesEditorValue(editor, createVariableReference2(value));
3585
3628
  return true;
3586
3629
  }
3587
3630
  const variableNode = $createVariableNode(value, {
@@ -3614,7 +3657,7 @@ function VariablesPlugin({
3614
3657
  }) {
3615
3658
  const [editor] = useLexicalComposerContext2();
3616
3659
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
3617
- const variablesRef = useRef10({ variables, knownUndefinedValues, isLoading });
3660
+ const variablesRef = useRef9({ variables, knownUndefinedValues, isLoading });
3618
3661
  variablesRef.current = { variables, knownUndefinedValues, isLoading };
3619
3662
  const canEditVariable = useCallback2(
3620
3663
  (name, variable) => (
@@ -3759,18 +3802,24 @@ function VariablesPlugin({
3759
3802
  var _a, _b;
3760
3803
  if (!disableVariables) {
3761
3804
  const targetVariable = variablesRef.current.variables[reference];
3762
- if (overwriteExistingValue) {
3763
- setVariablesEditorValue(editor, createVariableReference(reference));
3764
- return true;
3765
- }
3766
3805
  const variableNode = $createVariableNode(reference, {
3767
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
3806
+ displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
3768
3807
  hasClickEvent: canEditVariable(reference, targetVariable),
3769
3808
  referenceIsValid: true,
3770
3809
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
3771
3810
  isFresh: true,
3772
3811
  isLoading: false
3773
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
+ }
3774
3823
  if (targetKey) {
3775
3824
  (_b = $getNodeByKey(targetKey)) == null ? void 0 : _b.replace(variableNode);
3776
3825
  } else {
@@ -3806,14 +3855,14 @@ function VariablesPlugin({
3806
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;
3807
3856
  const newState = {
3808
3857
  ...currentState,
3809
- 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),
3810
3859
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
3811
3860
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
3812
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),
3813
3862
  tooltip,
3814
3863
  isFresh: false
3815
3864
  };
3816
- if (!dequal2(currentState, newState)) {
3865
+ if (!dequal(currentState, newState)) {
3817
3866
  variableNode.setState(newState);
3818
3867
  }
3819
3868
  },
@@ -3960,7 +4009,7 @@ var VariableNode = class _VariableNode extends DecoratorNode {
3960
4009
  * (albeit it won't get the fancy chip-node)
3961
4010
  */
3962
4011
  getTextContent() {
3963
- return createVariableReference2(this.reference);
4012
+ return createVariableReference3(this.reference);
3964
4013
  }
3965
4014
  /** Creates the DOM wrapper that hosts the node */
3966
4015
  createDOM() {
@@ -4171,9 +4220,11 @@ var input = css21`
4171
4220
  min-height: 50px;
4172
4221
  width: 100%;
4173
4222
  position: relative;
4174
- transition: background var(--duration-fast) var(--timing-ease-out),
4223
+ transition:
4224
+ background var(--duration-fast) var(--timing-ease-out),
4175
4225
  border-color var(--duration-fast) var(--timing-ease-out),
4176
- 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);
4177
4228
 
4178
4229
  &::placeholder {
4179
4230
  color: var(--gray-400);
@@ -4237,7 +4288,8 @@ var variableBindButton = css22`
4237
4288
  display: flex;
4238
4289
  height: 1.2rem;
4239
4290
  padding: var(--spacing-2xs);
4240
- transition: background var(--duration-fast) var(--timing-ease-out),
4291
+ transition:
4292
+ background var(--duration-fast) var(--timing-ease-out),
4241
4293
  color var(--duration-fast) var(--timing-ease-out);
4242
4294
  width: 1.2rem;
4243
4295
 
@@ -4320,23 +4372,9 @@ var inputMultiLine = (lines) => css22`
4320
4372
  `;
4321
4373
 
4322
4374
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
4375
+ import { hasReferencedVariables } from "@uniformdev/canvas";
4323
4376
  import * as React10 from "react";
4324
4377
  import { useMemo as useMemo9 } from "react";
4325
-
4326
- // src/components/Variables/util/hasReferencedVariables.ts
4327
- import { parseVariableExpression as parseVariableExpression2 } from "@uniformdev/canvas";
4328
- function hasReferencedVariables(value) {
4329
- let result = false;
4330
- parseVariableExpression2(value, (token, type) => {
4331
- if (type === "variable") {
4332
- result = true;
4333
- return false;
4334
- }
4335
- });
4336
- return result;
4337
- }
4338
-
4339
- // src/components/Variables/toolbox/InputVariablesProvider.tsx
4340
4378
  function useInputVariablesState({
4341
4379
  value,
4342
4380
  onChange,
@@ -4351,20 +4389,20 @@ function useInputVariablesState({
4351
4389
  renderMenuInPortal
4352
4390
  }) {
4353
4391
  const { variables } = useVariables(true);
4354
- const hasVariablesInValue = hasReferencedVariables(value != null ? value : "");
4392
+ const variableReferenceCountInValue = hasReferencedVariables(value != null ? value : "");
4355
4393
  const [lastKnownId] = React10.useState(id);
4356
- const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(hasVariablesInValue);
4394
+ const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
4357
4395
  React10.useEffect(() => {
4358
- if (hasVariablesInValue) {
4396
+ if (variableReferenceCountInValue) {
4359
4397
  setHadVariablesInValue(true);
4360
4398
  }
4361
- }, [hasVariablesInValue]);
4399
+ }, [variableReferenceCountInValue]);
4362
4400
  React10.useEffect(() => {
4363
4401
  if (id !== lastKnownId) {
4364
- setHadVariablesInValue(hasVariablesInValue);
4402
+ setHadVariablesInValue(variableReferenceCountInValue > 0);
4365
4403
  }
4366
- }, [hasVariablesInValue, id, lastKnownId]);
4367
- const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
4404
+ }, [variableReferenceCountInValue, id, lastKnownId]);
4405
+ const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
4368
4406
  const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
4369
4407
  const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
4370
4408
  const sharedMenuProps = useMemo9(
@@ -4393,7 +4431,7 @@ function useInputVariablesState({
4393
4431
  return {
4394
4432
  sharedMenuProps,
4395
4433
  disableVariablesForReals,
4396
- hasVariablesInValue,
4434
+ hasVariablesInValue: variableReferenceCountInValue > 0,
4397
4435
  hadVariablesInValue: hadVariablesInValueForReals,
4398
4436
  setHadVariablesInValue
4399
4437
  };
@@ -4416,7 +4454,8 @@ var variableBindButton2 = css23`
4416
4454
  display: flex;
4417
4455
  height: 1.2rem;
4418
4456
  padding: var(--spacing-2xs);
4419
- transition: background var(--duration-fast) var(--timing-ease-out),
4457
+ transition:
4458
+ background var(--duration-fast) var(--timing-ease-out),
4420
4459
  color var(--duration-fast) var(--timing-ease-out);
4421
4460
  width: 1.2rem;
4422
4461
 
@@ -4440,7 +4479,7 @@ import { CLEAR_EDITOR_COMMAND } from "lexical";
4440
4479
  import { BsFillPlusCircleFill } from "@react-icons/all-files/bs/BsFillPlusCircleFill";
4441
4480
  import { CgUsbC } from "@react-icons/all-files/cg/CgUsbC";
4442
4481
  import { HorizontalRhythm as HorizontalRhythm3, Menu as Menu2, MenuGroup as MenuGroup2, MenuItem as MenuItem2, MenuItemSeparator as MenuItemSeparator2 } from "@uniformdev/design-system";
4443
- import { useRef as useRef11 } from "react";
4482
+ import { useRef as useRef10 } from "react";
4444
4483
  import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
4445
4484
  function SelectVariableMenu({
4446
4485
  onSelectVariable,
@@ -4455,7 +4494,7 @@ function SelectVariableMenu({
4455
4494
  filterVariable
4456
4495
  }) {
4457
4496
  const { variables, canDispatch, readOnly } = useVariables(true);
4458
- const btnRef = useRef11(null);
4497
+ const btnRef = useRef10(null);
4459
4498
  const { editVariable } = useVariableEditor();
4460
4499
  const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
4461
4500
  const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
@@ -4589,7 +4628,7 @@ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
4589
4628
  import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
4590
4629
  import { LexicalComposer } from "@lexical/react/LexicalComposer";
4591
4630
  import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
4592
- 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";
4593
4632
 
4594
4633
  // src/components/Variables/composer/DisablePlugin.tsx
4595
4634
  import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
@@ -4604,50 +4643,18 @@ function DisablePlugin({ disabled }) {
4604
4643
 
4605
4644
  // src/components/Variables/composer/SingleLineTextPlugin.tsx
4606
4645
  import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
4607
- import { LineBreakNode } from "lexical";
4646
+ import { LineBreakNode as LineBreakNode2 } from "lexical";
4608
4647
  import { useEffect as useEffect13 } from "react";
4609
4648
  function SingleLineTextPlugin() {
4610
4649
  const [editor] = useLexicalComposerContext8();
4611
4650
  useEffect13(() => {
4612
- editor.registerNodeTransform(LineBreakNode, (node) => {
4651
+ editor.registerNodeTransform(LineBreakNode2, (node) => {
4613
4652
  node.remove();
4614
4653
  });
4615
4654
  }, [editor]);
4616
4655
  return null;
4617
4656
  }
4618
4657
 
4619
- // src/components/Variables/util/serializeVariablesEditorState.ts
4620
- import { createVariableReference as createVariableReference3 } from "@uniformdev/canvas";
4621
- import { LineBreakNode as LineBreakNode2, TextNode as TextNode3 } from "lexical";
4622
-
4623
- // src/components/Variables/util/variableExpression.ts
4624
- var variablePrefix = "${";
4625
- var variableSuffix = "}";
4626
-
4627
- // src/components/Variables/util/serializeVariablesEditorState.ts
4628
- function serializeVariablesEditorState(editorState) {
4629
- const buf = [];
4630
- serializeRecursive(editorState.toJSON().root, buf);
4631
- const result = buf.join("");
4632
- return result.length > 0 ? result : void 0;
4633
- }
4634
- function serializeRecursive(node, buffer) {
4635
- if (node.type === TextNode3.getType()) {
4636
- buffer.push(node.text.replace(variablePrefix, "\\${"));
4637
- }
4638
- if (node.type === VariableNode.getType()) {
4639
- buffer.push(createVariableReference3(node.reference));
4640
- }
4641
- if (node.type === LineBreakNode2.getType()) {
4642
- buffer.push("\n");
4643
- }
4644
- if ("children" in node && node.children) {
4645
- for (const child of node.children) {
4646
- serializeRecursive(child, buffer);
4647
- }
4648
- }
4649
- }
4650
-
4651
4658
  // src/components/Variables/toolbox/VariablesComposer.tsx
4652
4659
  import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
4653
4660
  function VariablesComposer(props) {
@@ -4674,8 +4681,8 @@ function VariablesComposer(props) {
4674
4681
  // eslint-disable-next-line react-hooks/exhaustive-deps
4675
4682
  []
4676
4683
  );
4677
- const editorState = useRef12();
4678
- const updateTimeout = useRef12();
4684
+ const editorState = useRef11();
4685
+ const updateTimeout = useRef11();
4679
4686
  if (typeof document === "undefined") return null;
4680
4687
  return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
4681
4688
  /* @__PURE__ */ jsx38(
@@ -4854,7 +4861,8 @@ function InputVariables(props) {
4854
4861
  filterVariable,
4855
4862
  styleVariant = "default",
4856
4863
  renderMenuInPortal,
4857
- disableDismissEditorOnChange
4864
+ disableDismissEditorOnChange,
4865
+ singleTokenMode
4858
4866
  } = props;
4859
4867
  const [finalId] = useState13(id != null ? id : () => v42());
4860
4868
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -4919,7 +4927,7 @@ function InputVariables(props) {
4919
4927
  buttonCss: variableBindButton,
4920
4928
  tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
4921
4929
  buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
4922
- replaceValueOnVariableInsert: useInputWithNoVariables
4930
+ replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
4923
4931
  }
4924
4932
  )
4925
4933
  ]
@@ -4959,13 +4967,13 @@ function InputVariables(props) {
4959
4967
  showAddVariableMenuOption,
4960
4968
  enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
4961
4969
  getEditorContext,
4962
- disabled,
4970
+ disabled: disabled || singleTokenMode,
4963
4971
  replaceValueOnVariableInsert: useInputWithNoVariables,
4964
4972
  autoFocus,
4965
4973
  filterVariable,
4966
4974
  children: [
4967
4975
  /* @__PURE__ */ jsx40(PasteTransformerPlugin, { transformPaste }),
4968
- /* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
4976
+ /* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
4969
4977
  editorRef ? /* @__PURE__ */ jsx40(EditorRefPlugin, { editorRef }) : null,
4970
4978
  body
4971
4979
  ]
@@ -5062,13 +5070,13 @@ import { useCallback as useCallback4 } from "react";
5062
5070
  import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
5063
5071
  import { mergeRegister as mergeRegister5 } from "@lexical/utils";
5064
5072
  import { $getNodeByKey as $getNodeByKey3, COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH3 } from "lexical";
5065
- import { useEffect as useEffect15, useRef as useRef13 } from "react";
5073
+ import { useEffect as useEffect15, useRef as useRef12 } from "react";
5066
5074
  function OnDisconnectPlugin({
5067
5075
  onDisconnect
5068
5076
  }) {
5069
5077
  const [editor] = useLexicalComposerContext10();
5070
5078
  const { variables } = useVariables(true);
5071
- const variablesRef = useRef13(variables);
5079
+ const variablesRef = useRef12(variables);
5072
5080
  variablesRef.current = variables;
5073
5081
  useEffect15(() => {
5074
5082
  return mergeRegister5(
@@ -5261,6 +5269,12 @@ ${prettifyBindExpression(bindExpression)}`
5261
5269
  };
5262
5270
  }
5263
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
+
5264
5278
  // src/components/Variables/VariablesList.tsx
5265
5279
  import { css as css27 } from "@emotion/react";
5266
5280
  import {
@@ -6232,11 +6246,11 @@ import { LoadingIndicator as LoadingIndicator3, Theme as Theme2 } from "@uniform
6232
6246
 
6233
6247
  // src/hooks/useInitializeUniformMeshSdk.ts
6234
6248
  import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
6235
- 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";
6236
6250
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
6237
6251
  const [error, setError] = useState15();
6238
6252
  const [sdk, setSdk] = useState15();
6239
- const initializationInProgress = useRef14(false);
6253
+ const initializationInProgress = useRef13(false);
6240
6254
  useEffect16(
6241
6255
  () => {
6242
6256
  if (typeof window === "undefined" || sdk) {
@@ -6785,7 +6799,8 @@ var ButtonStyles = css35`
6785
6799
  font-size: var(--fs-sm);
6786
6800
  line-height: 1;
6787
6801
  gap: var(--spacing-xs);
6788
- transition: border-color var(--duration-fast) var(--timing-ease-out),
6802
+ transition:
6803
+ border-color var(--duration-fast) var(--timing-ease-out),
6789
6804
  background-color var(--duration-fast) var(--timing-ease-out);
6790
6805
 
6791
6806
  &:hover {
@@ -7245,7 +7260,7 @@ var QueryFilter = ({
7245
7260
  };
7246
7261
 
7247
7262
  // src/components/ParamTypeDynamicDataProvider.tsx
7248
- 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";
7249
7264
  import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
7250
7265
  function ParamTypeDynamicDataProvider(props) {
7251
7266
  const { children } = props;
@@ -7267,7 +7282,7 @@ var JsonMeshVariableEditor = ({
7267
7282
  variable,
7268
7283
  context
7269
7284
  }) => {
7270
- const sillyRef = useRef15(false);
7285
+ const sillyRef = useRef14(false);
7271
7286
  const { editConnectedData } = useMeshLocation("paramType");
7272
7287
  useEffect18(() => {
7273
7288
  if (sillyRef.current) {
@@ -7301,371 +7316,445 @@ var JsonMeshVariableEditor = ({
7301
7316
  var NUMBER_OPERATORS = [
7302
7317
  {
7303
7318
  label: "equals...",
7304
- symbol: "=",
7305
7319
  value: "eq",
7306
- editorType: "number"
7320
+ editorType: "number",
7321
+ expectedValueType: "single"
7307
7322
  },
7308
7323
  {
7309
7324
  label: "does not equal...",
7310
- symbol: "\u2260",
7311
7325
  value: "neq",
7312
- editorType: "number"
7326
+ editorType: "number",
7327
+ expectedValueType: "single"
7313
7328
  },
7314
7329
  {
7315
7330
  label: "greater than...",
7316
- symbol: ">",
7317
7331
  value: "gt",
7318
- editorType: "number"
7332
+ editorType: "number",
7333
+ expectedValueType: "single"
7319
7334
  },
7320
7335
  {
7321
7336
  label: "greater than or equal to...",
7322
- symbol: "\u2265",
7323
7337
  value: "gte",
7324
- editorType: "number"
7338
+ editorType: "number",
7339
+ expectedValueType: "single"
7325
7340
  },
7326
7341
  {
7327
7342
  label: "less than...",
7328
- symbol: "<",
7329
7343
  value: "lt",
7330
- editorType: "number"
7344
+ editorType: "number",
7345
+ expectedValueType: "single"
7331
7346
  },
7332
7347
  {
7333
7348
  label: "less than or equal to...",
7334
- symbol: "\u2264",
7335
7349
  value: "lte",
7336
- editorType: "number"
7350
+ editorType: "number",
7351
+ expectedValueType: "single"
7337
7352
  },
7338
7353
  {
7339
7354
  label: "is empty",
7340
7355
  value: "ndef",
7341
- editorType: "empty"
7356
+ editorType: "empty",
7357
+ expectedValueType: "false"
7342
7358
  },
7343
7359
  {
7344
7360
  label: "is between...",
7345
7361
  value: "between",
7346
- editorType: "numberRange"
7362
+ editorType: "numberRange",
7363
+ expectedValueType: "between"
7347
7364
  },
7348
7365
  {
7349
7366
  label: "is not empty",
7350
7367
  value: "def",
7351
- editorType: "empty"
7368
+ editorType: "empty",
7369
+ expectedValueType: "true"
7352
7370
  }
7353
7371
  ];
7354
7372
  var DATE_OPERATORS = [
7355
7373
  {
7356
7374
  label: "is",
7357
7375
  value: "eq",
7358
- editorType: "date"
7376
+ editorType: "date",
7377
+ expectedValueType: "single"
7359
7378
  },
7360
7379
  {
7361
7380
  label: "is between...",
7362
7381
  value: "between",
7363
- editorType: "dateRange"
7382
+ editorType: "dateRange",
7383
+ expectedValueType: "between"
7364
7384
  },
7365
7385
  {
7366
7386
  label: "is before...",
7367
7387
  value: "lt",
7368
- editorType: "date"
7388
+ editorType: "date",
7389
+ expectedValueType: "single"
7369
7390
  },
7370
7391
  {
7371
7392
  label: "is after...",
7372
7393
  value: "gt",
7373
- editorType: "date"
7394
+ editorType: "date",
7395
+ expectedValueType: "single"
7374
7396
  },
7375
7397
  {
7376
7398
  label: "is on or before...",
7377
7399
  value: "lte",
7378
- editorType: "date"
7400
+ editorType: "date",
7401
+ expectedValueType: "single"
7379
7402
  },
7380
7403
  {
7381
7404
  label: "is on or after...",
7382
7405
  value: "gte",
7383
- editorType: "date"
7406
+ editorType: "date",
7407
+ expectedValueType: "single"
7384
7408
  },
7385
7409
  {
7386
7410
  label: "is empty",
7387
7411
  value: "ndef",
7388
- editorType: "empty"
7412
+ editorType: "empty",
7413
+ expectedValueType: "false"
7389
7414
  },
7390
7415
  {
7391
7416
  label: "is not",
7392
7417
  value: "neq",
7393
- editorType: "date"
7418
+ editorType: "date",
7419
+ expectedValueType: "single"
7394
7420
  },
7395
7421
  {
7396
7422
  label: "is not empty",
7397
7423
  value: "def",
7398
- editorType: "empty"
7424
+ editorType: "empty",
7425
+ expectedValueType: "true"
7399
7426
  }
7400
7427
  ];
7401
7428
  var TEXTBOX_OPERATORS = [
7402
7429
  {
7403
7430
  label: "contains...",
7404
7431
  value: "match",
7405
- editorType: "text"
7432
+ editorType: "text",
7433
+ expectedValueType: "single"
7406
7434
  },
7407
7435
  {
7408
7436
  label: "is",
7409
7437
  value: "eq",
7410
- editorType: "text"
7438
+ editorType: "text",
7439
+ expectedValueType: "single"
7411
7440
  },
7412
7441
  {
7413
7442
  label: "is empty",
7414
7443
  value: "ndef",
7415
- editorType: "empty"
7444
+ editorType: "empty",
7445
+ expectedValueType: "false"
7416
7446
  },
7417
7447
  {
7418
7448
  label: "starts with...",
7419
7449
  value: "starts",
7420
- editorType: "text"
7450
+ editorType: "text",
7451
+ expectedValueType: "single"
7421
7452
  },
7422
7453
  {
7423
7454
  label: "is not",
7424
7455
  value: "neq",
7425
- editorType: "text"
7456
+ editorType: "text",
7457
+ expectedValueType: "single"
7426
7458
  },
7427
7459
  {
7428
7460
  label: "is not empty",
7429
7461
  value: "def",
7430
- editorType: "empty"
7462
+ editorType: "empty",
7463
+ expectedValueType: "true"
7431
7464
  }
7432
7465
  ];
7433
7466
  var USER_OPERATORS = [
7434
7467
  {
7435
7468
  label: "contains...",
7436
7469
  value: "match",
7437
- editorType: "text"
7470
+ editorType: "text",
7471
+ expectedValueType: "single"
7438
7472
  },
7439
7473
  {
7440
7474
  label: "is",
7441
7475
  value: "eq",
7442
- editorType: "text"
7476
+ editorType: "text",
7477
+ expectedValueType: "single"
7443
7478
  },
7444
7479
  {
7445
7480
  label: "starts with...",
7446
7481
  value: "starts",
7447
- editorType: "text"
7482
+ editorType: "text",
7483
+ expectedValueType: "single"
7448
7484
  },
7449
7485
  {
7450
7486
  label: "is not",
7451
7487
  value: "neq",
7452
- editorType: "text"
7488
+ editorType: "text",
7489
+ expectedValueType: "single"
7453
7490
  }
7454
7491
  ];
7455
- var SYSTEM_DATE_OPERATORS = [
7492
+ var DATE_TIME_OPERATORS = [
7456
7493
  {
7457
7494
  label: "is",
7458
7495
  value: "sys-date-eq",
7459
- editorType: "date"
7496
+ editorType: "date",
7497
+ expectedValueType: "single"
7460
7498
  },
7461
7499
  {
7462
7500
  label: "is between...",
7463
7501
  value: "sys-date-between",
7464
- editorType: "dateRange"
7502
+ editorType: "dateRange",
7503
+ expectedValueType: "between"
7465
7504
  },
7466
7505
  {
7467
7506
  label: "is before...",
7468
7507
  value: "sys-date-lt",
7469
- editorType: "date"
7508
+ editorType: "date",
7509
+ expectedValueType: "single"
7470
7510
  },
7471
7511
  {
7472
7512
  label: "is after...",
7473
7513
  value: "sys-date-gt",
7474
- editorType: "date"
7514
+ editorType: "date",
7515
+ expectedValueType: "single"
7475
7516
  },
7476
7517
  {
7477
7518
  label: "is on or before...",
7478
7519
  value: "sys-date-lte",
7479
- editorType: "date"
7520
+ editorType: "date",
7521
+ expectedValueType: "single"
7480
7522
  },
7481
7523
  {
7482
7524
  label: "is on or after...",
7483
7525
  value: "sys-date-gte",
7484
- 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"
7485
7540
  }
7486
7541
  ];
7487
7542
  var RICHTEXT_OPERATORS = [
7488
7543
  {
7489
7544
  label: "contains...",
7490
7545
  value: "match",
7491
- editorType: "text"
7546
+ editorType: "text",
7547
+ expectedValueType: "single"
7492
7548
  },
7493
7549
  {
7494
7550
  label: "is empty",
7495
7551
  value: "ndef",
7496
- editorType: "empty"
7552
+ editorType: "empty",
7553
+ expectedValueType: "false"
7497
7554
  },
7498
7555
  {
7499
7556
  label: "starts with...",
7500
7557
  value: "starts",
7501
- editorType: "text"
7558
+ editorType: "text",
7559
+ expectedValueType: "single"
7502
7560
  },
7503
7561
  {
7504
7562
  label: "is not empty",
7505
7563
  value: "def",
7506
- editorType: "empty"
7564
+ editorType: "empty",
7565
+ expectedValueType: "true"
7507
7566
  }
7508
7567
  ];
7509
7568
  var CHECKBOX_OPERATORS = [
7510
7569
  {
7511
7570
  label: "is checked",
7512
7571
  value: "def",
7513
- editorType: "empty"
7572
+ editorType: "empty",
7573
+ expectedValueType: "true"
7514
7574
  },
7515
7575
  {
7516
7576
  label: "is not checked",
7517
7577
  value: "ndef",
7518
- editorType: "empty"
7578
+ editorType: "empty",
7579
+ expectedValueType: "false"
7519
7580
  }
7520
7581
  ];
7521
7582
  var SYSTEM_FIELD_OPERATORS = [
7522
7583
  {
7523
7584
  label: "is",
7524
7585
  value: "eq",
7525
- editorType: "singleChoice"
7586
+ editorType: "singleChoice",
7587
+ expectedValueType: "single"
7526
7588
  },
7527
7589
  {
7528
7590
  label: "is any of...",
7529
7591
  value: "in",
7530
- editorType: "multiChoice"
7592
+ editorType: "multiChoice",
7593
+ expectedValueType: "array"
7531
7594
  },
7532
7595
  {
7533
7596
  label: "is not",
7534
7597
  value: "neq",
7535
- editorType: "singleChoice"
7598
+ editorType: "singleChoice",
7599
+ expectedValueType: "single"
7536
7600
  },
7537
7601
  {
7538
7602
  label: "is none of...",
7539
7603
  value: "nin",
7540
- editorType: "multiChoice"
7604
+ editorType: "multiChoice",
7605
+ expectedValueType: "array"
7541
7606
  }
7542
7607
  ];
7543
7608
  var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
7544
7609
  {
7545
7610
  label: "is",
7546
7611
  value: "eq",
7547
- editorType: "singleChoice"
7612
+ editorType: "singleChoice",
7613
+ expectedValueType: "single"
7548
7614
  },
7549
7615
  {
7550
7616
  label: "is any of...",
7551
7617
  value: "in",
7552
- editorType: "multiChoice"
7618
+ editorType: "multiChoice",
7619
+ expectedValueType: "array"
7553
7620
  },
7554
7621
  {
7555
7622
  label: "is empty",
7556
7623
  value: "ndef",
7557
- editorType: "empty"
7624
+ editorType: "empty",
7625
+ expectedValueType: "false"
7558
7626
  },
7559
7627
  {
7560
7628
  label: "is not",
7561
7629
  value: "neq",
7562
- editorType: "singleChoice"
7630
+ editorType: "singleChoice",
7631
+ expectedValueType: "single"
7563
7632
  },
7564
7633
  {
7565
7634
  label: "is none of...",
7566
7635
  value: "nin",
7567
- editorType: "multiChoice"
7636
+ editorType: "multiChoice",
7637
+ expectedValueType: "array"
7568
7638
  },
7569
7639
  {
7570
7640
  label: "is not empty",
7571
7641
  value: "def",
7572
- editorType: "empty"
7642
+ editorType: "empty",
7643
+ expectedValueType: "true"
7573
7644
  }
7574
7645
  ];
7575
7646
  var PUBLISH_STATUS_FIELD_OPERATORS = [
7576
7647
  {
7577
7648
  label: "is",
7578
7649
  value: "eq",
7579
- editorType: "statusSingleChoice"
7650
+ editorType: "statusSingleChoice",
7651
+ expectedValueType: "single"
7580
7652
  },
7581
7653
  {
7582
7654
  label: "is any of...",
7583
7655
  value: "in",
7584
- editorType: "statusMultiChoice"
7656
+ editorType: "statusMultiChoice",
7657
+ expectedValueType: "array"
7585
7658
  },
7586
7659
  {
7587
7660
  label: "is not",
7588
7661
  value: "neq",
7589
- editorType: "statusSingleChoice"
7662
+ editorType: "statusSingleChoice",
7663
+ expectedValueType: "single"
7590
7664
  },
7591
7665
  {
7592
7666
  label: "is none of...",
7593
7667
  value: "nin",
7594
- editorType: "statusMultiChoice"
7668
+ editorType: "statusMultiChoice",
7669
+ expectedValueType: "array"
7595
7670
  }
7596
7671
  ];
7597
7672
  var SELECT_OPERATORS = [
7598
7673
  {
7599
7674
  label: "is",
7600
7675
  value: "eq",
7601
- editorType: "singleChoice"
7676
+ editorType: "singleChoice",
7677
+ expectedValueType: "single"
7602
7678
  },
7603
7679
  {
7604
7680
  label: "is any of...",
7605
7681
  value: "in",
7606
- editorType: "multiChoice"
7682
+ editorType: "multiChoice",
7683
+ expectedValueType: "array"
7607
7684
  },
7608
7685
  {
7609
7686
  label: "is empty",
7610
7687
  value: "ndef",
7611
- editorType: "empty"
7688
+ editorType: "empty",
7689
+ expectedValueType: "false"
7612
7690
  },
7613
7691
  {
7614
7692
  label: "contains...",
7615
7693
  value: "match",
7616
- editorType: "text"
7694
+ editorType: "text",
7695
+ expectedValueType: "single"
7617
7696
  },
7618
7697
  {
7619
7698
  label: "starts with...",
7620
7699
  value: "starts",
7621
- editorType: "text"
7700
+ editorType: "text",
7701
+ expectedValueType: "single"
7622
7702
  },
7623
7703
  {
7624
7704
  label: "is not",
7625
7705
  value: "neq",
7626
- editorType: "singleChoice"
7706
+ editorType: "singleChoice",
7707
+ expectedValueType: "single"
7627
7708
  },
7628
7709
  {
7629
7710
  label: "is none of...",
7630
7711
  value: "nin",
7631
- editorType: "multiChoice"
7712
+ editorType: "multiChoice",
7713
+ expectedValueType: "array"
7632
7714
  },
7633
7715
  {
7634
7716
  label: "is not empty",
7635
7717
  value: "def",
7636
- editorType: "empty"
7718
+ editorType: "empty",
7719
+ expectedValueType: "true"
7637
7720
  }
7638
7721
  ];
7639
7722
  var MULTI_SELECT_OPERATORS = [
7640
7723
  {
7641
7724
  label: "is",
7642
7725
  value: "eq",
7643
- editorType: "singleChoice"
7726
+ editorType: "singleChoice",
7727
+ expectedValueType: "single"
7644
7728
  },
7645
7729
  {
7646
7730
  label: "is any of...",
7647
7731
  value: "in",
7648
- editorType: "multiChoice"
7732
+ editorType: "multiChoice",
7733
+ expectedValueType: "array"
7649
7734
  },
7650
7735
  {
7651
7736
  label: "is empty",
7652
7737
  value: "ndef",
7653
- editorType: "empty"
7738
+ editorType: "empty",
7739
+ expectedValueType: "false"
7654
7740
  },
7655
7741
  {
7656
7742
  label: "is not",
7657
7743
  value: "neq",
7658
- editorType: "singleChoice"
7744
+ editorType: "singleChoice",
7745
+ expectedValueType: "single"
7659
7746
  },
7660
7747
  {
7661
7748
  label: "is none of...",
7662
7749
  value: "nin",
7663
- editorType: "multiChoice"
7750
+ editorType: "multiChoice",
7751
+ expectedValueType: "array"
7664
7752
  },
7665
7753
  {
7666
7754
  label: "is not empty",
7667
7755
  value: "def",
7668
- editorType: "empty"
7756
+ editorType: "empty",
7757
+ expectedValueType: "true"
7669
7758
  }
7670
7759
  ];
7671
7760
 
@@ -8315,7 +8404,7 @@ var ConditionalInputRow = css38`
8315
8404
  ${cq("764px")} {
8316
8405
  align-items: flex-start;
8317
8406
  display: grid;
8318
- grid-template-columns: 200px 160px 1fr 32px;
8407
+ grid-template-columns: 250px 160px 1fr 32px;
8319
8408
 
8320
8409
  & > div:nth-child(n) {
8321
8410
  width: auto;
@@ -8364,7 +8453,8 @@ var FilterButton = css38`
8364
8453
  gap: var(--spacing-sm);
8365
8454
  padding: var(--spacing-sm) var(--spacing-base);
8366
8455
  max-height: 40px;
8367
- transition: color var(--duration-fast) var(--timing-ease-out),
8456
+ transition:
8457
+ color var(--duration-fast) var(--timing-ease-out),
8368
8458
  background-color var(--duration-fast) var(--timing-ease-out),
8369
8459
  border-color var(--duration-fast) var(--timing-ease-out),
8370
8460
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -8459,6 +8549,9 @@ var ResetConditionsBtn = css38`
8459
8549
  &:focus {
8460
8550
  color: var(--action-destructive-hover);
8461
8551
  }
8552
+ &:disabled {
8553
+ color: var(--gray-400);
8554
+ }
8462
8555
  `;
8463
8556
  var IconBtn = css38`
8464
8557
  align-self: center;
@@ -8522,9 +8615,10 @@ var FilterButton2 = ({
8522
8615
 
8523
8616
  // src/components/SearchAndFilter/FilterControls.tsx
8524
8617
  import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
8618
+ import { hasReferencedVariables as hasReferencedVariables3 } from "@uniformdev/canvas";
8525
8619
  import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
8526
8620
  import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
8527
- 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";
8528
8622
  import { useDebounce as useDebounce9 } from "react-use";
8529
8623
  import { v4 as v43 } from "uuid";
8530
8624
 
@@ -8563,7 +8657,7 @@ var filterMapper = {
8563
8657
  statusSingleChoice: StatusSingleEditor,
8564
8658
  empty: null
8565
8659
  };
8566
- function withInputVariables(WrappedComponent) {
8660
+ function withInputVariables(WrappedComponent, noSwapping = false) {
8567
8661
  const WithInputVariables = (props) => {
8568
8662
  if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8569
8663
  return /* @__PURE__ */ jsx82(WrappedComponent, { ...props });
@@ -8576,7 +8670,7 @@ function withInputVariables(WrappedComponent) {
8576
8670
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8577
8671
  value: props.value,
8578
8672
  disabled: props.disabled,
8579
- inputWhenNoVariables: /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8673
+ inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8580
8674
  }
8581
8675
  );
8582
8676
  };
@@ -8606,7 +8700,7 @@ var bindableFiltersMapper = {
8606
8700
  multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
8607
8701
  singleChoice: withInputVariables(FilterSingleChoiceEditor),
8608
8702
  date: withInputVariables(DateEditor),
8609
- text: withInputVariables(TextEditor),
8703
+ text: withInputVariables(TextEditor, true),
8610
8704
  number: withInputVariables(NumberEditor)
8611
8705
  };
8612
8706
 
@@ -8638,6 +8732,7 @@ var SearchAndFilterProvider = ({
8638
8732
  filters,
8639
8733
  filterOptions,
8640
8734
  filterVisible = false,
8735
+ alwaysVisible = false,
8641
8736
  defaultSearchTerm = "",
8642
8737
  onSearchChange,
8643
8738
  onChange,
@@ -8649,7 +8744,7 @@ var SearchAndFilterProvider = ({
8649
8744
  }) => {
8650
8745
  const [searchTerm, setSearchTerm] = useState24(defaultSearchTerm);
8651
8746
  const deferredSearchTerm = useDeferredValue2(searchTerm);
8652
- const [filterVisibility, setFilterVisibility] = useState24(filterVisible);
8747
+ const [filterVisibility, setFilterVisibility] = useState24(alwaysVisible || filterVisible);
8653
8748
  const handleSearchTerm = useCallback6(
8654
8749
  (term) => {
8655
8750
  setSearchTerm(term);
@@ -8658,8 +8753,13 @@ var SearchAndFilterProvider = ({
8658
8753
  [setSearchTerm, onSearchChange]
8659
8754
  );
8660
8755
  const handleToggleFilterVisibility = useCallback6(
8661
- (visible) => setFilterVisibility(visible),
8662
- [setFilterVisibility]
8756
+ (visible) => {
8757
+ if (alwaysVisible) {
8758
+ return;
8759
+ }
8760
+ setFilterVisibility(visible);
8761
+ },
8762
+ [alwaysVisible]
8663
8763
  );
8664
8764
  const handleAddFilter = useCallback6(() => {
8665
8765
  onChange([...filters, { field: "", operator: "", value: "" }]);
@@ -8685,7 +8785,7 @@ var SearchAndFilterProvider = ({
8685
8785
  if (filterVisibility) {
8686
8786
  const handleEscKeyFilterClose = (e) => {
8687
8787
  if (e.key === "Escape") {
8688
- setFilterVisibility(false);
8788
+ handleToggleFilterVisibility(false);
8689
8789
  }
8690
8790
  };
8691
8791
  document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
@@ -8693,7 +8793,7 @@ var SearchAndFilterProvider = ({
8693
8793
  document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8694
8794
  };
8695
8795
  }
8696
- }, [filterVisibility]);
8796
+ }, [filterVisibility, handleToggleFilterVisibility]);
8697
8797
  return /* @__PURE__ */ jsx83(
8698
8798
  SearchAndFilterContext.Provider,
8699
8799
  {
@@ -8736,8 +8836,8 @@ var FilterControls = ({
8736
8836
  searchTerm,
8737
8837
  allowBindingSearchTerm
8738
8838
  } = useSearchAndFilter();
8739
- const editorRef = useRef16(null);
8740
- const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8839
+ const editorRef = useRef15(null);
8840
+ const variableRefernceCountInSearchTerm = hasReferencedVariables3(searchTerm);
8741
8841
  const [idToResetInputVariables, setIdToResetInputVariables] = useState25("data-resource-search-term-input");
8742
8842
  const [localeSearchTerm, setLocaleSearchTerm] = useState25(searchTerm);
8743
8843
  useDebounce9(
@@ -8791,7 +8891,7 @@ var FilterControls = ({
8791
8891
  )
8792
8892
  }
8793
8893
  ),
8794
- hasVariableInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
8894
+ variableRefernceCountInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
8795
8895
  "button",
8796
8896
  {
8797
8897
  css: ClearSearchButtonStyles,
@@ -8817,86 +8917,24 @@ var FilterControls = ({
8817
8917
  import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
8818
8918
  import { useMemo as useMemo23 } from "react";
8819
8919
 
8820
- // src/components/SearchAndFilter/FilterMenu.tsx
8821
- import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
8822
- import React13, { useEffect as useEffect23 } from "react";
8823
- import { jsx as jsx85, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8824
- var SearchAndFilterOptionsContainer2 = ({
8825
- buttonRow,
8826
- additionalFiltersContainer,
8827
- children
8828
- }) => {
8829
- return /* @__PURE__ */ jsxs46("div", { css: SearchAndFilterOptionsContainer, children: [
8830
- /* @__PURE__ */ jsx85("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8831
- buttonRow ? /* @__PURE__ */ jsx85(
8832
- HorizontalRhythm8,
8833
- {
8834
- css: SearchAndFilterButtonGroup,
8835
- gap: "sm",
8836
- align: "center",
8837
- justify: "space-between",
8838
- children: buttonRow
8839
- }
8840
- ) : null,
8841
- additionalFiltersContainer ? /* @__PURE__ */ jsx85("div", { children: additionalFiltersContainer }) : null
8842
- ] });
8843
- };
8844
- var FilterMenu = ({
8845
- id,
8846
- filterTitle = "Show results",
8847
- menuControls,
8848
- additionalFiltersContainer,
8849
- children,
8850
- dataTestId,
8851
- resetButtonText = "reset"
8852
- }) => {
8853
- const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
8854
- const innerMenuRef = React13.useRef(null);
8855
- useEffect23(() => {
8856
- var _a;
8857
- if (filterVisibility) {
8858
- (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
8859
- }
8860
- }, [filterVisibility]);
8861
- return /* @__PURE__ */ jsx85(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs46(
8862
- SearchAndFilterOptionsContainer2,
8863
- {
8864
- buttonRow: menuControls,
8865
- additionalFiltersContainer,
8866
- children: [
8867
- /* @__PURE__ */ jsxs46(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
8868
- filterTitle ? /* @__PURE__ */ jsx85("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
8869
- (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx85(
8870
- "button",
8871
- {
8872
- type: "button",
8873
- css: ResetConditionsBtn,
8874
- onClick: () => {
8875
- handleResetFilters();
8876
- setFilterVisibility(false);
8877
- },
8878
- "data-testid": "reset-filters",
8879
- children: resetButtonText
8880
- }
8881
- ) : null
8882
- ] }),
8883
- children
8884
- ]
8885
- }
8886
- ) : null });
8887
- };
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
+ }
8888
8925
 
8889
8926
  // src/components/SearchAndFilter/FilterItem.tsx
8890
- 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";
8891
8928
  var FilterItem = ({
8892
8929
  index,
8893
- paramOptions,
8894
8930
  operatorOptions,
8895
8931
  valueOptions,
8896
- onParamChange,
8932
+ onFilterOptionChange,
8933
+ onFilterDynamicChange,
8897
8934
  onOperatorChange,
8898
8935
  onValueChange,
8899
- initialCriteriaTitle = "Where"
8936
+ initialCriteriaTitle = "Where",
8937
+ criteriaGroupOperator = "and"
8900
8938
  }) => {
8901
8939
  var _a, _b;
8902
8940
  const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
@@ -8906,23 +8944,24 @@ var FilterItem = ({
8906
8944
  const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
8907
8945
  const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo23(() => {
8908
8946
  var _a2;
8909
- const currentSelectedFilter = filterOptions.find((item) => {
8947
+ const currentSelectedFilterGroup = filterOptions.find((item) => {
8910
8948
  var _a3;
8911
8949
  return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
8912
8950
  });
8913
- 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) => {
8914
8952
  return filters[index].field === item.value;
8915
8953
  });
8916
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
8954
+ const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
8917
8955
  const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
8918
8956
  return filters[index].operator === item.value;
8919
8957
  });
8958
+ const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
8920
8959
  return {
8921
- selectedFieldValue: selectedFieldValue2,
8960
+ selectedFieldValue: selectedFilterOption,
8922
8961
  selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
8923
8962
  selectedMetaValue: filters[index].value,
8924
8963
  readOnly: isCurrentFieldReadOnly,
8925
- bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
8964
+ bindable: bindable2
8926
8965
  };
8927
8966
  }, [filters, filterOptions, index, operatorOptions]);
8928
8967
  const readOnlyProps = readOnly ? {
@@ -8931,17 +8970,28 @@ var FilterItem = ({
8931
8970
  menuIsOpen: false,
8932
8971
  isClearable: false
8933
8972
  } : {};
8934
- return /* @__PURE__ */ jsxs47("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8935
- /* @__PURE__ */ jsx86("span", { children: index === 0 ? initialCriteriaTitle : "and" }),
8936
- /* @__PURE__ */ jsxs47("div", { css: ConditionalInputRow, children: [
8937
- /* @__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(
8938
8988
  InputComboBox5,
8939
8989
  {
8940
8990
  "aria-label": label,
8941
- options: paramOptions,
8991
+ options: filterOptions,
8942
8992
  onChange: (e) => {
8943
8993
  var _a2;
8944
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8994
+ onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8945
8995
  },
8946
8996
  isOptionDisabled: (option) => {
8947
8997
  var _a2;
@@ -8961,7 +9011,7 @@ var FilterItem = ({
8961
9011
  name: `filter-field-${index}`
8962
9012
  }
8963
9013
  ),
8964
- /* @__PURE__ */ jsx86(
9014
+ /* @__PURE__ */ jsx85(
8965
9015
  InputComboBox5,
8966
9016
  {
8967
9017
  "aria-label": operatorLabel,
@@ -8985,7 +9035,7 @@ var FilterItem = ({
8985
9035
  name: `filter-operator-${index}`
8986
9036
  }
8987
9037
  ),
8988
- /* @__PURE__ */ jsx86(
9038
+ /* @__PURE__ */ jsx85(
8989
9039
  FilterEditorRenderer,
8990
9040
  {
8991
9041
  "aria-label": metaDataLabel,
@@ -8999,7 +9049,7 @@ var FilterItem = ({
8999
9049
  valueTestId: "filter-value"
9000
9050
  }
9001
9051
  ),
9002
- readOnly ? null : /* @__PURE__ */ jsx86(
9052
+ readOnly ? null : /* @__PURE__ */ jsx85(
9003
9053
  "button",
9004
9054
  {
9005
9055
  type: "button",
@@ -9008,35 +9058,184 @@ var FilterItem = ({
9008
9058
  css: IconBtn,
9009
9059
  "data-testid": "delete-filter",
9010
9060
  disabled: filters.length === 1,
9011
- 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" })
9012
9062
  }
9013
9063
  )
9014
9064
  ] })
9015
9065
  ] });
9016
9066
  };
9017
- var singleValuedOperators = /* @__PURE__ */ new Set([
9018
- "eq",
9019
- "neq",
9020
- "lt",
9021
- "gt",
9022
- "is",
9023
- "!is",
9024
- "has",
9025
- "!has",
9026
- "startswith",
9027
- "!startswith",
9028
- "endswith",
9029
- "!endswith"
9030
- ]);
9031
- var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
9032
- var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
9033
- 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";
9034
9232
  var FilterItems = ({
9035
9233
  addButtonText = "add condition",
9036
9234
  additionalFiltersContainer,
9037
9235
  filterTitle,
9038
9236
  resetButtonText,
9039
- initialCriteriaTitle
9237
+ initialCriteriaTitle,
9238
+ criteriaGroupOperator
9040
9239
  }) => {
9041
9240
  const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
9042
9241
  const handleUpdateFilter = (index, prop, value) => {
@@ -9044,32 +9243,16 @@ var FilterItems = ({
9044
9243
  const next = [...filters];
9045
9244
  next[index] = { ...next[index], [prop]: value };
9046
9245
  if (prop === "operator") {
9047
- const newOperator = value;
9048
- const currentValue = next[index].value;
9049
- if (Array.isArray(newOperator)) {
9050
- throw new Error("Operator value must be a single string");
9051
- }
9052
- if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
9053
- next[index].value = next[index].value[0];
9054
- }
9055
- if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
9056
- next[index].value = currentValue ? [currentValue] : [];
9057
- }
9058
- if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
9059
- next[index].value = "";
9060
- }
9061
- if (noValueOperators.has(newOperator)) {
9062
- next[index].value = "";
9063
- }
9064
- if (newOperator === "between" && Array.isArray(currentValue) === false) {
9065
- next[index].value = [currentValue, ""];
9066
- }
9067
- if (value === "def" || value === "true") {
9068
- next[index].value = "true";
9069
- }
9070
- if (value === "ndef" || value === "false") {
9071
- next[index].value = "false";
9246
+ const newOperatorId = value;
9247
+ const currentFilter = next[index];
9248
+ if (!newOperatorId) {
9249
+ throw new Error("you bad");
9072
9250
  }
9251
+ next[index] = getNewFilterValueAfterOperatorChange({
9252
+ newOperatorId,
9253
+ currentFilter,
9254
+ filterOptions
9255
+ });
9073
9256
  }
9074
9257
  if (prop === "field") {
9075
9258
  const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
@@ -9078,15 +9261,16 @@ var FilterItems = ({
9078
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";
9079
9262
  next[index].operator = firstOperatorInAvailableOperators;
9080
9263
  next[index].value = "";
9264
+ next[index].dynamicField = void 0;
9081
9265
  }
9082
9266
  setFilters(next);
9083
9267
  };
9084
- return /* @__PURE__ */ jsx86(
9268
+ return /* @__PURE__ */ jsx87(
9085
9269
  FilterMenu,
9086
9270
  {
9087
9271
  id: "search-and-filter-options",
9088
9272
  dataTestId: "search-and-filter-options",
9089
- menuControls: /* @__PURE__ */ jsxs47(
9273
+ menuControls: /* @__PURE__ */ jsxs48(
9090
9274
  "button",
9091
9275
  {
9092
9276
  type: "button",
@@ -9094,7 +9278,7 @@ var FilterItems = ({
9094
9278
  onClick: handleAddFilter,
9095
9279
  "data-testid": "add-filter",
9096
9280
  children: [
9097
- /* @__PURE__ */ jsx86(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9281
+ /* @__PURE__ */ jsx87(Icon9, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9098
9282
  addButtonText
9099
9283
  ]
9100
9284
  }
@@ -9110,17 +9294,18 @@ var FilterItems = ({
9110
9294
  })) == null ? void 0 : _a.options) != null ? _b : [];
9111
9295
  const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
9112
9296
  const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
9113
- return /* @__PURE__ */ jsx86(
9297
+ return /* @__PURE__ */ jsx87(
9114
9298
  FilterItem,
9115
9299
  {
9116
9300
  index: i,
9117
- paramOptions: filterOptions,
9118
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
9301
+ onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
9119
9302
  operatorOptions: possibleOperators,
9120
9303
  onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
9121
9304
  onValueChange: (e) => handleUpdateFilter(i, "value", e),
9305
+ onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
9122
9306
  valueOptions: possibleValueOptions,
9123
- initialCriteriaTitle
9307
+ initialCriteriaTitle,
9308
+ criteriaGroupOperator
9124
9309
  },
9125
9310
  i
9126
9311
  );
@@ -9134,7 +9319,7 @@ import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
9134
9319
 
9135
9320
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9136
9321
  import { Button as Button6, Callout as Callout6, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
9137
- 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";
9138
9323
  var SearchAndFilterResultContainer = ({
9139
9324
  buttonText,
9140
9325
  clearButtonLabel = "clear",
@@ -9164,18 +9349,18 @@ var SearchAndFilterResultContainer = ({
9164
9349
  handleResetFilters();
9165
9350
  }
9166
9351
  };
9167
- return /* @__PURE__ */ jsxs48(Fragment17, { children: [
9168
- /* @__PURE__ */ jsxs48(HorizontalRhythm9, { children: [
9169
- /* @__PURE__ */ jsxs48("span", { children: [
9352
+ return /* @__PURE__ */ jsxs49(Fragment17, { children: [
9353
+ /* @__PURE__ */ jsxs49(HorizontalRhythm9, { children: [
9354
+ /* @__PURE__ */ jsxs49("span", { children: [
9170
9355
  totalResults,
9171
9356
  " results ",
9172
9357
  searchTerm ? `for "${searchTerm}"` : null
9173
9358
  ] }),
9174
- !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 })
9175
9360
  ] }),
9176
- totalResults === 0 ? /* @__PURE__ */ jsxs48(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9177
- calloutText ? /* @__PURE__ */ jsx87(Paragraph, { children: calloutText }) : null,
9178
- 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(
9179
9364
  Button6,
9180
9365
  {
9181
9366
  buttonType: "tertiaryOutline",
@@ -9190,14 +9375,14 @@ var SearchAndFilterResultContainer = ({
9190
9375
  };
9191
9376
 
9192
9377
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9193
- 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";
9194
9379
  var SearchAndFilter = ({
9195
9380
  filters,
9196
9381
  filterOptions,
9197
9382
  filterVisible,
9198
9383
  filterControls,
9199
9384
  viewSwitchControls,
9200
- resultsContainerView = /* @__PURE__ */ jsx88(SearchAndFilterResultContainer, {}),
9385
+ resultsContainerView = /* @__PURE__ */ jsx89(SearchAndFilterResultContainer, {}),
9201
9386
  filterMapper: filterMapper2 = filterMapper,
9202
9387
  additionalFiltersContainer,
9203
9388
  onChange,
@@ -9207,7 +9392,7 @@ var SearchAndFilter = ({
9207
9392
  allowBindingSearchTerm = false,
9208
9393
  resetFilterValues = []
9209
9394
  }) => {
9210
- return /* @__PURE__ */ jsx88(
9395
+ return /* @__PURE__ */ jsx89(
9211
9396
  SearchAndFilterProvider,
9212
9397
  {
9213
9398
  filters,
@@ -9220,18 +9405,18 @@ var SearchAndFilter = ({
9220
9405
  resetFilterValues,
9221
9406
  filterMapper: filterMapper2,
9222
9407
  allowBindingSearchTerm,
9223
- children: /* @__PURE__ */ jsxs49(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
9224
- /* @__PURE__ */ jsxs49("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9225
- /* @__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(
9226
9411
  "div",
9227
9412
  {
9228
9413
  css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9229
- children: !filterControls ? /* @__PURE__ */ jsx88(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9414
+ children: !filterControls ? /* @__PURE__ */ jsx89(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9230
9415
  }
9231
9416
  ),
9232
9417
  viewSwitchControls
9233
9418
  ] }),
9234
- /* @__PURE__ */ jsx88(FilterItems, { additionalFiltersContainer }),
9419
+ /* @__PURE__ */ jsx89(FilterItems, { additionalFiltersContainer }),
9235
9420
  resultsContainerView
9236
9421
  ] })
9237
9422
  }
@@ -9242,7 +9427,7 @@ var SearchAndFilter = ({
9242
9427
  import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
9243
9428
  import { createContext as createContext7, useState as useState26 } from "react";
9244
9429
  import { useDebounce as useDebounce10 } from "react-use";
9245
- import { jsx as jsx89 } from "@emotion/react/jsx-runtime";
9430
+ import { jsx as jsx90 } from "@emotion/react/jsx-runtime";
9246
9431
  var SearchOnlyContext = createContext7({
9247
9432
  searchTerm: "",
9248
9433
  setSearchTerm: () => {
@@ -9259,14 +9444,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9259
9444
  300,
9260
9445
  [localeSearchTerm]
9261
9446
  );
9262
- return /* @__PURE__ */ jsx89(
9447
+ return /* @__PURE__ */ jsx90(
9263
9448
  SearchOnlyContext.Provider,
9264
9449
  {
9265
9450
  value: {
9266
9451
  searchTerm,
9267
9452
  setSearchTerm: setLocaleSearchTerm
9268
9453
  },
9269
- 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(
9270
9455
  InputKeywordSearch3,
9271
9456
  {
9272
9457
  placeholder: "Search...",
@@ -9361,7 +9546,8 @@ var FilterButton3 = css39`
9361
9546
  gap: var(--spacing-sm);
9362
9547
  padding: var(--spacing-sm) var(--spacing-base);
9363
9548
  max-height: 40px;
9364
- transition: color var(--duration-fast) var(--timing-ease-out),
9549
+ transition:
9550
+ color var(--duration-fast) var(--timing-ease-out),
9365
9551
  background-color var(--duration-fast) var(--timing-ease-out),
9366
9552
  border-color var(--duration-fast) var(--timing-ease-out),
9367
9553
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -9517,7 +9703,7 @@ var InputVariableWrapper = css39`
9517
9703
  `;
9518
9704
 
9519
9705
  // src/components/SearchAndFilter/SortItems.tsx
9520
- 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";
9521
9707
  var SortItems = ({
9522
9708
  sortByLabel = "Sort by",
9523
9709
  localeLabel = "Show locale",
@@ -9539,11 +9725,11 @@ var SortItems = ({
9539
9725
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9540
9726
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9541
9727
  const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9542
- return /* @__PURE__ */ jsxs50("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9543
- /* @__PURE__ */ jsxs50(VerticalRhythm8, { gap: "xs", children: [
9544
- /* @__PURE__ */ jsx90("span", { css: Title2, children: sortByLabel }),
9545
- /* @__PURE__ */ jsxs50("div", { css: SortFilterInputRow, children: [
9546
- /* @__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(
9547
9733
  InputVariables,
9548
9734
  {
9549
9735
  disableInlineMenu: disableSortBinding,
@@ -9551,7 +9737,7 @@ var SortItems = ({
9551
9737
  value: sortField,
9552
9738
  valueToResetTo: "created_at",
9553
9739
  onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9554
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9740
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9555
9741
  InputComboBox6,
9556
9742
  {
9557
9743
  id: "sort-by-field",
@@ -9574,7 +9760,7 @@ var SortItems = ({
9574
9760
  )
9575
9761
  }
9576
9762
  ),
9577
- /* @__PURE__ */ jsx90(
9763
+ /* @__PURE__ */ jsx91(
9578
9764
  InputVariables,
9579
9765
  {
9580
9766
  disableInlineMenu: disableSortBinding,
@@ -9582,7 +9768,7 @@ var SortItems = ({
9582
9768
  valueToResetTo: "DESC",
9583
9769
  showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9584
9770
  onChange: (e) => onSortChange(`${sortField}_${e}`),
9585
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9771
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9586
9772
  SegmentedControl,
9587
9773
  {
9588
9774
  noCheckmark: true,
@@ -9614,14 +9800,14 @@ var SortItems = ({
9614
9800
  )
9615
9801
  ] })
9616
9802
  ] }),
9617
- 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(
9618
9804
  InputVariables,
9619
9805
  {
9620
9806
  label: localeLabelValue,
9621
9807
  value: localeValue,
9622
9808
  showMenuPosition: "inline-right",
9623
9809
  onChange: (e) => onLocaleChange(e != null ? e : ""),
9624
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9810
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9625
9811
  InputSelect8,
9626
9812
  {
9627
9813
  name: "localeReturned",
@@ -9652,14 +9838,14 @@ function createLocationValidator(setValue, validate) {
9652
9838
 
9653
9839
  // src/utils/useContentDataResourceLocaleInfo.ts
9654
9840
  import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
9655
- import { useEffect as useEffect24, useRef as useRef17 } from "react";
9841
+ import { useEffect as useEffect24, useRef as useRef16 } from "react";
9656
9842
  function useContentDataResourceLocaleInfo({
9657
9843
  locale,
9658
9844
  setLocale,
9659
9845
  dynamicInputs
9660
9846
  }) {
9661
9847
  var _a;
9662
- const setLocaleRef = useRef17(setLocale);
9848
+ const setLocaleRef = useRef16(setLocale);
9663
9849
  setLocaleRef.current = setLocale;
9664
9850
  const { flatVariables } = useVariables();
9665
9851
  const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
@@ -9720,6 +9906,7 @@ export {
9720
9906
  Callout7 as Callout,
9721
9907
  ControlledValuePlugin,
9722
9908
  DATE_OPERATORS,
9909
+ DATE_TIME_OPERATORS,
9723
9910
  DISCONNECT_VARIABLE_COMMAND,
9724
9911
  DamSelectedItem,
9725
9912
  DataRefreshButton,
@@ -9813,7 +10000,6 @@ export {
9813
10000
  RequestUrlInput,
9814
10001
  ResolvableLoadingValue,
9815
10002
  SELECT_OPERATORS,
9816
- SYSTEM_DATE_OPERATORS,
9817
10003
  SYSTEM_FIELD_OPERATORS,
9818
10004
  ScrollableList2 as ScrollableList,
9819
10005
  ScrollableListItem,
@@ -9875,7 +10061,7 @@ export {
9875
10061
  entrySearchSelectOption,
9876
10062
  entrySearchWrapper,
9877
10063
  filterMapper,
9878
- hasReferencedVariables,
10064
+ hasReferencedVariables2 as hasReferencedVariables,
9879
10065
  prettifyBindExpression,
9880
10066
  productSearchRowActiveIcon,
9881
10067
  productSearchRowCategory,
@@ -9910,6 +10096,7 @@ export {
9910
10096
  selectedItemIcon,
9911
10097
  selectedItemInner,
9912
10098
  selectedItemTitle,
10099
+ serializeVariablesEditorSerializedState,
9913
10100
  serializeVariablesEditorState,
9914
10101
  setVariablesEditorValue,
9915
10102
  urlEncodeRequestParameter,