@uniformdev/mesh-sdk-react 19.135.0 → 19.135.1-alpha.9

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
@@ -2652,6 +2652,9 @@ function DefaultDamItemRenderer({ item }) {
2652
2652
  ] }) : null;
2653
2653
  }
2654
2654
 
2655
+ // src/components/DataResourceDynamicInputProvider.tsx
2656
+ import { createContext as createContext4, useContext as useContext6 } from "react";
2657
+
2655
2658
  // src/hooks/useConnectedDataAsVariables.tsx
2656
2659
  import { useMemo as useMemo3 } from "react";
2657
2660
  function useConnectedDataAsVariables(connectedData) {
@@ -2945,15 +2948,16 @@ import {
2945
2948
  KEY_BACKSPACE_COMMAND,
2946
2949
  KEY_DELETE_COMMAND
2947
2950
  } from "lexical";
2948
- import { useCallback as useCallback3, useEffect as useEffect8 } from "react";
2951
+ import { useCallback as useCallback3, useEffect as useEffect9 } from "react";
2949
2952
 
2950
2953
  // src/components/Variables/util/prettifyBindExpression.tsx
2951
2954
  function prettifyBindExpression(bindExpression) {
2952
- return bindExpression.substring(bindExpression.lastIndexOf(":") + 1);
2955
+ const [, expression] = bindExpression.split(":");
2956
+ return expression;
2953
2957
  }
2954
2958
 
2955
2959
  // src/components/Variables/composer/VariableChip.tsx
2956
- import { MultilineChip } from "@uniformdev/design-system";
2960
+ import { MultilineChip, Tooltip, VerticalRhythm } from "@uniformdev/design-system";
2957
2961
  import { Fragment as Fragment5 } from "react";
2958
2962
  import { jsx as jsx30 } from "@emotion/react/jsx-runtime";
2959
2963
  function VariableChip({
@@ -2969,42 +2973,58 @@ function VariableChip({
2969
2973
  }) {
2970
2974
  const hasClickEvent = !!onClick;
2971
2975
  const referenceIsValidFr = isFresh ? true : referenceIsValid;
2972
- const Wrapper = referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
2976
+ const Wrapper = referenceIsValidFr === "warning" ? WarningVariableReference : referenceIsValidFr === "info" ? InfoVariableReference : referenceIsValidFr ? Fragment5 : UndefinedVariableReference;
2973
2977
  const extraTitle = !referenceIsValidFr ? `${reference} is not defined.` : hasClickEvent && clickToEdit ? "Click to edit" : void 0;
2978
+ const chippy = /* @__PURE__ */ jsx30(MultilineChip, { onClick, "aria-selected": selected ? true : void 0, "aria-disabled": disabled, children: /* @__PURE__ */ jsx30(Wrapper, { children: displayName || reference }) });
2979
+ if (tooltip) {
2980
+ const tip = tooltip ? `${tooltip}${extraTitle ? `
2981
+
2982
+ ${extraTitle}` : ""}` : extraTitle != null ? extraTitle : "";
2983
+ const tipLines = tip.split("\n");
2984
+ return /* @__PURE__ */ jsx30(
2985
+ Tooltip,
2986
+ {
2987
+ title: /* @__PURE__ */ jsx30(VerticalRhythm, { gap: "sm", children: tipLines.map((t, index) => /* @__PURE__ */ jsx30("div", { children: t }, index)) }),
2988
+ children: /* @__PURE__ */ jsx30("span", { children: chippy })
2989
+ }
2990
+ );
2991
+ }
2992
+ return chippy;
2993
+ }
2994
+ function UndefinedVariableReference({ children }) {
2974
2995
  return /* @__PURE__ */ jsx30(
2975
- MultilineChip,
2996
+ "span",
2976
2997
  {
2977
- title: tooltip ? `${tooltip}${extraTitle ? `
2978
-
2979
- ${extraTitle}` : ""}` : extraTitle,
2980
- onClick,
2981
- "aria-selected": selected ? true : void 0,
2982
- "aria-disabled": disabled,
2983
- children: /* @__PURE__ */ jsx30(Wrapper, { children: displayName || reference })
2998
+ style: {
2999
+ textDecoration: "underline",
3000
+ textDecorationStyle: "wavy",
3001
+ textDecorationColor: "var(--error)"
3002
+ },
3003
+ children
2984
3004
  }
2985
3005
  );
2986
3006
  }
2987
- function UndefinedVariableReference({ children }) {
3007
+ function InfoVariableReference({ children }) {
2988
3008
  return /* @__PURE__ */ jsx30(
2989
3009
  "span",
2990
3010
  {
2991
3011
  style: {
2992
3012
  textDecoration: "underline",
2993
3013
  textDecorationStyle: "wavy",
2994
- textDecorationColor: "red"
3014
+ textDecorationColor: "var(--primary-action-default)"
2995
3015
  },
2996
3016
  children
2997
3017
  }
2998
3018
  );
2999
3019
  }
3000
- function InfoVariableReference({ children }) {
3020
+ function WarningVariableReference({ children }) {
3001
3021
  return /* @__PURE__ */ jsx30(
3002
3022
  "span",
3003
3023
  {
3004
3024
  style: {
3005
3025
  textDecoration: "underline",
3006
3026
  textDecorationStyle: "wavy",
3007
- textDecorationColor: "blue"
3027
+ textDecorationColor: "var(--alert)"
3008
3028
  },
3009
3029
  children
3010
3030
  }
@@ -3034,7 +3054,7 @@ import {
3034
3054
  COMMAND_PRIORITY_NORMAL,
3035
3055
  createCommand
3036
3056
  } from "lexical";
3037
- import { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3057
+ import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef10, useState as useState10 } from "react";
3038
3058
  import { createPortal } from "react-dom";
3039
3059
 
3040
3060
  // src/components/Variables/toolbox/SelectVariableMenu.styles.ts
@@ -3068,7 +3088,7 @@ var variablesTipText = css18`
3068
3088
 
3069
3089
  // src/components/Variables/VariablesProvider.tsx
3070
3090
  import mitt from "mitt";
3071
- import { createContext as createContext3, useContext as useContext5, useMemo as useMemo7, useState as useState9 } from "react";
3091
+ import { createContext as createContext3, useContext as useContext5, useEffect as useEffect7, useMemo as useMemo7, useState as useState9 } from "react";
3072
3092
 
3073
3093
  // src/components/Variables/util/useVariableEditTransaction.ts
3074
3094
  import { useCallback, useEffect as useEffect6, useState as useState8 } from "react";
@@ -3265,7 +3285,8 @@ function VariablesProvider({
3265
3285
  readOnly,
3266
3286
  isLoading,
3267
3287
  children,
3268
- knownUndefinedValues = {}
3288
+ knownUndefinedValues = {},
3289
+ onChangeKnownUndefinedValue
3269
3290
  }) {
3270
3291
  const [editing, setEditing] = useState9();
3271
3292
  const [editingContext, setEditingContext] = useState9();
@@ -3332,6 +3353,15 @@ function VariablesProvider({
3332
3353
  isLoading: !!isLoading
3333
3354
  };
3334
3355
  }, [valueBasedContextValue, editVariableTxn, editing, events, knownUndefinedValues, isLoading]);
3356
+ useEffect7(() => {
3357
+ if (editing === void 0) {
3358
+ return;
3359
+ }
3360
+ const activeElement = document.activeElement;
3361
+ if (activeElement && "blur" in activeElement && typeof activeElement.blur === "function") {
3362
+ activeElement.blur();
3363
+ }
3364
+ }, [editing]);
3335
3365
  return /* @__PURE__ */ jsxs17(VariablesContext.Provider, { value: contextValue, children: [
3336
3366
  children,
3337
3367
  typeof editing !== "undefined" ? /* @__PURE__ */ jsx32(
@@ -3340,9 +3370,19 @@ function VariablesProvider({
3340
3370
  context: editingContext,
3341
3371
  onSubmit: (val, editorCompletedContext) => {
3342
3372
  contextValue.dispatch({ type: "cancelEdit" });
3343
- const { name, ...varValue } = val;
3344
- const latestValue = { ...value, [name]: varValue };
3345
- onChange == null ? void 0 : onChange(latestValue);
3373
+ if ("resultType" in val) {
3374
+ if (!onChangeKnownUndefinedValue) {
3375
+ throw new Error(
3376
+ "onChangeKnownUndefinedValue must be provided to handle known-undefined-value results"
3377
+ );
3378
+ }
3379
+ const { name, ...kuv } = val;
3380
+ onChangeKnownUndefinedValue(val.name, kuv);
3381
+ } else {
3382
+ const { name, ...varValue } = val;
3383
+ const latestValue = { ...value, [name]: varValue };
3384
+ onChange == null ? void 0 : onChange(latestValue);
3385
+ }
3346
3386
  events.emit("editCompleted", {
3347
3387
  canceled: false,
3348
3388
  selectedVariable: val,
@@ -3625,7 +3665,7 @@ function VariablesPlugin({
3625
3665
  },
3626
3666
  [editor, onSelect, queryString, replaceValueOnVariableInsert]
3627
3667
  );
3628
- useEffect7(() => {
3668
+ useEffect8(() => {
3629
3669
  return mergeRegister(
3630
3670
  editor.registerCommand(
3631
3671
  EDIT_VARIABLE_COMMAND,
@@ -3757,21 +3797,21 @@ function VariablesPlugin({
3757
3797
  ]);
3758
3798
  const updateExistingNodeIfChanged = useCallback2(
3759
3799
  (variableNode) => {
3760
- var _a, _b, _c;
3800
+ var _a, _b, _c, _d;
3761
3801
  const targetVar = variablesRef.current.variables[variableNode.reference];
3762
3802
  const targetUndefinedVar = variablesRef.current.knownUndefinedValues[variableNode.reference];
3763
3803
  const isLoadingVariables = variablesRef.current.isLoading;
3764
3804
  const currentState = variableNode.getState();
3765
- if (currentState.isFresh && !targetVar) {
3805
+ if (currentState.isFresh && !targetVar && !targetUndefinedVar) {
3766
3806
  return;
3767
3807
  }
3768
- const tooltip = (_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.info;
3808
+ 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;
3769
3809
  const newState = {
3770
3810
  ...currentState,
3771
3811
  displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || variableNode.reference,
3772
3812
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
3773
3813
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
3774
- referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
3814
+ 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),
3775
3815
  tooltip,
3776
3816
  isFresh: false
3777
3817
  };
@@ -3781,14 +3821,14 @@ function VariablesPlugin({
3781
3821
  },
3782
3822
  [canEditVariable]
3783
3823
  );
3784
- useEffect7(() => {
3824
+ useEffect8(() => {
3785
3825
  editor.update(() => {
3786
3826
  $nodesOfType2(VariableNode).forEach((variableNode) => {
3787
3827
  updateExistingNodeIfChanged(variableNode);
3788
3828
  });
3789
3829
  });
3790
- }, [editor, variables, canEditVariable, updateExistingNodeIfChanged]);
3791
- useEffect7(() => {
3830
+ }, [editor, variables, knownUndefinedValues, canEditVariable, updateExistingNodeIfChanged]);
3831
+ useEffect8(() => {
3792
3832
  return editor.registerNodeTransform(VariableNode, (variableNode) => {
3793
3833
  updateExistingNodeIfChanged(variableNode);
3794
3834
  });
@@ -3967,7 +4007,7 @@ function VariableNodeComponent({
3967
4007
  },
3968
4008
  [isSelected, nodeKey]
3969
4009
  );
3970
- useEffect8(() => {
4010
+ useEffect9(() => {
3971
4011
  return mergeRegister2(
3972
4012
  editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW),
3973
4013
  editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW),
@@ -4055,7 +4095,14 @@ function $isTargetWithinDecorator(target) {
4055
4095
  }
4056
4096
 
4057
4097
  // src/components/Variables/InputVariables.tsx
4058
- import { Caption, ErrorMessage, InfoMessage, WarningMessage } from "@uniformdev/design-system";
4098
+ import { css as css24 } from "@emotion/react";
4099
+ import {
4100
+ Caption,
4101
+ ErrorMessage,
4102
+ HorizontalRhythm as HorizontalRhythm4,
4103
+ InfoMessage,
4104
+ WarningMessage
4105
+ } from "@uniformdev/design-system";
4059
4106
  import { useState as useState13 } from "react";
4060
4107
  import { v4 as v42 } from "uuid";
4061
4108
 
@@ -4077,10 +4124,10 @@ function EditorRefPlugin({
4077
4124
  import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
4078
4125
  import { mergeRegister as mergeRegister3 } from "@lexical/utils";
4079
4126
  import { $getSelection as $getSelection3, $isRangeSelection as $isRangeSelection2, COMMAND_PRIORITY_HIGH, PASTE_COMMAND } from "lexical";
4080
- import { useEffect as useEffect9 } from "react";
4127
+ import { useEffect as useEffect10 } from "react";
4081
4128
  function PasteTransformerPlugin({ transformPaste }) {
4082
4129
  const [editor] = useLexicalComposerContext5();
4083
- useEffect9(() => {
4130
+ useEffect10(() => {
4084
4131
  return mergeRegister3(
4085
4132
  editor.registerCommand(
4086
4133
  PASTE_COMMAND,
@@ -4161,6 +4208,7 @@ var input = css21`
4161
4208
  var inputCompact = css21`
4162
4209
  border: 1px solid var(--white);
4163
4210
  padding-block: var(--spacing-sm);
4211
+ min-height: 39px;
4164
4212
  font-size: var(--fs-sm);
4165
4213
  `;
4166
4214
  var inputDisabled = css21`
@@ -4170,14 +4218,107 @@ var inputDisabled = css21`
4170
4218
  var placeholderCaption = css21`
4171
4219
  position: absolute;
4172
4220
  color: var(--gray-400);
4173
- inset: var(--spacing-base) var(--spacing-lg) var(--spacing-base) var(--spacing-base);
4221
+ inset: 12px var(--spacing-base) 12px var(--spacing-sm);
4174
4222
  overflow: hidden;
4175
4223
  text-overflow: ellipsis;
4176
4224
  white-space: nowrap;
4177
4225
  pointer-events: none;
4178
4226
  `;
4179
4227
  var placeholderCompact = css21`
4180
- inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
4228
+ inset: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-sm);
4229
+ `;
4230
+
4231
+ // src/components/Variables/styles/ParameterVariables.styles.ts
4232
+ import { css as css22 } from "@emotion/react";
4233
+ import { scrollbarStyles as scrollbarStyles3 } from "@uniformdev/design-system";
4234
+ var variableBindButton = css22`
4235
+ align-items: center;
4236
+ border: none;
4237
+ border-radius: var(--rounded-base);
4238
+ background: none;
4239
+ display: flex;
4240
+ height: 1.2rem;
4241
+ padding: var(--spacing-2xs);
4242
+ transition: background var(--duration-fast) var(--timing-ease-out),
4243
+ color var(--duration-fast) var(--timing-ease-out);
4244
+ width: 1.2rem;
4245
+
4246
+ &:hover,
4247
+ &[aria-pressed='true']:not(:disabled) {
4248
+ background: var(--brand-secondary-3);
4249
+ color: var(--white);
4250
+ }
4251
+
4252
+ &[aria-disabled='true'] {
4253
+ background: none;
4254
+ color: currentColor;
4255
+ }
4256
+
4257
+ // fixes menu resizing issue within iframes
4258
+ // see https://linear.app/uniform/issue/UNI-3068/mesh-integration-resizing-with-menus
4259
+ + [role='menu'] {
4260
+ max-height: unset;
4261
+ }
4262
+ `;
4263
+ var input2 = css22`
4264
+ display: block;
4265
+ appearance: none;
4266
+ box-sizing: border-box;
4267
+ background: var(--white);
4268
+ border: 1px solid var(--gray-200);
4269
+ border-radius: var(--rounded-sm);
4270
+ color: var(--gray-700);
4271
+ font-size: var(--fs-sm);
4272
+ line-height: 1.5;
4273
+ min-height: 2rem;
4274
+ padding: var(--spacing-sm);
4275
+ width: 100%;
4276
+ position: relative;
4277
+ white-space: normal;
4278
+ transition-property: background, border-color, color, box-shadow, border-radius;
4279
+ transition-duration: var(--duration-fast);
4280
+ transition-timing-function: var(--timing-ease-out);
4281
+
4282
+ &::placeholder {
4283
+ color: var(--gray-400);
4284
+ }
4285
+
4286
+ &:focus,
4287
+ &:focus-within {
4288
+ border-radius: var(--rounded-sm);
4289
+ box-shadow: var(--elevation-100);
4290
+ border: 1px solid var(--accent-dark-active);
4291
+ outline: none;
4292
+ }
4293
+ &:hover {
4294
+ border: 1px solid var(--accent-dark-hover);
4295
+ }
4296
+
4297
+ &:disabled,
4298
+ &:disabled::placeholder,
4299
+ &:disabled:hover {
4300
+ border-radius: var(--rounded-sm);
4301
+ cursor: not-allowed;
4302
+ color: var(--gray-400);
4303
+ }
4304
+
4305
+ &[readonly],
4306
+ &[contenteditable='false'] {
4307
+ cursor: not-allowed;
4308
+ color: var(--gray-400);
4309
+ }
4310
+
4311
+ > p {
4312
+ margin: 0;
4313
+ }
4314
+ `;
4315
+ var inputMultiLine = (lines) => css22`
4316
+ ${scrollbarStyles3}
4317
+ // 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
4318
+ // as the text looked to close to the bottom of the input
4319
+ height: calc(${lines * 1.5}em + var(--spacing-sm) + var(--spacing-xs));
4320
+ resize: vertical;
4321
+ overflow: auto;
4181
4322
  `;
4182
4323
 
4183
4324
  // src/components/Variables/toolbox/InputVariablesProvider.tsx
@@ -4258,15 +4399,15 @@ function useInputVariablesState({
4258
4399
  }
4259
4400
 
4260
4401
  // src/components/Variables/toolbox/VariableField.styles.ts
4261
- import { css as css22 } from "@emotion/react";
4262
- var labelText = css22`
4402
+ import { css as css23 } from "@emotion/react";
4403
+ var labelText = css23`
4263
4404
  align-items: center;
4264
4405
  display: flex;
4265
4406
  gap: var(--spacing-xs);
4266
4407
  font-weight: var(--fw-regular);
4267
4408
  margin: 0 0 var(--spacing-xs);
4268
4409
  `;
4269
- var variableBindButton = css22`
4410
+ var variableBindButton2 = css23`
4270
4411
  align-items: center;
4271
4412
  border: none;
4272
4413
  border-radius: var(--rounded-base);
@@ -4425,14 +4566,14 @@ function VariableField({
4425
4566
  }) {
4426
4567
  const { variables } = useVariables(true);
4427
4568
  const varCount = Object.keys(variables).length;
4428
- const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ jsx37(
4569
+ const variableSelector = (varCount > 0 || (selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.showAddVariableMenuOption)) && !disableVariables ? /* @__PURE__ */ jsx37("div", { "data-testid": "label-var-menu", children: /* @__PURE__ */ jsx37(
4429
4570
  VariablesComposerVariableMenu,
4430
4571
  {
4431
4572
  ...selectVariableMenuOptions,
4432
- buttonCss: [variableBindButton, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
4573
+ buttonCss: [variableBindButton2, selectVariableMenuOptions == null ? void 0 : selectVariableMenuOptions.buttonCss],
4433
4574
  buttonProps: isActive ? { "aria-pressed": "true" } : void 0
4434
4575
  }
4435
- ) : null;
4576
+ ) }) : null;
4436
4577
  return /* @__PURE__ */ jsxs20("div", { "data-testid": "variable-field", children: [
4437
4578
  /* @__PURE__ */ jsxs20("label", { htmlFor: id, css: labelText, "data-testid": "field-name", children: [
4438
4579
  variableSelector,
@@ -4451,10 +4592,10 @@ import { useMemo as useMemo10, useRef as useRef12, useState as useState12 } from
4451
4592
 
4452
4593
  // src/components/Variables/composer/DisablePlugin.tsx
4453
4594
  import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
4454
- import { useEffect as useEffect11 } from "react";
4595
+ import { useEffect as useEffect12 } from "react";
4455
4596
  function DisablePlugin({ disabled }) {
4456
4597
  const [editor] = useLexicalComposerContext7();
4457
- useEffect11(() => {
4598
+ useEffect12(() => {
4458
4599
  editor.setEditable(!disabled);
4459
4600
  }, [editor, disabled]);
4460
4601
  return null;
@@ -4463,10 +4604,10 @@ function DisablePlugin({ disabled }) {
4463
4604
  // src/components/Variables/composer/SingleLineTextPlugin.tsx
4464
4605
  import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
4465
4606
  import { LineBreakNode } from "lexical";
4466
- import { useEffect as useEffect12 } from "react";
4607
+ import { useEffect as useEffect13 } from "react";
4467
4608
  function SingleLineTextPlugin() {
4468
4609
  const [editor] = useLexicalComposerContext8();
4469
- useEffect12(() => {
4610
+ useEffect13(() => {
4470
4611
  editor.registerNodeTransform(LineBreakNode, (node) => {
4471
4612
  node.remove();
4472
4613
  });
@@ -4588,10 +4729,10 @@ import {
4588
4729
  CUT_COMMAND,
4589
4730
  PASTE_COMMAND as PASTE_COMMAND2
4590
4731
  } from "lexical";
4591
- import { useEffect as useEffect13 } from "react";
4732
+ import { useEffect as useEffect14 } from "react";
4592
4733
  import { Fragment as Fragment9, jsx as jsx39, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
4593
4734
  function VariablesComposerInput({
4594
- css: css37,
4735
+ css: css40,
4595
4736
  placeholder,
4596
4737
  ...contentEditableProps
4597
4738
  }) {
@@ -4610,7 +4751,7 @@ function VariablesComposerInput({
4610
4751
  }
4611
4752
  function RichishCopyAndPastePlugin() {
4612
4753
  const [editor] = useLexicalComposerContext9();
4613
- useEffect13(() => {
4754
+ useEffect14(() => {
4614
4755
  return mergeRegister4(
4615
4756
  editor.registerCommand(
4616
4757
  COPY_COMMAND,
@@ -4694,6 +4835,7 @@ function InputVariables(props) {
4694
4835
  value,
4695
4836
  enableEditingVariables,
4696
4837
  disableInlineMenu,
4838
+ showMenuPosition,
4697
4839
  onChange,
4698
4840
  transformPaste,
4699
4841
  showAddVariableMenuOption,
@@ -4711,7 +4853,8 @@ function InputVariables(props) {
4711
4853
  editorRef,
4712
4854
  filterVariable,
4713
4855
  styleVariant = "default",
4714
- renderMenuInPortal
4856
+ renderMenuInPortal,
4857
+ disableDismissEditorOnChange
4715
4858
  } = props;
4716
4859
  const [finalId] = useState13(id != null ? id : () => v42());
4717
4860
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -4721,40 +4864,65 @@ function InputVariables(props) {
4721
4864
  "div",
4722
4865
  {
4723
4866
  onKeyDown: () => {
4724
- if (isEditing && canDispatch) {
4867
+ if (!disableDismissEditorOnChange && isEditing && canDispatch) {
4725
4868
  dispatch({ type: "cancelEdit" });
4726
4869
  }
4727
4870
  },
4728
4871
  css: disabled ? inputDisabled : "",
4729
4872
  children: [
4730
- useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx40(
4731
- InputVariablesOverlayMenu,
4873
+ /* @__PURE__ */ jsxs23(
4874
+ HorizontalRhythm4,
4732
4875
  {
4733
- ...sharedMenuProps,
4734
- disabled: disableVariablesForReals || disableInlineMenu === true || disableInlineMenu === "by-input",
4735
- portal: renderMenuInPortal,
4736
- replaceValueOnVariableInsert: useInputWithNoVariables,
4737
- useInputWhenNoVariables: useInputWithNoVariables,
4738
- children: /* @__PURE__ */ jsx40(
4739
- VariablesComposerInput,
4740
- {
4741
- id: finalId,
4742
- "aria-label": ariaLabel,
4743
- "data-testid": dataTestId ? dataTestId : "input-container",
4744
- "data-text-value": value,
4745
- css: [input, styleVariant === "compact" ? inputCompact : null],
4746
- placeholder: placeholder ? /* @__PURE__ */ jsx40(
4747
- Caption,
4748
- {
4749
- css: [
4750
- placeholderCaption,
4751
- styleVariant === "compact" ? placeholderCompact : null
4752
- ],
4753
- children: placeholder
4754
- }
4755
- ) : void 0
4756
- }
4757
- )
4876
+ align: "center",
4877
+ gap: "xs",
4878
+ css: css24`
4879
+ position: relative;
4880
+ & > div:first-child {
4881
+ flex-grow: 1;
4882
+ }
4883
+ `,
4884
+ children: [
4885
+ useInputWithNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx40(
4886
+ InputVariablesOverlayMenu,
4887
+ {
4888
+ ...sharedMenuProps,
4889
+ disabled: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu === true || disableInlineMenu === "by-input",
4890
+ portal: renderMenuInPortal,
4891
+ replaceValueOnVariableInsert: useInputWithNoVariables,
4892
+ useInputWhenNoVariables: useInputWithNoVariables,
4893
+ children: /* @__PURE__ */ jsx40(
4894
+ VariablesComposerInput,
4895
+ {
4896
+ id: finalId,
4897
+ "aria-label": ariaLabel,
4898
+ "data-testid": dataTestId ? dataTestId : "input-container",
4899
+ "data-text-value": value,
4900
+ css: [input, styleVariant === "compact" ? inputCompact : null],
4901
+ placeholder: placeholder ? /* @__PURE__ */ jsx40(
4902
+ Caption,
4903
+ {
4904
+ css: [
4905
+ placeholderCaption,
4906
+ styleVariant === "compact" ? placeholderCompact : null
4907
+ ],
4908
+ children: placeholder
4909
+ }
4910
+ ) : void 0
4911
+ }
4912
+ )
4913
+ }
4914
+ ),
4915
+ disableVariablesForReals || showMenuPosition !== "inline-right" ? null : /* @__PURE__ */ jsx40(
4916
+ VariablesComposerVariableMenu,
4917
+ {
4918
+ ...sharedMenuProps,
4919
+ buttonCss: variableBindButton,
4920
+ tip: useInputWithNoVariables ? void 0 : "Tip: access this list by typing $$",
4921
+ buttonProps: hadVariablesInValue ? { "aria-pressed": "true" } : void 0,
4922
+ replaceValueOnVariableInsert: useInputWithNoVariables
4923
+ }
4924
+ )
4925
+ ]
4758
4926
  }
4759
4927
  ),
4760
4928
  caption ? /* @__PURE__ */ jsx40(Caption, { children: caption }) : null,
@@ -4776,7 +4944,7 @@ function InputVariables(props) {
4776
4944
  },
4777
4945
  id: finalId,
4778
4946
  isActive: hadVariablesInValue,
4779
- disableVariables: disableVariablesForReals || disableInlineMenu === "by-label",
4947
+ disableVariables: disableVariablesForReals || showMenuPosition && showMenuPosition !== "label" || disableInlineMenu === "by-label",
4780
4948
  children: input3
4781
4949
  }
4782
4950
  );
@@ -4814,7 +4982,7 @@ function InputVariablesOverlayMenu({
4814
4982
  if (disabled) {
4815
4983
  return /* @__PURE__ */ jsx40(Fragment10, { children });
4816
4984
  }
4817
- return /* @__PURE__ */ jsxs23("div", { css: menuContainer, children: [
4985
+ return /* @__PURE__ */ jsxs23("div", { css: menuContainer, "data-testid": "inline-var-menu", children: [
4818
4986
  children,
4819
4987
  /* @__PURE__ */ jsx40(
4820
4988
  VariablesComposerVariableMenu,
@@ -4831,155 +4999,69 @@ function InputVariablesOverlayMenu({
4831
4999
  // src/components/Variables/ParameterConnectionIndicator.tsx
4832
5000
  import { CgUsbC as CgUsbC2 } from "@react-icons/all-files/cg/CgUsbC";
4833
5001
  import { bindVariablesToObject } from "@uniformdev/canvas";
4834
- import { HorizontalRhythm as HorizontalRhythm4, Menu as Menu3 } from "@uniformdev/design-system";
5002
+ import { HorizontalRhythm as HorizontalRhythm5, Menu as Menu3 } from "@uniformdev/design-system";
4835
5003
  import { useMemo as useMemo11 } from "react";
5004
+ import { jsx as jsx41, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
5005
+ function ParameterConnectionIndicator({
5006
+ children,
5007
+ value,
5008
+ menuOptions,
5009
+ disabled,
5010
+ menuTooltip = "Insert variable",
5011
+ overrideMenuButtonParentMargin
5012
+ }) {
5013
+ const hasVariablesInValue = useMemo11(() => {
5014
+ let result = false;
5015
+ bindVariablesToObject({
5016
+ value,
5017
+ variables: {},
5018
+ handleBinding: () => {
5019
+ result = true;
5020
+ }
5021
+ });
5022
+ return result;
5023
+ }, [value]);
5024
+ return /* @__PURE__ */ jsxs24(HorizontalRhythm5, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5025
+ /* @__PURE__ */ jsx41("div", { css: { flex: 1 }, children }),
5026
+ disabled ? null : /* @__PURE__ */ jsx41(
5027
+ Menu3,
5028
+ {
5029
+ placement: "bottom-start",
5030
+ withoutPortal: true,
5031
+ menuTrigger: /* @__PURE__ */ jsx41(
5032
+ "div",
5033
+ {
5034
+ css: overrideMenuButtonParentMargin ? {
5035
+ marginBottom: overrideMenuButtonParentMargin
5036
+ } : void 0,
5037
+ children: /* @__PURE__ */ jsx41(
5038
+ "button",
5039
+ {
5040
+ title: menuTooltip,
5041
+ "aria-pressed": hasVariablesInValue,
5042
+ css: [menuBtn, variableBindButton],
5043
+ type: "button",
5044
+ children: /* @__PURE__ */ jsx41(CgUsbC2, { size: "1.4rem" })
5045
+ }
5046
+ )
5047
+ }
5048
+ ),
5049
+ menuLabel: menuTooltip,
5050
+ children: menuOptions
5051
+ }
5052
+ )
5053
+ ] });
5054
+ }
4836
5055
 
4837
- // src/components/Variables/styles/ParameterVariables.styles.ts
4838
- import { css as css23 } from "@emotion/react";
4839
- import { scrollbarStyles as scrollbarStyles3 } from "@uniformdev/design-system";
4840
- var variableBindButton2 = css23`
4841
- align-items: center;
4842
- border: none;
4843
- border-radius: var(--rounded-base);
4844
- background: none;
4845
- display: flex;
4846
- height: 1.2rem;
4847
- padding: var(--spacing-2xs);
4848
- transition: background var(--duration-fast) var(--timing-ease-out),
4849
- color var(--duration-fast) var(--timing-ease-out);
4850
- width: 1.2rem;
4851
-
4852
- &:hover,
4853
- &[aria-pressed='true']:not(:disabled) {
4854
- background: var(--brand-secondary-3);
4855
- color: var(--white);
4856
- }
4857
-
4858
- &[aria-disabled='true'] {
4859
- background: none;
4860
- color: currentColor;
4861
- }
4862
-
4863
- // fixes menu resizing issue within iframes
4864
- // see https://linear.app/uniform/issue/UNI-3068/mesh-integration-resizing-with-menus
4865
- + [role='menu'] {
4866
- max-height: unset;
4867
- }
4868
- `;
4869
- var input2 = css23`
4870
- display: block;
4871
- appearance: none;
4872
- box-sizing: border-box;
4873
- background: var(--white);
4874
- border: 1px solid var(--gray-200);
4875
- border-radius: var(--rounded-sm);
4876
- color: var(--gray-700);
4877
- font-size: var(--fs-sm);
4878
- line-height: 1.5;
4879
- min-height: 2rem;
4880
- padding: var(--spacing-sm);
4881
- width: 100%;
4882
- position: relative;
4883
- white-space: normal;
4884
- transition-property: background, border-color, color, box-shadow, border-radius;
4885
- transition-duration: var(--duration-fast);
4886
- transition-timing-function: var(--timing-ease-out);
4887
-
4888
- &::placeholder {
4889
- color: var(--gray-400);
4890
- }
4891
-
4892
- &:focus,
4893
- &:focus-within {
4894
- border-radius: var(--rounded-sm);
4895
- box-shadow: var(--elevation-100);
4896
- border: 1px solid var(--accent-dark-active);
4897
- outline: none;
4898
- }
4899
- &:hover {
4900
- border: 1px solid var(--accent-dark-hover);
4901
- }
4902
-
4903
- &:disabled,
4904
- &:disabled::placeholder,
4905
- &:disabled:hover {
4906
- border-radius: var(--rounded-sm);
4907
- cursor: not-allowed;
4908
- color: var(--gray-400);
4909
- }
4910
-
4911
- &[readonly],
4912
- &[contenteditable='false'] {
4913
- cursor: not-allowed;
4914
- color: var(--gray-400);
4915
- }
4916
-
4917
- > p {
4918
- margin: 0;
4919
- }
4920
- `;
4921
- var inputMultiLine = (lines) => css23`
4922
- ${scrollbarStyles3}
4923
- // 1.5 = line height, spacing-sm = top and bottom padding + spacing-xs to give a slight increase in height
4924
- // as the text looked to close to the bottom of the input
4925
- height: calc(${lines * 1.5}em + var(--spacing-sm) + var(--spacing-xs));
4926
- resize: vertical;
4927
- overflow: auto;
4928
- `;
4929
-
4930
- // src/components/Variables/ParameterConnectionIndicator.tsx
4931
- import { jsx as jsx41, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
4932
- function ParameterConnectionIndicator({
4933
- children,
4934
- value,
4935
- menuOptions,
4936
- disabled,
4937
- menuTooltip = "Insert variable"
4938
- }) {
4939
- const hasVariablesInValue = useMemo11(() => {
4940
- let result = false;
4941
- bindVariablesToObject({
4942
- value,
4943
- variables: {},
4944
- handleBinding: () => {
4945
- result = true;
4946
- }
4947
- });
4948
- return result;
4949
- }, [value]);
4950
- return /* @__PURE__ */ jsxs24(HorizontalRhythm4, { align: "center", gap: "xs", css: { width: "100%" }, children: [
4951
- /* @__PURE__ */ jsx41("div", { css: { flex: 1 }, children }),
4952
- disabled ? null : /* @__PURE__ */ jsx41(
4953
- Menu3,
4954
- {
4955
- placement: "bottom-start",
4956
- withoutPortal: true,
4957
- menuTrigger: /* @__PURE__ */ jsx41(
4958
- "button",
4959
- {
4960
- title: menuTooltip,
4961
- "aria-pressed": hasVariablesInValue,
4962
- css: [menuBtn, variableBindButton2],
4963
- type: "button",
4964
- children: /* @__PURE__ */ jsx41(CgUsbC2, { size: "1.4rem" })
4965
- }
4966
- ),
4967
- menuLabel: menuTooltip,
4968
- children: menuOptions
4969
- }
4970
- )
4971
- ] });
4972
- }
4973
-
4974
- // src/components/Variables/ParameterOrSingleVariable.tsx
4975
- import { HorizontalRhythm as HorizontalRhythm5 } from "@uniformdev/design-system";
4976
- import { useCallback as useCallback4 } from "react";
5056
+ // src/components/Variables/ParameterOrSingleVariable.tsx
5057
+ import { HorizontalRhythm as HorizontalRhythm6 } from "@uniformdev/design-system";
5058
+ import { useCallback as useCallback4 } from "react";
4977
5059
 
4978
5060
  // src/components/Variables/composer/OnDisconnectPlugin.tsx
4979
5061
  import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
4980
5062
  import { mergeRegister as mergeRegister5 } from "@lexical/utils";
4981
5063
  import { $getNodeByKey as $getNodeByKey3, COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH3 } from "lexical";
4982
- import { useEffect as useEffect14, useRef as useRef13 } from "react";
5064
+ import { useEffect as useEffect15, useRef as useRef13 } from "react";
4983
5065
  function OnDisconnectPlugin({
4984
5066
  onDisconnect
4985
5067
  }) {
@@ -4987,7 +5069,7 @@ function OnDisconnectPlugin({
4987
5069
  const { variables } = useVariables(true);
4988
5070
  const variablesRef = useRef13(variables);
4989
5071
  variablesRef.current = variables;
4990
- useEffect14(() => {
5072
+ useEffect15(() => {
4991
5073
  return mergeRegister5(
4992
5074
  editor.registerCommand(
4993
5075
  DISCONNECT_VARIABLE_COMMAND,
@@ -5058,7 +5140,7 @@ function ParameterOrSingleVariable(props) {
5058
5140
  /* @__PURE__ */ jsx42(OnDisconnectPlugin, { onDisconnect: handleDisconnect }),
5059
5141
  editorRef ? /* @__PURE__ */ jsx42(EditorRefPlugin, { editorRef }) : null,
5060
5142
  /* @__PURE__ */ jsx42(ControlledValuePlugin, { enabled: true, value }),
5061
- /* @__PURE__ */ jsxs25(HorizontalRhythm5, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5143
+ /* @__PURE__ */ jsxs25(HorizontalRhythm6, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5062
5144
  /* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
5063
5145
  VariablesComposerInput,
5064
5146
  {
@@ -5071,7 +5153,7 @@ function ParameterOrSingleVariable(props) {
5071
5153
  VariablesComposerVariableMenu,
5072
5154
  {
5073
5155
  ...sharedMenuProps,
5074
- buttonCss: [variableBindButton2],
5156
+ buttonCss: [variableBindButton],
5075
5157
  buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
5076
5158
  replaceValueOnVariableInsert: true,
5077
5159
  filterVariable
@@ -5085,8 +5167,8 @@ function ParameterOrSingleVariable(props) {
5085
5167
  }
5086
5168
 
5087
5169
  // src/components/Variables/ParameterVariables.tsx
5088
- import { css as css24 } from "@emotion/react";
5089
- import { HorizontalRhythm as HorizontalRhythm6 } from "@uniformdev/design-system";
5170
+ import { css as css25 } from "@emotion/react";
5171
+ import { HorizontalRhythm as HorizontalRhythm7 } from "@uniformdev/design-system";
5090
5172
  import { jsx as jsx43, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
5091
5173
  function ParameterVariables(props) {
5092
5174
  const {
@@ -5124,19 +5206,17 @@ function ParameterVariables(props) {
5124
5206
  children: [
5125
5207
  editorRef ? /* @__PURE__ */ jsx43(EditorRefPlugin, { editorRef }) : null,
5126
5208
  /* @__PURE__ */ jsx43(ControlledValuePlugin, { value, enabled: useInputWhenNoVariables }),
5127
- /* @__PURE__ */ jsxs26(
5128
- HorizontalRhythm6,
5129
- {
5130
- align: "center",
5131
- gap: "xs",
5132
- css: { width: "100%" },
5133
- onKeyDown: () => {
5134
- if (isEditing && canDispatch) {
5135
- dispatch({ type: "cancelEdit" });
5136
- }
5137
- },
5138
- children: [
5139
- /* @__PURE__ */ jsx43("div", { css: { flex: 1 }, children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx43(
5209
+ /* @__PURE__ */ jsxs26(HorizontalRhythm7, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5210
+ /* @__PURE__ */ jsx43(
5211
+ "div",
5212
+ {
5213
+ css: { flex: 1 },
5214
+ onKeyDown: () => {
5215
+ if (isEditing && canDispatch) {
5216
+ dispatch({ type: "cancelEdit" });
5217
+ }
5218
+ },
5219
+ children: useInputWhenNoVariables ? inputWhenNoVariables : /* @__PURE__ */ jsx43(
5140
5220
  VariablesComposerInput,
5141
5221
  {
5142
5222
  "aria-label": ariaLabel,
@@ -5144,24 +5224,24 @@ function ParameterVariables(props) {
5144
5224
  "data-text-value": value,
5145
5225
  css: [
5146
5226
  input2,
5147
- typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) : css24``,
5148
- inputCss != null ? inputCss : css24``
5227
+ typeof multiLine === "number" ? inputMultiLine(multiLine) : multiLine === true ? inputMultiLine(2) : css25``,
5228
+ inputCss != null ? inputCss : css25``
5149
5229
  ]
5150
5230
  }
5151
- ) }),
5152
- disableVariablesForReals ? null : /* @__PURE__ */ jsx43(
5153
- VariablesComposerVariableMenu,
5154
- {
5155
- ...sharedMenuProps,
5156
- buttonCss: [variableBindButton2],
5157
- tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
5158
- buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
5159
- replaceValueOnVariableInsert: useInputWhenNoVariables
5160
- }
5161
5231
  )
5162
- ]
5163
- }
5164
- )
5232
+ }
5233
+ ),
5234
+ disableVariablesForReals ? null : /* @__PURE__ */ jsx43(
5235
+ VariablesComposerVariableMenu,
5236
+ {
5237
+ ...sharedMenuProps,
5238
+ buttonCss: [variableBindButton],
5239
+ tip: useInputWhenNoVariables ? void 0 : "Tip: access this list by typing $$",
5240
+ buttonProps: hasVariablesInValue ? { "aria-pressed": "true" } : void 0,
5241
+ replaceValueOnVariableInsert: useInputWhenNoVariables
5242
+ }
5243
+ )
5244
+ ] })
5165
5245
  ]
5166
5246
  }
5167
5247
  );
@@ -5169,7 +5249,7 @@ function ParameterVariables(props) {
5169
5249
 
5170
5250
  // src/components/Variables/util/convertConnectedDataToVariable.ts
5171
5251
  function convertConnectedDataToVariable(bindExpression, value) {
5172
- const isValuePrimitive = typeof value === "string" || typeof value === "number" || typeof value === "boolean";
5252
+ const isValuePrimitive = typeof value === "string" && value.length > 0 || typeof value === "number" || typeof value === "boolean";
5173
5253
  return {
5174
5254
  ephemeral: true,
5175
5255
  displayName: isValuePrimitive ? value.toString() : prettifyBindExpression(bindExpression),
@@ -5181,7 +5261,7 @@ ${prettifyBindExpression(bindExpression)}`
5181
5261
  }
5182
5262
 
5183
5263
  // src/components/Variables/VariablesList.tsx
5184
- import { css as css26 } from "@emotion/react";
5264
+ import { css as css27 } from "@emotion/react";
5185
5265
  import {
5186
5266
  AddListButton,
5187
5267
  button,
@@ -5196,8 +5276,8 @@ import {
5196
5276
  import { Draggable as Draggable2, Droppable as Droppable2 } from "react-beautiful-dnd";
5197
5277
 
5198
5278
  // src/components/Variables/styles/VariablesList.styles.ts
5199
- import { css as css25 } from "@emotion/react";
5200
- var tableRow = (isDragging) => css25`
5279
+ import { css as css26 } from "@emotion/react";
5280
+ var tableRow = (isDragging) => css26`
5201
5281
  position: relative;
5202
5282
  ${isDragging ? `
5203
5283
  display: table;
@@ -5205,7 +5285,7 @@ var tableRow = (isDragging) => css25`
5205
5285
  top: auto !important;
5206
5286
  ` : void 0}
5207
5287
  `;
5208
- var tableCellDragIcon = css25`
5288
+ var tableCellDragIcon = css26`
5209
5289
  &::after {
5210
5290
  content: '';
5211
5291
  display: block;
@@ -5223,7 +5303,7 @@ var tableCellDragIcon = css25`
5223
5303
  opacity: 1;
5224
5304
  }
5225
5305
  `;
5226
- var variableName = css25`
5306
+ var variableName = css26`
5227
5307
  border: none;
5228
5308
  font-weight: var(--fw-medium);
5229
5309
  padding: 0;
@@ -5233,7 +5313,7 @@ var variableName = css25`
5233
5313
  white-space: nowrap;
5234
5314
  max-width: 20ch;
5235
5315
  `;
5236
- var variableValue = css25`
5316
+ var variableValue = css26`
5237
5317
  overflow: hidden;
5238
5318
  text-overflow: ellipsis;
5239
5319
  white-space: nowrap;
@@ -5310,7 +5390,7 @@ function VariablesList() {
5310
5390
  title: `delete ${text}`,
5311
5391
  css: [
5312
5392
  button,
5313
- css26`
5393
+ css27`
5314
5394
  background: transparent;
5315
5395
  `
5316
5396
  ],
@@ -5344,6 +5424,10 @@ function VariablesList() {
5344
5424
 
5345
5425
  // src/components/DataResourceDynamicInputProvider.tsx
5346
5426
  import { jsx as jsx45 } from "@emotion/react/jsx-runtime";
5427
+ var DataResourceInputContext = createContext4(void 0);
5428
+ var useDataResourceDynamicInputs = () => {
5429
+ return useContext6(DataResourceInputContext);
5430
+ };
5347
5431
  function DataResourceDynamicInputProvider(props) {
5348
5432
  const { children, dynamicInputs } = props;
5349
5433
  if (dynamicInputs) {
@@ -5362,11 +5446,11 @@ function DataResourceDynamicInputProviderRenderer({
5362
5446
  dynamicInputs
5363
5447
  }) {
5364
5448
  const variables = useDynamicInputsAsVariables(dynamicInputs);
5365
- return /* @__PURE__ */ jsx45(VariablesProvider, { value: variables, readOnly: true, children });
5449
+ return /* @__PURE__ */ jsx45(DataResourceInputContext.Provider, { value: dynamicInputs, children: /* @__PURE__ */ jsx45(VariablesProvider, { value: variables, readOnly: true, children }) });
5366
5450
  }
5367
5451
 
5368
5452
  // src/components/DataResourceVariablesList.tsx
5369
- import { Callout as Callout4, VerticalRhythm } from "@uniformdev/design-system";
5453
+ import { Callout as Callout4, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
5370
5454
  import { jsx as jsx46 } from "@emotion/react/jsx-runtime";
5371
5455
  function DataResourceVariablesList(props) {
5372
5456
  const {
@@ -5398,7 +5482,7 @@ function DataResourceVariablesListExplicit({
5398
5482
  }
5399
5483
  return /* @__PURE__ */ jsx46(Callout4, { type: "note", children: "No settings are required." });
5400
5484
  }
5401
- return /* @__PURE__ */ jsx46(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx46(VerticalRhythm, { children: variableDefinitions.map((variableDefinition) => {
5485
+ return /* @__PURE__ */ jsx46(DataResourceDynamicInputProvider, { dynamicInputs, children: /* @__PURE__ */ jsx46(VerticalRhythm2, { children: variableDefinitions.map((variableDefinition) => {
5402
5486
  var _a, _b, _c;
5403
5487
  const VariableRenderer = variableDefinition.type ? (_a = typeRenderers == null ? void 0 : typeRenderers[variableDefinition.type]) != null ? _a : TextVariableRenderer : TextVariableRenderer;
5404
5488
  return /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46(
@@ -5439,7 +5523,7 @@ function TextVariableRenderer({ definition, value, setValue }) {
5439
5523
  }
5440
5524
 
5441
5525
  // src/components/Request/RequestBody.tsx
5442
- import { css as css28 } from "@emotion/react";
5526
+ import { css as css29 } from "@emotion/react";
5443
5527
  import { InputSelect as InputSelect4, JsonEditor } from "@uniformdev/design-system";
5444
5528
  import { useState as useState14 } from "react";
5445
5529
 
@@ -5525,11 +5609,11 @@ function useRequest() {
5525
5609
  }
5526
5610
 
5527
5611
  // src/components/Request/styles/Request.styles.ts
5528
- import { css as css27 } from "@emotion/react";
5529
- var innerContentStyles = css27`
5612
+ import { css as css28 } from "@emotion/react";
5613
+ var innerContentStyles = css28`
5530
5614
  background: var(--white);
5531
5615
  `;
5532
- var requestTypeContainer = (bgColor) => css27`
5616
+ var requestTypeContainer = (bgColor) => css28`
5533
5617
  align-items: start;
5534
5618
  background: ${bgColor};
5535
5619
  display: grid;
@@ -5571,7 +5655,7 @@ function RequestBody() {
5571
5655
  return /* @__PURE__ */ jsxs28(
5572
5656
  "div",
5573
5657
  {
5574
- css: css28`
5658
+ css: css29`
5575
5659
  background: var(--white);
5576
5660
  `,
5577
5661
  children: [
@@ -5579,7 +5663,7 @@ function RequestBody() {
5579
5663
  RequestTypeContainer,
5580
5664
  {
5581
5665
  bgColor: "var(--gray-100)",
5582
- css: css28`
5666
+ css: css29`
5583
5667
  padding: var(--spacing-sm) var(--spacing-base);
5584
5668
  `,
5585
5669
  children: /* @__PURE__ */ jsx49(
@@ -5625,6 +5709,7 @@ function RequestBody() {
5625
5709
  // src/components/Request/RequestHeaders.tsx
5626
5710
  import {
5627
5711
  Input as Input3,
5712
+ InputToggle,
5628
5713
  Table as Table2,
5629
5714
  TableBody as TableBody2,
5630
5715
  TableCellData as TableCellData2,
@@ -5706,8 +5791,11 @@ function RequestHeaders({
5706
5791
  }
5707
5792
  ) : null }),
5708
5793
  addOmitIfEmpty ? /* @__PURE__ */ jsx50(TableCellData2, { width: "50%", children: header.key ? /* @__PURE__ */ jsx50(
5709
- Input3,
5794
+ InputToggle,
5710
5795
  {
5796
+ label: "Omit if empty",
5797
+ showLabel: false,
5798
+ name: "omitIfEmpty",
5711
5799
  type: "checkbox",
5712
5800
  checked: header.omitIfEmpty,
5713
5801
  "data-testid": "header-omitifempty",
@@ -5752,6 +5840,7 @@ function RequestMethodSelect(props) {
5752
5840
  // src/components/Request/RequestParameters.tsx
5753
5841
  import {
5754
5842
  Input as Input4,
5843
+ InputToggle as InputToggle2,
5755
5844
  Table as Table3,
5756
5845
  TableBody as TableBody3,
5757
5846
  TableCellData as TableCellData3,
@@ -5843,8 +5932,11 @@ function RequestParameters({
5843
5932
  }
5844
5933
  ) : null }),
5845
5934
  addOmitIfEmpty ? /* @__PURE__ */ jsx52(TableCellData3, { width: "50%", children: parameter.key ? /* @__PURE__ */ jsx52(
5846
- Input4,
5935
+ InputToggle2,
5847
5936
  {
5937
+ label: "Omit if empty",
5938
+ showLabel: false,
5939
+ name: "omitIfEmpty",
5848
5940
  type: "checkbox",
5849
5941
  checked: parameter.omitIfEmpty,
5850
5942
  "data-testid": "parameter-omitifempty",
@@ -5868,7 +5960,7 @@ function RequestParameters({
5868
5960
  }
5869
5961
 
5870
5962
  // src/components/Request/RequestUrl.tsx
5871
- import { css as css29 } from "@emotion/react";
5963
+ import { css as css30 } from "@emotion/react";
5872
5964
  import { useMemo as useMemo13 } from "react";
5873
5965
 
5874
5966
  // src/components/Request/urlEncodeRequestParameter.ts
@@ -5905,7 +5997,7 @@ function RequestUrl() {
5905
5997
  return /* @__PURE__ */ jsxs31(
5906
5998
  "small",
5907
5999
  {
5908
- css: css29`
6000
+ css: css30`
5909
6001
  display: inline-block;
5910
6002
  margin-bottom: var(--spacing-xs);
5911
6003
  word-break: break-word;
@@ -6143,12 +6235,12 @@ import { LoadingIndicator as LoadingIndicator3, Theme as Theme2 } from "@uniform
6143
6235
 
6144
6236
  // src/hooks/useInitializeUniformMeshSdk.ts
6145
6237
  import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
6146
- import { useEffect as useEffect15, useRef as useRef14, useState as useState15 } from "react";
6238
+ import { useEffect as useEffect16, useRef as useRef14, useState as useState15 } from "react";
6147
6239
  var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
6148
6240
  const [error, setError] = useState15();
6149
6241
  const [sdk, setSdk] = useState15();
6150
6242
  const initializationInProgress = useRef14(false);
6151
- useEffect15(
6243
+ useEffect16(
6152
6244
  () => {
6153
6245
  if (typeof window === "undefined" || sdk) {
6154
6246
  return;
@@ -6206,7 +6298,7 @@ var MeshApp = ({
6206
6298
  };
6207
6299
 
6208
6300
  // src/components/ObjectSearch/DataRefreshButton.tsx
6209
- import { css as css30 } from "@emotion/react";
6301
+ import { css as css31 } from "@emotion/react";
6210
6302
  import { Button as Button3, LoadingIndicator as LoadingIndicator4 } from "@uniformdev/design-system";
6211
6303
  import { jsx as jsx58, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
6212
6304
  var DataRefreshButton = ({
@@ -6219,7 +6311,7 @@ var DataRefreshButton = ({
6219
6311
  !isLoading ? null : /* @__PURE__ */ jsx58(
6220
6312
  LoadingIndicator4,
6221
6313
  {
6222
- css: css30`
6314
+ css: css31`
6223
6315
  ${isLoading ? "opacity: 0.2;" : void 0}
6224
6316
  `
6225
6317
  }
@@ -6229,22 +6321,23 @@ var DataRefreshButton = ({
6229
6321
  };
6230
6322
 
6231
6323
  // src/components/ObjectSearch/ObjectSearchContainer.tsx
6232
- import { css as css32 } from "@emotion/react";
6324
+ import { css as css36 } from "@emotion/react";
6233
6325
  import { bindVariables } from "@uniformdev/canvas";
6234
- import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm2 } from "@uniformdev/design-system";
6326
+ import { Callout as Callout5, Container, IconsProvider, ScrollableList, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
6327
+ import React12 from "react";
6235
6328
 
6236
6329
  // src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
6237
6330
  import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
6238
6331
  import {
6239
- createContext as createContext5,
6332
+ createContext as createContext6,
6240
6333
  useCallback as useCallback5,
6241
- useContext as useContext7,
6334
+ useContext as useContext8,
6242
6335
  useDeferredValue,
6243
6336
  useMemo as useMemo14,
6244
6337
  useState as useState16
6245
6338
  } from "react";
6246
6339
  import { jsx as jsx59 } from "@emotion/react/jsx-runtime";
6247
- var ObjectSearchContext = createContext5({
6340
+ var ObjectSearchContext = createContext6({
6248
6341
  onSetQuery: () => {
6249
6342
  },
6250
6343
  onSelectItem: () => {
@@ -6252,8 +6345,6 @@ var ObjectSearchContext = createContext5({
6252
6345
  query: {},
6253
6346
  boundQuery: {},
6254
6347
  list: {},
6255
- onSetList: () => {
6256
- },
6257
6348
  selectedListItems: [],
6258
6349
  onRemoveAllSelectedItems: () => {
6259
6350
  },
@@ -6337,7 +6428,7 @@ var ObjectSearchProvider = ({
6337
6428
  return /* @__PURE__ */ jsx59(ObjectSearchContext.Provider, { value, children });
6338
6429
  };
6339
6430
  function useObjectSearchContext() {
6340
- return useContext7(ObjectSearchContext);
6431
+ return useContext8(ObjectSearchContext);
6341
6432
  }
6342
6433
  function bindQuery(query, inputs) {
6343
6434
  const { result, errors } = bindVariablesToObject2({
@@ -6355,9 +6446,9 @@ function bindQuery(query, inputs) {
6355
6446
  import { Chip, Popover } from "@uniformdev/design-system";
6356
6447
 
6357
6448
  // src/components/ObjectSearch/styles/ObjectSearchListItem.styles.ts
6358
- import { css as css31 } from "@emotion/react";
6449
+ import { css as css32 } from "@emotion/react";
6359
6450
  import { skeletonLoading } from "@uniformdev/design-system";
6360
- var ObjectListItemContainer = css31`
6451
+ var ObjectListItemContainer = css32`
6361
6452
  align-items: center;
6362
6453
  border: 1px solid var(--gray-300);
6363
6454
  border-radius: var(--rounded-base);
@@ -6366,11 +6457,11 @@ var ObjectListItemContainer = css31`
6366
6457
  grid-template-columns: 1fr auto;
6367
6458
  padding: var(--spacing-sm);
6368
6459
  `;
6369
- var ObjectListItemContainerDisabled = css31`
6460
+ var ObjectListItemContainerDisabled = css32`
6370
6461
  opacity: var(--opacity-50);
6371
6462
  pointer-events: none;
6372
6463
  `;
6373
- var ObjectListItemLoading = css31`
6464
+ var ObjectListItemLoading = css32`
6374
6465
  animation: ${skeletonLoading} 1s linear infinite alternate;
6375
6466
  border-color: transparent;
6376
6467
  min-height: 42px;
@@ -6394,36 +6485,36 @@ var ObjectListItemLoading = css31`
6394
6485
  width: 1rem;
6395
6486
  }
6396
6487
  `;
6397
- var ObjectListItemHeadingGroup = css31`
6488
+ var ObjectListItemHeadingGroup = css32`
6398
6489
  align-items: center;
6399
6490
  display: grid;
6400
6491
  `;
6401
- var ObjectListItemThumbnail = css31`
6492
+ var ObjectListItemThumbnail = css32`
6402
6493
  width: 30px;
6403
6494
  object-fit: contain;
6404
6495
  `;
6405
- var ObjectListItemTitle = css31`
6496
+ var ObjectListItemTitle = css32`
6406
6497
  color: var(--typography-base);
6407
6498
  display: block;
6408
6499
  font-size: var(--fs-sm);
6409
6500
  `;
6410
- var ObjectListItemSubtitle = css31`
6501
+ var ObjectListItemSubtitle = css32`
6411
6502
  color: var(--gray-500);
6412
6503
  display: block;
6413
6504
  font-size: var(--fs-xs);
6414
6505
  line-height: 1;
6415
6506
  `;
6416
- var ObjectListItemInfoContainer = css31`
6507
+ var ObjectListItemInfoContainer = css32`
6417
6508
  align-items: center;
6418
6509
  display: flex;
6419
6510
  gap: var(--spacing-sm);
6420
6511
  justify-content: center;
6421
6512
  `;
6422
- var ObjectListItemControlledContent = css31`
6513
+ var ObjectListItemControlledContent = css32`
6423
6514
  display: flex;
6424
6515
  gap: var(--spacing-sm);
6425
6516
  `;
6426
- var ObjectListItemUnControlledContent = css31`
6517
+ var ObjectListItemUnControlledContent = css32`
6427
6518
  margin-top: var(--spacing-sm);
6428
6519
  grid-column: 1 / -1;
6429
6520
  `;
@@ -6493,241 +6584,58 @@ var ObjectSearchListItemLoadingSkeleton = () => {
6493
6584
  return /* @__PURE__ */ jsx60("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
6494
6585
  };
6495
6586
 
6496
- // src/components/ObjectSearch/ObjectSearchContainer.tsx
6497
- import { jsx as jsx61, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
6498
- var ObjectSearchContainer = ({
6499
- label,
6500
- enableDynamicInputToResultId,
6501
- searchFilters,
6502
- resultList,
6503
- children
6504
- }) => {
6505
- var _a, _b;
6506
- const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
6507
- const { flatVariables } = useVariables(true);
6508
- const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
6509
- const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx61(
6510
- ScrollableList,
6511
- {
6512
- role: "list",
6513
- css: css32`
6514
- > div {
6515
- transition: max-height var(--duration-slow) var(--timing-ease-out);
6516
- max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
6517
- }
6518
- `,
6519
- children: /* @__PURE__ */ jsx61(DefaultResultList, {})
6520
- }
6521
- );
6522
- const body = /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
6523
- searchFilters,
6524
- listItems
6525
- ] });
6526
- const handleSelectedVariableChange = (selectedValue) => {
6527
- var _a2;
6528
- if (!selectedValue) {
6529
- onSelectItem([]);
6530
- return;
6531
- }
6532
- const { result, errors } = bindVariables({
6533
- value: selectedValue,
6534
- variables: flatVariables,
6535
- errorPrefix: "Dynamic input"
6536
- });
6537
- if (!result) {
6538
- onSelectItem([]);
6539
- return;
6540
- }
6541
- const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
6542
- onSelectItem([
6543
- {
6544
- title: selectedValue,
6545
- contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
6546
- // spread any matched list item, overriding the above default props
6547
- ...item,
6548
- // we want to make sure the ID is our dynamic value
6549
- id: selectedValue
6550
- }
6551
- ]);
6552
- };
6553
- return /* @__PURE__ */ jsx61(IconsProvider, { children: /* @__PURE__ */ jsxs35(VerticalRhythm2, { children: [
6554
- /* @__PURE__ */ jsx61(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx61(
6555
- InputVariables,
6556
- {
6557
- label,
6558
- value: inputValue,
6559
- onChange: (value) => {
6560
- if (value === inputValue) {
6561
- return;
6562
- }
6563
- handleSelectedVariableChange(value);
6564
- },
6565
- inputWhenNoVariables: body,
6566
- disableVariables: !enableDynamicInputToResultId
6567
- }
6568
- ) : body }),
6569
- children
6570
- ] }) });
6571
- };
6572
- var DefaultResultList = () => {
6573
- var _a;
6574
- const { list } = useObjectSearchContext();
6575
- if (!list.items) {
6576
- return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx61(ObjectSearchListItemLoadingSkeleton, {}, i));
6577
- }
6578
- if (list.items.length === 0) {
6579
- return /* @__PURE__ */ jsx61(Callout5, { type: "info", children: "No results were found" });
6580
- }
6581
- return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx61(ObjectSearchListItem, { ...item }, item.id));
6582
- };
6587
+ // src/components/ObjectSearch/ObjectSearchResultList.tsx
6588
+ import { Button as Button5, Counter } from "@uniformdev/design-system";
6589
+ import { Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
6583
6590
 
6584
- // src/components/ObjectSearch/ObjectSearchFilter.tsx
6585
- import { DebouncedInputKeywordSearch, InputSelect as InputSelect6 } from "@uniformdev/design-system";
6586
- import { useMemo as useMemo15, useState as useState17 } from "react";
6591
+ // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6592
+ import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/design-system";
6593
+ import { format as timeagoFormat } from "timeago.js";
6587
6594
 
6588
- // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
6595
+ // src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
6589
6596
  import { css as css33 } from "@emotion/react";
6590
- var ObjectSearchFilterContainerLabel = css33`
6591
- align-items: center;
6592
- display: flex;
6597
+ import { button as button2 } from "@uniformdev/design-system";
6598
+ var ButtonStyles = css33`
6599
+ ${button2}
6600
+ background: transparent;
6601
+ border: 1px solid var(--typography-base);
6602
+ color: var(--typography-base);
6603
+ padding: var(--spacing-sm);
6593
6604
  font-size: var(--fs-sm);
6594
- font-weight: var(--fw-bold);
6595
- line-height: 1rem;
6596
- margin-bottom: var(--spacing-sm);
6597
- `;
6598
- var ObjectSearchFilterContainer = css33`
6599
- display: grid;
6600
- gap: var(--spacing-base);
6605
+ line-height: 1;
6606
+ gap: var(--spacing-xs);
6607
+ transition: border-color var(--duration-fast) var(--timing-ease-out),
6608
+ background-color var(--duration-fast) var(--timing-ease-out);
6609
+
6610
+ &:hover {
6611
+ background: var(--gray-100);
6612
+ border-color: var(--gray-300);
6613
+ }
6614
+
6615
+ &:disabled {
6616
+ background: var(--gray-300);
6617
+ border-color: var(--gray-200);
6618
+ color: var(--gray-500);
6619
+ }
6620
+
6621
+ &:link {
6622
+ text-decoration: none;
6623
+ }
6601
6624
  `;
6602
- var ObjectSearchFilterGrid = (gridColumns) => css33`
6603
- display: grid;
6604
- grid-template-columns: ${gridColumns};
6605
- gap: var(--spacing-base);
6606
- `;
6607
-
6608
- // src/components/ObjectSearch/ObjectSearchFilter.tsx
6609
- import { jsx as jsx62, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
6610
- var ObjectSearchFilter = ({
6611
- requireContentType,
6612
- typeSelectorAllTypesOptionText = "All content types",
6613
- searchInputName = "searchText",
6614
- searchInputPlaceholderText = "Enter keyword to narrow your results",
6615
- selectLabel = "Content Type Select",
6616
- selectOptions
6617
- }) => {
6618
- var _a, _b;
6619
- const { query, onSetQuery } = useObjectSearchContext();
6620
- const [searchState, setSearchState] = useState17({
6621
- contentType: (_a = query.contentType) != null ? _a : "",
6622
- keyword: (_b = query.keyword) != null ? _b : ""
6623
- });
6624
- const handleFilterChange = (value) => {
6625
- setSearchState((prev) => {
6626
- return { ...prev, ...value };
6627
- });
6628
- onSetQuery({ ...query, ...value });
6629
- };
6630
- const memoizedSelectOptions = useMemo15(() => {
6631
- if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
6632
- return [];
6633
- }
6634
- return [
6635
- ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
6636
- ...selectOptions != null ? selectOptions : []
6637
- ];
6638
- }, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
6639
- const shouldRenderSelect = memoizedSelectOptions.length > 0;
6640
- return /* @__PURE__ */ jsxs36(
6641
- "fieldset",
6642
- {
6643
- css: [
6644
- ObjectSearchFilterContainer,
6645
- ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
6646
- ],
6647
- children: [
6648
- memoizedSelectOptions.length ? /* @__PURE__ */ jsx62(
6649
- InputSelect6,
6650
- {
6651
- label: selectLabel,
6652
- showLabel: false,
6653
- onChange: (e) => handleFilterChange({ contentType: e.target.value }),
6654
- options: memoizedSelectOptions,
6655
- value: query.contentType
6656
- }
6657
- ) : null,
6658
- /* @__PURE__ */ jsx62(
6659
- DebouncedInputKeywordSearch,
6660
- {
6661
- inputFieldName: searchInputName,
6662
- placeholder: searchInputPlaceholderText,
6663
- onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
6664
- disabledFieldSubmission: true,
6665
- defaultValue: searchState.keyword,
6666
- delay: 300
6667
- }
6668
- )
6669
- ]
6670
- }
6671
- );
6672
- };
6673
-
6674
- // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
6675
- import { jsx as jsx63, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
6676
- var ObjectSearchFilterContainer2 = ({ label, children }) => {
6677
- return /* @__PURE__ */ jsxs37("div", { children: [
6678
- label ? /* @__PURE__ */ jsx63("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
6679
- /* @__PURE__ */ jsx63("div", { css: ObjectSearchFilterContainer, children })
6680
- ] });
6681
- };
6682
-
6683
- // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6684
- import { Badge, Button as Button4, Popover as Popover2 } from "@uniformdev/design-system";
6685
- import { format as timeagoFormat } from "timeago.js";
6686
-
6687
- // src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
6688
- import { css as css34 } from "@emotion/react";
6689
- import { button as button2 } from "@uniformdev/design-system";
6690
- var ButtonStyles = css34`
6691
- ${button2}
6692
- background: transparent;
6693
- border: 1px solid var(--typography-base);
6694
- color: var(--typography-base);
6695
- padding: var(--spacing-sm);
6696
- font-size: var(--fs-sm);
6697
- line-height: 1;
6698
- gap: var(--spacing-xs);
6699
- transition: border-color var(--duration-fast) var(--timing-ease-out),
6700
- background-color var(--duration-fast) var(--timing-ease-out);
6701
-
6702
- &:hover {
6703
- background: var(--gray-100);
6704
- border-color: var(--gray-300);
6705
- }
6706
-
6707
- &:disabled {
6708
- background: var(--gray-300);
6709
- border-color: var(--gray-200);
6710
- color: var(--gray-500);
6711
- }
6712
-
6713
- &:link {
6714
- text-decoration: none;
6715
- }
6716
- `;
6717
- var ButtonIcon = css34`
6718
- width: 1rem;
6719
- height: 1rem;
6625
+ var ButtonIcon = css33`
6626
+ width: 1rem;
6627
+ height: 1rem;
6720
6628
  `;
6721
6629
 
6722
6630
  // src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
6723
- import { jsx as jsx64, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
6631
+ import { jsx as jsx61, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
6724
6632
  var ObjectSearchResultItemButton = ({
6725
6633
  text,
6726
6634
  icon,
6727
6635
  ...props
6728
6636
  }) => {
6729
- return /* @__PURE__ */ jsxs38("button", { type: "button", css: ButtonStyles, ...props, children: [
6730
- !icon ? null : /* @__PURE__ */ jsx64(Image, { src: icon, css: ButtonIcon }),
6637
+ return /* @__PURE__ */ jsxs35("button", { type: "button", css: ButtonStyles, ...props, children: [
6638
+ !icon ? null : /* @__PURE__ */ jsx61(Image, { src: icon, css: ButtonIcon }),
6731
6639
  text
6732
6640
  ] });
6733
6641
  };
@@ -6736,15 +6644,15 @@ var LinkButton = ({
6736
6644
  icon,
6737
6645
  ...props
6738
6646
  }) => {
6739
- return /* @__PURE__ */ jsxs38("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6740
- !icon ? null : /* @__PURE__ */ jsx64(Image, { src: icon, css: ButtonIcon }),
6647
+ return /* @__PURE__ */ jsxs35("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
6648
+ !icon ? null : /* @__PURE__ */ jsx61(Image, { src: icon, css: ButtonIcon }),
6741
6649
  text
6742
6650
  ] });
6743
6651
  };
6744
6652
 
6745
6653
  // src/components/ObjectSearch/styles/ObjectSearchResultItem.styles.ts
6746
- import { css as css35 } from "@emotion/react";
6747
- var ObjectSearchResultItemContainer = css35`
6654
+ import { css as css34 } from "@emotion/react";
6655
+ var ObjectSearchResultItemContainer = css34`
6748
6656
  align-items: center;
6749
6657
  border: 1px solid var(--gray-300);
6750
6658
  border-radius: var(--rounded-base);
@@ -6760,7 +6668,7 @@ var ObjectSearchResultItemContainer = css35`
6760
6668
  }
6761
6669
  }
6762
6670
  `;
6763
- var ObjectSearchDragHandle = css35`
6671
+ var ObjectSearchDragHandle = css34`
6764
6672
  border-left: 2px dotted var(--gray-300);
6765
6673
  border-right: 2px dotted var(--gray-300);
6766
6674
  position: absolute;
@@ -6769,41 +6677,41 @@ var ObjectSearchDragHandle = css35`
6769
6677
  transition: opacity var(--duration-fast) var(--timing-ease-out);
6770
6678
  opacity: 0;
6771
6679
  `;
6772
- var ObjectSearchResultItemSubtitle = css35`
6680
+ var ObjectSearchResultItemSubtitle = css34`
6773
6681
  color: var(--gray-500);
6774
6682
  display: block;
6775
6683
  font-size: var(--fs-xs);
6776
6684
  line-height: 1;
6777
6685
  `;
6778
- var ObjectSearchResultItemTitle = css35`
6686
+ var ObjectSearchResultItemTitle = css34`
6779
6687
  align-items: center;
6780
6688
  color: var(--typography-base);
6781
6689
  display: flex;
6782
6690
  gap: var(--spacing-xs);
6783
6691
  `;
6784
- var ObjectSearchResultItemTimeStamp = css35`
6692
+ var ObjectSearchResultItemTimeStamp = css34`
6785
6693
  color: var(--gray-500);
6786
6694
  font-size: var(--fs-xs);
6787
6695
  `;
6788
- var ObjectSearchAuthorStateGroup = css35`
6696
+ var ObjectSearchAuthorStateGroup = css34`
6789
6697
  align-items: center;
6790
6698
  display: flex;
6791
6699
  gap: var(--spacing-sm);
6792
6700
  `;
6793
- var ObjectSearchUpdateGroup = css35`
6701
+ var ObjectSearchUpdateGroup = css34`
6794
6702
  display: grid;
6795
6703
  `;
6796
- var ObjectSearchContentContainer = css35`
6704
+ var ObjectSearchContentContainer = css34`
6797
6705
  display: flex;
6798
6706
  gap: var(--spacing-base);
6799
6707
  `;
6800
- var ObjectSearchImage = css35`
6708
+ var ObjectSearchImage = css34`
6801
6709
  width: 56px;
6802
6710
  object-fit: contain;
6803
6711
  `;
6804
6712
 
6805
6713
  // src/components/ObjectSearch/ObjectSearchResultItem.tsx
6806
- import { jsx as jsx65, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
6714
+ import { jsx as jsx62, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
6807
6715
  var ObjectSearchResultItem = ({
6808
6716
  id,
6809
6717
  title,
@@ -6827,70 +6735,66 @@ var ObjectSearchResultItem = ({
6827
6735
  onSelectItem({ id, title: id });
6828
6736
  onRemove == null ? void 0 : onRemove();
6829
6737
  };
6830
- return /* @__PURE__ */ jsxs39("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
6831
- disableDnD ? null : /* @__PURE__ */ jsx65("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6832
- /* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsxs39("div", { css: ObjectSearchContentContainer, children: [
6833
- !imageUrl ? null : /* @__PURE__ */ jsx65("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6834
- /* @__PURE__ */ jsxs39("div", { children: [
6835
- /* @__PURE__ */ jsx65("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
6836
- /* @__PURE__ */ jsxs39("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
6738
+ return /* @__PURE__ */ jsxs36("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
6739
+ disableDnD ? null : /* @__PURE__ */ jsx62("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
6740
+ /* @__PURE__ */ jsx62("div", { children: /* @__PURE__ */ jsxs36("div", { css: ObjectSearchContentContainer, children: [
6741
+ !imageUrl ? null : /* @__PURE__ */ jsx62("img", { src: imageUrl, alt: `Thumbnail for ${title}`, css: ObjectSearchImage }),
6742
+ /* @__PURE__ */ jsxs36("div", { children: [
6743
+ /* @__PURE__ */ jsx62("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
6744
+ /* @__PURE__ */ jsxs36("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
6837
6745
  title != null ? title : name,
6838
- !popoverData ? null : /* @__PURE__ */ jsx65(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6746
+ !popoverData ? null : /* @__PURE__ */ jsx62(Popover2, { baseId: title, ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
6839
6747
  ] }),
6840
- !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchAuthorStateGroup, children: [
6841
- !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx65(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6842
- !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchUpdateGroup, children: [
6843
- !createdAt ? null : /* @__PURE__ */ jsxs39("small", { css: ObjectSearchResultItemTimeStamp, children: [
6844
- /* @__PURE__ */ jsx65("strong", { children: "Last updated: " }),
6748
+ !createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs36("div", { css: ObjectSearchAuthorStateGroup, children: [
6749
+ !(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx62(Badge, { ...publishStatus, size: "sm", uppercaseText: true }),
6750
+ !createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs36("div", { css: ObjectSearchUpdateGroup, children: [
6751
+ !createdAt ? null : /* @__PURE__ */ jsxs36("small", { css: ObjectSearchResultItemTimeStamp, children: [
6752
+ /* @__PURE__ */ jsx62("strong", { children: "Last updated: " }),
6845
6753
  timeagoFormat(createdAt)
6846
6754
  ] }),
6847
- !publishedAt ? null : /* @__PURE__ */ jsxs39("small", { css: ObjectSearchResultItemTimeStamp, children: [
6848
- /* @__PURE__ */ jsx65("strong", { children: "Last published: " }),
6755
+ !publishedAt ? null : /* @__PURE__ */ jsxs36("small", { css: ObjectSearchResultItemTimeStamp, children: [
6756
+ /* @__PURE__ */ jsx62("strong", { children: "Last published: " }),
6849
6757
  timeagoFormat(publishedAt)
6850
6758
  ] })
6851
6759
  ] })
6852
6760
  ] }),
6853
- /* @__PURE__ */ jsx65("div", { children })
6761
+ /* @__PURE__ */ jsx62("div", { children })
6854
6762
  ] })
6855
6763
  ] }) }),
6856
- !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs39("div", { css: ObjectSearchAuthorStateGroup, children: [
6857
- !editLink ? null : /* @__PURE__ */ jsx65(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6858
- hideRemoveButton ? null : /* @__PURE__ */ jsx65(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6764
+ !editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs36("div", { css: ObjectSearchAuthorStateGroup, children: [
6765
+ !editLink ? null : /* @__PURE__ */ jsx62(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
6766
+ hideRemoveButton ? null : /* @__PURE__ */ jsx62(Button4, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
6859
6767
  ] })
6860
6768
  ] });
6861
6769
  };
6862
6770
 
6863
- // src/components/ObjectSearch/ObjectSearchResultList.tsx
6864
- import { Button as Button5, Counter } from "@uniformdev/design-system";
6865
- import { Draggable as Draggable3, Droppable as Droppable3 } from "react-beautiful-dnd";
6866
-
6867
6771
  // src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
6868
- import { css as css36 } from "@emotion/react";
6869
- var ObjectSearchResultListContainer = css36`
6772
+ import { css as css35 } from "@emotion/react";
6773
+ var ObjectSearchResultListContainer = css35`
6870
6774
  align-items: center;
6871
6775
  display: flex;
6872
6776
  gap: var(--spacing-sm);
6873
6777
  justify-content: space-between;
6874
6778
  `;
6875
- var ObjectSearchDragContainer = css36`
6779
+ var ObjectSearchDragContainer = css35`
6876
6780
  margin: 0 0 var(--spacing-sm);
6877
6781
  `;
6878
- var ObjectSearchContainerDragging = css36`
6782
+ var ObjectSearchContainerDragging = css35`
6879
6783
  box-shadow: var(--shadow-base);
6880
6784
  opacity: var(--opacity-50);
6881
6785
  `;
6882
- var ObjectSearchResultListCounterContainer = css36`
6786
+ var ObjectSearchResultListCounterContainer = css35`
6883
6787
  align-items: center;
6884
6788
  display: flex;
6885
6789
  gap: var(--spacing-sm);
6886
6790
  `;
6887
- var ObjectSearchResultListTitle = css36`
6791
+ var ObjectSearchResultListTitle = css35`
6888
6792
  font-weight: var(--fw-bold);
6889
6793
  line-height: 1;
6890
6794
  `;
6891
6795
 
6892
6796
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
6893
- import { Fragment as Fragment13, jsx as jsx66, jsxs as jsxs40 } from "@emotion/react/jsx-runtime";
6797
+ import { Fragment as Fragment13, jsx as jsx63, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
6894
6798
  function ObjectSearchResultList({
6895
6799
  resultLabelText = "Selected",
6896
6800
  removeButtonText = "Remove all",
@@ -6898,7 +6802,7 @@ function ObjectSearchResultList({
6898
6802
  hideRemoveButton = false,
6899
6803
  resultLabelOverride,
6900
6804
  additionalButtons,
6901
- renderResultComponent = (value) => /* @__PURE__ */ jsx66(ObjectSearchResultItem, { ...value }),
6805
+ renderResultComponent = (value) => /* @__PURE__ */ jsx63(ObjectSearchResultItem, { ...value }),
6902
6806
  multiSelectId,
6903
6807
  disableDnD = false,
6904
6808
  getContainerForDnDReparenting,
@@ -6923,9 +6827,10 @@ function ObjectSearchResultList({
6923
6827
  const item = selectedListItems.find((i) => i.id === rubric.draggableId);
6924
6828
  const renderListItem = renderResultComponent({
6925
6829
  ...item,
6830
+ hideRemoveButton,
6926
6831
  disableDnD: selectedListItems.length === 1 || disableDnD
6927
6832
  });
6928
- return /* @__PURE__ */ jsx66(
6833
+ return /* @__PURE__ */ jsx63(
6929
6834
  "div",
6930
6835
  {
6931
6836
  css: [
@@ -6940,16 +6845,16 @@ function ObjectSearchResultList({
6940
6845
  }
6941
6846
  );
6942
6847
  };
6943
- return /* @__PURE__ */ jsxs40(Fragment13, { children: [
6944
- /* @__PURE__ */ jsxs40("div", { role: "group", css: ObjectSearchResultListContainer, children: [
6945
- !resultLabelOverride ? /* @__PURE__ */ jsxs40("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
6946
- /* @__PURE__ */ jsx66("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
6848
+ return /* @__PURE__ */ jsxs37(Fragment13, { children: [
6849
+ /* @__PURE__ */ jsxs37("div", { role: "group", css: ObjectSearchResultListContainer, children: [
6850
+ !resultLabelOverride ? /* @__PURE__ */ jsxs37("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
6851
+ /* @__PURE__ */ jsx63("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
6947
6852
  " ",
6948
- !selectedListItems.length ? null : /* @__PURE__ */ jsx66(Counter, { count: selectedListItems.length })
6853
+ !selectedListItems.length ? null : /* @__PURE__ */ jsx63(Counter, { count: selectedListItems.length })
6949
6854
  ] }) : resultLabelOverride,
6950
- /* @__PURE__ */ jsxs40("div", { css: ObjectSearchResultListCounterContainer, children: [
6855
+ /* @__PURE__ */ jsxs37("div", { css: ObjectSearchResultListCounterContainer, children: [
6951
6856
  additionalButtons,
6952
- hideRemoveButton ? null : /* @__PURE__ */ jsx66(
6857
+ hideRemoveButton ? null : /* @__PURE__ */ jsx63(
6953
6858
  Button5,
6954
6859
  {
6955
6860
  buttonType: "ghostDestructive",
@@ -6961,15 +6866,15 @@ function ObjectSearchResultList({
6961
6866
  )
6962
6867
  ] })
6963
6868
  ] }),
6964
- !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx66(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx66(
6869
+ !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx63(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx63(
6965
6870
  Droppable3,
6966
6871
  {
6967
6872
  droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
6968
6873
  renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
6969
6874
  getContainerForClone: getContainerForDnDReparenting,
6970
- children: (provided) => /* @__PURE__ */ jsxs40("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
6875
+ children: (provided) => /* @__PURE__ */ jsxs37("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
6971
6876
  selectedListItems.map((item, i) => {
6972
- return /* @__PURE__ */ jsx66(
6877
+ return /* @__PURE__ */ jsx63(
6973
6878
  Draggable3,
6974
6879
  {
6975
6880
  draggableId: item.id,
@@ -6987,60 +6892,324 @@ function ObjectSearchResultList({
6987
6892
  ] });
6988
6893
  }
6989
6894
 
6990
- // src/components/ObjectSearch/QueryFilter.tsx
6991
- import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
6992
- import { useEffect as useEffect16, useState as useState18 } from "react";
6993
- import { jsx as jsx67, jsxs as jsxs41 } from "@emotion/react/jsx-runtime";
6994
- var QueryFilter = ({
6895
+ // src/components/ObjectSearch/ObjectSearchContainer.tsx
6896
+ import { Fragment as Fragment14, jsx as jsx64, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
6897
+ var ObjectSearchContainer = ({
6898
+ label,
6899
+ enableDynamicInputToResultId,
6900
+ searchFilters,
6901
+ resultList,
6902
+ children = /* @__PURE__ */ jsx64(ObjectSearchResultList, {})
6903
+ }) => {
6904
+ var _a, _b;
6905
+ const { onSelectItem, selectedListItems, list, dynamicEntryId, onSetQuery, query } = useObjectSearchContext();
6906
+ const { flatVariables } = useVariables(true);
6907
+ const inputValue = (_b = dynamicEntryId != null ? dynamicEntryId : (_a = selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
6908
+ const isDynamicEntryIdAvailable = React12.useMemo(
6909
+ () => Boolean(inputValue && hasReferencedVariables(inputValue)),
6910
+ [inputValue]
6911
+ );
6912
+ const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx64(
6913
+ ScrollableList,
6914
+ {
6915
+ role: "list",
6916
+ css: css36`
6917
+ > div {
6918
+ transition: max-height var(--duration-slow) var(--timing-ease-out);
6919
+ max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
6920
+ }
6921
+ `,
6922
+ children: /* @__PURE__ */ jsx64(DefaultResultList, {})
6923
+ }
6924
+ );
6925
+ const handleSelectedVariableChange = (selectedValue) => {
6926
+ var _a2;
6927
+ if (!selectedValue) {
6928
+ onSelectItem([]);
6929
+ return;
6930
+ }
6931
+ const { result, errors } = bindVariables({
6932
+ value: selectedValue,
6933
+ variables: flatVariables,
6934
+ errorPrefix: "Dynamic input"
6935
+ });
6936
+ if (!result) {
6937
+ onSelectItem([]);
6938
+ return;
6939
+ }
6940
+ const item = (_a2 = list.items) == null ? void 0 : _a2.find((i) => i.id === result);
6941
+ onSelectItem([
6942
+ {
6943
+ title: selectedValue,
6944
+ contentType: (errors == null ? void 0 : errors.length) ? errors[0] instanceof Error ? errors[0].message : errors[0] : `Current dynamic value "${result}" is not an ID in the options`,
6945
+ // spread any matched list item, overriding the above default props
6946
+ ...item,
6947
+ // we want to make sure the ID is our dynamic value
6948
+ id: selectedValue
6949
+ }
6950
+ ]);
6951
+ if (hasReferencedVariables(selectedValue)) {
6952
+ onSetQuery({ ...query, dynamicEntryId: selectedValue });
6953
+ }
6954
+ };
6955
+ const showSearchList = !label || !isDynamicEntryIdAvailable || !enableDynamicInputToResultId;
6956
+ return /* @__PURE__ */ jsx64(IconsProvider, { children: /* @__PURE__ */ jsxs38(VerticalRhythm3, { children: [
6957
+ /* @__PURE__ */ jsx64(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: /* @__PURE__ */ jsxs38(VerticalRhythm3, { children: [
6958
+ label ? /* @__PURE__ */ jsx64(
6959
+ InputVariables,
6960
+ {
6961
+ id: "entryId",
6962
+ label,
6963
+ value: inputValue,
6964
+ onChange: (value) => {
6965
+ if (value === inputValue) {
6966
+ return;
6967
+ }
6968
+ handleSelectedVariableChange(value);
6969
+ },
6970
+ inputWhenNoVariables: /* @__PURE__ */ jsx64(Fragment14, { children: searchFilters }),
6971
+ disableVariables: !enableDynamicInputToResultId
6972
+ }
6973
+ ) : searchFilters,
6974
+ showSearchList ? listItems : null
6975
+ ] }) }),
6976
+ children
6977
+ ] }) });
6978
+ };
6979
+ var DefaultResultList = () => {
6980
+ var _a, _b;
6981
+ const { list, isListLoading } = useObjectSearchContext();
6982
+ if (isListLoading || !list.items) {
6983
+ return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx64(ObjectSearchListItemLoadingSkeleton, {}, i));
6984
+ }
6985
+ if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
6986
+ return /* @__PURE__ */ jsx64(Callout5, { type: "info", children: "No results were found" });
6987
+ }
6988
+ return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ jsx64(ObjectSearchListItem, { ...item }, item.id));
6989
+ };
6990
+
6991
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
6992
+ import { DebouncedInputKeywordSearch, InputSelect as InputSelect6, VerticalRhythm as VerticalRhythm4 } from "@uniformdev/design-system";
6993
+ import { useMemo as useMemo15, useState as useState17 } from "react";
6994
+ import { useDebounce as useDebounce4 } from "react-use";
6995
+
6996
+ // src/utils/createLocationValidator.ts
6997
+ function createLocationValidator(setValue, validate) {
6998
+ return (dispatch) => setValue((previous) => {
6999
+ const { newValue, options } = dispatch(previous);
7000
+ return { newValue, options: validate(newValue, options) };
7001
+ });
7002
+ }
7003
+
7004
+ // src/utils/useContentDataResourceLocaleInfo.ts
7005
+ import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
7006
+ import { useEffect as useEffect17, useRef as useRef15 } from "react";
7007
+ function useContentDataResourceLocaleInfo({
7008
+ locale,
7009
+ setLocale,
7010
+ dynamicInputs
7011
+ }) {
7012
+ var _a;
7013
+ const setLocaleRef = useRef15(setLocale);
7014
+ setLocaleRef.current = setLocale;
7015
+ const { flatVariables } = useVariables();
7016
+ const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
7017
+ const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
7018
+ useEffect17(() => {
7019
+ if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
7020
+ setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
7021
+ }
7022
+ }, [locale, effectiveLocale]);
7023
+ return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
7024
+ }
7025
+
7026
+ // src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
7027
+ import { css as css37 } from "@emotion/react";
7028
+ var ObjectSearchFilterContainerLabel = css37`
7029
+ align-items: center;
7030
+ display: flex;
7031
+ font-size: var(--fs-sm);
7032
+ font-weight: var(--fw-bold);
7033
+ line-height: 1rem;
7034
+ margin-bottom: var(--spacing-sm);
7035
+ `;
7036
+ var ObjectSearchFilterContainer = css37`
7037
+ display: grid;
7038
+ gap: var(--spacing-base);
7039
+ `;
7040
+ var ObjectSearchFilterGrid = (gridColumns) => css37`
7041
+ display: grid;
7042
+ grid-template-columns: ${gridColumns};
7043
+ gap: var(--spacing-base);
7044
+ `;
7045
+
7046
+ // src/components/ObjectSearch/ObjectSearchFilter.tsx
7047
+ import { jsx as jsx65, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
7048
+ var ObjectSearchFilter = ({
6995
7049
  requireContentType,
6996
- queryFilterTitle = "Configure Query",
6997
- contentTypeLabel = "Filter by content type",
6998
7050
  typeSelectorAllTypesOptionText = "All content types",
6999
- contentTypeOptions,
7000
7051
  searchInputName = "searchText",
7001
7052
  searchInputPlaceholderText = "Enter keyword to narrow your results",
7002
- searchInputLabel = "Query",
7003
- countLabel = "Count",
7004
- countValue = 5,
7005
- sortLabel = "Sort By",
7006
- sortOptions,
7007
- sortOrderLabel = "Sort Order",
7008
- sortOrderOptions = [
7009
- {
7010
- value: "asc",
7011
- label: "Ascending"
7012
- },
7013
- {
7014
- value: "desc",
7015
- label: "Descending"
7016
- }
7017
- ],
7018
- children
7053
+ selectLabel = "Content Type Select",
7054
+ localeFilterLabel = "Filter by locale",
7055
+ selectOptions
7019
7056
  }) => {
7020
- var _a, _b, _c, _d, _e, _f, _g;
7021
- const { query, onSetQuery } = useObjectSearchContext();
7022
- const [queryState, setQueryState] = useState18({
7023
- contentType: (_a = query.contentType) != null ? _a : "",
7024
- keyword: (_b = query.keyword) != null ? _b : "",
7025
- count: (_c = query.count) != null ? _c : countValue,
7026
- sortBy: (_d = query.sortBy) != null ? _d : "",
7027
- sortOrder: (_e = query.sortOrder) != null ? _e : ""
7057
+ var _a, _b, _c;
7058
+ const { query, onSetQuery, localeOptions, enableFilterByLocale } = useObjectSearchContext();
7059
+ const dynamicInputs = useDataResourceDynamicInputs();
7060
+ const { boundLocale = "", effectiveLocale } = useContentDataResourceLocaleInfo({
7061
+ locale: query.locale,
7062
+ dynamicInputs: dynamicInputs != null ? dynamicInputs : {},
7063
+ setLocale: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" })
7064
+ });
7065
+ const [searchState, setSearchState] = useState17({
7066
+ keyword: (_a = query.keyword) != null ? _a : "",
7067
+ contentType: (_b = query.contentType) != null ? _b : "",
7068
+ locale: (_c = query.locale) != null ? _c : ""
7028
7069
  });
7029
7070
  const handleFilterChange = (value) => {
7030
- setQueryState((prev) => ({ ...prev, ...value }));
7031
- onSetQuery({ ...query, ...value });
7071
+ setSearchState((prev) => {
7072
+ return { ...prev, ...value };
7073
+ });
7032
7074
  };
7033
- useEffect16(() => {
7034
- onSetQuery(queryState);
7035
- }, []);
7036
- return /* @__PURE__ */ jsxs41("fieldset", { children: [
7037
- /* @__PURE__ */ jsx67("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
7038
- /* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(VerticalRhythm3, { children: [
7039
- /* @__PURE__ */ jsx67(
7040
- InputVariables,
7041
- {
7042
- label: searchInputLabel,
7043
- value: (_f = queryState.keyword) != null ? _f : "",
7075
+ useDebounce4(
7076
+ () => {
7077
+ onSetQuery({ ...query, ...searchState });
7078
+ },
7079
+ 500,
7080
+ [searchState]
7081
+ );
7082
+ const memoizedSelectOptions = useMemo15(() => {
7083
+ if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
7084
+ return [];
7085
+ }
7086
+ return [
7087
+ ...!requireContentType ? [{ value: "any", label: typeSelectorAllTypesOptionText }] : [],
7088
+ ...selectOptions != null ? selectOptions : []
7089
+ ];
7090
+ }, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
7091
+ const shouldRenderSelect = memoizedSelectOptions.length > 0;
7092
+ return /* @__PURE__ */ jsxs39(VerticalRhythm4, { gap: "base", children: [
7093
+ /* @__PURE__ */ jsxs39(
7094
+ "fieldset",
7095
+ {
7096
+ css: [
7097
+ ObjectSearchFilterContainer,
7098
+ ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
7099
+ ],
7100
+ children: [
7101
+ memoizedSelectOptions.length ? /* @__PURE__ */ jsx65(
7102
+ InputSelect6,
7103
+ {
7104
+ label: selectLabel,
7105
+ showLabel: false,
7106
+ onChange: (e) => handleFilterChange({ contentType: e.target.value }),
7107
+ options: memoizedSelectOptions,
7108
+ value: query.contentType,
7109
+ "data-testid": "select-entry"
7110
+ }
7111
+ ) : null,
7112
+ /* @__PURE__ */ jsx65(
7113
+ DebouncedInputKeywordSearch,
7114
+ {
7115
+ inputFieldName: searchInputName,
7116
+ placeholder: searchInputPlaceholderText,
7117
+ onSearchTextChanged: (keyword) => handleFilterChange({ keyword }),
7118
+ disabledFieldSubmission: true,
7119
+ defaultValue: searchState.keyword,
7120
+ delay: 300
7121
+ }
7122
+ )
7123
+ ]
7124
+ }
7125
+ ),
7126
+ enableFilterByLocale && (localeOptions == null ? void 0 : localeOptions.length) && /* @__PURE__ */ jsx65(
7127
+ InputVariables,
7128
+ {
7129
+ label: localeFilterLabel,
7130
+ id: "locale",
7131
+ value: effectiveLocale,
7132
+ onChange: (newLocale) => handleFilterChange({ locale: newLocale != null ? newLocale : "" }),
7133
+ disableInlineMenu: true,
7134
+ inputWhenNoVariables: /* @__PURE__ */ jsx65(
7135
+ InputSelect6,
7136
+ {
7137
+ id: "locale",
7138
+ options: localeOptions,
7139
+ name: "locale",
7140
+ label: "",
7141
+ value: boundLocale,
7142
+ onChange: (e) => handleFilterChange({ locale: e.target.value })
7143
+ }
7144
+ )
7145
+ }
7146
+ )
7147
+ ] });
7148
+ };
7149
+
7150
+ // src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
7151
+ import { jsx as jsx66, jsxs as jsxs40 } from "@emotion/react/jsx-runtime";
7152
+ var ObjectSearchFilterContainer2 = ({ label, children }) => {
7153
+ return /* @__PURE__ */ jsxs40("div", { children: [
7154
+ label ? /* @__PURE__ */ jsx66("span", { css: ObjectSearchFilterContainerLabel, children: label }) : null,
7155
+ /* @__PURE__ */ jsx66("div", { css: ObjectSearchFilterContainer, children })
7156
+ ] });
7157
+ };
7158
+
7159
+ // src/components/ObjectSearch/QueryFilter.tsx
7160
+ import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input5, InputSelect as InputSelect7, VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
7161
+ import { useEffect as useEffect18, useState as useState18 } from "react";
7162
+ import { jsx as jsx67, jsxs as jsxs41 } from "@emotion/react/jsx-runtime";
7163
+ var QueryFilter = ({
7164
+ requireContentType,
7165
+ queryFilterTitle = "Configure Query",
7166
+ contentTypeLabel = "Filter by content type",
7167
+ typeSelectorAllTypesOptionText = "All content types",
7168
+ contentTypeOptions,
7169
+ searchInputName = "searchText",
7170
+ searchInputPlaceholderText = "Enter keyword to narrow your results",
7171
+ searchInputLabel = "Query",
7172
+ countLabel = "Count",
7173
+ countValue = 5,
7174
+ sortLabel = "Sort By",
7175
+ sortOptions,
7176
+ sortOrderLabel = "Sort Order",
7177
+ sortOrderOptions = [
7178
+ {
7179
+ value: "asc",
7180
+ label: "Ascending"
7181
+ },
7182
+ {
7183
+ value: "desc",
7184
+ label: "Descending"
7185
+ }
7186
+ ],
7187
+ children
7188
+ }) => {
7189
+ var _a, _b, _c, _d, _e, _f, _g;
7190
+ const { query, onSetQuery } = useObjectSearchContext();
7191
+ const [queryState, setQueryState] = useState18({
7192
+ contentType: (_a = query.contentType) != null ? _a : "",
7193
+ keyword: (_b = query.keyword) != null ? _b : "",
7194
+ count: (_c = query.count) != null ? _c : countValue,
7195
+ sortBy: (_d = query.sortBy) != null ? _d : "",
7196
+ sortOrder: (_e = query.sortOrder) != null ? _e : ""
7197
+ });
7198
+ const handleFilterChange = (value) => {
7199
+ setQueryState((prev) => ({ ...prev, ...value }));
7200
+ onSetQuery({ ...query, ...value });
7201
+ };
7202
+ useEffect18(() => {
7203
+ onSetQuery(queryState);
7204
+ }, []);
7205
+ return /* @__PURE__ */ jsxs41("fieldset", { children: [
7206
+ /* @__PURE__ */ jsx67("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
7207
+ /* @__PURE__ */ jsx67("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs41(VerticalRhythm5, { children: [
7208
+ /* @__PURE__ */ jsx67(
7209
+ InputVariables,
7210
+ {
7211
+ label: searchInputLabel,
7212
+ value: (_f = queryState.keyword) != null ? _f : "",
7044
7213
  onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
7045
7214
  disableInlineMenu: true,
7046
7215
  id: "qf_searchText",
@@ -7155,9 +7324,107 @@ var QueryFilter = ({
7155
7324
  ] });
7156
7325
  };
7157
7326
 
7158
- // src/components/ParamTypeDynamicDataProvider.tsx
7159
- import { useEffect as useEffect17, useMemo as useMemo16, useRef as useRef15 } from "react";
7327
+ // src/components/ObjectSearch/ObjectSearchListOfSearchResults.tsx
7328
+ import { Callout as Callout6 } from "@uniformdev/design-system";
7160
7329
  import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
7330
+ function ObjectSearchListOfSearchResults() {
7331
+ var _a, _b;
7332
+ const { list, isListLoading } = useObjectSearchContext();
7333
+ if (isListLoading) {
7334
+ return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx68(ObjectSearchListItemLoadingSkeleton, {}, i));
7335
+ }
7336
+ if (((_a = list.items) == null ? void 0 : _a.length) === 0) {
7337
+ return /* @__PURE__ */ jsx68(Callout6, { type: "info", children: "No results were found" });
7338
+ }
7339
+ return (_b = list.items) == null ? void 0 : _b.map((item) => /* @__PURE__ */ jsx68(ObjectSearchListItem, { ...item }, item.id));
7340
+ }
7341
+
7342
+ // src/components/ObjectSearch/hooks/ControlledObjectSearchProvider.tsx
7343
+ import { useCallback as useCallback6, useDeferredValue as useDeferredValue2, useEffect as useEffect19, useMemo as useMemo16, useRef as useRef16 } from "react";
7344
+ import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
7345
+ var ControlledObjectSearchProvider = ({
7346
+ selectedItems,
7347
+ searchResultItems,
7348
+ selectedItemsLoading,
7349
+ searchResultListLoading,
7350
+ onQueryChange = () => {
7351
+ },
7352
+ onSelectItemsChange,
7353
+ isMulti = false,
7354
+ children,
7355
+ query = {},
7356
+ enableFilterByLocale,
7357
+ localeOptions,
7358
+ dynamicEntryId,
7359
+ isManualSelection
7360
+ }) => {
7361
+ var _a, _b;
7362
+ const { flatVariables } = useVariables(true);
7363
+ const querySearchDeferred = useDeferredValue2(query);
7364
+ const innerSelectedItems = useRef16(selectedItems);
7365
+ useEffect19(() => {
7366
+ if (selectedItems !== void 0) {
7367
+ innerSelectedItems.current = selectedItems;
7368
+ }
7369
+ }, [selectedItems]);
7370
+ const onSetQuery = useCallback6(
7371
+ (value) => {
7372
+ const newQuery = { ...query, ...value };
7373
+ onQueryChange(newQuery);
7374
+ },
7375
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7376
+ [onQueryChange]
7377
+ );
7378
+ const onSelectItem = useCallback6(
7379
+ (selectedResult) => {
7380
+ var _a2;
7381
+ if (Array.isArray(selectedResult)) {
7382
+ innerSelectedItems.current = selectedResult;
7383
+ onSelectItemsChange(selectedResult);
7384
+ } else {
7385
+ const itemIsAlreadySelected = selectedItems == null ? void 0 : selectedItems.some((item) => item.id === selectedResult.id);
7386
+ const updatedSelectedItems = itemIsAlreadySelected ? (_a2 = selectedItems == null ? void 0 : selectedItems.filter((item) => item.id !== selectedResult.id)) != null ? _a2 : [] : [...selectedItems != null ? selectedItems : [], selectedResult];
7387
+ innerSelectedItems.current = updatedSelectedItems;
7388
+ onSelectItemsChange(updatedSelectedItems);
7389
+ }
7390
+ },
7391
+ [onSelectItemsChange, selectedItems]
7392
+ );
7393
+ const onRemoveAllSelectedItems = useCallback6(() => {
7394
+ innerSelectedItems.current = [];
7395
+ onSelectItemsChange([]);
7396
+ }, [onSelectItemsChange]);
7397
+ const list = useMemo16(() => ({ items: searchResultItems }), [searchResultItems]);
7398
+ const boundQuery = useMemo16(() => bindQuery(query, flatVariables), [query, flatVariables]);
7399
+ const isLoadingInitially = Boolean(
7400
+ isManualSelection ? !((_a = innerSelectedItems.current) == null ? void 0 : _a.length) && selectedItemsLoading : selectedItemsLoading
7401
+ );
7402
+ return /* @__PURE__ */ jsx69(
7403
+ ObjectSearchContext.Provider,
7404
+ {
7405
+ value: {
7406
+ boundQuery,
7407
+ onSetQuery,
7408
+ query: querySearchDeferred,
7409
+ onSelectItem,
7410
+ selectedListItems: (_b = isManualSelection ? innerSelectedItems.current : selectedItems) != null ? _b : [],
7411
+ onRemoveAllSelectedItems,
7412
+ list,
7413
+ isSelectedItemsListLoading: isLoadingInitially,
7414
+ isListLoading: searchResultListLoading,
7415
+ isMulti,
7416
+ localeOptions,
7417
+ enableFilterByLocale,
7418
+ dynamicEntryId
7419
+ },
7420
+ children
7421
+ }
7422
+ );
7423
+ };
7424
+
7425
+ // src/components/ParamTypeDynamicDataProvider.tsx
7426
+ import { useEffect as useEffect20, useMemo as useMemo17, useRef as useRef17 } from "react";
7427
+ import { jsx as jsx70 } from "@emotion/react/jsx-runtime";
7161
7428
  function ParamTypeDynamicDataProvider(props) {
7162
7429
  const { children } = props;
7163
7430
  const {
@@ -7165,11 +7432,11 @@ function ParamTypeDynamicDataProvider(props) {
7165
7432
  } = useMeshLocation("paramType");
7166
7433
  const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
7167
7434
  const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
7168
- const variables = useMemo16(
7435
+ const variables = useMemo17(
7169
7436
  () => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
7170
7437
  [dynamicInputsAsVariables, connectedDataAsVariables]
7171
7438
  );
7172
- return /* @__PURE__ */ jsx68(VariablesProvider, { value: variables, onChange: () => {
7439
+ return /* @__PURE__ */ jsx70(VariablesProvider, { value: variables, onChange: () => {
7173
7440
  }, editVariableComponent: JsonMeshVariableEditor, children });
7174
7441
  }
7175
7442
  var JsonMeshVariableEditor = ({
@@ -7178,9 +7445,9 @@ var JsonMeshVariableEditor = ({
7178
7445
  variable,
7179
7446
  context
7180
7447
  }) => {
7181
- const sillyRef = useRef15(false);
7448
+ const sillyRef = useRef17(false);
7182
7449
  const { editConnectedData } = useMeshLocation("paramType");
7183
- useEffect17(() => {
7450
+ useEffect20(() => {
7184
7451
  if (sillyRef.current) {
7185
7452
  return;
7186
7453
  }
@@ -7208,102 +7475,2165 @@ var JsonMeshVariableEditor = ({
7208
7475
  return null;
7209
7476
  };
7210
7477
 
7211
- // src/utils/createLocationValidator.ts
7212
- function createLocationValidator(setValue, validate) {
7213
- return (dispatch) => setValue((previous) => {
7214
- const { newValue, options } = dispatch(previous);
7215
- return { newValue, options: validate(newValue, options) };
7216
- });
7217
- }
7218
-
7219
- // src/utils/useContentDataResourceLocaleInfo.ts
7220
- import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
7221
- import { useEffect as useEffect18, useRef as useRef16 } from "react";
7222
- function useContentDataResourceLocaleInfo({
7223
- locale,
7224
- setLocale,
7225
- dynamicInputs
7226
- }) {
7227
- var _a;
7228
- const setLocaleRef = useRef16(setLocale);
7229
- setLocaleRef.current = setLocale;
7230
- const { flatVariables } = useVariables();
7231
- const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
7232
- const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
7233
- useEffect18(() => {
7234
- if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
7235
- setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
7236
- }
7237
- }, [locale, effectiveLocale]);
7238
- return { effectiveLocale, boundLocale: boundLocale ? boundLocale : void 0 };
7239
- }
7240
-
7241
- // src/index.ts
7242
- import {
7243
- AddListButton as AddListButton2,
7244
- Button as Button6,
7245
- Callout as Callout6,
7246
- DrawerContent,
7247
- Heading,
7248
- Input as Input6,
7249
- InputComboBox,
7250
- InputKeywordSearch as InputKeywordSearch2,
7251
- InputSelect as InputSelect8,
7252
- InputToggle,
7253
- Label,
7254
- LoadingIndicator as LoadingIndicator5,
7255
- LoadingOverlay as LoadingOverlay2,
7256
- Menu as Menu4,
7257
- MenuItem as MenuItem3,
7258
- ParameterGroup,
7259
- ParameterImage,
7260
- ParameterImageInner,
7261
- ParameterInput,
7262
- ParameterInputInner,
7263
- ParameterLabel,
7264
- ParameterMenuButton,
7265
- ParameterSelect,
7266
- ParameterSelectInner,
7267
- ParameterShell,
7268
- ParameterTextarea,
7269
- ParameterTextareaInner,
7270
- ParameterToggle,
7271
- ParameterToggleInner,
7272
- ScrollableList as ScrollableList2,
7273
- ScrollableListItem,
7274
- Switch,
7275
- Textarea,
7276
- Theme as Theme3
7277
- } from "@uniformdev/design-system";
7278
- export * from "@uniformdev/mesh-sdk";
7279
- export {
7280
- $createVariableNode,
7281
- $isVariableNode,
7282
- AddListButton2 as AddListButton,
7283
- Button6 as Button,
7284
- Callout6 as Callout,
7285
- ControlledValuePlugin,
7286
- DISCONNECT_VARIABLE_COMMAND,
7287
- DamSelectedItem,
7288
- DataRefreshButton,
7289
- DataResourceDynamicInputProvider,
7290
- DataResourceVariablesList,
7291
- DataResourceVariablesListExplicit,
7292
- DataSourceEditor,
7293
- DataTypeEditor,
7294
- DefaultSearchRow,
7295
- DefaultSelectedItem,
7296
- DrawerContent,
7297
- EDIT_VARIABLE_COMMAND,
7298
- EntrySearch,
7299
- Heading,
7300
- INSERT_VARIABLE_COMMAND,
7301
- icons_exports as Icons,
7302
- Input6 as Input,
7303
- InputComboBox,
7304
- InputKeywordSearch2 as InputKeywordSearch,
7305
- InputSelect8 as InputSelect,
7306
- InputToggle,
7478
+ // src/components/SearchAndFilter/constants.ts
7479
+ var NUMBER_OPERATORS = [
7480
+ {
7481
+ label: "equals...",
7482
+ symbol: "=",
7483
+ value: "eq",
7484
+ editorType: "number"
7485
+ },
7486
+ {
7487
+ label: "does not equal...",
7488
+ symbol: "\u2260",
7489
+ value: "neq",
7490
+ editorType: "number"
7491
+ },
7492
+ {
7493
+ label: "greater than...",
7494
+ symbol: ">",
7495
+ value: "gt",
7496
+ editorType: "number"
7497
+ },
7498
+ {
7499
+ label: "greater than or equal to...",
7500
+ symbol: "\u2265",
7501
+ value: "gte",
7502
+ editorType: "number"
7503
+ },
7504
+ {
7505
+ label: "less than...",
7506
+ symbol: "<",
7507
+ value: "lt",
7508
+ editorType: "number"
7509
+ },
7510
+ {
7511
+ label: "less than or equal to...",
7512
+ symbol: "\u2264",
7513
+ value: "lte",
7514
+ editorType: "number"
7515
+ },
7516
+ {
7517
+ label: "is empty",
7518
+ value: "ndef",
7519
+ editorType: "empty"
7520
+ },
7521
+ {
7522
+ label: "is between...",
7523
+ value: "between",
7524
+ editorType: "numberRange"
7525
+ },
7526
+ {
7527
+ label: "is not empty",
7528
+ value: "def",
7529
+ editorType: "empty"
7530
+ }
7531
+ ];
7532
+ var DATE_OPERATORS = [
7533
+ {
7534
+ label: "is",
7535
+ value: "eq",
7536
+ editorType: "date"
7537
+ },
7538
+ {
7539
+ label: "is between...",
7540
+ value: "between",
7541
+ editorType: "dateRange"
7542
+ },
7543
+ {
7544
+ label: "is before...",
7545
+ value: "lt",
7546
+ editorType: "date"
7547
+ },
7548
+ {
7549
+ label: "is after...",
7550
+ value: "gt",
7551
+ editorType: "date"
7552
+ },
7553
+ {
7554
+ label: "is on or before...",
7555
+ value: "lte",
7556
+ editorType: "date"
7557
+ },
7558
+ {
7559
+ label: "is on or after...",
7560
+ value: "gte",
7561
+ editorType: "date"
7562
+ },
7563
+ {
7564
+ label: "is empty",
7565
+ value: "ndef",
7566
+ editorType: "empty"
7567
+ },
7568
+ {
7569
+ label: "is not",
7570
+ value: "neq",
7571
+ editorType: "date"
7572
+ },
7573
+ {
7574
+ label: "is not empty",
7575
+ value: "def",
7576
+ editorType: "empty"
7577
+ }
7578
+ ];
7579
+ var TEXTBOX_OPERATORS = [
7580
+ {
7581
+ label: "contains...",
7582
+ value: "match",
7583
+ editorType: "text"
7584
+ },
7585
+ {
7586
+ label: "is",
7587
+ value: "eq",
7588
+ editorType: "text"
7589
+ },
7590
+ {
7591
+ label: "is empty",
7592
+ value: "ndef",
7593
+ editorType: "empty"
7594
+ },
7595
+ {
7596
+ label: "starts with...",
7597
+ value: "starts",
7598
+ editorType: "text"
7599
+ },
7600
+ {
7601
+ label: "is not",
7602
+ value: "neq",
7603
+ editorType: "text"
7604
+ },
7605
+ {
7606
+ label: "is not empty",
7607
+ value: "def",
7608
+ editorType: "empty"
7609
+ }
7610
+ ];
7611
+ var USER_OPERATORS = [
7612
+ {
7613
+ label: "contains...",
7614
+ value: "match",
7615
+ editorType: "text"
7616
+ },
7617
+ {
7618
+ label: "is",
7619
+ value: "eq",
7620
+ editorType: "text"
7621
+ },
7622
+ {
7623
+ label: "starts with...",
7624
+ value: "starts",
7625
+ editorType: "text"
7626
+ },
7627
+ {
7628
+ label: "is not",
7629
+ value: "neq",
7630
+ editorType: "text"
7631
+ }
7632
+ ];
7633
+ var SYSTEM_DATE_OPERATORS = [
7634
+ {
7635
+ label: "is",
7636
+ value: "sys-date-eq",
7637
+ editorType: "date"
7638
+ },
7639
+ {
7640
+ label: "is between...",
7641
+ value: "sys-date-between",
7642
+ editorType: "dateRange"
7643
+ },
7644
+ {
7645
+ label: "is before...",
7646
+ value: "sys-date-lt",
7647
+ editorType: "date"
7648
+ },
7649
+ {
7650
+ label: "is after...",
7651
+ value: "sys-date-gt",
7652
+ editorType: "date"
7653
+ },
7654
+ {
7655
+ label: "is on or before...",
7656
+ value: "sys-date-lte",
7657
+ editorType: "date"
7658
+ },
7659
+ {
7660
+ label: "is on or after...",
7661
+ value: "sys-date-gte",
7662
+ editorType: "date"
7663
+ },
7664
+ {
7665
+ label: "is not",
7666
+ value: "sys-date-neq",
7667
+ editorType: "date"
7668
+ }
7669
+ ];
7670
+ var RICHTEXT_OPERATORS = [
7671
+ {
7672
+ label: "contains...",
7673
+ value: "match",
7674
+ editorType: "text"
7675
+ },
7676
+ {
7677
+ label: "is empty",
7678
+ value: "ndef",
7679
+ editorType: "empty"
7680
+ },
7681
+ {
7682
+ label: "starts with...",
7683
+ value: "starts",
7684
+ editorType: "text"
7685
+ },
7686
+ {
7687
+ label: "is not empty",
7688
+ value: "def",
7689
+ editorType: "empty"
7690
+ }
7691
+ ];
7692
+ var CHECKBOX_OPERATORS = [
7693
+ {
7694
+ label: "is checked",
7695
+ value: "def",
7696
+ editorType: "empty"
7697
+ },
7698
+ {
7699
+ label: "is not checked",
7700
+ value: "ndef",
7701
+ editorType: "empty"
7702
+ }
7703
+ ];
7704
+ var SYSTEM_FIELD_OPERATORS = [
7705
+ {
7706
+ label: "is",
7707
+ value: "eq",
7708
+ editorType: "singleChoice"
7709
+ },
7710
+ {
7711
+ label: "is any of...",
7712
+ value: "in",
7713
+ editorType: "multiChoice"
7714
+ },
7715
+ {
7716
+ label: "is not",
7717
+ value: "neq",
7718
+ editorType: "singleChoice"
7719
+ },
7720
+ {
7721
+ label: "is none of...",
7722
+ value: "nin",
7723
+ editorType: "multiChoice"
7724
+ }
7725
+ ];
7726
+ var PUBLISH_STATUS_FIELD_OPERATORS = [
7727
+ {
7728
+ label: "is",
7729
+ value: "eq",
7730
+ editorType: "statusSingleChoice"
7731
+ },
7732
+ {
7733
+ label: "is any of...",
7734
+ value: "in",
7735
+ editorType: "statusMultiChoice"
7736
+ },
7737
+ {
7738
+ label: "is not",
7739
+ value: "neq",
7740
+ editorType: "statusSingleChoice"
7741
+ },
7742
+ {
7743
+ label: "is none of...",
7744
+ value: "nin",
7745
+ editorType: "statusMultiChoice"
7746
+ }
7747
+ ];
7748
+ var SELECT_OPERATORS = [
7749
+ {
7750
+ label: "is",
7751
+ value: "eq",
7752
+ editorType: "singleChoice"
7753
+ },
7754
+ {
7755
+ label: "is any of...",
7756
+ value: "in",
7757
+ editorType: "multiChoice"
7758
+ },
7759
+ {
7760
+ label: "is empty",
7761
+ value: "ndef",
7762
+ editorType: "empty"
7763
+ },
7764
+ {
7765
+ label: "contains...",
7766
+ value: "match",
7767
+ editorType: "text"
7768
+ },
7769
+ {
7770
+ label: "starts with...",
7771
+ value: "starts",
7772
+ editorType: "text"
7773
+ },
7774
+ {
7775
+ label: "is not",
7776
+ value: "neq",
7777
+ editorType: "singleChoice"
7778
+ },
7779
+ {
7780
+ label: "is none of...",
7781
+ value: "nin",
7782
+ editorType: "multiChoice"
7783
+ },
7784
+ {
7785
+ label: "is not empty",
7786
+ value: "def",
7787
+ editorType: "empty"
7788
+ }
7789
+ ];
7790
+
7791
+ // src/components/SearchAndFilter/FilterButton.tsx
7792
+ import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
7793
+
7794
+ // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
7795
+ import { css as css38 } from "@emotion/react";
7796
+ import { cq, fadeInLtr } from "@uniformdev/design-system";
7797
+ var SearchAndFilterControlsWrapper = (gridColumns) => css38`
7798
+ align-items: stretch;
7799
+ display: grid;
7800
+ grid-template-columns: ${gridColumns};
7801
+ gap: var(--spacing-sm);
7802
+ `;
7803
+ var SearchAndFilterOutterControlWrapper = (gridColumns) => css38`
7804
+ align-items: stretch;
7805
+ display: grid;
7806
+ grid-template-columns: ${gridColumns};
7807
+ gap: var(--spacing-sm);
7808
+ `;
7809
+ var ConditionalFilterRow = css38`
7810
+ display: grid;
7811
+ grid-template-columns: 35px 1fr;
7812
+ gap: var(--spacing-sm);
7813
+ margin-left: var(--spacing-base);
7814
+
7815
+ ${cq("380px")} {
7816
+ align-items: center;
7817
+
7818
+ &:after {
7819
+ content: '';
7820
+ display: block;
7821
+ height: 1px;
7822
+ background: var(--gray-300);
7823
+ width: calc(100% - var(--spacing-base));
7824
+ margin-left: var(--spacing-base);
7825
+ }
7826
+ &:last-of-type:after {
7827
+ display: none;
7828
+ }
7829
+ }
7830
+
7831
+ &:nth-of-type(2) {
7832
+ margin-left: 0;
7833
+ grid-template-columns: 50px 1fr;
7834
+ }
7835
+
7836
+ ${cq("580px")} {
7837
+ &:after {
7838
+ display: none;
7839
+ }
7840
+ }
7841
+
7842
+ @media (prefers-reduced-motion: no-preference) {
7843
+ animation: ${fadeInLtr} var(--duration-fast) var(--timing-ease-out);
7844
+ }
7845
+ `;
7846
+ var ConditionalInputRow = css38`
7847
+ display: flex;
7848
+ gap: var(--spacing-sm);
7849
+ flex-wrap: wrap;
7850
+
7851
+ ${cq("380px")} {
7852
+ & > div:nth-child(-n + 2) {
7853
+ width: calc(50% - var(--spacing-sm));
7854
+ }
7855
+
7856
+ & > div:nth-child(n + 3) {
7857
+ width: calc(100% - 48px);
7858
+ }
7859
+ }
7860
+ ${cq("764px")} {
7861
+ display: grid;
7862
+ grid-template-columns: 200px 160px 1fr 32px;
7863
+
7864
+ & > div:nth-child(n) {
7865
+ width: auto;
7866
+ }
7867
+ }
7868
+ `;
7869
+ var SearchInput = css38`
7870
+ max-height: 40px;
7871
+ min-height: unset;
7872
+ `;
7873
+ var BindableKeywordSearchInputStyles = css38`
7874
+ position: relative;
7875
+ width: 100%;
7876
+
7877
+ & [data-lexical-editor='true'] {
7878
+ padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
7879
+ font-size: var(--fs-sm);
7880
+ border-radius: var(--rounded-full);
7881
+ max-height: 40px;
7882
+ min-height: unset;
7883
+ width: 100%;
7884
+ position: relative;
7885
+ white-space: nowrap;
7886
+ }
7887
+ `;
7888
+ var ClearSearchButtonContainer = css38`
7889
+ align-items: center;
7890
+ display: flex;
7891
+ position: absolute;
7892
+ inset: 0 var(--spacing-lg) 0 auto;
7893
+ `;
7894
+ var ClearSearchButtonStyles = css38`
7895
+ background: none;
7896
+ border: none;
7897
+ padding: 0;
7898
+ pointer-events: all;
7899
+ `;
7900
+ var FilterButton = css38`
7901
+ align-items: center;
7902
+ background: var(--white);
7903
+ border: 1px solid var(--gray-300);
7904
+ border-radius: var(--rounded-full);
7905
+ color: var(--typography-base);
7906
+ display: flex;
7907
+ font-size: var(--fs-sm);
7908
+ gap: var(--spacing-sm);
7909
+ padding: var(--spacing-sm) var(--spacing-base);
7910
+ max-height: 40px;
7911
+ transition: color var(--duration-fast) var(--timing-ease-out),
7912
+ background-color var(--duration-fast) var(--timing-ease-out),
7913
+ border-color var(--duration-fast) var(--timing-ease-out),
7914
+ box-shadow var(--duration-fast) var(--timing-ease-out);
7915
+
7916
+ svg {
7917
+ color: var(--gray-300);
7918
+ transition: color var(--duration-fast) var(--timing-ease-out);
7919
+ }
7920
+
7921
+ &:hover,
7922
+ :where([aria-expanded='true']) {
7923
+ outline: none;
7924
+ background: var(--gray-200);
7925
+ border-color: var(--gray-300);
7926
+
7927
+ svg {
7928
+ color: var(--typography-base);
7929
+ }
7930
+ }
7931
+
7932
+ &:disabled {
7933
+ opacity: var(--opacity-50);
7934
+ }
7935
+ `;
7936
+ var FilterButtonText = css38`
7937
+ overflow: hidden;
7938
+ text-overflow: ellipsis;
7939
+ white-space: nowrap;
7940
+ max-width: 14ch;
7941
+ `;
7942
+ var FilterButtonSelected = css38`
7943
+ background: var(--gray-100);
7944
+ border-color: var(--gray-300);
7945
+
7946
+ svg {
7947
+ color: var(--accent-dark);
7948
+ }
7949
+ `;
7950
+ var FilterButtonWithOptions = css38`
7951
+ :where([aria-expanded='true']) {
7952
+ background: var(--purple-rain-100);
7953
+ border-color: var(--accent-light);
7954
+ color: var(--typography-base);
7955
+ box-shadow: var(--elevation-100);
7956
+
7957
+ svg {
7958
+ color: var(--accent-dark);
7959
+ }
7960
+ }
7961
+ `;
7962
+ var SearchIcon = css38`
7963
+ color: var(--icon-color);
7964
+ position: absolute;
7965
+ inset: 0 var(--spacing-base) 0 auto;
7966
+ margin: auto;
7967
+ transition: color var(--duration-fast) var(--timing-ease-out);
7968
+ `;
7969
+ var AddConditionalBtn = css38`
7970
+ align-items: center;
7971
+ background: transparent;
7972
+ border: none;
7973
+ color: var(--primary-action-default);
7974
+ display: flex;
7975
+ gap: var(--spacing-sm);
7976
+ transition: color var(--duration-fast) var(--timing-ease-out);
7977
+ padding: 0;
7978
+
7979
+ &:hover,
7980
+ &:focus {
7981
+ color: var(--primary-action-hover);
7982
+ }
7983
+
7984
+ &:disabled {
7985
+ color: var(--gray-400);
7986
+ }
7987
+ `;
7988
+ var Title = css38`
7989
+ color: var(--typography-light);
7990
+
7991
+ &:focus {
7992
+ outline: none;
7993
+ }
7994
+ `;
7995
+ var ResetConditionsBtn = css38`
7996
+ background: transparent;
7997
+ border: none;
7998
+ color: var(--action-destructive-default);
7999
+ transition: color var(--duration-fast) var(--timing-ease-out);
8000
+ padding: 0;
8001
+
8002
+ &:hover,
8003
+ &:focus {
8004
+ color: var(--action-destructive-hover);
8005
+ }
8006
+ `;
8007
+ var IconBtn = css38`
8008
+ background: transparent;
8009
+ border: none;
8010
+ padding: var(--spacing-sm);
8011
+ `;
8012
+ var SearchAndFilterOptionsContainer = css38`
8013
+ background: var(--gray-50);
8014
+ border: 1px solid var(--gray-300);
8015
+ border-radius: var(--rounded-base);
8016
+ container-type: inline-size;
8017
+ display: flex;
8018
+ flex-direction: column;
8019
+ gap: var(--spacing-sm);
8020
+ padding: var(--spacing-md) 0 var(--spacing-base);
8021
+ will-change: height;
8022
+ position: relative;
8023
+ z-index: 1;
8024
+ `;
8025
+ var SearchAndFilterOptionsInnerContainer = css38`
8026
+ display: flex;
8027
+ flex-direction: column;
8028
+ gap: var(--spacing-sm);
8029
+ padding-inline: var(--spacing-md);
8030
+ `;
8031
+ var SearchAndFilterButtonGroup = css38`
8032
+ margin-top: var(--spacing-xs);
8033
+ margin-left: calc(56px + var(--spacing-md));
8034
+ `;
8035
+
8036
+ // src/components/SearchAndFilter/FilterButton.tsx
8037
+ import { jsx as jsx71, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
8038
+ var FilterButton2 = ({
8039
+ text = "Filters",
8040
+ icon = "filter-add",
8041
+ filterCount,
8042
+ hasSelectedValue,
8043
+ dataTestId,
8044
+ ...props
8045
+ }) => {
8046
+ return /* @__PURE__ */ jsxs42(
8047
+ "button",
8048
+ {
8049
+ type: "button",
8050
+ css: [
8051
+ FilterButton,
8052
+ hasSelectedValue ? FilterButtonSelected : void 0,
8053
+ filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
8054
+ ],
8055
+ ...props,
8056
+ "data-testid": dataTestId,
8057
+ children: [
8058
+ /* @__PURE__ */ jsx71(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
8059
+ /* @__PURE__ */ jsx71("span", { css: FilterButtonText, children: text }),
8060
+ filterCount ? /* @__PURE__ */ jsx71(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
8061
+ ]
8062
+ }
8063
+ );
8064
+ };
8065
+
8066
+ // src/components/SearchAndFilter/FilterControls.tsx
8067
+ import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
8068
+ import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
8069
+ import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
8070
+ import { useEffect as useEffect23, useRef as useRef18, useState as useState21 } from "react";
8071
+ import { useDebounce as useDebounce6 } from "react-use";
8072
+ import { v4 as v43 } from "uuid";
8073
+
8074
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8075
+ import { VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
8076
+ import {
8077
+ createContext as createContext7,
8078
+ useCallback as useCallback7,
8079
+ useContext as useContext9,
8080
+ useDeferredValue as useDeferredValue3,
8081
+ useEffect as useEffect22,
8082
+ useMemo as useMemo18,
8083
+ useState as useState20
8084
+ } from "react";
8085
+
8086
+ // src/components/SearchAndFilter/FilterEditor.tsx
8087
+ import { FieldMessage, Input as Input6, InputComboBox, StatusBullet } from "@uniformdev/design-system";
8088
+ import { useEffect as useEffect21, useState as useState19 } from "react";
8089
+ import { useDebounce as useDebounce5 } from "react-use";
8090
+ import { Fragment as Fragment15, jsx as jsx72, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
8091
+ var readOnlyAttributes = {
8092
+ isSearchable: false,
8093
+ menuIsOpen: false,
8094
+ isClearable: false
8095
+ };
8096
+ var FilterMultiChoiceEditor = ({
8097
+ value,
8098
+ options,
8099
+ disabled,
8100
+ readOnly,
8101
+ valueTestId,
8102
+ ...props
8103
+ }) => {
8104
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8105
+ const isClearable = !readOnly || !disabled;
8106
+ return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
8107
+ InputComboBox,
8108
+ {
8109
+ ...props,
8110
+ placeholder: "Type to search...",
8111
+ options,
8112
+ isMulti: true,
8113
+ isClearable,
8114
+ isDisabled: disabled,
8115
+ onChange: (e) => {
8116
+ var _a;
8117
+ return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
8118
+ },
8119
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
8120
+ "aria-readonly": readOnly,
8121
+ styles: {
8122
+ menu(base) {
8123
+ return {
8124
+ ...base,
8125
+ minWidth: "max-content"
8126
+ };
8127
+ }
8128
+ },
8129
+ ...readOnlyProps
8130
+ }
8131
+ ) });
8132
+ };
8133
+ var FilterSingleChoiceEditor = ({
8134
+ options,
8135
+ value,
8136
+ disabled,
8137
+ readOnly,
8138
+ onChange,
8139
+ valueTestId
8140
+ }) => {
8141
+ var _a;
8142
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8143
+ return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
8144
+ InputComboBox,
8145
+ {
8146
+ placeholder: "Type to search...",
8147
+ options,
8148
+ isClearable: true,
8149
+ onChange: (e) => {
8150
+ var _a2;
8151
+ return onChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8152
+ },
8153
+ isDisabled: disabled,
8154
+ value: (_a = options == null ? void 0 : options.find((option) => option.value === value)) != null ? _a : null,
8155
+ "aria-readonly": readOnly,
8156
+ styles: {
8157
+ menu(base) {
8158
+ return {
8159
+ ...base,
8160
+ minWidth: "max-content"
8161
+ };
8162
+ }
8163
+ },
8164
+ ...readOnlyProps
8165
+ }
8166
+ ) });
8167
+ };
8168
+ var CustomOptions = ({ label, value }) => {
8169
+ return /* @__PURE__ */ jsx72(StatusBullet, { status: label, message: value });
8170
+ };
8171
+ var StatusMultiEditor = ({
8172
+ options,
8173
+ value,
8174
+ disabled,
8175
+ readOnly,
8176
+ onChange,
8177
+ valueTestId
8178
+ }) => {
8179
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8180
+ return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
8181
+ InputComboBox,
8182
+ {
8183
+ options,
8184
+ isMulti: true,
8185
+ onChange: (e) => {
8186
+ var _a;
8187
+ return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
8188
+ },
8189
+ formatOptionLabel: CustomOptions,
8190
+ "aria-readonly": readOnly,
8191
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
8192
+ isDisabled: disabled,
8193
+ styles: {
8194
+ menu(base) {
8195
+ return {
8196
+ ...base,
8197
+ minWidth: "max-content"
8198
+ };
8199
+ }
8200
+ },
8201
+ ...readOnlyProps
8202
+ }
8203
+ ) });
8204
+ };
8205
+ var StatusSingleEditor = ({
8206
+ options,
8207
+ value,
8208
+ disabled,
8209
+ readOnly,
8210
+ onChange,
8211
+ valueTestId
8212
+ }) => {
8213
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8214
+ return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
8215
+ InputComboBox,
8216
+ {
8217
+ options,
8218
+ onChange: (e) => {
8219
+ var _a;
8220
+ return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
8221
+ },
8222
+ formatOptionLabel: CustomOptions,
8223
+ "aria-readonly": readOnly,
8224
+ value: options == null ? void 0 : options.find((option) => option.value === value),
8225
+ isDisabled: disabled,
8226
+ styles: {
8227
+ menu(base) {
8228
+ return {
8229
+ ...base,
8230
+ minWidth: "max-content"
8231
+ };
8232
+ }
8233
+ },
8234
+ ...readOnlyProps
8235
+ }
8236
+ ) });
8237
+ };
8238
+ var TextEditor = ({
8239
+ onChange,
8240
+ ariaLabel,
8241
+ value,
8242
+ readOnly,
8243
+ valueTestId
8244
+ }) => {
8245
+ const [innerValue, setInnerValue] = useState19(value != null ? value : "");
8246
+ useDebounce5(() => onChange(innerValue), 500, [innerValue]);
8247
+ return /* @__PURE__ */ jsx72(
8248
+ Input6,
8249
+ {
8250
+ showLabel: false,
8251
+ label: ariaLabel,
8252
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8253
+ placeholder: "Enter phrase to search\u2026",
8254
+ value: innerValue,
8255
+ readOnly,
8256
+ "data-testid": valueTestId
8257
+ }
8258
+ );
8259
+ };
8260
+ var NumberRangeEditor = ({
8261
+ onChange,
8262
+ disabled,
8263
+ ariaLabel,
8264
+ value,
8265
+ readOnly,
8266
+ valueTestId
8267
+ }) => {
8268
+ const [minValue, setMinValue] = useState19("");
8269
+ const [maxValue, setMaxValue] = useState19("");
8270
+ const [error, setError] = useState19("");
8271
+ useDebounce5(
8272
+ () => {
8273
+ if (minValue && maxValue && !error) {
8274
+ onChange([minValue, maxValue]);
8275
+ } else {
8276
+ onChange([]);
8277
+ }
8278
+ },
8279
+ 500,
8280
+ [minValue, maxValue]
8281
+ );
8282
+ useEffect21(() => {
8283
+ if (!maxValue && !minValue) {
8284
+ return;
8285
+ }
8286
+ const max = Number(maxValue);
8287
+ const min = Number(minValue);
8288
+ if (max < min || min > max) {
8289
+ setError("Please enter a valid numeric range");
8290
+ return;
8291
+ }
8292
+ if (maxValue && !minValue || minValue && !maxValue) {
8293
+ setError("Please enter both a low and high number");
8294
+ return;
8295
+ }
8296
+ if (error) {
8297
+ setError("");
8298
+ }
8299
+ if (min && max) {
8300
+ setMinValue(minValue);
8301
+ setMaxValue(maxValue);
8302
+ }
8303
+ }, [maxValue, minValue, setError]);
8304
+ return /* @__PURE__ */ jsxs43(Fragment15, { children: [
8305
+ /* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8306
+ /* @__PURE__ */ jsx72(
8307
+ Input6,
8308
+ {
8309
+ label: `${ariaLabel}-min`,
8310
+ type: "number",
8311
+ showLabel: false,
8312
+ min: 0,
8313
+ placeholder: "Low",
8314
+ onChange: (e) => setMinValue(e.currentTarget.value),
8315
+ "aria-invalid": !error ? false : true,
8316
+ disabled,
8317
+ value: value ? value[0] : "",
8318
+ readOnly,
8319
+ "data-testid": "value-low"
8320
+ }
8321
+ ),
8322
+ /* @__PURE__ */ jsx72(
8323
+ Input6,
8324
+ {
8325
+ type: "number",
8326
+ label: `${ariaLabel}-max`,
8327
+ showLabel: false,
8328
+ min: 0,
8329
+ placeholder: "High",
8330
+ onChange: (e) => setMaxValue(e.currentTarget.value),
8331
+ "aria-invalid": !error ? false : true,
8332
+ disabled,
8333
+ value: value ? value[1] : "",
8334
+ readOnly,
8335
+ "data-testid": "value-high"
8336
+ }
8337
+ )
8338
+ ] }),
8339
+ /* @__PURE__ */ jsx72(ErrorContainer, { errorMessage: error })
8340
+ ] });
8341
+ };
8342
+ var NumberEditor = ({
8343
+ ariaLabel,
8344
+ onChange,
8345
+ disabled,
8346
+ value,
8347
+ readOnly,
8348
+ valueTestId
8349
+ }) => {
8350
+ const [innerValue, setInnerValue] = useState19(value != null ? value : "");
8351
+ useDebounce5(() => onChange(innerValue), 500, [innerValue]);
8352
+ return /* @__PURE__ */ jsx72(
8353
+ Input6,
8354
+ {
8355
+ label: ariaLabel,
8356
+ type: "number",
8357
+ showLabel: false,
8358
+ min: 0,
8359
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8360
+ disabled,
8361
+ value: innerValue,
8362
+ readOnly,
8363
+ "data-testid": valueTestId
8364
+ }
8365
+ );
8366
+ };
8367
+ var DateEditor = ({
8368
+ onChange,
8369
+ ariaLabel,
8370
+ disabled,
8371
+ value,
8372
+ readOnly,
8373
+ valueTestId
8374
+ }) => {
8375
+ const [innerValue, setInnerValue] = useState19(value != null ? value : "");
8376
+ useDebounce5(() => onChange(innerValue), 500, [innerValue]);
8377
+ return /* @__PURE__ */ jsx72(
8378
+ Input6,
8379
+ {
8380
+ type: "date",
8381
+ label: ariaLabel,
8382
+ showLabel: false,
8383
+ onChange: (e) => setInnerValue(e.currentTarget.value),
8384
+ disabled,
8385
+ value: innerValue,
8386
+ readOnly,
8387
+ "data-testid": valueTestId
8388
+ }
8389
+ );
8390
+ };
8391
+ var DateRangeEditor = ({
8392
+ ariaLabel,
8393
+ onChange,
8394
+ disabled,
8395
+ value,
8396
+ readOnly,
8397
+ valueTestId
8398
+ }) => {
8399
+ const [minDateValue, setMinDateValue] = useState19(value ? value[0] : "");
8400
+ const [maxDateValue, setMaxDateValue] = useState19(value ? value[1] : "");
8401
+ const [error, setError] = useState19("");
8402
+ useDebounce5(
8403
+ () => {
8404
+ if (minDateValue && maxDateValue && !error) {
8405
+ onChange([minDateValue, maxDateValue]);
8406
+ } else {
8407
+ onChange([]);
8408
+ }
8409
+ },
8410
+ 500,
8411
+ [minDateValue, maxDateValue]
8412
+ );
8413
+ useEffect21(() => {
8414
+ if (!minDateValue || !maxDateValue) {
8415
+ return;
8416
+ }
8417
+ const minDate = new Date(minDateValue);
8418
+ const maxDate = new Date(maxDateValue);
8419
+ if (maxDate < minDate) {
8420
+ setError("The max date cannot be lower than the min date");
8421
+ return;
8422
+ }
8423
+ if (maxDate && !minDate) {
8424
+ setError("Please enter both a low and high date");
8425
+ return;
8426
+ }
8427
+ const minDateString = minDate.toDateString();
8428
+ const maxDateString = maxDate.toDateString();
8429
+ if (minDateString === maxDateString || maxDateString === minDateString) {
8430
+ setError("The min and max date cannot be the same");
8431
+ return;
8432
+ }
8433
+ if (minDate > maxDate) {
8434
+ setError("The min date cannot be higher than the max date");
8435
+ return;
8436
+ }
8437
+ if (error) {
8438
+ setError("");
8439
+ }
8440
+ if (minDate && maxDate) {
8441
+ setMinDateValue(minDateValue);
8442
+ setMaxDateValue(maxDateValue);
8443
+ } else {
8444
+ setMinDateValue("");
8445
+ setMaxDateValue("");
8446
+ }
8447
+ }, [minDateValue, maxDateValue, setError]);
8448
+ return /* @__PURE__ */ jsxs43(Fragment15, { children: [
8449
+ /* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8450
+ /* @__PURE__ */ jsx72(
8451
+ Input6,
8452
+ {
8453
+ label: `${ariaLabel}-min-date`,
8454
+ type: "date",
8455
+ showLabel: false,
8456
+ value: minDateValue,
8457
+ onChange: (e) => setMinDateValue(e.currentTarget.value),
8458
+ "aria-invalid": !error ? false : true,
8459
+ disabled,
8460
+ readOnly,
8461
+ "data-testid": "value-low"
8462
+ }
8463
+ ),
8464
+ /* @__PURE__ */ jsx72(
8465
+ Input6,
8466
+ {
8467
+ label: `${ariaLabel}-max-date`,
8468
+ type: "date",
8469
+ showLabel: false,
8470
+ value: maxDateValue,
8471
+ onChange: (e) => setMaxDateValue(e.currentTarget.value),
8472
+ "aria-invalid": !error ? false : true,
8473
+ disabled,
8474
+ readOnly,
8475
+ "data-testid": "value-high"
8476
+ }
8477
+ )
8478
+ ] }),
8479
+ /* @__PURE__ */ jsx72(ErrorContainer, { errorMessage: error })
8480
+ ] });
8481
+ };
8482
+ var FilterEditorRenderer = ({ editorType, ...props }) => {
8483
+ const { filterMapper: contextFilterMapper } = useSearchAndFilter();
8484
+ const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
8485
+ if (!Editor) {
8486
+ return null;
8487
+ }
8488
+ if (editorType === "empty") {
8489
+ return null;
8490
+ }
8491
+ return /* @__PURE__ */ jsx72(Editor, { ...props });
8492
+ };
8493
+ var filterMapper = {
8494
+ multiChoice: FilterMultiChoiceEditor,
8495
+ singleChoice: FilterSingleChoiceEditor,
8496
+ date: DateEditor,
8497
+ dateRange: DateRangeEditor,
8498
+ text: TextEditor,
8499
+ numberRange: NumberRangeEditor,
8500
+ number: NumberEditor,
8501
+ statusMultiChoice: StatusMultiEditor,
8502
+ statusSingleChoice: StatusSingleEditor,
8503
+ empty: null
8504
+ };
8505
+ function withInputVariables(WrappedComponent) {
8506
+ const WithInputVariables = (props) => {
8507
+ if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8508
+ return /* @__PURE__ */ jsx72(WrappedComponent, { ...props });
8509
+ }
8510
+ return /* @__PURE__ */ jsx72(
8511
+ InputVariables,
8512
+ {
8513
+ disableInlineMenu: true,
8514
+ showMenuPosition: "inline-right",
8515
+ onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8516
+ value: props.value,
8517
+ disabled: props.disabled,
8518
+ inputWhenNoVariables: /* @__PURE__ */ jsx72(WrappedComponent, { ...props })
8519
+ }
8520
+ );
8521
+ };
8522
+ return WithInputVariables;
8523
+ }
8524
+ function withInputVariablesForMultiValue(WrappedComponent) {
8525
+ const WithInputVariables = (props) => {
8526
+ var _a;
8527
+ if (!props.bindable || props.disabled || props.readOnly) {
8528
+ return /* @__PURE__ */ jsx72(WrappedComponent, { ...props });
8529
+ }
8530
+ return /* @__PURE__ */ jsx72(
8531
+ InputVariables,
8532
+ {
8533
+ disableInlineMenu: true,
8534
+ showMenuPosition: "inline-right",
8535
+ onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
8536
+ value: (_a = props.value) == null ? void 0 : _a[0],
8537
+ inputWhenNoVariables: /* @__PURE__ */ jsx72(WrappedComponent, { ...props })
8538
+ }
8539
+ );
8540
+ };
8541
+ return WithInputVariables;
8542
+ }
8543
+ var bindableFiltersMapper = {
8544
+ ...filterMapper,
8545
+ multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
8546
+ singleChoice: withInputVariables(FilterSingleChoiceEditor),
8547
+ date: withInputVariables(DateEditor),
8548
+ text: withInputVariables(TextEditor),
8549
+ number: withInputVariables(NumberEditor)
8550
+ };
8551
+ var ErrorContainer = ({ errorMessage }) => {
8552
+ return /* @__PURE__ */ jsx72(
8553
+ "div",
8554
+ {
8555
+ css: {
8556
+ gridColumn: "span 6",
8557
+ order: 6
8558
+ },
8559
+ children: /* @__PURE__ */ jsx72(FieldMessage, { errorMessage })
8560
+ }
8561
+ );
8562
+ };
8563
+ var twoColumnGrid = {
8564
+ display: "grid",
8565
+ gridTemplateColumns: "1fr 1fr",
8566
+ gap: "var(--spacing-sm);"
8567
+ };
8568
+
8569
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8570
+ import { jsx as jsx73 } from "@emotion/react/jsx-runtime";
8571
+ var SearchAndFilterContext = createContext7({
8572
+ searchTerm: "",
8573
+ setSearchTerm: () => {
8574
+ },
8575
+ filterVisibility: void 0,
8576
+ setFilterVisibility: () => {
8577
+ },
8578
+ filters: [],
8579
+ setFilters: () => {
8580
+ },
8581
+ handleAddFilter: () => {
8582
+ },
8583
+ handleResetFilters: () => {
8584
+ },
8585
+ handleDeleteFilter: () => {
8586
+ },
8587
+ filterOptions: [],
8588
+ validFilterQuery: [],
8589
+ filterMapper: {},
8590
+ totalResults: 0,
8591
+ allowBindingSearchTerm: false
8592
+ });
8593
+ var SearchAndFilterProvider = ({
8594
+ filters,
8595
+ filterOptions,
8596
+ filterVisible = false,
8597
+ defaultSearchTerm = "",
8598
+ onSearchChange,
8599
+ onChange,
8600
+ resetFilterValues = [{ field: "", operator: "", value: "" }],
8601
+ totalResults,
8602
+ filterMapper: filterMapper2 = filterMapper,
8603
+ children,
8604
+ allowBindingSearchTerm
8605
+ }) => {
8606
+ const [searchTerm, setSearchTerm] = useState20(defaultSearchTerm);
8607
+ const deferredSearchTerm = useDeferredValue3(searchTerm);
8608
+ const [filterVisibility, setFilterVisibility] = useState20(filterVisible);
8609
+ const handleSearchTerm = useCallback7(
8610
+ (term) => {
8611
+ setSearchTerm(term);
8612
+ onSearchChange == null ? void 0 : onSearchChange(term);
8613
+ },
8614
+ [setSearchTerm, onSearchChange]
8615
+ );
8616
+ const handleToggleFilterVisibility = useCallback7(
8617
+ (visible) => setFilterVisibility(visible),
8618
+ [setFilterVisibility]
8619
+ );
8620
+ const handleAddFilter = useCallback7(() => {
8621
+ onChange([...filters, { field: "", operator: "", value: "" }]);
8622
+ }, [filters, onChange]);
8623
+ const handleResetFilters = useCallback7(() => {
8624
+ onSearchChange == null ? void 0 : onSearchChange("");
8625
+ onChange(resetFilterValues);
8626
+ }, [onChange, resetFilterValues, onSearchChange]);
8627
+ const handleDeleteFilter = useCallback7(
8628
+ (index) => {
8629
+ const remainingFilters = filters.filter((_, i) => i !== index);
8630
+ onChange(remainingFilters);
8631
+ },
8632
+ [filters, onChange]
8633
+ );
8634
+ const validFilterQuery = useMemo18(() => {
8635
+ const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
8636
+ if (hasValidFilters) {
8637
+ return filters;
8638
+ }
8639
+ }, [filters]);
8640
+ useEffect22(() => {
8641
+ if (filterVisibility) {
8642
+ const handleEscKeyFilterClose = (e) => {
8643
+ if (e.key === "Escape") {
8644
+ setFilterVisibility(false);
8645
+ }
8646
+ };
8647
+ document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8648
+ return () => {
8649
+ document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
8650
+ };
8651
+ }
8652
+ }, [filterVisibility]);
8653
+ return /* @__PURE__ */ jsx73(
8654
+ SearchAndFilterContext.Provider,
8655
+ {
8656
+ value: {
8657
+ searchTerm: deferredSearchTerm,
8658
+ setSearchTerm: (e) => handleSearchTerm(e),
8659
+ filterVisibility,
8660
+ setFilterVisibility: (e) => handleToggleFilterVisibility(e),
8661
+ filters,
8662
+ setFilters: (e) => onChange(e),
8663
+ handleAddFilter,
8664
+ handleResetFilters,
8665
+ handleDeleteFilter,
8666
+ filterOptions,
8667
+ validFilterQuery,
8668
+ totalResults,
8669
+ filterMapper: filterMapper2,
8670
+ allowBindingSearchTerm
8671
+ },
8672
+ children: /* @__PURE__ */ jsx73(VerticalRhythm6, { children })
8673
+ }
8674
+ );
8675
+ };
8676
+ var useSearchAndFilter = () => {
8677
+ const value = useContext9(SearchAndFilterContext);
8678
+ return { ...value };
8679
+ };
8680
+
8681
+ // src/components/SearchAndFilter/FilterControls.tsx
8682
+ import { Fragment as Fragment16, jsx as jsx74, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
8683
+ var FilterControls = ({
8684
+ children,
8685
+ hideSearchInput
8686
+ }) => {
8687
+ const {
8688
+ setFilterVisibility,
8689
+ filterVisibility,
8690
+ setSearchTerm,
8691
+ validFilterQuery,
8692
+ searchTerm,
8693
+ allowBindingSearchTerm
8694
+ } = useSearchAndFilter();
8695
+ const editorRef = useRef18(null);
8696
+ const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8697
+ const [idToResetInputVariables, setIdToResetInputVariables] = useState21("data-resource-search-term-input");
8698
+ const [localeSearchTerm, setLocaleSearchTerm] = useState21(searchTerm);
8699
+ useDebounce6(
8700
+ () => {
8701
+ setSearchTerm(localeSearchTerm);
8702
+ },
8703
+ 300,
8704
+ [localeSearchTerm]
8705
+ );
8706
+ useEffect23(() => {
8707
+ if (searchTerm === "") {
8708
+ setLocaleSearchTerm("");
8709
+ setIdToResetInputVariables(`data-resource-search-term-input-${v43()}`);
8710
+ }
8711
+ }, [searchTerm]);
8712
+ return /* @__PURE__ */ jsxs44(Fragment16, { children: [
8713
+ /* @__PURE__ */ jsx74(
8714
+ FilterButton2,
8715
+ {
8716
+ "aria-controls": "search-and-filter-options",
8717
+ "aria-label": "filter options",
8718
+ "aria-haspopup": "true",
8719
+ text: "Filter/Sort",
8720
+ "aria-expanded": filterVisibility === true,
8721
+ filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
8722
+ onClick: () => setFilterVisibility(!filterVisibility),
8723
+ dataTestId: "filters-button"
8724
+ }
8725
+ ),
8726
+ hideSearchInput ? null : /* @__PURE__ */ jsxs44("div", { css: BindableKeywordSearchInputStyles, children: [
8727
+ /* @__PURE__ */ jsx74(
8728
+ InputVariables,
8729
+ {
8730
+ label: "",
8731
+ id: idToResetInputVariables,
8732
+ showMenuPosition: "inline-right",
8733
+ editorRef,
8734
+ value: localeSearchTerm,
8735
+ onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
8736
+ disableVariables: !allowBindingSearchTerm,
8737
+ inputWhenNoVariables: /* @__PURE__ */ jsx74(
8738
+ InputKeywordSearch2,
8739
+ {
8740
+ placeholder: "Search...",
8741
+ onSearchTextChanged: (e) => setLocaleSearchTerm(e),
8742
+ value: localeSearchTerm,
8743
+ compact: true,
8744
+ rounded: true,
8745
+ css: SearchInput
8746
+ }
8747
+ )
8748
+ }
8749
+ ),
8750
+ hasVariableInSearchTerm ? /* @__PURE__ */ jsx74("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx74(
8751
+ "button",
8752
+ {
8753
+ css: ClearSearchButtonStyles,
8754
+ onClick: () => {
8755
+ setLocaleSearchTerm("");
8756
+ if (editorRef.current) {
8757
+ if (editorRef.current.getRootElement() !== document.activeElement) {
8758
+ editorRef.current.dispatchCommand(CLEAR_EDITOR_COMMAND2, void 0);
8759
+ }
8760
+ }
8761
+ },
8762
+ type: "button",
8763
+ "data-testid": "keyword-search-clear-button",
8764
+ children: /* @__PURE__ */ jsx74(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
8765
+ }
8766
+ ) }) : null
8767
+ ] }),
8768
+ children
8769
+ ] });
8770
+ };
8771
+
8772
+ // src/components/SearchAndFilter/FilterItem.tsx
8773
+ import { Icon as Icon8, InputComboBox as InputComboBox2 } from "@uniformdev/design-system";
8774
+ import { useMemo as useMemo19 } from "react";
8775
+
8776
+ // src/components/SearchAndFilter/FilterMenu.tsx
8777
+ import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
8778
+ import React14, { useEffect as useEffect24 } from "react";
8779
+ import { jsx as jsx75, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
8780
+ var SearchAndFilterOptionsContainer2 = ({
8781
+ buttonRow,
8782
+ additionalFiltersContainer,
8783
+ children
8784
+ }) => {
8785
+ return /* @__PURE__ */ jsxs45("div", { css: SearchAndFilterOptionsContainer, children: [
8786
+ /* @__PURE__ */ jsx75("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8787
+ buttonRow ? /* @__PURE__ */ jsx75(
8788
+ HorizontalRhythm8,
8789
+ {
8790
+ css: SearchAndFilterButtonGroup,
8791
+ gap: "sm",
8792
+ align: "center",
8793
+ justify: "space-between",
8794
+ children: buttonRow
8795
+ }
8796
+ ) : null,
8797
+ additionalFiltersContainer ? /* @__PURE__ */ jsx75("div", { children: additionalFiltersContainer }) : null
8798
+ ] });
8799
+ };
8800
+ var FilterMenu = ({
8801
+ id,
8802
+ filterTitle = "Show results",
8803
+ menuControls,
8804
+ additionalFiltersContainer,
8805
+ children,
8806
+ dataTestId,
8807
+ resetButtonText = "reset"
8808
+ }) => {
8809
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
8810
+ const innerMenuRef = React14.useRef(null);
8811
+ useEffect24(() => {
8812
+ var _a;
8813
+ if (filterVisibility) {
8814
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
8815
+ }
8816
+ }, [filterVisibility]);
8817
+ return /* @__PURE__ */ jsx75(VerticalRhythm7, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs45(
8818
+ SearchAndFilterOptionsContainer2,
8819
+ {
8820
+ buttonRow: menuControls,
8821
+ additionalFiltersContainer,
8822
+ children: [
8823
+ /* @__PURE__ */ jsxs45(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
8824
+ /* @__PURE__ */ jsx75("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
8825
+ (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx75(
8826
+ "button",
8827
+ {
8828
+ type: "button",
8829
+ css: ResetConditionsBtn,
8830
+ onClick: () => {
8831
+ handleResetFilters();
8832
+ setFilterVisibility(false);
8833
+ },
8834
+ "data-testid": "reset-filters",
8835
+ children: resetButtonText
8836
+ }
8837
+ ) : null
8838
+ ] }),
8839
+ children
8840
+ ]
8841
+ }
8842
+ ) : null });
8843
+ };
8844
+
8845
+ // src/components/SearchAndFilter/FilterItem.tsx
8846
+ import { jsx as jsx76, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8847
+ var FilterItem = ({
8848
+ index,
8849
+ paramOptions,
8850
+ operatorOptions,
8851
+ valueOptions,
8852
+ onParamChange,
8853
+ onOperatorChange,
8854
+ onValueChange
8855
+ }) => {
8856
+ var _a, _b;
8857
+ const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
8858
+ const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
8859
+ const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
8860
+ const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
8861
+ const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
8862
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo19(() => {
8863
+ var _a2;
8864
+ const currentSelectedFilter = filterOptions.find((item) => {
8865
+ var _a3;
8866
+ return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
8867
+ });
8868
+ const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
8869
+ return filters[index].field === item.value;
8870
+ });
8871
+ const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
8872
+ const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
8873
+ return filters[index].operator === item.value;
8874
+ });
8875
+ return {
8876
+ selectedFieldValue: selectedFieldValue2,
8877
+ selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
8878
+ selectedMetaValue: filters[index].value,
8879
+ readOnly: isCurrentFieldReadOnly,
8880
+ bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
8881
+ };
8882
+ }, [filters, filterOptions, index, operatorOptions]);
8883
+ const readOnlyProps = readOnly ? {
8884
+ "aria-readonly": true,
8885
+ isSearchable: false,
8886
+ menuIsOpen: false,
8887
+ isClearable: false
8888
+ } : {};
8889
+ return /* @__PURE__ */ jsxs46("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8890
+ /* @__PURE__ */ jsx76("span", { children: index === 0 ? "Where" : "and" }),
8891
+ /* @__PURE__ */ jsxs46("div", { css: ConditionalInputRow, children: [
8892
+ /* @__PURE__ */ jsx76(
8893
+ InputComboBox2,
8894
+ {
8895
+ "aria-label": label,
8896
+ options: paramOptions,
8897
+ onChange: (e) => {
8898
+ var _a2;
8899
+ onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8900
+ },
8901
+ isOptionDisabled: (option) => {
8902
+ var _a2;
8903
+ return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
8904
+ },
8905
+ styles: {
8906
+ menu(base) {
8907
+ return {
8908
+ ...base,
8909
+ minWidth: "max-content"
8910
+ };
8911
+ }
8912
+ },
8913
+ value: selectedFieldValue,
8914
+ ...readOnlyProps,
8915
+ id: "filter-field",
8916
+ name: `filter-field-${index}`
8917
+ }
8918
+ ),
8919
+ /* @__PURE__ */ jsx76(
8920
+ InputComboBox2,
8921
+ {
8922
+ "aria-label": operatorLabel,
8923
+ options: operatorOptions,
8924
+ onChange: (e) => {
8925
+ var _a2;
8926
+ return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8927
+ },
8928
+ isDisabled: !filters[index].field,
8929
+ value: selectedOperatorValue,
8930
+ styles: {
8931
+ menu(base) {
8932
+ return {
8933
+ ...base,
8934
+ minWidth: "max-content"
8935
+ };
8936
+ }
8937
+ },
8938
+ ...readOnlyProps,
8939
+ id: "filter-operator",
8940
+ name: `filter-operator-${index}`
8941
+ }
8942
+ ),
8943
+ /* @__PURE__ */ jsx76(
8944
+ FilterEditorRenderer,
8945
+ {
8946
+ "aria-label": metaDataLabel,
8947
+ editorType: metaDataPossibleOptions,
8948
+ options: valueOptions,
8949
+ onChange: (e) => onValueChange(e != null ? e : ""),
8950
+ readOnly,
8951
+ bindable,
8952
+ disabled: !filters[index].operator,
8953
+ value: selectedMetaValue,
8954
+ valueTestId: "filter-value"
8955
+ }
8956
+ ),
8957
+ readOnly || index === 0 ? null : /* @__PURE__ */ jsx76(
8958
+ "button",
8959
+ {
8960
+ type: "button",
8961
+ onClick: () => handleDeleteFilter(index),
8962
+ "aria-label": "delete filter",
8963
+ css: IconBtn,
8964
+ "data-testid": "delete-filter",
8965
+ children: /* @__PURE__ */ jsx76(Icon8, { icon: "trash", iconColor: "red", size: "1rem" })
8966
+ }
8967
+ )
8968
+ ] })
8969
+ ] });
8970
+ };
8971
+ var FilterItems = ({
8972
+ addButtonText = "add condition",
8973
+ additionalFiltersContainer
8974
+ }) => {
8975
+ const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
8976
+ const handleUpdateFilter = (index, prop, value) => {
8977
+ var _a, _b, _c, _d, _e;
8978
+ const next = [...filters];
8979
+ next[index] = { ...next[index], [prop]: value };
8980
+ if (prop === "operator") {
8981
+ if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
8982
+ next[index].value = next[index].value[0];
8983
+ }
8984
+ if (filters[index].operator === "ndef" || filters[index].operator === "def") {
8985
+ next[index].value = "";
8986
+ }
8987
+ if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
8988
+ next[index].value = [next[index].value, ""];
8989
+ }
8990
+ if (value === "def" || value === "true") {
8991
+ next[index].value = "true";
8992
+ }
8993
+ if (value === "ndef" || value === "false") {
8994
+ next[index].value = "false";
8995
+ }
8996
+ }
8997
+ if (prop === "field") {
8998
+ const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
8999
+ var _a2;
9000
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
9001
+ })) == 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";
9002
+ next[index].operator = firstOperatorInAvailableOperators;
9003
+ next[index].value = "";
9004
+ }
9005
+ setFilters(next);
9006
+ };
9007
+ return /* @__PURE__ */ jsx76(
9008
+ FilterMenu,
9009
+ {
9010
+ id: "search-and-filter-options",
9011
+ dataTestId: "search-and-filter-options",
9012
+ menuControls: /* @__PURE__ */ jsxs46(
9013
+ "button",
9014
+ {
9015
+ type: "button",
9016
+ css: AddConditionalBtn,
9017
+ onClick: handleAddFilter,
9018
+ "data-testid": "add-filter",
9019
+ children: [
9020
+ /* @__PURE__ */ jsx76(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9021
+ addButtonText
9022
+ ]
9023
+ }
9024
+ ),
9025
+ additionalFiltersContainer,
9026
+ children: filters.map((item, i) => {
9027
+ var _a, _b, _c, _d, _e, _f;
9028
+ const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
9029
+ var _a2;
9030
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
9031
+ })) == null ? void 0 : _a.options) != null ? _b : [];
9032
+ const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
9033
+ const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
9034
+ return /* @__PURE__ */ jsx76(
9035
+ FilterItem,
9036
+ {
9037
+ index: i,
9038
+ paramOptions: filterOptions,
9039
+ onParamChange: (e) => handleUpdateFilter(i, "field", e),
9040
+ operatorOptions: possibleOperators,
9041
+ onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
9042
+ onValueChange: (e) => handleUpdateFilter(i, "value", e),
9043
+ valueOptions: possibleValueOptions
9044
+ },
9045
+ i
9046
+ );
9047
+ })
9048
+ }
9049
+ );
9050
+ };
9051
+
9052
+ // src/components/SearchAndFilter/SearchAndFilter.tsx
9053
+ import { VerticalRhythm as VerticalRhythm8 } from "@uniformdev/design-system";
9054
+
9055
+ // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9056
+ import { Button as Button6, Callout as Callout7, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
9057
+ import { Fragment as Fragment17, jsx as jsx77, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
9058
+ var SearchAndFilterResultContainer = ({
9059
+ buttonText,
9060
+ clearButtonLabel = "clear",
9061
+ calloutTitle,
9062
+ calloutText,
9063
+ onHandleClear,
9064
+ hideClearButton
9065
+ }) => {
9066
+ const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
9067
+ const automateCalloutTitle = () => {
9068
+ if (searchTerm && !filters.length) {
9069
+ return "No search results found";
9070
+ }
9071
+ if (filters.length && !searchTerm) {
9072
+ return "No results match the selected filters";
9073
+ }
9074
+ return "No matching results found";
9075
+ };
9076
+ if (totalResults && totalResults > 0) {
9077
+ return null;
9078
+ }
9079
+ const handleClearSearch = () => {
9080
+ setSearchTerm("");
9081
+ if (onHandleClear) {
9082
+ onHandleClear();
9083
+ } else {
9084
+ handleResetFilters();
9085
+ }
9086
+ };
9087
+ return /* @__PURE__ */ jsxs47(Fragment17, { children: [
9088
+ /* @__PURE__ */ jsxs47(HorizontalRhythm9, { children: [
9089
+ /* @__PURE__ */ jsxs47("span", { children: [
9090
+ totalResults,
9091
+ " results ",
9092
+ searchTerm ? `for "${searchTerm}"` : null
9093
+ ] }),
9094
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx77(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9095
+ ] }),
9096
+ totalResults === 0 ? /* @__PURE__ */ jsxs47(Callout7, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9097
+ calloutText ? /* @__PURE__ */ jsx77(Paragraph, { children: calloutText }) : null,
9098
+ hideClearButton ? null : /* @__PURE__ */ jsx77(Button6, { buttonType: "tertiaryOutline", size: "xs", onClick: handleClearSearch, children: buttonText != null ? buttonText : "Clear search" })
9099
+ ] }) : null
9100
+ ] });
9101
+ };
9102
+
9103
+ // src/components/SearchAndFilter/SearchAndFilter.tsx
9104
+ import { jsx as jsx78, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
9105
+ var SearchAndFilter = ({
9106
+ filters,
9107
+ filterOptions,
9108
+ filterVisible,
9109
+ filterControls,
9110
+ viewSwitchControls,
9111
+ resultsContainerView = /* @__PURE__ */ jsx78(SearchAndFilterResultContainer, {}),
9112
+ filterMapper: filterMapper2 = filterMapper,
9113
+ additionalFiltersContainer,
9114
+ onChange,
9115
+ defaultSearchTerm,
9116
+ onSearchChange,
9117
+ totalResults,
9118
+ allowBindingSearchTerm = false,
9119
+ resetFilterValues = []
9120
+ }) => {
9121
+ return /* @__PURE__ */ jsx78(
9122
+ SearchAndFilterProvider,
9123
+ {
9124
+ filters,
9125
+ filterOptions,
9126
+ filterVisible,
9127
+ onChange,
9128
+ defaultSearchTerm,
9129
+ onSearchChange,
9130
+ totalResults,
9131
+ resetFilterValues,
9132
+ filterMapper: filterMapper2,
9133
+ allowBindingSearchTerm,
9134
+ children: /* @__PURE__ */ jsxs48(VerticalRhythm8, { "data-testid": "search-and-filter", children: [
9135
+ /* @__PURE__ */ jsxs48("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9136
+ /* @__PURE__ */ jsx78(
9137
+ "div",
9138
+ {
9139
+ css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9140
+ children: !filterControls ? /* @__PURE__ */ jsx78(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9141
+ }
9142
+ ),
9143
+ viewSwitchControls
9144
+ ] }),
9145
+ /* @__PURE__ */ jsx78(FilterItems, { additionalFiltersContainer }),
9146
+ resultsContainerView
9147
+ ] })
9148
+ }
9149
+ );
9150
+ };
9151
+
9152
+ // src/components/SearchAndFilter/SearchOnlyFilter.tsx
9153
+ import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
9154
+ import { createContext as createContext8, useState as useState22 } from "react";
9155
+ import { useDebounce as useDebounce7 } from "react-use";
9156
+ import { jsx as jsx79 } from "@emotion/react/jsx-runtime";
9157
+ var SearchOnlyContext = createContext8({
9158
+ searchTerm: "",
9159
+ setSearchTerm: () => {
9160
+ }
9161
+ });
9162
+ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9163
+ const { searchTerm, setSearchTerm } = useSearchAndFilter();
9164
+ const [localeSearchTerm, setLocaleSearchTerm] = useState22("");
9165
+ useDebounce7(
9166
+ () => {
9167
+ setSearchTerm(localeSearchTerm);
9168
+ onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
9169
+ },
9170
+ 300,
9171
+ [localeSearchTerm]
9172
+ );
9173
+ return /* @__PURE__ */ jsx79(
9174
+ SearchOnlyContext.Provider,
9175
+ {
9176
+ value: {
9177
+ searchTerm,
9178
+ setSearchTerm: setLocaleSearchTerm
9179
+ },
9180
+ children: /* @__PURE__ */ jsx79("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx79(
9181
+ InputKeywordSearch3,
9182
+ {
9183
+ placeholder: "Search...",
9184
+ onSearchTextChanged: (e) => setLocaleSearchTerm(e),
9185
+ value: localeSearchTerm,
9186
+ compact: true,
9187
+ rounded: true
9188
+ }
9189
+ ) })
9190
+ }
9191
+ );
9192
+ };
9193
+
9194
+ // src/components/SearchAndFilter/SortItems.tsx
9195
+ import { InputComboBox as InputComboBox3, InputSelect as InputSelect8, SegmentedControl, VerticalRhythm as VerticalRhythm9 } from "@uniformdev/design-system";
9196
+
9197
+ // src/components/SearchAndFilter/styles/SortItems.styles.ts
9198
+ import { css as css39 } from "@emotion/react";
9199
+ import { cq as cq2, fadeInLtr as fadeInLtr2 } from "@uniformdev/design-system";
9200
+ var ConditionalFilterRow2 = css39`
9201
+ display: grid;
9202
+ grid-template-columns: 35px 1fr;
9203
+ gap: var(--spacing-sm);
9204
+ margin-left: var(--spacing-base);
9205
+
9206
+ ${cq2("380px")} {
9207
+ align-items: center;
9208
+
9209
+ &:after {
9210
+ content: '';
9211
+ display: block;
9212
+ height: 1px;
9213
+ background: var(--gray-300);
9214
+ width: calc(100% - var(--spacing-base));
9215
+ margin-left: var(--spacing-base);
9216
+ }
9217
+ &:last-of-type:after {
9218
+ display: none;
9219
+ }
9220
+ }
9221
+
9222
+ &:nth-of-type(2) {
9223
+ margin-left: 0;
9224
+ grid-template-columns: 50px 1fr;
9225
+ }
9226
+
9227
+ ${cq2("580px")} {
9228
+ &:after {
9229
+ display: none;
9230
+ }
9231
+ }
9232
+
9233
+ @media (prefers-reduced-motion: no-preference) {
9234
+ animation: ${fadeInLtr2} var(--duration-fast) var(--timing-ease-out);
9235
+ }
9236
+ `;
9237
+ var ConditionalInputRow2 = css39`
9238
+ display: flex;
9239
+ gap: var(--spacing-sm);
9240
+ flex-wrap: wrap;
9241
+
9242
+ ${cq2("380px")} {
9243
+ & > div:nth-child(-n + 2) {
9244
+ width: calc(50% - var(--spacing-sm));
9245
+ }
9246
+
9247
+ & > div:nth-child(n + 3) {
9248
+ width: calc(100% - 48px);
9249
+ }
9250
+ }
9251
+ ${cq2("580px")} {
9252
+ display: grid;
9253
+ grid-template-columns: 200px 160px 1fr 32px;
9254
+
9255
+ & > div:nth-child(n) {
9256
+ width: auto;
9257
+ }
9258
+ }
9259
+ `;
9260
+ var SearchInput2 = css39`
9261
+ max-height: 40px;
9262
+ min-height: unset;
9263
+ `;
9264
+ var FilterButton3 = css39`
9265
+ align-items: center;
9266
+ background: var(--white);
9267
+ border: 1px solid var(--gray-300);
9268
+ border-radius: var(--rounded-full);
9269
+ color: var(--typography-base);
9270
+ display: flex;
9271
+ font-size: var(--fs-sm);
9272
+ gap: var(--spacing-sm);
9273
+ padding: var(--spacing-sm) var(--spacing-base);
9274
+ max-height: 40px;
9275
+ transition: color var(--duration-fast) var(--timing-ease-out),
9276
+ background-color var(--duration-fast) var(--timing-ease-out),
9277
+ border-color var(--duration-fast) var(--timing-ease-out),
9278
+ box-shadow var(--duration-fast) var(--timing-ease-out);
9279
+
9280
+ svg {
9281
+ color: var(--gray-300);
9282
+ transition: color var(--duration-fast) var(--timing-ease-out);
9283
+ }
9284
+
9285
+ &:hover,
9286
+ :where([aria-expanded='true']) {
9287
+ outline: none;
9288
+ background: var(--gray-200);
9289
+ border-color: var(--gray-300);
9290
+
9291
+ svg {
9292
+ color: var(--typography-base);
9293
+ }
9294
+ }
9295
+
9296
+ &:disabled {
9297
+ opacity: var(--opacity-50);
9298
+ }
9299
+ `;
9300
+ var FilterButtonText2 = css39`
9301
+ overflow: hidden;
9302
+ text-overflow: ellipsis;
9303
+ white-space: nowrap;
9304
+ max-width: 14ch;
9305
+ `;
9306
+ var FilterButtonSelected2 = css39`
9307
+ background: var(--gray-100);
9308
+ border-color: var(--gray-300);
9309
+
9310
+ svg {
9311
+ color: var(--accent-dark);
9312
+ }
9313
+ `;
9314
+ var FilterButtonWithOptions2 = css39`
9315
+ :where([aria-expanded='true']) {
9316
+ background: var(--purple-rain-100);
9317
+ border-color: var(--accent-light);
9318
+ color: var(--typography-base);
9319
+ box-shadow: var(--elevation-100);
9320
+
9321
+ svg {
9322
+ color: var(--accent-dark);
9323
+ }
9324
+ }
9325
+ `;
9326
+ var SearchIcon2 = css39`
9327
+ color: var(--icon-color);
9328
+ position: absolute;
9329
+ inset: 0 var(--spacing-base) 0 auto;
9330
+ margin: auto;
9331
+ transition: color var(--duration-fast) var(--timing-ease-out);
9332
+ `;
9333
+ var AddConditionalBtn2 = css39`
9334
+ align-items: center;
9335
+ background: transparent;
9336
+ border: none;
9337
+ color: var(--primary-action-default);
9338
+ display: flex;
9339
+ gap: var(--spacing-sm);
9340
+ transition: color var(--duration-fast) var(--timing-ease-out);
9341
+ padding: 0;
9342
+
9343
+ &:hover,
9344
+ &:focus {
9345
+ color: var(--primary-action-hover);
9346
+ }
9347
+
9348
+ &:disabled {
9349
+ color: var(--gray-400);
9350
+ }
9351
+ `;
9352
+ var Title2 = css39`
9353
+ color: var(--typography-light);
9354
+
9355
+ &:focus {
9356
+ outline: none;
9357
+ }
9358
+ `;
9359
+ var ResetConditionsBtn2 = css39`
9360
+ background: transparent;
9361
+ border: none;
9362
+ color: var(--action-destructive-default);
9363
+ transition: color var(--duration-fast) var(--timing-ease-out);
9364
+ padding: 0;
9365
+
9366
+ &:hover,
9367
+ &:focus {
9368
+ color: var(--action-destructive-hover);
9369
+ }
9370
+ `;
9371
+ var IconBtn2 = css39`
9372
+ background: transparent;
9373
+ border: none;
9374
+ padding: var(--spacing-sm);
9375
+ `;
9376
+ var SearchAndFilterOptionsContainer3 = css39`
9377
+ background: var(--gray-50);
9378
+ border: 1px solid var(--gray-300);
9379
+ border-radius: var(--rounded-base);
9380
+ container-type: inline-size;
9381
+ display: flex;
9382
+ flex-direction: column;
9383
+ gap: var(--spacing-sm);
9384
+ padding: var(--spacing-md) 0 var(--spacing-base);
9385
+ will-change: height;
9386
+ position: relative;
9387
+ z-index: 1;
9388
+ `;
9389
+ var SearchAndFilterOptionsInnerContainer2 = css39`
9390
+ display: flex;
9391
+ flex-direction: column;
9392
+ gap: var(--spacing-sm);
9393
+ padding-inline: var(--spacing-md);
9394
+ `;
9395
+ var SearchAndFilterButtonGroup2 = css39`
9396
+ margin-top: var(--spacing-xs);
9397
+ margin-left: calc(56px + var(--spacing-md));
9398
+ `;
9399
+ var SortFilterWrapper = (hiddenLocaleInput) => css39`
9400
+ align-items: center;
9401
+ border-top: 1px solid var(--gray-300);
9402
+ display: flex;
9403
+ flex-wrap: wrap;
9404
+ gap: var(--spacing-base);
9405
+ padding: var(--spacing-base) var(--spacing-md) 0;
9406
+ position: relative;
9407
+ z-index: 0;
9408
+
9409
+ ${cq2("420px")} {
9410
+ display: grid;
9411
+ grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
9412
+ }
9413
+ `;
9414
+ var SortFilterInputRow = css39`
9415
+ align-items: center;
9416
+ display: grid;
9417
+ grid-template-columns: 1fr auto;
9418
+ gap: var(--spacing-base);
9419
+ `;
9420
+ var InputVariableWrapper = css39`
9421
+ flex-grow: 1;
9422
+
9423
+ // we need to override label styles nested within the input variable
9424
+ // as these are slightly different from the default label styles
9425
+ label > span {
9426
+ color: var(--typography-light);
9427
+ }
9428
+ `;
9429
+
9430
+ // src/components/SearchAndFilter/SortItems.tsx
9431
+ import { jsx as jsx80, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9432
+ var SortItems = ({
9433
+ sortByLabel = "Sort by",
9434
+ localeLabel = "Show locale",
9435
+ sortOptions,
9436
+ sortByValue,
9437
+ onSortChange,
9438
+ localeValue,
9439
+ localeOptions,
9440
+ onLocaleChange,
9441
+ disableSortBinding
9442
+ }) => {
9443
+ var _a, _b;
9444
+ const hideLocaleOptions = !localeOptions || !onLocaleChange;
9445
+ const values = sortByValue == null ? void 0 : sortByValue.split("_");
9446
+ const sortDirection = values == null ? void 0 : values.pop();
9447
+ const sortField = values == null ? void 0 : values.join("_");
9448
+ const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
9449
+ var _a2;
9450
+ return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9451
+ })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9452
+ const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9453
+ return /* @__PURE__ */ jsxs49("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9454
+ /* @__PURE__ */ jsxs49(VerticalRhythm9, { gap: "xs", children: [
9455
+ /* @__PURE__ */ jsx80("span", { css: Title2, children: sortByLabel }),
9456
+ /* @__PURE__ */ jsxs49("div", { css: SortFilterInputRow, children: [
9457
+ /* @__PURE__ */ jsx80(
9458
+ InputVariables,
9459
+ {
9460
+ disableInlineMenu: disableSortBinding,
9461
+ showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9462
+ value: sortField,
9463
+ valueToResetTo: "created_at",
9464
+ onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9465
+ inputWhenNoVariables: /* @__PURE__ */ jsx80(
9466
+ InputComboBox3,
9467
+ {
9468
+ id: "sort-by-field",
9469
+ "aria-label": "Sort by",
9470
+ options: sortOptions,
9471
+ onChange: (e) => {
9472
+ const fieldName = e == null ? void 0 : e.value;
9473
+ onSortChange(`${fieldName}_${sortDirection}`);
9474
+ },
9475
+ styles: {
9476
+ menu(base) {
9477
+ return {
9478
+ ...base,
9479
+ minWidth: "max-content"
9480
+ };
9481
+ }
9482
+ },
9483
+ value: currentSelectedOption
9484
+ }
9485
+ )
9486
+ }
9487
+ ),
9488
+ /* @__PURE__ */ jsx80(
9489
+ InputVariables,
9490
+ {
9491
+ disableInlineMenu: disableSortBinding,
9492
+ value: sortDirection,
9493
+ valueToResetTo: "DESC",
9494
+ showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9495
+ onChange: (e) => onSortChange(`${sortField}_${e}`),
9496
+ inputWhenNoVariables: /* @__PURE__ */ jsx80(
9497
+ SegmentedControl,
9498
+ {
9499
+ noCheckmark: true,
9500
+ name: "sortBy",
9501
+ hideOptionText: true,
9502
+ iconSize: "1rem",
9503
+ size: "xl",
9504
+ options: [
9505
+ {
9506
+ label: "Ascending",
9507
+ icon: "arrow-up",
9508
+ value: `ASC`,
9509
+ tooltip: "Ascending (e.g. A-Z, oldest to newest)",
9510
+ "data-testid": "sort-ascending"
9511
+ },
9512
+ {
9513
+ label: "Descending",
9514
+ icon: "arrow-down",
9515
+ value: `DESC`,
9516
+ tooltip: "Descending (e.g. Z-A, newest to oldest)",
9517
+ "data-testid": "sort-descending"
9518
+ }
9519
+ ],
9520
+ onChange: (e) => onSortChange(`${sortField}_${e}`),
9521
+ value: sortDirection
9522
+ }
9523
+ )
9524
+ }
9525
+ )
9526
+ ] })
9527
+ ] }),
9528
+ hideLocaleOptions ? null : /* @__PURE__ */ jsx80(VerticalRhythm9, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx80(
9529
+ InputVariables,
9530
+ {
9531
+ label: localeLabelValue,
9532
+ value: localeValue,
9533
+ showMenuPosition: "inline-right",
9534
+ onChange: (e) => onLocaleChange(e != null ? e : ""),
9535
+ inputWhenNoVariables: /* @__PURE__ */ jsx80(
9536
+ InputSelect8,
9537
+ {
9538
+ name: "localeReturned",
9539
+ "aria-label": localeLabelValue,
9540
+ label: localeLabelValue,
9541
+ showLabel: false,
9542
+ "data-testid": "context-locale",
9543
+ onChange: (e) => {
9544
+ var _a2;
9545
+ return onLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
9546
+ },
9547
+ options: localeOptions,
9548
+ value: localeValue
9549
+ }
9550
+ )
9551
+ }
9552
+ ) })
9553
+ ] });
9554
+ };
9555
+
9556
+ // src/index.ts
9557
+ import {
9558
+ AddListButton as AddListButton2,
9559
+ Button as Button7,
9560
+ Callout as Callout8,
9561
+ DrawerContent,
9562
+ Heading,
9563
+ Input as Input7,
9564
+ InputComboBox as InputComboBox4,
9565
+ InputKeywordSearch as InputKeywordSearch4,
9566
+ InputSelect as InputSelect9,
9567
+ InputToggle as InputToggle3,
9568
+ Label,
9569
+ LoadingIndicator as LoadingIndicator5,
9570
+ LoadingOverlay as LoadingOverlay2,
9571
+ Menu as Menu4,
9572
+ MenuItem as MenuItem3,
9573
+ ParameterGroup,
9574
+ ParameterImage,
9575
+ ParameterImageInner,
9576
+ ParameterInput,
9577
+ ParameterInputInner,
9578
+ ParameterLabel,
9579
+ ParameterMenuButton,
9580
+ ParameterSelect,
9581
+ ParameterSelectInner,
9582
+ ParameterShell,
9583
+ ParameterTextarea,
9584
+ ParameterTextareaInner,
9585
+ ParameterToggle,
9586
+ ParameterToggleInner,
9587
+ ScrollableList as ScrollableList2,
9588
+ ScrollableListItem,
9589
+ Switch,
9590
+ Textarea,
9591
+ Theme as Theme3,
9592
+ utilityColors
9593
+ } from "@uniformdev/design-system";
9594
+ export * from "@uniformdev/mesh-sdk";
9595
+ export {
9596
+ $createVariableNode,
9597
+ $isVariableNode,
9598
+ AddListButton2 as AddListButton,
9599
+ Button7 as Button,
9600
+ CHECKBOX_OPERATORS,
9601
+ Callout8 as Callout,
9602
+ ControlledObjectSearchProvider,
9603
+ ControlledValuePlugin,
9604
+ DATE_OPERATORS,
9605
+ DISCONNECT_VARIABLE_COMMAND,
9606
+ DamSelectedItem,
9607
+ DataRefreshButton,
9608
+ DataResourceDynamicInputProvider,
9609
+ DataResourceInputContext,
9610
+ DataResourceVariablesList,
9611
+ DataResourceVariablesListExplicit,
9612
+ DataSourceEditor,
9613
+ DataTypeEditor,
9614
+ DateEditor,
9615
+ DateRangeEditor,
9616
+ DefaultSearchRow,
9617
+ DefaultSelectedItem,
9618
+ DrawerContent,
9619
+ EDIT_VARIABLE_COMMAND,
9620
+ EntrySearch,
9621
+ FilterButton2 as FilterButton,
9622
+ FilterControls,
9623
+ FilterEditorRenderer,
9624
+ FilterItem,
9625
+ FilterItems,
9626
+ FilterMenu,
9627
+ FilterMultiChoiceEditor,
9628
+ FilterSingleChoiceEditor,
9629
+ Heading,
9630
+ INSERT_VARIABLE_COMMAND,
9631
+ icons_exports as Icons,
9632
+ Input7 as Input,
9633
+ InputComboBox4 as InputComboBox,
9634
+ InputKeywordSearch4 as InputKeywordSearch,
9635
+ InputSelect9 as InputSelect,
9636
+ InputToggle3 as InputToggle,
7307
9637
  InputVariables,
7308
9638
  Label,
7309
9639
  LinkButton,
@@ -7312,16 +9642,22 @@ export {
7312
9642
  Menu4 as Menu,
7313
9643
  MenuItem3 as MenuItem,
7314
9644
  MeshApp,
9645
+ NUMBER_OPERATORS,
9646
+ NumberEditor,
9647
+ NumberRangeEditor,
7315
9648
  OPEN_INSERT_VARIABLE_COMMAND,
7316
9649
  ObjectSearchContainer,
9650
+ ObjectSearchContext,
7317
9651
  ObjectSearchFilter,
7318
9652
  ObjectSearchFilterContainer2 as ObjectSearchFilterContainer,
7319
9653
  ObjectSearchListItem,
7320
9654
  ObjectSearchListItemLoadingSkeleton,
9655
+ ObjectSearchListOfSearchResults,
7321
9656
  ObjectSearchProvider,
7322
9657
  ObjectSearchResultItem,
7323
9658
  ObjectSearchResultItemButton,
7324
9659
  ObjectSearchResultList,
9660
+ PUBLISH_STATUS_FIELD_OPERATORS,
7325
9661
  ParamTypeDynamicDataProvider,
7326
9662
  ParameterConnectionIndicator,
7327
9663
  ParameterGroup,
@@ -7349,6 +9685,7 @@ export {
7349
9685
  ProductSearchRow,
7350
9686
  ProductSelectedItem,
7351
9687
  QueryFilter,
9688
+ RICHTEXT_OPERATORS,
7352
9689
  RequestBody,
7353
9690
  RequestHeaders,
7354
9691
  RequestMethodSelect,
@@ -7358,19 +9695,37 @@ export {
7358
9695
  RequestUrl,
7359
9696
  RequestUrlInput,
7360
9697
  ResolvableLoadingValue,
9698
+ SELECT_OPERATORS,
9699
+ SYSTEM_DATE_OPERATORS,
9700
+ SYSTEM_FIELD_OPERATORS,
7361
9701
  ScrollableList2 as ScrollableList,
7362
9702
  ScrollableListItem,
9703
+ SearchAndFilter,
9704
+ SearchAndFilterContext,
9705
+ SearchAndFilterOptionsContainer2 as SearchAndFilterOptionsContainer,
9706
+ SearchAndFilterProvider,
9707
+ SearchAndFilterResultContainer,
9708
+ SearchOnlyContext,
9709
+ SearchOnlyFilter,
7363
9710
  SelectionField,
9711
+ SortItems,
9712
+ StatusMultiEditor,
9713
+ StatusSingleEditor,
7364
9714
  Switch,
9715
+ TEXTBOX_OPERATORS,
9716
+ TextEditor,
7365
9717
  TextVariableRenderer,
7366
9718
  Textarea,
7367
9719
  Theme3 as Theme,
9720
+ USER_OPERATORS,
7368
9721
  VariableEditor,
7369
9722
  VariableNode,
7370
9723
  VariablesList,
7371
9724
  VariablesPlugin,
7372
9725
  VariablesProvider,
7373
9726
  badgeIcon,
9727
+ bindQuery,
9728
+ bindableFiltersMapper,
7374
9729
  convertConnectedDataToVariable,
7375
9730
  createLocationValidator,
7376
9731
  damSelectItemImage,
@@ -7401,6 +9756,7 @@ export {
7401
9756
  entrySearchSelectInput,
7402
9757
  entrySearchSelectOption,
7403
9758
  entrySearchWrapper,
9759
+ filterMapper,
7404
9760
  hasReferencedVariables,
7405
9761
  prettifyBindExpression,
7406
9762
  productSearchRowActiveIcon,
@@ -7442,6 +9798,7 @@ export {
7442
9798
  urlEncodeRequestUrl,
7443
9799
  useConnectedDataAsVariables,
7444
9800
  useContentDataResourceLocaleInfo,
9801
+ useDataResourceDynamicInputs,
7445
9802
  useDynamicInputsAsVariables,
7446
9803
  useMeshLocation,
7447
9804
  useObjectSearchContext,
@@ -7451,10 +9808,12 @@ export {
7451
9808
  useRequest,
7452
9809
  useRequestHeader,
7453
9810
  useRequestParameter,
9811
+ useSearchAndFilter,
7454
9812
  useUniformMeshSdk,
7455
9813
  useVariableEditor,
7456
9814
  useVariables,
7457
9815
  useVariablesMenu,
9816
+ utilityColors,
7458
9817
  variableDefaultTextValue,
7459
9818
  variablePrefix,
7460
9819
  variableSuffix,