@uniformdev/mesh-sdk-react 19.173.1-alpha.17 → 19.173.2-alpha.258

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,18 +2794,63 @@ 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
+ if (serializedEditorState) {
2817
+ serializeRecursive(serializedEditorState, buf);
2818
+ }
2819
+ const result = buf.join("");
2820
+ return result.length > 0 ? result : void 0;
2821
+ }
2822
+ function serializeRecursive(node, buffer) {
2823
+ if (node.type === TextNode.getType()) {
2824
+ buffer.push(node.text.replace(variablePrefix, "\\${"));
2825
+ }
2826
+ if (node.type === VariableNode.getType()) {
2827
+ buffer.push(createVariableReference(node.reference));
2828
+ }
2829
+ if (node.type === LineBreakNode.getType()) {
2830
+ buffer.push("\n");
2831
+ }
2832
+ if ("children" in node && node.children) {
2833
+ for (const child of node.children) {
2834
+ if (!child) {
2835
+ continue;
2836
+ }
2837
+ serializeRecursive(child, buffer);
2838
+ }
2839
+ }
2840
+ }
2841
+
2842
+ // src/components/Variables/util/setVariablesEditorValue.ts
2843
+ import { emptyRichTextValue } from "@uniformdev/richtext";
2797
2844
 
2798
2845
  // src/components/Variables/util/deserializeVariablesEditorState.ts
2799
2846
  import { parseVariableExpression } from "@uniformdev/canvas";
2800
- import { TextNode } from "lexical";
2847
+ import { TextNode as TextNode2 } from "lexical";
2801
2848
  function deserializeVariablesEditorState(serialized) {
2802
2849
  const result = [];
2803
2850
  parseVariableExpression(serialized != null ? serialized : "", (token, type) => {
2804
2851
  if (type === "text") {
2805
2852
  const node = {
2806
- type: TextNode.getType(),
2853
+ type: TextNode2.getType(),
2807
2854
  text: token,
2808
2855
  mode: "normal",
2809
2856
  version: 1,
@@ -2857,14 +2904,18 @@ function refreshVariableNodeMetadata(editor) {
2857
2904
  }
2858
2905
 
2859
2906
  // src/components/Variables/util/setVariablesEditorValue.ts
2860
- function setVariablesEditorValue(editor, newValue) {
2907
+ function setVariablesEditorValue(editor, newValue, tag) {
2861
2908
  if (typeof newValue === "undefined" || typeof newValue === "string") {
2862
2909
  const parsedState = editor.parseEditorState(deserializeVariablesEditorState(newValue));
2863
- editor.setEditorState(parsedState);
2910
+ editor.setEditorState(parsedState.clone(null), {
2911
+ tag
2912
+ });
2864
2913
  } else {
2865
2914
  try {
2866
2915
  const parsedState = editor.parseEditorState(newValue);
2867
- editor.setEditorState(parsedState);
2916
+ editor.setEditorState(parsedState.clone(null), {
2917
+ tag
2918
+ });
2868
2919
  } catch (e) {
2869
2920
  console.warn(
2870
2921
  "Tried to set invalid Lexical state, probably invalidly formatted state object - falling back to empty state. Invalid state attempted:",
@@ -2872,27 +2923,10 @@ function setVariablesEditorValue(editor, newValue) {
2872
2923
  "Error:",
2873
2924
  e
2874
2925
  );
2875
- const parsedState = editor.parseEditorState({
2876
- root: {
2877
- type: "root",
2878
- version: 1,
2879
- direction: null,
2880
- format: "",
2881
- indent: 0,
2882
- children: [
2883
- {
2884
- type: "paragraph",
2885
- version: 1,
2886
- format: "start",
2887
- indent: 0,
2888
- direction: null,
2889
- children: [],
2890
- textFormat: 0
2891
- }
2892
- ]
2893
- }
2926
+ const parsedState = editor.parseEditorState(emptyRichTextValue);
2927
+ editor.setEditorState(parsedState.clone(null), {
2928
+ tag
2894
2929
  });
2895
- editor.setEditorState(parsedState);
2896
2930
  }
2897
2931
  }
2898
2932
  refreshVariableNodeMetadata(editor);
@@ -2905,17 +2939,18 @@ function ControlledValuePlugin({
2905
2939
  extraDependencies
2906
2940
  }) {
2907
2941
  const [editor] = useLexicalComposerContext();
2908
- const lastValueRef = useRef8(value);
2909
2942
  useEffect5(() => {
2943
+ var _a, _b;
2910
2944
  if (!enabled) {
2911
2945
  return;
2912
2946
  }
2913
- if (dequal(lastValueRef.current, value)) {
2947
+ const currentValue = (_a = serializeVariablesEditorState(editor.getEditorState())) != null ? _a : "";
2948
+ const newValue = (_b = value !== void 0 && typeof value !== "string" ? serializeVariablesEditorSerializedState(value.root) : value) != null ? _b : "";
2949
+ if (currentValue === newValue) {
2914
2950
  return;
2915
2951
  }
2916
2952
  setTimeout(() => {
2917
2953
  if (editor) {
2918
- lastValueRef.current = value;
2919
2954
  setVariablesEditorValue(editor, value);
2920
2955
  }
2921
2956
  });
@@ -3004,7 +3039,7 @@ import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexica
3004
3039
  import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
3005
3040
  import { $moveCharacter, $shouldOverrideDefaultCharacterSelection } from "@lexical/selection";
3006
3041
  import { mergeRegister as mergeRegister2 } from "@lexical/utils";
3007
- import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
3042
+ import { createVariableReference as createVariableReference3 } from "@uniformdev/canvas";
3008
3043
  import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
3009
3044
  import {
3010
3045
  $getNearestNodeFromDOMNode,
@@ -3038,12 +3073,14 @@ import {
3038
3073
  } from "@lexical/react/LexicalTypeaheadMenuPlugin";
3039
3074
  import { mergeRegister } from "@lexical/utils";
3040
3075
  import { AiFillPlusCircle } from "@react-icons/all-files/ai/AiFillPlusCircle";
3041
- import { createVariableReference } from "@uniformdev/canvas";
3076
+ import { createVariableReference as createVariableReference2 } from "@uniformdev/canvas";
3042
3077
  import { HorizontalRhythm as HorizontalRhythm2, MenuGroup, MenuItemInner, MenuItemSeparator } from "@uniformdev/design-system";
3043
- import { dequal as dequal2 } from "dequal/lite";
3078
+ import { dequal } from "dequal/lite";
3044
3079
  import {
3080
+ $createParagraphNode,
3045
3081
  $createTextNode,
3046
3082
  $getNodeByKey,
3083
+ $getRoot,
3047
3084
  $getSelection,
3048
3085
  $insertNodes,
3049
3086
  $isNodeSelection,
@@ -3052,7 +3089,7 @@ import {
3052
3089
  COMMAND_PRIORITY_NORMAL,
3053
3090
  createCommand
3054
3091
  } from "lexical";
3055
- import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3092
+ import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef9, useState as useState10 } from "react";
3056
3093
  import { createPortal } from "react-dom";
3057
3094
 
3058
3095
  // src/components/Variables/toolbox/SelectVariableMenu.styles.ts
@@ -3138,7 +3175,7 @@ function useVariableEditTransaction({
3138
3175
  // src/components/Variables/VariableEditor.tsx
3139
3176
  import { zodResolver } from "@hookform/resolvers/zod";
3140
3177
  import { Button as Button2, Callout as Callout3, HorizontalRhythm, Input as Input2, useShortcut } from "@uniformdev/design-system";
3141
- import { useLayoutEffect, useRef as useRef9 } from "react";
3178
+ import { useLayoutEffect, useRef as useRef8 } from "react";
3142
3179
  import { useForm } from "react-hook-form";
3143
3180
  import { z } from "zod";
3144
3181
 
@@ -3197,7 +3234,7 @@ function VariableEditor({
3197
3234
  },
3198
3235
  activeWhenEditing: true
3199
3236
  });
3200
- const nameRef = useRef9(null);
3237
+ const nameRef = useRef8(null);
3201
3238
  const { ref, ...nameRegister } = register("name");
3202
3239
  useLayoutEffect(() => {
3203
3240
  if (nameRef.current && !nameRef.current.value) {
@@ -3581,7 +3618,7 @@ function useVariablesMenu({
3581
3618
  var _a;
3582
3619
  const targetVariable = variables[value];
3583
3620
  if (overwriteExistingValue) {
3584
- setVariablesEditorValue(editor, createVariableReference(value));
3621
+ setVariablesEditorValue(editor, createVariableReference2(value));
3585
3622
  return true;
3586
3623
  }
3587
3624
  const variableNode = $createVariableNode(value, {
@@ -3614,7 +3651,7 @@ function VariablesPlugin({
3614
3651
  }) {
3615
3652
  const [editor] = useLexicalComposerContext2();
3616
3653
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
3617
- const variablesRef = useRef10({ variables, knownUndefinedValues, isLoading });
3654
+ const variablesRef = useRef9({ variables, knownUndefinedValues, isLoading });
3618
3655
  variablesRef.current = { variables, knownUndefinedValues, isLoading };
3619
3656
  const canEditVariable = useCallback2(
3620
3657
  (name, variable) => (
@@ -3759,18 +3796,24 @@ function VariablesPlugin({
3759
3796
  var _a, _b;
3760
3797
  if (!disableVariables) {
3761
3798
  const targetVariable = variablesRef.current.variables[reference];
3762
- if (overwriteExistingValue) {
3763
- setVariablesEditorValue(editor, createVariableReference(reference));
3764
- return true;
3765
- }
3766
3799
  const variableNode = $createVariableNode(reference, {
3767
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || reference,
3800
+ displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
3768
3801
  hasClickEvent: canEditVariable(reference, targetVariable),
3769
3802
  referenceIsValid: true,
3770
3803
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
3771
3804
  isFresh: true,
3772
3805
  isLoading: false
3773
3806
  });
3807
+ if (overwriteExistingValue) {
3808
+ const pNode = $createParagraphNode();
3809
+ pNode.append(variableNode);
3810
+ editor.update(() => {
3811
+ const root = $getRoot();
3812
+ root.clear();
3813
+ root.append(pNode);
3814
+ });
3815
+ return true;
3816
+ }
3774
3817
  if (targetKey) {
3775
3818
  (_b = $getNodeByKey(targetKey)) == null ? void 0 : _b.replace(variableNode);
3776
3819
  } else {
@@ -3806,14 +3849,14 @@ function VariablesPlugin({
3806
3849
  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
3850
  const newState = {
3808
3851
  ...currentState,
3809
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
3852
+ displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
3810
3853
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
3811
3854
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
3812
3855
  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
3856
  tooltip,
3814
3857
  isFresh: false
3815
3858
  };
3816
- if (!dequal2(currentState, newState)) {
3859
+ if (!dequal(currentState, newState)) {
3817
3860
  variableNode.setState(newState);
3818
3861
  }
3819
3862
  },
@@ -3960,7 +4003,7 @@ var VariableNode = class _VariableNode extends DecoratorNode {
3960
4003
  * (albeit it won't get the fancy chip-node)
3961
4004
  */
3962
4005
  getTextContent() {
3963
- return createVariableReference2(this.reference);
4006
+ return createVariableReference3(this.reference);
3964
4007
  }
3965
4008
  /** Creates the DOM wrapper that hosts the node */
3966
4009
  createDOM() {
@@ -4171,9 +4214,11 @@ var input = css21`
4171
4214
  min-height: 50px;
4172
4215
  width: 100%;
4173
4216
  position: relative;
4174
- transition: background var(--duration-fast) var(--timing-ease-out),
4217
+ transition:
4218
+ background var(--duration-fast) var(--timing-ease-out),
4175
4219
  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);
4220
+ color var(--duration-fast) var(--timing-ease-out),
4221
+ box-shadow var(--duration-fast) var(--timing-ease-out);
4177
4222
 
4178
4223
  &::placeholder {
4179
4224
  color: var(--gray-400);
@@ -4237,7 +4282,8 @@ var variableBindButton = css22`
4237
4282
  display: flex;
4238
4283
  height: 1.2rem;
4239
4284
  padding: var(--spacing-2xs);
4240
- transition: background var(--duration-fast) var(--timing-ease-out),
4285
+ transition:
4286
+ background var(--duration-fast) var(--timing-ease-out),
4241
4287
  color var(--duration-fast) var(--timing-ease-out);
4242
4288
  width: 1.2rem;
4243
4289
 
@@ -4320,23 +4366,9 @@ var inputMultiLine = (lines) => css22`
4320
4366
  `;
4321
4367
 
4322
4368
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
4369
+ import { hasReferencedVariables } from "@uniformdev/canvas";
4323
4370
  import * as React10 from "react";
4324
4371
  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
4372
  function useInputVariablesState({
4341
4373
  value,
4342
4374
  onChange,
@@ -4351,20 +4383,20 @@ function useInputVariablesState({
4351
4383
  renderMenuInPortal
4352
4384
  }) {
4353
4385
  const { variables } = useVariables(true);
4354
- const hasVariablesInValue = hasReferencedVariables(value != null ? value : "");
4386
+ const variableReferenceCountInValue = hasReferencedVariables(value != null ? value : "");
4355
4387
  const [lastKnownId] = React10.useState(id);
4356
- const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(hasVariablesInValue);
4388
+ const [hadVariablesInValue, setHadVariablesInValue] = React10.useState(variableReferenceCountInValue > 0);
4357
4389
  React10.useEffect(() => {
4358
- if (hasVariablesInValue) {
4390
+ if (variableReferenceCountInValue) {
4359
4391
  setHadVariablesInValue(true);
4360
4392
  }
4361
- }, [hasVariablesInValue]);
4393
+ }, [variableReferenceCountInValue]);
4362
4394
  React10.useEffect(() => {
4363
4395
  if (id !== lastKnownId) {
4364
- setHadVariablesInValue(hasVariablesInValue);
4396
+ setHadVariablesInValue(variableReferenceCountInValue > 0);
4365
4397
  }
4366
- }, [hasVariablesInValue, id, lastKnownId]);
4367
- const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : hasVariablesInValue;
4398
+ }, [variableReferenceCountInValue, id, lastKnownId]);
4399
+ const hadVariablesInValueForReals = inputWhenNoVariables ? hadVariablesInValue : variableReferenceCountInValue > 0;
4368
4400
  const disableVariablesForReals = disableVariables || Object.keys(variables).length === 0 && !showAddVariableMenuOption;
4369
4401
  const disableResetForReals = !inputWhenNoVariables || !hadVariablesInValueForReals;
4370
4402
  const sharedMenuProps = useMemo9(
@@ -4393,7 +4425,7 @@ function useInputVariablesState({
4393
4425
  return {
4394
4426
  sharedMenuProps,
4395
4427
  disableVariablesForReals,
4396
- hasVariablesInValue,
4428
+ hasVariablesInValue: variableReferenceCountInValue > 0,
4397
4429
  hadVariablesInValue: hadVariablesInValueForReals,
4398
4430
  setHadVariablesInValue
4399
4431
  };
@@ -4416,7 +4448,8 @@ var variableBindButton2 = css23`
4416
4448
  display: flex;
4417
4449
  height: 1.2rem;
4418
4450
  padding: var(--spacing-2xs);
4419
- transition: background var(--duration-fast) var(--timing-ease-out),
4451
+ transition:
4452
+ background var(--duration-fast) var(--timing-ease-out),
4420
4453
  color var(--duration-fast) var(--timing-ease-out);
4421
4454
  width: 1.2rem;
4422
4455
 
@@ -4440,7 +4473,7 @@ import { CLEAR_EDITOR_COMMAND } from "lexical";
4440
4473
  import { BsFillPlusCircleFill } from "@react-icons/all-files/bs/BsFillPlusCircleFill";
4441
4474
  import { CgUsbC } from "@react-icons/all-files/cg/CgUsbC";
4442
4475
  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";
4476
+ import { useRef as useRef10 } from "react";
4444
4477
  import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs19 } from "@emotion/react/jsx-runtime";
4445
4478
  function SelectVariableMenu({
4446
4479
  onSelectVariable,
@@ -4455,7 +4488,7 @@ function SelectVariableMenu({
4455
4488
  filterVariable
4456
4489
  }) {
4457
4490
  const { variables, canDispatch, readOnly } = useVariables(true);
4458
- const btnRef = useRef11(null);
4491
+ const btnRef = useRef10(null);
4459
4492
  const { editVariable } = useVariableEditor();
4460
4493
  const variablesGroups = variablesToGroupedList(variables, filterVariable, getEditorContext == null ? void 0 : getEditorContext());
4461
4494
  const showAddVariableMenuOptionForReals = showAddVariableMenuOption && canDispatch && !readOnly;
@@ -4589,7 +4622,7 @@ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
4589
4622
  import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
4590
4623
  import { LexicalComposer } from "@lexical/react/LexicalComposer";
4591
4624
  import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
4592
- import { useMemo as useMemo10, useRef as useRef12, useState as useState12 } from "react";
4625
+ import { useMemo as useMemo10, useRef as useRef11, useState as useState12 } from "react";
4593
4626
 
4594
4627
  // src/components/Variables/composer/DisablePlugin.tsx
4595
4628
  import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
@@ -4604,50 +4637,18 @@ function DisablePlugin({ disabled }) {
4604
4637
 
4605
4638
  // src/components/Variables/composer/SingleLineTextPlugin.tsx
4606
4639
  import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
4607
- import { LineBreakNode } from "lexical";
4640
+ import { LineBreakNode as LineBreakNode2 } from "lexical";
4608
4641
  import { useEffect as useEffect13 } from "react";
4609
4642
  function SingleLineTextPlugin() {
4610
4643
  const [editor] = useLexicalComposerContext8();
4611
4644
  useEffect13(() => {
4612
- editor.registerNodeTransform(LineBreakNode, (node) => {
4645
+ editor.registerNodeTransform(LineBreakNode2, (node) => {
4613
4646
  node.remove();
4614
4647
  });
4615
4648
  }, [editor]);
4616
4649
  return null;
4617
4650
  }
4618
4651
 
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
4652
  // src/components/Variables/toolbox/VariablesComposer.tsx
4652
4653
  import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
4653
4654
  function VariablesComposer(props) {
@@ -4674,8 +4675,8 @@ function VariablesComposer(props) {
4674
4675
  // eslint-disable-next-line react-hooks/exhaustive-deps
4675
4676
  []
4676
4677
  );
4677
- const editorState = useRef12();
4678
- const updateTimeout = useRef12();
4678
+ const editorState = useRef11();
4679
+ const updateTimeout = useRef11();
4679
4680
  if (typeof document === "undefined") return null;
4680
4681
  return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
4681
4682
  /* @__PURE__ */ jsx38(
@@ -4854,7 +4855,8 @@ function InputVariables(props) {
4854
4855
  filterVariable,
4855
4856
  styleVariant = "default",
4856
4857
  renderMenuInPortal,
4857
- disableDismissEditorOnChange
4858
+ disableDismissEditorOnChange,
4859
+ singleTokenMode
4858
4860
  } = props;
4859
4861
  const [finalId] = useState13(id != null ? id : () => v42());
4860
4862
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -4919,7 +4921,7 @@ function InputVariables(props) {
4919
4921
  buttonCss: variableBindButton,
4920
4922
  tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
4921
4923
  buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
4922
- replaceValueOnVariableInsert: useInputWithNoVariables
4924
+ replaceValueOnVariableInsert: singleTokenMode || useInputWithNoVariables
4923
4925
  }
4924
4926
  )
4925
4927
  ]
@@ -4959,13 +4961,13 @@ function InputVariables(props) {
4959
4961
  showAddVariableMenuOption,
4960
4962
  enableEditingVariables: !disabled && !disableVariablesForReals && enableEditingVariables,
4961
4963
  getEditorContext,
4962
- disabled,
4964
+ disabled: disabled || singleTokenMode,
4963
4965
  replaceValueOnVariableInsert: useInputWithNoVariables,
4964
4966
  autoFocus,
4965
4967
  filterVariable,
4966
4968
  children: [
4967
4969
  /* @__PURE__ */ jsx40(PasteTransformerPlugin, { transformPaste }),
4968
- /* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: useInputWithNoVariables }),
4970
+ /* @__PURE__ */ jsx40(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
4969
4971
  editorRef ? /* @__PURE__ */ jsx40(EditorRefPlugin, { editorRef }) : null,
4970
4972
  body
4971
4973
  ]
@@ -5023,7 +5025,7 @@ function ParameterConnectionIndicator({
5023
5025
  return result;
5024
5026
  }, [value]);
5025
5027
  return /* @__PURE__ */ jsxs24(HorizontalRhythm5, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5026
- /* @__PURE__ */ jsx41("div", { css: { flex: 1 }, children }),
5028
+ /* @__PURE__ */ jsx41("div", { css: { flex: 1, maxWidth: "100%" }, children }),
5027
5029
  disabled ? null : /* @__PURE__ */ jsx41(
5028
5030
  Menu3,
5029
5031
  {
@@ -5062,13 +5064,13 @@ import { useCallback as useCallback4 } from "react";
5062
5064
  import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
5063
5065
  import { mergeRegister as mergeRegister5 } from "@lexical/utils";
5064
5066
  import { $getNodeByKey as $getNodeByKey3, COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH3 } from "lexical";
5065
- import { useEffect as useEffect15, useRef as useRef13 } from "react";
5067
+ import { useEffect as useEffect15, useRef as useRef12 } from "react";
5066
5068
  function OnDisconnectPlugin({
5067
5069
  onDisconnect
5068
5070
  }) {
5069
5071
  const [editor] = useLexicalComposerContext10();
5070
5072
  const { variables } = useVariables(true);
5071
- const variablesRef = useRef13(variables);
5073
+ const variablesRef = useRef12(variables);
5072
5074
  variablesRef.current = variables;
5073
5075
  useEffect15(() => {
5074
5076
  return mergeRegister5(
@@ -5261,8 +5263,15 @@ ${prettifyBindExpression(bindExpression)}`
5261
5263
  };
5262
5264
  }
5263
5265
 
5266
+ // src/components/Variables/util/hasReferencedVariables.ts
5267
+ import { hasReferencedVariables as canvasHasReferencedVariables } from "@uniformdev/canvas";
5268
+ function hasReferencedVariables2(value) {
5269
+ return canvasHasReferencedVariables(value) > 0;
5270
+ }
5271
+
5264
5272
  // src/components/Variables/VariablesList.tsx
5265
5273
  import { css as css27 } from "@emotion/react";
5274
+ import { CgTrash } from "@react-icons/all-files/cg/CgTrash";
5266
5275
  import {
5267
5276
  AddListButton,
5268
5277
  button,
@@ -5397,7 +5406,7 @@ function VariablesList() {
5397
5406
  ],
5398
5407
  "aria-controls": text,
5399
5408
  onClick: () => dispatch({ type: "remove", variable: name }),
5400
- children: /* @__PURE__ */ jsx44(Icon5, { icon: "trash", iconColor: "red" })
5409
+ children: /* @__PURE__ */ jsx44(Icon5, { icon: CgTrash, iconColor: "red" })
5401
5410
  }
5402
5411
  ) })
5403
5412
  ]
@@ -6232,11 +6241,11 @@ import { LoadingIndicator as LoadingIndicator3, Theme as Theme2 } from "@uniform
6232
6241
 
6233
6242
  // src/hooks/useInitializeUniformMeshSdk.ts
6234
6243
  import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
6235
- import { useEffect as useEffect16, useRef as useRef14, useState as useState15 } from "react";
6244
+ import { useEffect as useEffect16, useRef as useRef13, useState as useState15 } from "react";
6236
6245
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
6237
6246
  const [error, setError] = useState15();
6238
6247
  const [sdk, setSdk] = useState15();
6239
- const initializationInProgress = useRef14(false);
6248
+ const initializationInProgress = useRef13(false);
6240
6249
  useEffect16(
6241
6250
  () => {
6242
6251
  if (typeof window === "undefined" || sdk) {
@@ -6320,7 +6329,7 @@ var DataRefreshButton = ({
6320
6329
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
6321
6330
  import { css as css33 } from "@emotion/react";
6322
6331
  import { bindVariables } from "@uniformdev/canvas";
6323
- import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
6332
+ import { Callout as Callout5, Container, ScrollableList, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
6324
6333
 
6325
6334
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
6326
6335
  import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
@@ -6639,7 +6648,7 @@ var ObjectSearchContainer = ({
6639
6648
  }
6640
6649
  ]);
6641
6650
  };
6642
- return /* @__PURE__ */ jsx61(IconsProvider, { children: /* @__PURE__ */ jsxs35(VerticalRhythm3, { children: [
6651
+ return /* @__PURE__ */ jsxs35(VerticalRhythm3, { children: [
6643
6652
  /* @__PURE__ */ jsx61(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx61(
6644
6653
  InputVariables,
6645
6654
  {
@@ -6656,7 +6665,7 @@ var ObjectSearchContainer = ({
6656
6665
  }
6657
6666
  ) : body }),
6658
6667
  children
6659
- ] }) });
6668
+ ] });
6660
6669
  };
6661
6670
  var DefaultResultList = () => {
6662
6671
  var _a;
@@ -6785,7 +6794,8 @@ var ButtonStyles = css35`
6785
6794
  font-size: var(--fs-sm);
6786
6795
  line-height: 1;
6787
6796
  gap: var(--spacing-xs);
6788
- transition: border-color var(--duration-fast) var(--timing-ease-out),
6797
+ transition:
6798
+ border-color var(--duration-fast) var(--timing-ease-out),
6789
6799
  background-color var(--duration-fast) var(--timing-ease-out);
6790
6800
 
6791
6801
  &:hover {
@@ -7245,7 +7255,7 @@ var QueryFilter = ({
7245
7255
  };
7246
7256
 
7247
7257
  // src/components/ParamTypeDynamicDataProvider.tsx
7248
- import { useEffect as useEffect18, useMemo as useMemo16, useRef as useRef15 } from "react";
7258
+ import { useEffect as useEffect18, useMemo as useMemo16, useRef as useRef14 } from "react";
7249
7259
  import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
7250
7260
  function ParamTypeDynamicDataProvider(props) {
7251
7261
  const { children } = props;
@@ -7267,7 +7277,7 @@ var JsonMeshVariableEditor = ({
7267
7277
  variable,
7268
7278
  context
7269
7279
  }) => {
7270
- const sillyRef = useRef15(false);
7280
+ const sillyRef = useRef14(false);
7271
7281
  const { editConnectedData } = useMeshLocation("paramType");
7272
7282
  useEffect18(() => {
7273
7283
  if (sillyRef.current) {
@@ -7301,371 +7311,445 @@ var JsonMeshVariableEditor = ({
7301
7311
  var NUMBER_OPERATORS = [
7302
7312
  {
7303
7313
  label: "equals...",
7304
- symbol: "=",
7305
7314
  value: "eq",
7306
- editorType: "number"
7315
+ editorType: "number",
7316
+ expectedValueType: "single"
7307
7317
  },
7308
7318
  {
7309
7319
  label: "does not equal...",
7310
- symbol: "\u2260",
7311
7320
  value: "neq",
7312
- editorType: "number"
7321
+ editorType: "number",
7322
+ expectedValueType: "single"
7313
7323
  },
7314
7324
  {
7315
7325
  label: "greater than...",
7316
- symbol: ">",
7317
7326
  value: "gt",
7318
- editorType: "number"
7327
+ editorType: "number",
7328
+ expectedValueType: "single"
7319
7329
  },
7320
7330
  {
7321
7331
  label: "greater than or equal to...",
7322
- symbol: "\u2265",
7323
7332
  value: "gte",
7324
- editorType: "number"
7333
+ editorType: "number",
7334
+ expectedValueType: "single"
7325
7335
  },
7326
7336
  {
7327
7337
  label: "less than...",
7328
- symbol: "<",
7329
7338
  value: "lt",
7330
- editorType: "number"
7339
+ editorType: "number",
7340
+ expectedValueType: "single"
7331
7341
  },
7332
7342
  {
7333
7343
  label: "less than or equal to...",
7334
- symbol: "\u2264",
7335
7344
  value: "lte",
7336
- editorType: "number"
7345
+ editorType: "number",
7346
+ expectedValueType: "single"
7337
7347
  },
7338
7348
  {
7339
7349
  label: "is empty",
7340
7350
  value: "ndef",
7341
- editorType: "empty"
7351
+ editorType: "empty",
7352
+ expectedValueType: "false"
7342
7353
  },
7343
7354
  {
7344
7355
  label: "is between...",
7345
7356
  value: "between",
7346
- editorType: "numberRange"
7357
+ editorType: "numberRange",
7358
+ expectedValueType: "between"
7347
7359
  },
7348
7360
  {
7349
7361
  label: "is not empty",
7350
7362
  value: "def",
7351
- editorType: "empty"
7363
+ editorType: "empty",
7364
+ expectedValueType: "true"
7352
7365
  }
7353
7366
  ];
7354
7367
  var DATE_OPERATORS = [
7355
7368
  {
7356
7369
  label: "is",
7357
7370
  value: "eq",
7358
- editorType: "date"
7371
+ editorType: "date",
7372
+ expectedValueType: "single"
7359
7373
  },
7360
7374
  {
7361
7375
  label: "is between...",
7362
7376
  value: "between",
7363
- editorType: "dateRange"
7377
+ editorType: "dateRange",
7378
+ expectedValueType: "between"
7364
7379
  },
7365
7380
  {
7366
7381
  label: "is before...",
7367
7382
  value: "lt",
7368
- editorType: "date"
7383
+ editorType: "date",
7384
+ expectedValueType: "single"
7369
7385
  },
7370
7386
  {
7371
7387
  label: "is after...",
7372
7388
  value: "gt",
7373
- editorType: "date"
7389
+ editorType: "date",
7390
+ expectedValueType: "single"
7374
7391
  },
7375
7392
  {
7376
7393
  label: "is on or before...",
7377
7394
  value: "lte",
7378
- editorType: "date"
7395
+ editorType: "date",
7396
+ expectedValueType: "single"
7379
7397
  },
7380
7398
  {
7381
7399
  label: "is on or after...",
7382
7400
  value: "gte",
7383
- editorType: "date"
7401
+ editorType: "date",
7402
+ expectedValueType: "single"
7384
7403
  },
7385
7404
  {
7386
7405
  label: "is empty",
7387
7406
  value: "ndef",
7388
- editorType: "empty"
7407
+ editorType: "empty",
7408
+ expectedValueType: "false"
7389
7409
  },
7390
7410
  {
7391
7411
  label: "is not",
7392
7412
  value: "neq",
7393
- editorType: "date"
7413
+ editorType: "date",
7414
+ expectedValueType: "single"
7394
7415
  },
7395
7416
  {
7396
7417
  label: "is not empty",
7397
7418
  value: "def",
7398
- editorType: "empty"
7419
+ editorType: "empty",
7420
+ expectedValueType: "true"
7399
7421
  }
7400
7422
  ];
7401
7423
  var TEXTBOX_OPERATORS = [
7402
7424
  {
7403
7425
  label: "contains...",
7404
7426
  value: "match",
7405
- editorType: "text"
7427
+ editorType: "text",
7428
+ expectedValueType: "single"
7406
7429
  },
7407
7430
  {
7408
7431
  label: "is",
7409
7432
  value: "eq",
7410
- editorType: "text"
7433
+ editorType: "text",
7434
+ expectedValueType: "single"
7411
7435
  },
7412
7436
  {
7413
7437
  label: "is empty",
7414
7438
  value: "ndef",
7415
- editorType: "empty"
7439
+ editorType: "empty",
7440
+ expectedValueType: "false"
7416
7441
  },
7417
7442
  {
7418
7443
  label: "starts with...",
7419
7444
  value: "starts",
7420
- editorType: "text"
7445
+ editorType: "text",
7446
+ expectedValueType: "single"
7421
7447
  },
7422
7448
  {
7423
7449
  label: "is not",
7424
7450
  value: "neq",
7425
- editorType: "text"
7451
+ editorType: "text",
7452
+ expectedValueType: "single"
7426
7453
  },
7427
7454
  {
7428
7455
  label: "is not empty",
7429
7456
  value: "def",
7430
- editorType: "empty"
7457
+ editorType: "empty",
7458
+ expectedValueType: "true"
7431
7459
  }
7432
7460
  ];
7433
7461
  var USER_OPERATORS = [
7434
7462
  {
7435
7463
  label: "contains...",
7436
7464
  value: "match",
7437
- editorType: "text"
7465
+ editorType: "text",
7466
+ expectedValueType: "single"
7438
7467
  },
7439
7468
  {
7440
7469
  label: "is",
7441
7470
  value: "eq",
7442
- editorType: "text"
7471
+ editorType: "text",
7472
+ expectedValueType: "single"
7443
7473
  },
7444
7474
  {
7445
7475
  label: "starts with...",
7446
7476
  value: "starts",
7447
- editorType: "text"
7477
+ editorType: "text",
7478
+ expectedValueType: "single"
7448
7479
  },
7449
7480
  {
7450
7481
  label: "is not",
7451
7482
  value: "neq",
7452
- editorType: "text"
7483
+ editorType: "text",
7484
+ expectedValueType: "single"
7453
7485
  }
7454
7486
  ];
7455
- var SYSTEM_DATE_OPERATORS = [
7487
+ var DATE_TIME_OPERATORS = [
7456
7488
  {
7457
7489
  label: "is",
7458
7490
  value: "sys-date-eq",
7459
- editorType: "date"
7491
+ editorType: "date",
7492
+ expectedValueType: "single"
7460
7493
  },
7461
7494
  {
7462
7495
  label: "is between...",
7463
7496
  value: "sys-date-between",
7464
- editorType: "dateRange"
7497
+ editorType: "dateRange",
7498
+ expectedValueType: "between"
7465
7499
  },
7466
7500
  {
7467
7501
  label: "is before...",
7468
7502
  value: "sys-date-lt",
7469
- editorType: "date"
7503
+ editorType: "date",
7504
+ expectedValueType: "single"
7470
7505
  },
7471
7506
  {
7472
7507
  label: "is after...",
7473
7508
  value: "sys-date-gt",
7474
- editorType: "date"
7509
+ editorType: "date",
7510
+ expectedValueType: "single"
7475
7511
  },
7476
7512
  {
7477
7513
  label: "is on or before...",
7478
7514
  value: "sys-date-lte",
7479
- editorType: "date"
7515
+ editorType: "date",
7516
+ expectedValueType: "single"
7480
7517
  },
7481
7518
  {
7482
7519
  label: "is on or after...",
7483
7520
  value: "sys-date-gte",
7484
- editorType: "date"
7521
+ editorType: "date",
7522
+ expectedValueType: "single"
7523
+ },
7524
+ {
7525
+ label: "is empty",
7526
+ value: "ndef",
7527
+ editorType: "empty",
7528
+ expectedValueType: "false"
7529
+ },
7530
+ {
7531
+ label: "is not empty",
7532
+ value: "def",
7533
+ editorType: "empty",
7534
+ expectedValueType: "true"
7485
7535
  }
7486
7536
  ];
7487
7537
  var RICHTEXT_OPERATORS = [
7488
7538
  {
7489
7539
  label: "contains...",
7490
7540
  value: "match",
7491
- editorType: "text"
7541
+ editorType: "text",
7542
+ expectedValueType: "single"
7492
7543
  },
7493
7544
  {
7494
7545
  label: "is empty",
7495
7546
  value: "ndef",
7496
- editorType: "empty"
7547
+ editorType: "empty",
7548
+ expectedValueType: "false"
7497
7549
  },
7498
7550
  {
7499
7551
  label: "starts with...",
7500
7552
  value: "starts",
7501
- editorType: "text"
7553
+ editorType: "text",
7554
+ expectedValueType: "single"
7502
7555
  },
7503
7556
  {
7504
7557
  label: "is not empty",
7505
7558
  value: "def",
7506
- editorType: "empty"
7559
+ editorType: "empty",
7560
+ expectedValueType: "true"
7507
7561
  }
7508
7562
  ];
7509
7563
  var CHECKBOX_OPERATORS = [
7510
7564
  {
7511
7565
  label: "is checked",
7512
7566
  value: "def",
7513
- editorType: "empty"
7567
+ editorType: "empty",
7568
+ expectedValueType: "true"
7514
7569
  },
7515
7570
  {
7516
7571
  label: "is not checked",
7517
7572
  value: "ndef",
7518
- editorType: "empty"
7573
+ editorType: "empty",
7574
+ expectedValueType: "false"
7519
7575
  }
7520
7576
  ];
7521
7577
  var SYSTEM_FIELD_OPERATORS = [
7522
7578
  {
7523
7579
  label: "is",
7524
7580
  value: "eq",
7525
- editorType: "singleChoice"
7581
+ editorType: "singleChoice",
7582
+ expectedValueType: "single"
7526
7583
  },
7527
7584
  {
7528
7585
  label: "is any of...",
7529
7586
  value: "in",
7530
- editorType: "multiChoice"
7587
+ editorType: "multiChoice",
7588
+ expectedValueType: "array"
7531
7589
  },
7532
7590
  {
7533
7591
  label: "is not",
7534
7592
  value: "neq",
7535
- editorType: "singleChoice"
7593
+ editorType: "singleChoice",
7594
+ expectedValueType: "single"
7536
7595
  },
7537
7596
  {
7538
7597
  label: "is none of...",
7539
7598
  value: "nin",
7540
- editorType: "multiChoice"
7599
+ editorType: "multiChoice",
7600
+ expectedValueType: "array"
7541
7601
  }
7542
7602
  ];
7543
7603
  var OPTIONAL_SYSTEM_FIELD_OPERATORS = [
7544
7604
  {
7545
7605
  label: "is",
7546
7606
  value: "eq",
7547
- editorType: "singleChoice"
7607
+ editorType: "singleChoice",
7608
+ expectedValueType: "single"
7548
7609
  },
7549
7610
  {
7550
7611
  label: "is any of...",
7551
7612
  value: "in",
7552
- editorType: "multiChoice"
7613
+ editorType: "multiChoice",
7614
+ expectedValueType: "array"
7553
7615
  },
7554
7616
  {
7555
7617
  label: "is empty",
7556
7618
  value: "ndef",
7557
- editorType: "empty"
7619
+ editorType: "empty",
7620
+ expectedValueType: "false"
7558
7621
  },
7559
7622
  {
7560
7623
  label: "is not",
7561
7624
  value: "neq",
7562
- editorType: "singleChoice"
7625
+ editorType: "singleChoice",
7626
+ expectedValueType: "single"
7563
7627
  },
7564
7628
  {
7565
7629
  label: "is none of...",
7566
7630
  value: "nin",
7567
- editorType: "multiChoice"
7631
+ editorType: "multiChoice",
7632
+ expectedValueType: "array"
7568
7633
  },
7569
7634
  {
7570
7635
  label: "is not empty",
7571
7636
  value: "def",
7572
- editorType: "empty"
7637
+ editorType: "empty",
7638
+ expectedValueType: "true"
7573
7639
  }
7574
7640
  ];
7575
7641
  var PUBLISH_STATUS_FIELD_OPERATORS = [
7576
7642
  {
7577
7643
  label: "is",
7578
7644
  value: "eq",
7579
- editorType: "statusSingleChoice"
7645
+ editorType: "statusSingleChoice",
7646
+ expectedValueType: "single"
7580
7647
  },
7581
7648
  {
7582
7649
  label: "is any of...",
7583
7650
  value: "in",
7584
- editorType: "statusMultiChoice"
7651
+ editorType: "statusMultiChoice",
7652
+ expectedValueType: "array"
7585
7653
  },
7586
7654
  {
7587
7655
  label: "is not",
7588
7656
  value: "neq",
7589
- editorType: "statusSingleChoice"
7657
+ editorType: "statusSingleChoice",
7658
+ expectedValueType: "single"
7590
7659
  },
7591
7660
  {
7592
7661
  label: "is none of...",
7593
7662
  value: "nin",
7594
- editorType: "statusMultiChoice"
7663
+ editorType: "statusMultiChoice",
7664
+ expectedValueType: "array"
7595
7665
  }
7596
7666
  ];
7597
7667
  var SELECT_OPERATORS = [
7598
7668
  {
7599
7669
  label: "is",
7600
7670
  value: "eq",
7601
- editorType: "singleChoice"
7671
+ editorType: "singleChoice",
7672
+ expectedValueType: "single"
7602
7673
  },
7603
7674
  {
7604
7675
  label: "is any of...",
7605
7676
  value: "in",
7606
- editorType: "multiChoice"
7677
+ editorType: "multiChoice",
7678
+ expectedValueType: "array"
7607
7679
  },
7608
7680
  {
7609
7681
  label: "is empty",
7610
7682
  value: "ndef",
7611
- editorType: "empty"
7683
+ editorType: "empty",
7684
+ expectedValueType: "false"
7612
7685
  },
7613
7686
  {
7614
7687
  label: "contains...",
7615
7688
  value: "match",
7616
- editorType: "text"
7689
+ editorType: "text",
7690
+ expectedValueType: "single"
7617
7691
  },
7618
7692
  {
7619
7693
  label: "starts with...",
7620
7694
  value: "starts",
7621
- editorType: "text"
7695
+ editorType: "text",
7696
+ expectedValueType: "single"
7622
7697
  },
7623
7698
  {
7624
7699
  label: "is not",
7625
7700
  value: "neq",
7626
- editorType: "singleChoice"
7701
+ editorType: "singleChoice",
7702
+ expectedValueType: "single"
7627
7703
  },
7628
7704
  {
7629
7705
  label: "is none of...",
7630
7706
  value: "nin",
7631
- editorType: "multiChoice"
7707
+ editorType: "multiChoice",
7708
+ expectedValueType: "array"
7632
7709
  },
7633
7710
  {
7634
7711
  label: "is not empty",
7635
7712
  value: "def",
7636
- editorType: "empty"
7713
+ editorType: "empty",
7714
+ expectedValueType: "true"
7637
7715
  }
7638
7716
  ];
7639
7717
  var MULTI_SELECT_OPERATORS = [
7640
7718
  {
7641
7719
  label: "is",
7642
7720
  value: "eq",
7643
- editorType: "singleChoice"
7721
+ editorType: "singleChoice",
7722
+ expectedValueType: "single"
7644
7723
  },
7645
7724
  {
7646
7725
  label: "is any of...",
7647
7726
  value: "in",
7648
- editorType: "multiChoice"
7727
+ editorType: "multiChoice",
7728
+ expectedValueType: "array"
7649
7729
  },
7650
7730
  {
7651
7731
  label: "is empty",
7652
7732
  value: "ndef",
7653
- editorType: "empty"
7733
+ editorType: "empty",
7734
+ expectedValueType: "false"
7654
7735
  },
7655
7736
  {
7656
7737
  label: "is not",
7657
7738
  value: "neq",
7658
- editorType: "singleChoice"
7739
+ editorType: "singleChoice",
7740
+ expectedValueType: "single"
7659
7741
  },
7660
7742
  {
7661
7743
  label: "is none of...",
7662
7744
  value: "nin",
7663
- editorType: "multiChoice"
7745
+ editorType: "multiChoice",
7746
+ expectedValueType: "array"
7664
7747
  },
7665
7748
  {
7666
7749
  label: "is not empty",
7667
7750
  value: "def",
7668
- editorType: "empty"
7751
+ editorType: "empty",
7752
+ expectedValueType: "true"
7669
7753
  }
7670
7754
  ];
7671
7755
 
@@ -8245,7 +8329,7 @@ var TextMultiChoiceEditor = ({
8245
8329
  };
8246
8330
 
8247
8331
  // src/components/SearchAndFilter/FilterButton.tsx
8248
- import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
8332
+ import { Counter as Counter2, customIcons, Icon as Icon6 } from "@uniformdev/design-system";
8249
8333
 
8250
8334
  // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
8251
8335
  import { css as css38 } from "@emotion/react";
@@ -8315,13 +8399,16 @@ var ConditionalInputRow = css38`
8315
8399
  ${cq("764px")} {
8316
8400
  align-items: flex-start;
8317
8401
  display: grid;
8318
- grid-template-columns: 200px 160px 1fr 32px;
8402
+ grid-template-columns: 250px 160px 1fr 32px;
8319
8403
 
8320
8404
  & > div:nth-child(n) {
8321
8405
  width: auto;
8322
8406
  }
8323
8407
  }
8324
8408
  `;
8409
+ var ConditionalInputRowEmpty = css38`
8410
+ flex-wrap: nowrap;
8411
+ `;
8325
8412
  var SearchInput = css38`
8326
8413
  max-height: 40px;
8327
8414
  min-height: unset;
@@ -8364,7 +8451,8 @@ var FilterButton = css38`
8364
8451
  gap: var(--spacing-sm);
8365
8452
  padding: var(--spacing-sm) var(--spacing-base);
8366
8453
  max-height: 40px;
8367
- transition: color var(--duration-fast) var(--timing-ease-out),
8454
+ transition:
8455
+ color var(--duration-fast) var(--timing-ease-out),
8368
8456
  background-color var(--duration-fast) var(--timing-ease-out),
8369
8457
  border-color var(--duration-fast) var(--timing-ease-out),
8370
8458
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -8459,6 +8547,9 @@ var ResetConditionsBtn = css38`
8459
8547
  &:focus {
8460
8548
  color: var(--action-destructive-hover);
8461
8549
  }
8550
+ &:disabled {
8551
+ color: var(--gray-400);
8552
+ }
8462
8553
  `;
8463
8554
  var IconBtn = css38`
8464
8555
  align-self: center;
@@ -8489,15 +8580,26 @@ var SearchAndFilterButtonGroup = css38`
8489
8580
  margin-top: var(--spacing-xs);
8490
8581
  margin-left: calc(56px + var(--spacing-md));
8491
8582
  `;
8583
+ var SearchAndFilterAdditionalContainer = css38`
8584
+ align-items: center;
8585
+ border-top: 1px solid var(--gray-300);
8586
+ display: flex;
8587
+ flex-wrap: nowrap;
8588
+ gap: var(--spacing-base);
8589
+ padding: var(--spacing-base) var(--spacing-md) 0;
8590
+ position: relative;
8591
+ z-index: 0;
8592
+ `;
8492
8593
 
8493
8594
  // src/components/SearchAndFilter/FilterButton.tsx
8494
8595
  import { jsx as jsx81, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
8495
8596
  var FilterButton2 = ({
8496
8597
  text = "Filters",
8497
- icon = "filter-add",
8598
+ icon = customIcons["filter-add"],
8498
8599
  filterCount,
8499
8600
  hasSelectedValue,
8500
8601
  dataTestId,
8602
+ showDropdownIcon,
8501
8603
  ...props
8502
8604
  }) => {
8503
8605
  return /* @__PURE__ */ jsxs44(
@@ -8514,7 +8616,8 @@ var FilterButton2 = ({
8514
8616
  children: [
8515
8617
  /* @__PURE__ */ jsx81(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
8516
8618
  /* @__PURE__ */ jsx81("span", { css: FilterButtonText, children: text }),
8517
- filterCount ? /* @__PURE__ */ jsx81(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
8619
+ filterCount ? /* @__PURE__ */ jsx81(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null,
8620
+ showDropdownIcon ? /* @__PURE__ */ jsx81(Icon6, { icon: "chevron-down", iconColor: "currentColor", size: "1rem" }) : null
8518
8621
  ]
8519
8622
  }
8520
8623
  );
@@ -8522,9 +8625,10 @@ var FilterButton2 = ({
8522
8625
 
8523
8626
  // src/components/SearchAndFilter/FilterControls.tsx
8524
8627
  import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
8628
+ import { hasReferencedVariables as hasReferencedVariables3 } from "@uniformdev/canvas";
8525
8629
  import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
8526
8630
  import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
8527
- import { useEffect as useEffect22, useRef as useRef16, useState as useState25 } from "react";
8631
+ import { useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
8528
8632
  import { useDebounce as useDebounce9 } from "react-use";
8529
8633
  import { v4 as v43 } from "uuid";
8530
8634
 
@@ -8563,7 +8667,7 @@ var filterMapper = {
8563
8667
  statusSingleChoice: StatusSingleEditor,
8564
8668
  empty: null
8565
8669
  };
8566
- function withInputVariables(WrappedComponent) {
8670
+ function withInputVariables(WrappedComponent, noSwapping = false) {
8567
8671
  const WithInputVariables = (props) => {
8568
8672
  if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8569
8673
  return /* @__PURE__ */ jsx82(WrappedComponent, { ...props });
@@ -8576,7 +8680,7 @@ function withInputVariables(WrappedComponent) {
8576
8680
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8577
8681
  value: props.value,
8578
8682
  disabled: props.disabled,
8579
- inputWhenNoVariables: /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8683
+ inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8580
8684
  }
8581
8685
  );
8582
8686
  };
@@ -8606,7 +8710,7 @@ var bindableFiltersMapper = {
8606
8710
  multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
8607
8711
  singleChoice: withInputVariables(FilterSingleChoiceEditor),
8608
8712
  date: withInputVariables(DateEditor),
8609
- text: withInputVariables(TextEditor),
8713
+ text: withInputVariables(TextEditor, true),
8610
8714
  number: withInputVariables(NumberEditor)
8611
8715
  };
8612
8716
 
@@ -8638,6 +8742,7 @@ var SearchAndFilterProvider = ({
8638
8742
  filters,
8639
8743
  filterOptions,
8640
8744
  filterVisible = false,
8745
+ alwaysVisible = false,
8641
8746
  defaultSearchTerm = "",
8642
8747
  onSearchChange,
8643
8748
  onChange,
@@ -8649,7 +8754,7 @@ var SearchAndFilterProvider = ({
8649
8754
  }) => {
8650
8755
  const [searchTerm, setSearchTerm] = useState24(defaultSearchTerm);
8651
8756
  const deferredSearchTerm = useDeferredValue2(searchTerm);
8652
- const [filterVisibility, setFilterVisibility] = useState24(filterVisible);
8757
+ const [filterVisibility, setFilterVisibility] = useState24(alwaysVisible || filterVisible);
8653
8758
  const handleSearchTerm = useCallback6(
8654
8759
  (term) => {
8655
8760
  setSearchTerm(term);
@@ -8658,8 +8763,13 @@ var SearchAndFilterProvider = ({
8658
8763
  [setSearchTerm, onSearchChange]
8659
8764
  );
8660
8765
  const handleToggleFilterVisibility = useCallback6(
8661
- (visible) => setFilterVisibility(visible),
8662
- [setFilterVisibility]
8766
+ (visible) => {
8767
+ if (alwaysVisible) {
8768
+ return;
8769
+ }
8770
+ setFilterVisibility(visible);
8771
+ },
8772
+ [alwaysVisible]
8663
8773
  );
8664
8774
  const handleAddFilter = useCallback6(() => {
8665
8775
  onChange([...filters, { field: "", operator: "", value: "" }]);
@@ -8685,7 +8795,7 @@ var SearchAndFilterProvider = ({
8685
8795
  if (filterVisibility) {
8686
8796
  const handleEscKeyFilterClose = (e) => {
8687
8797
  if (e.key === "Escape") {
8688
- setFilterVisibility(false);
8798
+ handleToggleFilterVisibility(false);
8689
8799
  }
8690
8800
  };
8691
8801
  document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
@@ -8693,7 +8803,7 @@ var SearchAndFilterProvider = ({
8693
8803
  document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8694
8804
  };
8695
8805
  }
8696
- }, [filterVisibility]);
8806
+ }, [filterVisibility, handleToggleFilterVisibility]);
8697
8807
  return /* @__PURE__ */ jsx83(
8698
8808
  SearchAndFilterContext.Provider,
8699
8809
  {
@@ -8736,8 +8846,8 @@ var FilterControls = ({
8736
8846
  searchTerm,
8737
8847
  allowBindingSearchTerm
8738
8848
  } = useSearchAndFilter();
8739
- const editorRef = useRef16(null);
8740
- const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8849
+ const editorRef = useRef15(null);
8850
+ const variableRefernceCountInSearchTerm = hasReferencedVariables3(searchTerm);
8741
8851
  const [idToResetInputVariables, setIdToResetInputVariables] = useState25("data-resource-search-term-input");
8742
8852
  const [localeSearchTerm, setLocaleSearchTerm] = useState25(searchTerm);
8743
8853
  useDebounce9(
@@ -8791,7 +8901,7 @@ var FilterControls = ({
8791
8901
  )
8792
8902
  }
8793
8903
  ),
8794
- hasVariableInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
8904
+ variableRefernceCountInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
8795
8905
  "button",
8796
8906
  {
8797
8907
  css: ClearSearchButtonStyles,
@@ -8814,89 +8924,28 @@ var FilterControls = ({
8814
8924
  };
8815
8925
 
8816
8926
  // src/components/SearchAndFilter/FilterItem.tsx
8927
+ import { CgTrash as CgTrash2 } from "@react-icons/all-files/cg/CgTrash";
8817
8928
  import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
8818
8929
  import { useMemo as useMemo23 } from "react";
8819
8930
 
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
- };
8931
+ // src/components/SearchAndFilter/util/isFilterBindable.ts
8932
+ function isFilterBindable(filter, operator) {
8933
+ var _a, _b;
8934
+ return (_b = (_a = operator == null ? void 0 : operator.bindable) != null ? _a : filter == null ? void 0 : filter.bindable) != null ? _b : false;
8935
+ }
8888
8936
 
8889
8937
  // src/components/SearchAndFilter/FilterItem.tsx
8890
- import { jsx as jsx86, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
8938
+ import { jsx as jsx85, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8891
8939
  var FilterItem = ({
8892
8940
  index,
8893
- paramOptions,
8894
8941
  operatorOptions,
8895
8942
  valueOptions,
8896
- onParamChange,
8943
+ onFilterOptionChange,
8944
+ onFilterDynamicChange,
8897
8945
  onOperatorChange,
8898
8946
  onValueChange,
8899
- initialCriteriaTitle = "Where"
8947
+ initialCriteriaTitle = "Where",
8948
+ criteriaGroupOperator = "and"
8900
8949
  }) => {
8901
8950
  var _a, _b;
8902
8951
  const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
@@ -8906,23 +8955,24 @@ var FilterItem = ({
8906
8955
  const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
8907
8956
  const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo23(() => {
8908
8957
  var _a2;
8909
- const currentSelectedFilter = filterOptions.find((item) => {
8958
+ const currentSelectedFilterGroup = filterOptions.find((item) => {
8910
8959
  var _a3;
8911
8960
  return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
8912
8961
  });
8913
- const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
8962
+ const selectedFilterOption = (_a2 = currentSelectedFilterGroup == null ? void 0 : currentSelectedFilterGroup.options) == null ? void 0 : _a2.find((item) => {
8914
8963
  return filters[index].field === item.value;
8915
8964
  });
8916
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
8965
+ const isCurrentFieldReadOnly = selectedFilterOption == null ? void 0 : selectedFilterOption.readOnly;
8917
8966
  const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
8918
8967
  return filters[index].operator === item.value;
8919
8968
  });
8969
+ const bindable2 = isFilterBindable(selectedFilterOption, selectedOperatorValue2);
8920
8970
  return {
8921
- selectedFieldValue: selectedFieldValue2,
8971
+ selectedFieldValue: selectedFilterOption,
8922
8972
  selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
8923
8973
  selectedMetaValue: filters[index].value,
8924
8974
  readOnly: isCurrentFieldReadOnly,
8925
- bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
8975
+ bindable: bindable2
8926
8976
  };
8927
8977
  }, [filters, filterOptions, index, operatorOptions]);
8928
8978
  const readOnlyProps = readOnly ? {
@@ -8931,17 +8981,29 @@ var FilterItem = ({
8931
8981
  menuIsOpen: false,
8932
8982
  isClearable: false
8933
8983
  } : {};
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(
8984
+ const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
8985
+ const isEmptyOperator = metaDataPossibleOptions === "empty";
8986
+ return /* @__PURE__ */ jsxs46("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8987
+ /* @__PURE__ */ jsx85("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
8988
+ /* @__PURE__ */ jsxs46("div", { css: [ConditionalInputRow, isEmptyOperator ? ConditionalInputRowEmpty : null], children: [
8989
+ CustomLeftHandComponent ? /* @__PURE__ */ jsx85(
8990
+ CustomLeftHandComponent,
8991
+ {
8992
+ filterOption: selectedFieldValue,
8993
+ filter: filters[index],
8994
+ setFilterDynamicValue: onFilterDynamicChange,
8995
+ deselectFilterOption: () => {
8996
+ onFilterOptionChange("");
8997
+ }
8998
+ }
8999
+ ) : /* @__PURE__ */ jsx85(
8938
9000
  InputComboBox5,
8939
9001
  {
8940
9002
  "aria-label": label,
8941
- options: paramOptions,
9003
+ options: filterOptions,
8942
9004
  onChange: (e) => {
8943
9005
  var _a2;
8944
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
9006
+ onFilterOptionChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8945
9007
  },
8946
9008
  isOptionDisabled: (option) => {
8947
9009
  var _a2;
@@ -8961,7 +9023,7 @@ var FilterItem = ({
8961
9023
  name: `filter-field-${index}`
8962
9024
  }
8963
9025
  ),
8964
- /* @__PURE__ */ jsx86(
9026
+ /* @__PURE__ */ jsx85(
8965
9027
  InputComboBox5,
8966
9028
  {
8967
9029
  "aria-label": operatorLabel,
@@ -8985,7 +9047,7 @@ var FilterItem = ({
8985
9047
  name: `filter-operator-${index}`
8986
9048
  }
8987
9049
  ),
8988
- /* @__PURE__ */ jsx86(
9050
+ /* @__PURE__ */ jsx85(
8989
9051
  FilterEditorRenderer,
8990
9052
  {
8991
9053
  "aria-label": metaDataLabel,
@@ -8999,7 +9061,7 @@ var FilterItem = ({
8999
9061
  valueTestId: "filter-value"
9000
9062
  }
9001
9063
  ),
9002
- readOnly ? null : /* @__PURE__ */ jsx86(
9064
+ readOnly ? null : /* @__PURE__ */ jsx85(
9003
9065
  "button",
9004
9066
  {
9005
9067
  type: "button",
@@ -9008,35 +9070,185 @@ var FilterItem = ({
9008
9070
  css: IconBtn,
9009
9071
  "data-testid": "delete-filter",
9010
9072
  disabled: filters.length === 1,
9011
- children: /* @__PURE__ */ jsx86(Icon8, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
9073
+ children: /* @__PURE__ */ jsx85(Icon8, { icon: CgTrash2, iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
9012
9074
  }
9013
9075
  )
9014
9076
  ] })
9015
9077
  ] });
9016
9078
  };
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"]);
9079
+
9080
+ // src/components/SearchAndFilter/FilterItems.tsx
9081
+ import { CgMathPlus } from "@react-icons/all-files/cg/CgMathPlus";
9082
+ import { Icon as Icon9 } from "@uniformdev/design-system";
9083
+
9084
+ // src/components/SearchAndFilter/FilterMenu.tsx
9085
+ import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
9086
+ import React13, { useEffect as useEffect23 } from "react";
9087
+ import { jsx as jsx86, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
9088
+ var SearchAndFilterOptionsContainer2 = ({
9089
+ buttonRow,
9090
+ additionalFiltersContainer,
9091
+ children
9092
+ }) => {
9093
+ return /* @__PURE__ */ jsxs47("div", { css: SearchAndFilterOptionsContainer, children: [
9094
+ /* @__PURE__ */ jsx86("div", { css: SearchAndFilterOptionsInnerContainer, children }),
9095
+ buttonRow ? /* @__PURE__ */ jsx86(
9096
+ HorizontalRhythm8,
9097
+ {
9098
+ css: SearchAndFilterButtonGroup,
9099
+ gap: "sm",
9100
+ align: "center",
9101
+ justify: "space-between",
9102
+ children: buttonRow
9103
+ }
9104
+ ) : null,
9105
+ additionalFiltersContainer ? /* @__PURE__ */ jsx86("div", { css: SearchAndFilterAdditionalContainer, children: additionalFiltersContainer }) : null
9106
+ ] });
9107
+ };
9108
+ var FilterMenu = ({
9109
+ id,
9110
+ filterTitle = "Show results",
9111
+ menuControls,
9112
+ additionalFiltersContainer,
9113
+ children,
9114
+ dataTestId,
9115
+ resetButtonText = "reset"
9116
+ }) => {
9117
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
9118
+ const innerMenuRef = React13.useRef(null);
9119
+ useEffect23(() => {
9120
+ var _a;
9121
+ if (filterVisibility) {
9122
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
9123
+ }
9124
+ }, [filterVisibility]);
9125
+ return /* @__PURE__ */ jsx86(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs47(
9126
+ SearchAndFilterOptionsContainer2,
9127
+ {
9128
+ buttonRow: menuControls,
9129
+ additionalFiltersContainer,
9130
+ children: [
9131
+ /* @__PURE__ */ jsxs47(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
9132
+ filterTitle ? /* @__PURE__ */ jsx86("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
9133
+ (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx86(
9134
+ "button",
9135
+ {
9136
+ type: "button",
9137
+ css: ResetConditionsBtn,
9138
+ disabled: filters.every((f) => !f.field),
9139
+ onClick: () => {
9140
+ handleResetFilters();
9141
+ setFilterVisibility(false);
9142
+ },
9143
+ "data-testid": "reset-filters",
9144
+ children: resetButtonText
9145
+ }
9146
+ ) : null
9147
+ ] }),
9148
+ children
9149
+ ]
9150
+ }
9151
+ ) : null });
9152
+ };
9153
+
9154
+ // src/components/SearchAndFilter/util/getNewFilterValueAfterOperatorChange.ts
9155
+ import { hasReferencedVariables as hasReferencedVariables4 } from "@uniformdev/canvas";
9156
+ function getNewFilterValueAfterOperatorChange({
9157
+ newOperatorId,
9158
+ currentFilter,
9159
+ filterOptions
9160
+ }) {
9161
+ var _a, _b, _c;
9162
+ if (Array.isArray(newOperatorId)) {
9163
+ throw new Error("Operator value must be a single string");
9164
+ }
9165
+ const result = {
9166
+ ...currentFilter,
9167
+ operator: newOperatorId,
9168
+ value: ""
9169
+ };
9170
+ const currentOperatorId = currentFilter.operator;
9171
+ let currentValue = currentFilter.value;
9172
+ const currentFieldDefinition = filterOptions.flatMap((group) => {
9173
+ var _a2;
9174
+ return (_a2 = group.options) != null ? _a2 : [];
9175
+ }).find((filter) => filter.value === currentFilter.field);
9176
+ const currentOperator = (_a = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _a.find(
9177
+ (op) => op.value === currentOperatorId
9178
+ );
9179
+ const newOperator = (_b = currentFieldDefinition == null ? void 0 : currentFieldDefinition.operatorOptions) == null ? void 0 : _b.find((op) => op.value === newOperatorId);
9180
+ if (!currentOperator || !newOperator) {
9181
+ result.value = "";
9182
+ return result;
9183
+ } else {
9184
+ const currentOperatorValueType = currentOperator.expectedValueType;
9185
+ const newOperatorValueType = newOperator.expectedValueType;
9186
+ if (!isFilterBindable(currentFieldDefinition, newOperator) && hasBindings(currentValue)) {
9187
+ currentValue = "";
9188
+ }
9189
+ if (isHardcodedOperatorValue(currentOperatorValueType)) {
9190
+ result.value = isHardcodedOperatorValue(newOperatorValueType) ? newOperatorValueType : "";
9191
+ return result;
9192
+ }
9193
+ switch (newOperatorValueType) {
9194
+ case "single":
9195
+ if (Array.isArray(currentValue)) {
9196
+ if (currentOperatorValueType === "between") {
9197
+ result.value = "";
9198
+ } else {
9199
+ result.value = (_c = currentValue[0]) != null ? _c : "";
9200
+ }
9201
+ } else {
9202
+ result.value = currentValue;
9203
+ }
9204
+ return result;
9205
+ case "array":
9206
+ if (currentOperatorValueType === "between") {
9207
+ result.value = "";
9208
+ } else if (Array.isArray(currentValue)) {
9209
+ result.value = currentValue;
9210
+ } else {
9211
+ result.value = currentValue ? [currentValue] : [];
9212
+ }
9213
+ return result;
9214
+ case "between":
9215
+ if (Array.isArray(currentValue)) {
9216
+ result.value = "";
9217
+ } else {
9218
+ result.value = [currentValue, ""];
9219
+ }
9220
+ return result;
9221
+ case "none":
9222
+ result.value = "";
9223
+ return result;
9224
+ default:
9225
+ result.value = newOperatorValueType;
9226
+ return result;
9227
+ }
9228
+ }
9229
+ }
9230
+ function isHardcodedOperatorValue(valueType) {
9231
+ return valueType !== void 0 && valueType !== "array" && valueType !== "between" && valueType !== "none" && valueType !== "single";
9232
+ }
9233
+ function hasBindings(currentValue) {
9234
+ if (currentValue === void 0) {
9235
+ return false;
9236
+ }
9237
+ if (Array.isArray(currentValue)) {
9238
+ return currentValue.some((value) => hasReferencedVariables4(value));
9239
+ }
9240
+ return hasReferencedVariables4(currentValue) > 0;
9241
+ }
9242
+
9243
+ // src/components/SearchAndFilter/FilterItems.tsx
9244
+ import { jsx as jsx87, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
9034
9245
  var FilterItems = ({
9035
9246
  addButtonText = "add condition",
9036
9247
  additionalFiltersContainer,
9037
9248
  filterTitle,
9038
9249
  resetButtonText,
9039
- initialCriteriaTitle
9250
+ initialCriteriaTitle,
9251
+ criteriaGroupOperator
9040
9252
  }) => {
9041
9253
  const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
9042
9254
  const handleUpdateFilter = (index, prop, value) => {
@@ -9044,32 +9256,16 @@ var FilterItems = ({
9044
9256
  const next = [...filters];
9045
9257
  next[index] = { ...next[index], [prop]: value };
9046
9258
  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";
9259
+ const newOperatorId = value;
9260
+ const currentFilter = next[index];
9261
+ if (!newOperatorId) {
9262
+ throw new Error("you bad");
9072
9263
  }
9264
+ next[index] = getNewFilterValueAfterOperatorChange({
9265
+ newOperatorId,
9266
+ currentFilter,
9267
+ filterOptions
9268
+ });
9073
9269
  }
9074
9270
  if (prop === "field") {
9075
9271
  const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
@@ -9078,15 +9274,16 @@ var FilterItems = ({
9078
9274
  })) == 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
9275
  next[index].operator = firstOperatorInAvailableOperators;
9080
9276
  next[index].value = "";
9277
+ next[index].dynamicField = void 0;
9081
9278
  }
9082
9279
  setFilters(next);
9083
9280
  };
9084
- return /* @__PURE__ */ jsx86(
9281
+ return /* @__PURE__ */ jsx87(
9085
9282
  FilterMenu,
9086
9283
  {
9087
9284
  id: "search-and-filter-options",
9088
9285
  dataTestId: "search-and-filter-options",
9089
- menuControls: /* @__PURE__ */ jsxs47(
9286
+ menuControls: /* @__PURE__ */ jsxs48(
9090
9287
  "button",
9091
9288
  {
9092
9289
  type: "button",
@@ -9094,7 +9291,7 @@ var FilterItems = ({
9094
9291
  onClick: handleAddFilter,
9095
9292
  "data-testid": "add-filter",
9096
9293
  children: [
9097
- /* @__PURE__ */ jsx86(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9294
+ /* @__PURE__ */ jsx87(Icon9, { icon: CgMathPlus, iconColor: "currentColor", size: "1rem" }),
9098
9295
  addButtonText
9099
9296
  ]
9100
9297
  }
@@ -9110,17 +9307,18 @@ var FilterItems = ({
9110
9307
  })) == null ? void 0 : _a.options) != null ? _b : [];
9111
9308
  const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
9112
9309
  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(
9310
+ return /* @__PURE__ */ jsx87(
9114
9311
  FilterItem,
9115
9312
  {
9116
9313
  index: i,
9117
- paramOptions: filterOptions,
9118
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
9314
+ onFilterOptionChange: (e) => handleUpdateFilter(i, "field", e),
9119
9315
  operatorOptions: possibleOperators,
9120
9316
  onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
9121
9317
  onValueChange: (e) => handleUpdateFilter(i, "value", e),
9318
+ onFilterDynamicChange: (e) => handleUpdateFilter(i, "dynamicField", e),
9122
9319
  valueOptions: possibleValueOptions,
9123
- initialCriteriaTitle
9320
+ initialCriteriaTitle,
9321
+ criteriaGroupOperator
9124
9322
  },
9125
9323
  i
9126
9324
  );
@@ -9134,7 +9332,7 @@ import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
9134
9332
 
9135
9333
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9136
9334
  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";
9335
+ import { Fragment as Fragment17, jsx as jsx88, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9138
9336
  var SearchAndFilterResultContainer = ({
9139
9337
  buttonText,
9140
9338
  clearButtonLabel = "clear",
@@ -9164,18 +9362,18 @@ var SearchAndFilterResultContainer = ({
9164
9362
  handleResetFilters();
9165
9363
  }
9166
9364
  };
9167
- return /* @__PURE__ */ jsxs48(Fragment17, { children: [
9168
- /* @__PURE__ */ jsxs48(HorizontalRhythm9, { children: [
9169
- /* @__PURE__ */ jsxs48("span", { children: [
9365
+ return /* @__PURE__ */ jsxs49(Fragment17, { children: [
9366
+ /* @__PURE__ */ jsxs49(HorizontalRhythm9, { children: [
9367
+ /* @__PURE__ */ jsxs49("span", { children: [
9170
9368
  totalResults,
9171
9369
  " results ",
9172
9370
  searchTerm ? `for "${searchTerm}"` : null
9173
9371
  ] }),
9174
- !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx87(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9372
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx88(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9175
9373
  ] }),
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(
9374
+ totalResults === 0 ? /* @__PURE__ */ jsxs49(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9375
+ calloutText ? /* @__PURE__ */ jsx88(Paragraph, { children: calloutText }) : null,
9376
+ hideClearButton ? null : /* @__PURE__ */ jsx88(
9179
9377
  Button6,
9180
9378
  {
9181
9379
  buttonType: "tertiaryOutline",
@@ -9190,14 +9388,14 @@ var SearchAndFilterResultContainer = ({
9190
9388
  };
9191
9389
 
9192
9390
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9193
- import { jsx as jsx88, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9391
+ import { jsx as jsx89, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
9194
9392
  var SearchAndFilter = ({
9195
9393
  filters,
9196
9394
  filterOptions,
9197
9395
  filterVisible,
9198
9396
  filterControls,
9199
9397
  viewSwitchControls,
9200
- resultsContainerView = /* @__PURE__ */ jsx88(SearchAndFilterResultContainer, {}),
9398
+ resultsContainerView = /* @__PURE__ */ jsx89(SearchAndFilterResultContainer, {}),
9201
9399
  filterMapper: filterMapper2 = filterMapper,
9202
9400
  additionalFiltersContainer,
9203
9401
  onChange,
@@ -9207,7 +9405,7 @@ var SearchAndFilter = ({
9207
9405
  allowBindingSearchTerm = false,
9208
9406
  resetFilterValues = []
9209
9407
  }) => {
9210
- return /* @__PURE__ */ jsx88(
9408
+ return /* @__PURE__ */ jsx89(
9211
9409
  SearchAndFilterProvider,
9212
9410
  {
9213
9411
  filters,
@@ -9220,18 +9418,18 @@ var SearchAndFilter = ({
9220
9418
  resetFilterValues,
9221
9419
  filterMapper: filterMapper2,
9222
9420
  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(
9421
+ children: /* @__PURE__ */ jsxs50(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
9422
+ /* @__PURE__ */ jsxs50("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9423
+ /* @__PURE__ */ jsx89(
9226
9424
  "div",
9227
9425
  {
9228
9426
  css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9229
- children: !filterControls ? /* @__PURE__ */ jsx88(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9427
+ children: !filterControls ? /* @__PURE__ */ jsx89(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9230
9428
  }
9231
9429
  ),
9232
9430
  viewSwitchControls
9233
9431
  ] }),
9234
- /* @__PURE__ */ jsx88(FilterItems, { additionalFiltersContainer }),
9432
+ /* @__PURE__ */ jsx89(FilterItems, { additionalFiltersContainer }),
9235
9433
  resultsContainerView
9236
9434
  ] })
9237
9435
  }
@@ -9242,7 +9440,7 @@ var SearchAndFilter = ({
9242
9440
  import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
9243
9441
  import { createContext as createContext7, useState as useState26 } from "react";
9244
9442
  import { useDebounce as useDebounce10 } from "react-use";
9245
- import { jsx as jsx89 } from "@emotion/react/jsx-runtime";
9443
+ import { jsx as jsx90 } from "@emotion/react/jsx-runtime";
9246
9444
  var SearchOnlyContext = createContext7({
9247
9445
  searchTerm: "",
9248
9446
  setSearchTerm: () => {
@@ -9259,14 +9457,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9259
9457
  300,
9260
9458
  [localeSearchTerm]
9261
9459
  );
9262
- return /* @__PURE__ */ jsx89(
9460
+ return /* @__PURE__ */ jsx90(
9263
9461
  SearchOnlyContext.Provider,
9264
9462
  {
9265
9463
  value: {
9266
9464
  searchTerm,
9267
9465
  setSearchTerm: setLocaleSearchTerm
9268
9466
  },
9269
- children: /* @__PURE__ */ jsx89("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx89(
9467
+ children: /* @__PURE__ */ jsx90("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx90(
9270
9468
  InputKeywordSearch3,
9271
9469
  {
9272
9470
  placeholder: "Search...",
@@ -9361,7 +9559,8 @@ var FilterButton3 = css39`
9361
9559
  gap: var(--spacing-sm);
9362
9560
  padding: var(--spacing-sm) var(--spacing-base);
9363
9561
  max-height: 40px;
9364
- transition: color var(--duration-fast) var(--timing-ease-out),
9562
+ transition:
9563
+ color var(--duration-fast) var(--timing-ease-out),
9365
9564
  background-color var(--duration-fast) var(--timing-ease-out),
9366
9565
  border-color var(--duration-fast) var(--timing-ease-out),
9367
9566
  box-shadow var(--duration-fast) var(--timing-ease-out);
@@ -9487,13 +9686,9 @@ var SearchAndFilterButtonGroup2 = css39`
9487
9686
  `;
9488
9687
  var SortFilterWrapper = (hiddenLocaleInput) => css39`
9489
9688
  align-items: center;
9490
- border-top: 1px solid var(--gray-300);
9491
9689
  display: flex;
9492
- flex-wrap: wrap;
9493
9690
  gap: var(--spacing-base);
9494
- padding: var(--spacing-base) var(--spacing-md) 0;
9495
- position: relative;
9496
- z-index: 0;
9691
+ flex-grow: 1;
9497
9692
 
9498
9693
  ${cq2("420px")} {
9499
9694
  display: grid;
@@ -9517,7 +9712,7 @@ var InputVariableWrapper = css39`
9517
9712
  `;
9518
9713
 
9519
9714
  // src/components/SearchAndFilter/SortItems.tsx
9520
- import { jsx as jsx90, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
9715
+ import { jsx as jsx91, jsxs as jsxs51 } from "@emotion/react/jsx-runtime";
9521
9716
  var SortItems = ({
9522
9717
  sortByLabel = "Sort by",
9523
9718
  localeLabel = "Show locale",
@@ -9539,11 +9734,11 @@ var SortItems = ({
9539
9734
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9540
9735
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9541
9736
  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(
9737
+ return /* @__PURE__ */ jsxs51("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9738
+ /* @__PURE__ */ jsxs51(VerticalRhythm8, { gap: "xs", children: [
9739
+ /* @__PURE__ */ jsx91("span", { css: Title2, children: sortByLabel }),
9740
+ /* @__PURE__ */ jsxs51("div", { css: SortFilterInputRow, children: [
9741
+ /* @__PURE__ */ jsx91(
9547
9742
  InputVariables,
9548
9743
  {
9549
9744
  disableInlineMenu: disableSortBinding,
@@ -9551,7 +9746,7 @@ var SortItems = ({
9551
9746
  value: sortField,
9552
9747
  valueToResetTo: "created_at",
9553
9748
  onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9554
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9749
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9555
9750
  InputComboBox6,
9556
9751
  {
9557
9752
  id: "sort-by-field",
@@ -9574,7 +9769,7 @@ var SortItems = ({
9574
9769
  )
9575
9770
  }
9576
9771
  ),
9577
- /* @__PURE__ */ jsx90(
9772
+ /* @__PURE__ */ jsx91(
9578
9773
  InputVariables,
9579
9774
  {
9580
9775
  disableInlineMenu: disableSortBinding,
@@ -9582,7 +9777,7 @@ var SortItems = ({
9582
9777
  valueToResetTo: "DESC",
9583
9778
  showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9584
9779
  onChange: (e) => onSortChange(`${sortField}_${e}`),
9585
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9780
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9586
9781
  SegmentedControl,
9587
9782
  {
9588
9783
  noCheckmark: true,
@@ -9614,14 +9809,14 @@ var SortItems = ({
9614
9809
  )
9615
9810
  ] })
9616
9811
  ] }),
9617
- hideLocaleOptions ? null : /* @__PURE__ */ jsx90(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx90(
9812
+ hideLocaleOptions ? null : /* @__PURE__ */ jsx91(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx91(
9618
9813
  InputVariables,
9619
9814
  {
9620
9815
  label: localeLabelValue,
9621
9816
  value: localeValue,
9622
9817
  showMenuPosition: "inline-right",
9623
9818
  onChange: (e) => onLocaleChange(e != null ? e : ""),
9624
- inputWhenNoVariables: /* @__PURE__ */ jsx90(
9819
+ inputWhenNoVariables: /* @__PURE__ */ jsx91(
9625
9820
  InputSelect8,
9626
9821
  {
9627
9822
  name: "localeReturned",
@@ -9652,14 +9847,14 @@ function createLocationValidator(setValue, validate) {
9652
9847
 
9653
9848
  // src/utils/useContentDataResourceLocaleInfo.ts
9654
9849
  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";
9850
+ import { useEffect as useEffect24, useRef as useRef16 } from "react";
9656
9851
  function useContentDataResourceLocaleInfo({
9657
9852
  locale,
9658
9853
  setLocale,
9659
9854
  dynamicInputs
9660
9855
  }) {
9661
9856
  var _a;
9662
- const setLocaleRef = useRef17(setLocale);
9857
+ const setLocaleRef = useRef16(setLocale);
9663
9858
  setLocaleRef.current = setLocale;
9664
9859
  const { flatVariables } = useVariables();
9665
9860
  const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
@@ -9720,6 +9915,7 @@ export {
9720
9915
  Callout7 as Callout,
9721
9916
  ControlledValuePlugin,
9722
9917
  DATE_OPERATORS,
9918
+ DATE_TIME_OPERATORS,
9723
9919
  DISCONNECT_VARIABLE_COMMAND,
9724
9920
  DamSelectedItem,
9725
9921
  DataRefreshButton,
@@ -9813,7 +10009,6 @@ export {
9813
10009
  RequestUrlInput,
9814
10010
  ResolvableLoadingValue,
9815
10011
  SELECT_OPERATORS,
9816
- SYSTEM_DATE_OPERATORS,
9817
10012
  SYSTEM_FIELD_OPERATORS,
9818
10013
  ScrollableList2 as ScrollableList,
9819
10014
  ScrollableListItem,
@@ -9875,7 +10070,7 @@ export {
9875
10070
  entrySearchSelectOption,
9876
10071
  entrySearchWrapper,
9877
10072
  filterMapper,
9878
- hasReferencedVariables,
10073
+ hasReferencedVariables2 as hasReferencedVariables,
9879
10074
  prettifyBindExpression,
9880
10075
  productSearchRowActiveIcon,
9881
10076
  productSearchRowCategory,
@@ -9910,6 +10105,7 @@ export {
9910
10105
  selectedItemIcon,
9911
10106
  selectedItemInner,
9912
10107
  selectedItemTitle,
10108
+ serializeVariablesEditorSerializedState,
9913
10109
  serializeVariablesEditorState,
9914
10110
  setVariablesEditorValue,
9915
10111
  urlEncodeRequestParameter,