@uniformdev/mesh-sdk-react 19.159.0 → 19.159.1-alpha.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1651,8 +1651,7 @@ var EntrySearch = ({
1651
1651
  const handleCancelClick = (e) => {
1652
1652
  e.preventDefault();
1653
1653
  setListOpen(false);
1654
- if (onCancel)
1655
- onCancel();
1654
+ if (onCancel) onCancel();
1656
1655
  };
1657
1656
  const handleLoadMoreClick = () => {
1658
1657
  search(textInput, {
@@ -4672,8 +4671,7 @@ function VariablesComposer(props) {
4672
4671
  );
4673
4672
  const editorState = useRef12();
4674
4673
  const updateTimeout = useRef12();
4675
- if (typeof document === "undefined")
4676
- return null;
4674
+ if (typeof document === "undefined") return null;
4677
4675
  return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
4678
4676
  /* @__PURE__ */ jsx38(
4679
4677
  OnChangePlugin,
@@ -5138,7 +5136,7 @@ function ParameterOrSingleVariable(props) {
5138
5136
  editorRef ? /* @__PURE__ */ jsx42(EditorRefPlugin, { editorRef }) : null,
5139
5137
  /* @__PURE__ */ jsx42(ControlledValuePlugin, { enabled: true, value }),
5140
5138
  /* @__PURE__ */ jsxs25(HorizontalRhythm6, { align: "center", gap: "xs", css: { width: "100%" }, children: [
5141
- /* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
5139
+ /* @__PURE__ */ jsx42("div", { css: { flex: 1, minWidth: "0" }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
5142
5140
  VariablesComposerInput,
5143
5141
  {
5144
5142
  "data-text-value": value,
@@ -7632,6 +7630,28 @@ var MULTI_SELECT_OPERATORS = [
7632
7630
  editorType: "empty"
7633
7631
  }
7634
7632
  ];
7633
+ var WORKFLOW_STAGES_OPERATORS = [
7634
+ {
7635
+ label: "is",
7636
+ value: "eq",
7637
+ editorType: "singleChoice"
7638
+ },
7639
+ {
7640
+ label: "is any of...",
7641
+ value: "in",
7642
+ editorType: "multiChoice"
7643
+ },
7644
+ {
7645
+ label: "is not",
7646
+ value: "neq",
7647
+ editorType: "singleChoice"
7648
+ },
7649
+ {
7650
+ label: "is none of...",
7651
+ value: "nin",
7652
+ editorType: "multiChoice"
7653
+ }
7654
+ ];
7635
7655
 
7636
7656
  // src/components/SearchAndFilter/editors/DateEditor.tsx
7637
7657
  import { Input as Input6 } from "@uniformdev/design-system";
@@ -8156,6 +8176,58 @@ var TextEditor = ({
8156
8176
  );
8157
8177
  };
8158
8178
 
8179
+ // src/components/SearchAndFilter/editors/TextMultiChoiceEditor.tsx
8180
+ import {
8181
+ convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups5,
8182
+ getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups3,
8183
+ InputCreatableComboBox
8184
+ } from "@uniformdev/design-system";
8185
+ import { useMemo as useMemo21 } from "react";
8186
+ import { jsx as jsx80 } from "@emotion/react/jsx-runtime";
8187
+ var TextMultiChoiceEditor = ({
8188
+ value,
8189
+ disabled,
8190
+ readOnly,
8191
+ valueTestId,
8192
+ ...props
8193
+ }) => {
8194
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8195
+ const isClearable = !readOnly || !disabled;
8196
+ const { groupedOptions, selectedOptions } = useMemo21(() => {
8197
+ var _a;
8198
+ const coercedValue = typeof value === "string" ? [value] : value != null ? value : [];
8199
+ const options = (_a = coercedValue.map((v) => ({ label: v, value: v }))) != null ? _a : [];
8200
+ return convertComboBoxGroupsToSelectableGroups5({ options, selectedItems: new Set(value) });
8201
+ }, [value]);
8202
+ return /* @__PURE__ */ jsx80("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx80(
8203
+ InputCreatableComboBox,
8204
+ {
8205
+ ...props,
8206
+ placeholder: "Type a value\u2026",
8207
+ noOptionsMessage: () => "Type to create a new value",
8208
+ options: groupedOptions,
8209
+ isMulti: true,
8210
+ isClearable,
8211
+ isDisabled: disabled,
8212
+ onChange: (e) => {
8213
+ const selectedValues = getComboBoxSelectedSelectableGroups3(e);
8214
+ return props.onChange([...selectedValues]);
8215
+ },
8216
+ value: selectedOptions,
8217
+ "aria-readonly": readOnly,
8218
+ styles: {
8219
+ menu(base) {
8220
+ return {
8221
+ ...base,
8222
+ minWidth: "max-content"
8223
+ };
8224
+ }
8225
+ },
8226
+ ...readOnlyProps
8227
+ }
8228
+ ) });
8229
+ };
8230
+
8159
8231
  // src/components/SearchAndFilter/FilterButton.tsx
8160
8232
  import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
8161
8233
 
@@ -8365,7 +8437,7 @@ var ResetConditionsBtn = css38`
8365
8437
  border: none;
8366
8438
  color: var(--action-destructive-default);
8367
8439
  transition: color var(--duration-fast) var(--timing-ease-out);
8368
- padding: 0;
8440
+ padding: 0 var(--spacing-sm) 0 0;
8369
8441
 
8370
8442
  &:hover,
8371
8443
  &:focus {
@@ -8373,6 +8445,7 @@ var ResetConditionsBtn = css38`
8373
8445
  }
8374
8446
  `;
8375
8447
  var IconBtn = css38`
8448
+ align-self: center;
8376
8449
  background: transparent;
8377
8450
  border: none;
8378
8451
  padding: var(--spacing-sm);
@@ -8388,7 +8461,7 @@ var SearchAndFilterOptionsContainer = css38`
8388
8461
  padding: var(--spacing-md) 0 var(--spacing-base);
8389
8462
  will-change: height;
8390
8463
  position: relative;
8391
- z-index: 1;
8464
+ z-index: 2;
8392
8465
  `;
8393
8466
  var SearchAndFilterOptionsInnerContainer = css38`
8394
8467
  display: flex;
@@ -8402,7 +8475,7 @@ var SearchAndFilterButtonGroup = css38`
8402
8475
  `;
8403
8476
 
8404
8477
  // src/components/SearchAndFilter/FilterButton.tsx
8405
- import { jsx as jsx80, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
8478
+ import { jsx as jsx81, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
8406
8479
  var FilterButton2 = ({
8407
8480
  text = "Filters",
8408
8481
  icon = "filter-add",
@@ -8423,9 +8496,9 @@ var FilterButton2 = ({
8423
8496
  ...props,
8424
8497
  "data-testid": dataTestId,
8425
8498
  children: [
8426
- /* @__PURE__ */ jsx80(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
8427
- /* @__PURE__ */ jsx80("span", { css: FilterButtonText, children: text }),
8428
- filterCount ? /* @__PURE__ */ jsx80(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
8499
+ /* @__PURE__ */ jsx81(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
8500
+ /* @__PURE__ */ jsx81("span", { css: FilterButtonText, children: text }),
8501
+ filterCount ? /* @__PURE__ */ jsx81(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
8429
8502
  ]
8430
8503
  }
8431
8504
  );
@@ -8447,22 +8520,19 @@ import {
8447
8520
  useContext as useContext8,
8448
8521
  useDeferredValue as useDeferredValue2,
8449
8522
  useEffect as useEffect21,
8450
- useMemo as useMemo21,
8523
+ useMemo as useMemo22,
8451
8524
  useState as useState24
8452
8525
  } from "react";
8453
8526
 
8454
8527
  // src/components/SearchAndFilter/FilterEditor.tsx
8455
- import { jsx as jsx81 } from "@emotion/react/jsx-runtime";
8528
+ import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
8456
8529
  var FilterEditorRenderer = ({ editorType, ...props }) => {
8457
8530
  const { filterMapper: contextFilterMapper } = useSearchAndFilter();
8458
8531
  const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
8459
- if (!Editor) {
8460
- return null;
8532
+ if (!Editor || editorType === "empty") {
8533
+ return /* @__PURE__ */ jsx82("span", {});
8461
8534
  }
8462
- if (editorType === "empty") {
8463
- return null;
8464
- }
8465
- return /* @__PURE__ */ jsx81(Editor, { ...props });
8535
+ return /* @__PURE__ */ jsx82(Editor, { ...props });
8466
8536
  };
8467
8537
  var filterMapper = {
8468
8538
  multiChoice: FilterMultiChoiceEditor,
@@ -8470,6 +8540,7 @@ var filterMapper = {
8470
8540
  date: DateEditor,
8471
8541
  dateRange: DateRangeEditor,
8472
8542
  text: TextEditor,
8543
+ textMultiChoice: TextMultiChoiceEditor,
8473
8544
  numberRange: NumberRangeEditor,
8474
8545
  number: NumberEditor,
8475
8546
  statusMultiChoice: StatusMultiEditor,
@@ -8479,9 +8550,9 @@ var filterMapper = {
8479
8550
  function withInputVariables(WrappedComponent) {
8480
8551
  const WithInputVariables = (props) => {
8481
8552
  if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8482
- return /* @__PURE__ */ jsx81(WrappedComponent, { ...props });
8553
+ return /* @__PURE__ */ jsx82(WrappedComponent, { ...props });
8483
8554
  }
8484
- return /* @__PURE__ */ jsx81(
8555
+ return /* @__PURE__ */ jsx82(
8485
8556
  InputVariables,
8486
8557
  {
8487
8558
  disableInlineMenu: true,
@@ -8489,7 +8560,7 @@ function withInputVariables(WrappedComponent) {
8489
8560
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8490
8561
  value: props.value,
8491
8562
  disabled: props.disabled,
8492
- inputWhenNoVariables: /* @__PURE__ */ jsx81(WrappedComponent, { ...props })
8563
+ inputWhenNoVariables: /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8493
8564
  }
8494
8565
  );
8495
8566
  };
@@ -8499,16 +8570,16 @@ function withInputVariablesForMultiValue(WrappedComponent) {
8499
8570
  const WithInputVariables = (props) => {
8500
8571
  var _a;
8501
8572
  if (!props.bindable || props.disabled || props.readOnly) {
8502
- return /* @__PURE__ */ jsx81(WrappedComponent, { ...props });
8573
+ return /* @__PURE__ */ jsx82(WrappedComponent, { ...props });
8503
8574
  }
8504
- return /* @__PURE__ */ jsx81(
8575
+ return /* @__PURE__ */ jsx82(
8505
8576
  InputVariables,
8506
8577
  {
8507
8578
  disableInlineMenu: true,
8508
8579
  showMenuPosition: "inline-right",
8509
8580
  onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
8510
8581
  value: (_a = props.value) == null ? void 0 : _a[0],
8511
- inputWhenNoVariables: /* @__PURE__ */ jsx81(WrappedComponent, { ...props })
8582
+ inputWhenNoVariables: /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
8512
8583
  }
8513
8584
  );
8514
8585
  };
@@ -8524,7 +8595,7 @@ var bindableFiltersMapper = {
8524
8595
  };
8525
8596
 
8526
8597
  // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8527
- import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
8598
+ import { jsx as jsx83 } from "@emotion/react/jsx-runtime";
8528
8599
  var SearchAndFilterContext = createContext6({
8529
8600
  searchTerm: "",
8530
8601
  setSearchTerm: () => {
@@ -8588,7 +8659,7 @@ var SearchAndFilterProvider = ({
8588
8659
  },
8589
8660
  [filters, onChange]
8590
8661
  );
8591
- const validFilterQuery = useMemo21(() => {
8662
+ const validFilterQuery = useMemo22(() => {
8592
8663
  const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
8593
8664
  if (hasValidFilters) {
8594
8665
  return filters;
@@ -8607,7 +8678,7 @@ var SearchAndFilterProvider = ({
8607
8678
  };
8608
8679
  }
8609
8680
  }, [filterVisibility]);
8610
- return /* @__PURE__ */ jsx82(
8681
+ return /* @__PURE__ */ jsx83(
8611
8682
  SearchAndFilterContext.Provider,
8612
8683
  {
8613
8684
  value: {
@@ -8626,7 +8697,7 @@ var SearchAndFilterProvider = ({
8626
8697
  filterMapper: filterMapper2,
8627
8698
  allowBindingSearchTerm
8628
8699
  },
8629
- children: /* @__PURE__ */ jsx82(VerticalRhythm5, { children })
8700
+ children: /* @__PURE__ */ jsx83(VerticalRhythm5, { children })
8630
8701
  }
8631
8702
  );
8632
8703
  };
@@ -8636,7 +8707,7 @@ var useSearchAndFilter = () => {
8636
8707
  };
8637
8708
 
8638
8709
  // src/components/SearchAndFilter/FilterControls.tsx
8639
- import { Fragment as Fragment16, jsx as jsx83, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
8710
+ import { Fragment as Fragment16, jsx as jsx84, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
8640
8711
  var FilterControls = ({
8641
8712
  children,
8642
8713
  hideSearchInput
@@ -8667,7 +8738,7 @@ var FilterControls = ({
8667
8738
  }
8668
8739
  }, [searchTerm]);
8669
8740
  return /* @__PURE__ */ jsxs45(Fragment16, { children: [
8670
- /* @__PURE__ */ jsx83(
8741
+ /* @__PURE__ */ jsx84(
8671
8742
  FilterButton2,
8672
8743
  {
8673
8744
  "aria-controls": "search-and-filter-options",
@@ -8681,7 +8752,7 @@ var FilterControls = ({
8681
8752
  }
8682
8753
  ),
8683
8754
  hideSearchInput ? null : /* @__PURE__ */ jsxs45("div", { css: BindableKeywordSearchInputStyles, children: [
8684
- /* @__PURE__ */ jsx83(
8755
+ /* @__PURE__ */ jsx84(
8685
8756
  InputVariables,
8686
8757
  {
8687
8758
  label: "",
@@ -8691,7 +8762,7 @@ var FilterControls = ({
8691
8762
  value: localeSearchTerm,
8692
8763
  onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
8693
8764
  disableVariables: !allowBindingSearchTerm,
8694
- inputWhenNoVariables: /* @__PURE__ */ jsx83(
8765
+ inputWhenNoVariables: /* @__PURE__ */ jsx84(
8695
8766
  InputKeywordSearch2,
8696
8767
  {
8697
8768
  placeholder: "Search...",
@@ -8704,7 +8775,7 @@ var FilterControls = ({
8704
8775
  )
8705
8776
  }
8706
8777
  ),
8707
- hasVariableInSearchTerm ? /* @__PURE__ */ jsx83("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx83(
8778
+ hasVariableInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
8708
8779
  "button",
8709
8780
  {
8710
8781
  css: ClearSearchButtonStyles,
@@ -8718,7 +8789,7 @@ var FilterControls = ({
8718
8789
  },
8719
8790
  type: "button",
8720
8791
  "data-testid": "keyword-search-clear-button",
8721
- children: /* @__PURE__ */ jsx83(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
8792
+ children: /* @__PURE__ */ jsx84(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
8722
8793
  }
8723
8794
  ) }) : null
8724
8795
  ] }),
@@ -8728,20 +8799,20 @@ var FilterControls = ({
8728
8799
 
8729
8800
  // src/components/SearchAndFilter/FilterItem.tsx
8730
8801
  import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
8731
- import { useMemo as useMemo22 } from "react";
8802
+ import { useMemo as useMemo23 } from "react";
8732
8803
 
8733
8804
  // src/components/SearchAndFilter/FilterMenu.tsx
8734
8805
  import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
8735
8806
  import React13, { useEffect as useEffect23 } from "react";
8736
- import { jsx as jsx84, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8807
+ import { jsx as jsx85, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8737
8808
  var SearchAndFilterOptionsContainer2 = ({
8738
8809
  buttonRow,
8739
8810
  additionalFiltersContainer,
8740
8811
  children
8741
8812
  }) => {
8742
8813
  return /* @__PURE__ */ jsxs46("div", { css: SearchAndFilterOptionsContainer, children: [
8743
- /* @__PURE__ */ jsx84("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8744
- buttonRow ? /* @__PURE__ */ jsx84(
8814
+ /* @__PURE__ */ jsx85("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8815
+ buttonRow ? /* @__PURE__ */ jsx85(
8745
8816
  HorizontalRhythm8,
8746
8817
  {
8747
8818
  css: SearchAndFilterButtonGroup,
@@ -8751,7 +8822,7 @@ var SearchAndFilterOptionsContainer2 = ({
8751
8822
  children: buttonRow
8752
8823
  }
8753
8824
  ) : null,
8754
- additionalFiltersContainer ? /* @__PURE__ */ jsx84("div", { children: additionalFiltersContainer }) : null
8825
+ additionalFiltersContainer ? /* @__PURE__ */ jsx85("div", { children: additionalFiltersContainer }) : null
8755
8826
  ] });
8756
8827
  };
8757
8828
  var FilterMenu = ({
@@ -8771,15 +8842,15 @@ var FilterMenu = ({
8771
8842
  (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
8772
8843
  }
8773
8844
  }, [filterVisibility]);
8774
- return /* @__PURE__ */ jsx84(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs46(
8845
+ return /* @__PURE__ */ jsx85(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs46(
8775
8846
  SearchAndFilterOptionsContainer2,
8776
8847
  {
8777
8848
  buttonRow: menuControls,
8778
8849
  additionalFiltersContainer,
8779
8850
  children: [
8780
8851
  /* @__PURE__ */ jsxs46(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
8781
- /* @__PURE__ */ jsx84("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
8782
- (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx84(
8852
+ filterTitle ? /* @__PURE__ */ jsx85("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
8853
+ (filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx85(
8783
8854
  "button",
8784
8855
  {
8785
8856
  type: "button",
@@ -8800,7 +8871,7 @@ var FilterMenu = ({
8800
8871
  };
8801
8872
 
8802
8873
  // src/components/SearchAndFilter/FilterItem.tsx
8803
- import { jsx as jsx85, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
8874
+ import { jsx as jsx86, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
8804
8875
  var FilterItem = ({
8805
8876
  index,
8806
8877
  paramOptions,
@@ -8808,7 +8879,8 @@ var FilterItem = ({
8808
8879
  valueOptions,
8809
8880
  onParamChange,
8810
8881
  onOperatorChange,
8811
- onValueChange
8882
+ onValueChange,
8883
+ initialCriteriaTitle = "Where"
8812
8884
  }) => {
8813
8885
  var _a, _b;
8814
8886
  const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
@@ -8816,7 +8888,7 @@ var FilterItem = ({
8816
8888
  const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
8817
8889
  const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
8818
8890
  const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
8819
- const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo22(() => {
8891
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo23(() => {
8820
8892
  var _a2;
8821
8893
  const currentSelectedFilter = filterOptions.find((item) => {
8822
8894
  var _a3;
@@ -8844,9 +8916,9 @@ var FilterItem = ({
8844
8916
  isClearable: false
8845
8917
  } : {};
8846
8918
  return /* @__PURE__ */ jsxs47("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8847
- /* @__PURE__ */ jsx85("span", { children: index === 0 ? "Where" : "and" }),
8919
+ /* @__PURE__ */ jsx86("span", { children: index === 0 ? initialCriteriaTitle : "and" }),
8848
8920
  /* @__PURE__ */ jsxs47("div", { css: ConditionalInputRow, children: [
8849
- /* @__PURE__ */ jsx85(
8921
+ /* @__PURE__ */ jsx86(
8850
8922
  InputComboBox5,
8851
8923
  {
8852
8924
  "aria-label": label,
@@ -8873,7 +8945,7 @@ var FilterItem = ({
8873
8945
  name: `filter-field-${index}`
8874
8946
  }
8875
8947
  ),
8876
- /* @__PURE__ */ jsx85(
8948
+ /* @__PURE__ */ jsx86(
8877
8949
  InputComboBox5,
8878
8950
  {
8879
8951
  "aria-label": operatorLabel,
@@ -8897,7 +8969,7 @@ var FilterItem = ({
8897
8969
  name: `filter-operator-${index}`
8898
8970
  }
8899
8971
  ),
8900
- /* @__PURE__ */ jsx85(
8972
+ /* @__PURE__ */ jsx86(
8901
8973
  FilterEditorRenderer,
8902
8974
  {
8903
8975
  "aria-label": metaDataLabel,
@@ -8911,7 +8983,7 @@ var FilterItem = ({
8911
8983
  valueTestId: "filter-value"
8912
8984
  }
8913
8985
  ),
8914
- readOnly || index === 0 ? null : /* @__PURE__ */ jsx85(
8986
+ readOnly ? null : /* @__PURE__ */ jsx86(
8915
8987
  "button",
8916
8988
  {
8917
8989
  type: "button",
@@ -8919,15 +8991,36 @@ var FilterItem = ({
8919
8991
  "aria-label": "delete filter",
8920
8992
  css: IconBtn,
8921
8993
  "data-testid": "delete-filter",
8922
- children: /* @__PURE__ */ jsx85(Icon8, { icon: "trash", iconColor: "red", size: "1rem" })
8994
+ disabled: filters.length === 1,
8995
+ children: /* @__PURE__ */ jsx86(Icon8, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
8923
8996
  }
8924
8997
  )
8925
8998
  ] })
8926
8999
  ] });
8927
9000
  };
9001
+ var singleValuedOperators = /* @__PURE__ */ new Set([
9002
+ "eq",
9003
+ "neq",
9004
+ "lt",
9005
+ "gt",
9006
+ "is",
9007
+ "!is",
9008
+ "has",
9009
+ "!has",
9010
+ "startswith",
9011
+ "!startswith",
9012
+ "endswith",
9013
+ "!endswith"
9014
+ ]);
9015
+ var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
9016
+ var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
9017
+ var noValueOperators = /* @__PURE__ */ new Set(["empty", "!empty"]);
8928
9018
  var FilterItems = ({
8929
9019
  addButtonText = "add condition",
8930
- additionalFiltersContainer
9020
+ additionalFiltersContainer,
9021
+ filterTitle,
9022
+ resetButtonText,
9023
+ initialCriteriaTitle
8931
9024
  }) => {
8932
9025
  const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
8933
9026
  const handleUpdateFilter = (index, prop, value) => {
@@ -8935,14 +9028,25 @@ var FilterItems = ({
8935
9028
  const next = [...filters];
8936
9029
  next[index] = { ...next[index], [prop]: value };
8937
9030
  if (prop === "operator") {
8938
- if (!Array.isArray(value) && ["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
9031
+ const newOperator = value;
9032
+ const currentValue = next[index].value;
9033
+ if (Array.isArray(newOperator)) {
9034
+ throw new Error("Operator value must be a single string");
9035
+ }
9036
+ if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
8939
9037
  next[index].value = next[index].value[0];
8940
9038
  }
8941
- if (filters[index].operator === "ndef" || filters[index].operator === "def") {
9039
+ if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
9040
+ next[index].value = currentValue ? [currentValue] : [];
9041
+ }
9042
+ if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
8942
9043
  next[index].value = "";
8943
9044
  }
8944
- if (!Array.isArray(value) && ["between"].includes(value) && Array.isArray(next[index].value) === false) {
8945
- next[index].value = [next[index].value, ""];
9045
+ if (noValueOperators.has(newOperator)) {
9046
+ next[index].value = "";
9047
+ }
9048
+ if (newOperator === "between" && Array.isArray(currentValue) === false) {
9049
+ next[index].value = [currentValue, ""];
8946
9050
  }
8947
9051
  if (value === "def" || value === "true") {
8948
9052
  next[index].value = "true";
@@ -8961,7 +9065,7 @@ var FilterItems = ({
8961
9065
  }
8962
9066
  setFilters(next);
8963
9067
  };
8964
- return /* @__PURE__ */ jsx85(
9068
+ return /* @__PURE__ */ jsx86(
8965
9069
  FilterMenu,
8966
9070
  {
8967
9071
  id: "search-and-filter-options",
@@ -8974,12 +9078,14 @@ var FilterItems = ({
8974
9078
  onClick: handleAddFilter,
8975
9079
  "data-testid": "add-filter",
8976
9080
  children: [
8977
- /* @__PURE__ */ jsx85(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
9081
+ /* @__PURE__ */ jsx86(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
8978
9082
  addButtonText
8979
9083
  ]
8980
9084
  }
8981
9085
  ),
8982
9086
  additionalFiltersContainer,
9087
+ filterTitle,
9088
+ resetButtonText,
8983
9089
  children: filters.map((item, i) => {
8984
9090
  var _a, _b, _c, _d, _e, _f;
8985
9091
  const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
@@ -8988,7 +9094,7 @@ var FilterItems = ({
8988
9094
  })) == null ? void 0 : _a.options) != null ? _b : [];
8989
9095
  const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
8990
9096
  const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
8991
- return /* @__PURE__ */ jsx85(
9097
+ return /* @__PURE__ */ jsx86(
8992
9098
  FilterItem,
8993
9099
  {
8994
9100
  index: i,
@@ -8997,7 +9103,8 @@ var FilterItems = ({
8997
9103
  operatorOptions: possibleOperators,
8998
9104
  onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
8999
9105
  onValueChange: (e) => handleUpdateFilter(i, "value", e),
9000
- valueOptions: possibleValueOptions
9106
+ valueOptions: possibleValueOptions,
9107
+ initialCriteriaTitle
9001
9108
  },
9002
9109
  i
9003
9110
  );
@@ -9011,7 +9118,7 @@ import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
9011
9118
 
9012
9119
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
9013
9120
  import { Button as Button6, Callout as Callout6, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
9014
- import { Fragment as Fragment17, jsx as jsx86, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
9121
+ import { Fragment as Fragment17, jsx as jsx87, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
9015
9122
  var SearchAndFilterResultContainer = ({
9016
9123
  buttonText,
9017
9124
  clearButtonLabel = "clear",
@@ -9048,24 +9155,33 @@ var SearchAndFilterResultContainer = ({
9048
9155
  " results ",
9049
9156
  searchTerm ? `for "${searchTerm}"` : null
9050
9157
  ] }),
9051
- !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx86(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9158
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx87(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9052
9159
  ] }),
9053
9160
  totalResults === 0 ? /* @__PURE__ */ jsxs48(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9054
- calloutText ? /* @__PURE__ */ jsx86(Paragraph, { children: calloutText }) : null,
9055
- hideClearButton ? null : /* @__PURE__ */ jsx86(Button6, { buttonType: "tertiaryOutline", size: "xs", onClick: handleClearSearch, children: buttonText != null ? buttonText : "Clear search" })
9161
+ calloutText ? /* @__PURE__ */ jsx87(Paragraph, { children: calloutText }) : null,
9162
+ hideClearButton ? null : /* @__PURE__ */ jsx87(
9163
+ Button6,
9164
+ {
9165
+ buttonType: "tertiaryOutline",
9166
+ size: "xs",
9167
+ onClick: handleClearSearch,
9168
+ "data-testid": "clear-search",
9169
+ children: buttonText != null ? buttonText : "Clear search"
9170
+ }
9171
+ )
9056
9172
  ] }) : null
9057
9173
  ] });
9058
9174
  };
9059
9175
 
9060
9176
  // src/components/SearchAndFilter/SearchAndFilter.tsx
9061
- import { jsx as jsx87, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9177
+ import { jsx as jsx88, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9062
9178
  var SearchAndFilter = ({
9063
9179
  filters,
9064
9180
  filterOptions,
9065
9181
  filterVisible,
9066
9182
  filterControls,
9067
9183
  viewSwitchControls,
9068
- resultsContainerView = /* @__PURE__ */ jsx87(SearchAndFilterResultContainer, {}),
9184
+ resultsContainerView = /* @__PURE__ */ jsx88(SearchAndFilterResultContainer, {}),
9069
9185
  filterMapper: filterMapper2 = filterMapper,
9070
9186
  additionalFiltersContainer,
9071
9187
  onChange,
@@ -9075,7 +9191,7 @@ var SearchAndFilter = ({
9075
9191
  allowBindingSearchTerm = false,
9076
9192
  resetFilterValues = []
9077
9193
  }) => {
9078
- return /* @__PURE__ */ jsx87(
9194
+ return /* @__PURE__ */ jsx88(
9079
9195
  SearchAndFilterProvider,
9080
9196
  {
9081
9197
  filters,
@@ -9090,16 +9206,16 @@ var SearchAndFilter = ({
9090
9206
  allowBindingSearchTerm,
9091
9207
  children: /* @__PURE__ */ jsxs49(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
9092
9208
  /* @__PURE__ */ jsxs49("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9093
- /* @__PURE__ */ jsx87(
9209
+ /* @__PURE__ */ jsx88(
9094
9210
  "div",
9095
9211
  {
9096
9212
  css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
9097
- children: !filterControls ? /* @__PURE__ */ jsx87(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9213
+ children: !filterControls ? /* @__PURE__ */ jsx88(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9098
9214
  }
9099
9215
  ),
9100
9216
  viewSwitchControls
9101
9217
  ] }),
9102
- /* @__PURE__ */ jsx87(FilterItems, { additionalFiltersContainer }),
9218
+ /* @__PURE__ */ jsx88(FilterItems, { additionalFiltersContainer }),
9103
9219
  resultsContainerView
9104
9220
  ] })
9105
9221
  }
@@ -9110,7 +9226,7 @@ var SearchAndFilter = ({
9110
9226
  import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
9111
9227
  import { createContext as createContext7, useState as useState26 } from "react";
9112
9228
  import { useDebounce as useDebounce10 } from "react-use";
9113
- import { jsx as jsx88 } from "@emotion/react/jsx-runtime";
9229
+ import { jsx as jsx89 } from "@emotion/react/jsx-runtime";
9114
9230
  var SearchOnlyContext = createContext7({
9115
9231
  searchTerm: "",
9116
9232
  setSearchTerm: () => {
@@ -9127,14 +9243,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9127
9243
  300,
9128
9244
  [localeSearchTerm]
9129
9245
  );
9130
- return /* @__PURE__ */ jsx88(
9246
+ return /* @__PURE__ */ jsx89(
9131
9247
  SearchOnlyContext.Provider,
9132
9248
  {
9133
9249
  value: {
9134
9250
  searchTerm,
9135
9251
  setSearchTerm: setLocaleSearchTerm
9136
9252
  },
9137
- children: /* @__PURE__ */ jsx88("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx88(
9253
+ children: /* @__PURE__ */ jsx89("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx89(
9138
9254
  InputKeywordSearch3,
9139
9255
  {
9140
9256
  placeholder: "Search...",
@@ -9385,7 +9501,7 @@ var InputVariableWrapper = css39`
9385
9501
  `;
9386
9502
 
9387
9503
  // src/components/SearchAndFilter/SortItems.tsx
9388
- import { jsx as jsx89, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
9504
+ import { jsx as jsx90, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
9389
9505
  var SortItems = ({
9390
9506
  sortByLabel = "Sort by",
9391
9507
  localeLabel = "Show locale",
@@ -9409,9 +9525,9 @@ var SortItems = ({
9409
9525
  const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9410
9526
  return /* @__PURE__ */ jsxs50("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9411
9527
  /* @__PURE__ */ jsxs50(VerticalRhythm8, { gap: "xs", children: [
9412
- /* @__PURE__ */ jsx89("span", { css: Title2, children: sortByLabel }),
9528
+ /* @__PURE__ */ jsx90("span", { css: Title2, children: sortByLabel }),
9413
9529
  /* @__PURE__ */ jsxs50("div", { css: SortFilterInputRow, children: [
9414
- /* @__PURE__ */ jsx89(
9530
+ /* @__PURE__ */ jsx90(
9415
9531
  InputVariables,
9416
9532
  {
9417
9533
  disableInlineMenu: disableSortBinding,
@@ -9419,7 +9535,7 @@ var SortItems = ({
9419
9535
  value: sortField,
9420
9536
  valueToResetTo: "created_at",
9421
9537
  onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9422
- inputWhenNoVariables: /* @__PURE__ */ jsx89(
9538
+ inputWhenNoVariables: /* @__PURE__ */ jsx90(
9423
9539
  InputComboBox6,
9424
9540
  {
9425
9541
  id: "sort-by-field",
@@ -9442,7 +9558,7 @@ var SortItems = ({
9442
9558
  )
9443
9559
  }
9444
9560
  ),
9445
- /* @__PURE__ */ jsx89(
9561
+ /* @__PURE__ */ jsx90(
9446
9562
  InputVariables,
9447
9563
  {
9448
9564
  disableInlineMenu: disableSortBinding,
@@ -9450,7 +9566,7 @@ var SortItems = ({
9450
9566
  valueToResetTo: "DESC",
9451
9567
  showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9452
9568
  onChange: (e) => onSortChange(`${sortField}_${e}`),
9453
- inputWhenNoVariables: /* @__PURE__ */ jsx89(
9569
+ inputWhenNoVariables: /* @__PURE__ */ jsx90(
9454
9570
  SegmentedControl,
9455
9571
  {
9456
9572
  noCheckmark: true,
@@ -9482,14 +9598,14 @@ var SortItems = ({
9482
9598
  )
9483
9599
  ] })
9484
9600
  ] }),
9485
- hideLocaleOptions ? null : /* @__PURE__ */ jsx89(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx89(
9601
+ hideLocaleOptions ? null : /* @__PURE__ */ jsx90(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx90(
9486
9602
  InputVariables,
9487
9603
  {
9488
9604
  label: localeLabelValue,
9489
9605
  value: localeValue,
9490
9606
  showMenuPosition: "inline-right",
9491
9607
  onChange: (e) => onLocaleChange(e != null ? e : ""),
9492
- inputWhenNoVariables: /* @__PURE__ */ jsx89(
9608
+ inputWhenNoVariables: /* @__PURE__ */ jsx90(
9493
9609
  InputSelect8,
9494
9610
  {
9495
9611
  name: "localeReturned",
@@ -9698,6 +9814,7 @@ export {
9698
9814
  Switch,
9699
9815
  TEXTBOX_OPERATORS,
9700
9816
  TextEditor,
9817
+ TextMultiChoiceEditor,
9701
9818
  TextVariableRenderer,
9702
9819
  Textarea,
9703
9820
  Theme3 as Theme,
@@ -9707,6 +9824,7 @@ export {
9707
9824
  VariablesList,
9708
9825
  VariablesPlugin,
9709
9826
  VariablesProvider,
9827
+ WORKFLOW_STAGES_OPERATORS,
9710
9828
  badgeIcon,
9711
9829
  bindableFiltersMapper,
9712
9830
  convertConnectedDataToVariable,