@uniformdev/mesh-sdk-react 19.154.1-alpha.22 → 19.154.1-alpha.26

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
@@ -7478,11 +7478,6 @@ var SYSTEM_DATE_OPERATORS = [
7478
7478
  label: "is on or after...",
7479
7479
  value: "sys-date-gte",
7480
7480
  editorType: "date"
7481
- },
7482
- {
7483
- label: "is not",
7484
- value: "sys-date-neq",
7485
- editorType: "date"
7486
7481
  }
7487
7482
  ];
7488
7483
  var RICHTEXT_OPERATORS = [
@@ -7637,349 +7632,247 @@ var MULTI_SELECT_OPERATORS = [
7637
7632
  editorType: "empty"
7638
7633
  }
7639
7634
  ];
7635
+ var WORKFLOW_STAGES_OPERATORS = [
7636
+ {
7637
+ label: "is",
7638
+ value: "eq",
7639
+ editorType: "singleChoice"
7640
+ },
7641
+ {
7642
+ label: "is any of...",
7643
+ value: "in",
7644
+ editorType: "multiChoice"
7645
+ },
7646
+ {
7647
+ label: "is not",
7648
+ value: "neq",
7649
+ editorType: "singleChoice"
7650
+ },
7651
+ {
7652
+ label: "is none of...",
7653
+ value: "nin",
7654
+ editorType: "multiChoice"
7655
+ }
7656
+ ];
7640
7657
 
7641
- // src/components/SearchAndFilter/FilterButton.tsx
7642
- import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
7643
-
7644
- // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
7645
- import { css as css38 } from "@emotion/react";
7646
- import { cq, fadeInLtr } from "@uniformdev/design-system";
7647
- var SearchAndFilterControlsWrapper = (gridColumns) => css38`
7648
- align-items: stretch;
7649
- display: grid;
7650
- grid-template-columns: ${gridColumns};
7651
- gap: var(--spacing-sm);
7652
- `;
7653
- var SearchAndFilterOutterControlWrapper = (gridColumns) => css38`
7654
- align-items: stretch;
7655
- display: grid;
7656
- grid-template-columns: ${gridColumns};
7657
- gap: var(--spacing-sm);
7658
- `;
7659
- var ConditionalFilterRow = css38`
7660
- display: grid;
7661
- grid-template-columns: 35px 1fr;
7662
- gap: var(--spacing-sm);
7663
- margin-left: var(--spacing-base);
7658
+ // src/components/SearchAndFilter/editors/DateEditor.tsx
7659
+ import { Input as Input6 } from "@uniformdev/design-system";
7660
+ import { useState as useState19 } from "react";
7661
+ import { useDebounce as useDebounce4 } from "react-use";
7662
+ import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
7663
+ var DateEditor = ({
7664
+ onChange,
7665
+ ariaLabel,
7666
+ disabled,
7667
+ value,
7668
+ readOnly,
7669
+ valueTestId
7670
+ }) => {
7671
+ const [innerValue, setInnerValue] = useState19(value != null ? value : "");
7672
+ useDebounce4(() => onChange(innerValue), 500, [innerValue]);
7673
+ return /* @__PURE__ */ jsx69(
7674
+ Input6,
7675
+ {
7676
+ type: "date",
7677
+ label: ariaLabel,
7678
+ showLabel: false,
7679
+ onChange: (e) => setInnerValue(e.currentTarget.value),
7680
+ disabled,
7681
+ value: innerValue,
7682
+ readOnly,
7683
+ "data-testid": valueTestId
7684
+ }
7685
+ );
7686
+ };
7664
7687
 
7665
- ${cq("380px")} {
7666
- align-items: center;
7688
+ // src/components/SearchAndFilter/editors/DateRangeEditor.tsx
7689
+ import { Input as Input7 } from "@uniformdev/design-system";
7690
+ import { useEffect as useEffect19, useState as useState20 } from "react";
7691
+ import { useDebounce as useDebounce5 } from "react-use";
7667
7692
 
7668
- &:after {
7669
- content: '';
7670
- display: block;
7671
- height: 1px;
7672
- background: var(--gray-300);
7673
- width: calc(100% - var(--spacing-base));
7674
- margin-left: var(--spacing-base);
7675
- }
7676
- &:last-of-type:after {
7677
- display: none;
7693
+ // src/components/SearchAndFilter/editors/shared/ErrorContainer.tsx
7694
+ import { FieldMessage } from "@uniformdev/design-system";
7695
+ import { jsx as jsx70 } from "@emotion/react/jsx-runtime";
7696
+ var ErrorContainer = ({ errorMessage }) => {
7697
+ return /* @__PURE__ */ jsx70(
7698
+ "div",
7699
+ {
7700
+ css: {
7701
+ gridColumn: "span 6",
7702
+ order: 6
7703
+ },
7704
+ children: /* @__PURE__ */ jsx70(FieldMessage, { errorMessage })
7678
7705
  }
7679
- }
7706
+ );
7707
+ };
7680
7708
 
7681
- &:nth-of-type(2) {
7682
- margin-left: 0;
7683
- grid-template-columns: 50px 1fr;
7684
- }
7709
+ // src/components/SearchAndFilter/editors/shared/twoColumnGrid.tsx
7710
+ var twoColumnGrid = {
7711
+ display: "grid",
7712
+ gridTemplateColumns: "1fr 1fr",
7713
+ gap: "var(--spacing-sm);"
7714
+ };
7685
7715
 
7686
- ${cq("580px")} {
7687
- &:after {
7688
- display: none;
7716
+ // src/components/SearchAndFilter/editors/DateRangeEditor.tsx
7717
+ import { Fragment as Fragment14, jsx as jsx71, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
7718
+ var DateRangeEditor = ({
7719
+ ariaLabel,
7720
+ onChange,
7721
+ disabled,
7722
+ value,
7723
+ readOnly,
7724
+ valueTestId
7725
+ }) => {
7726
+ const [minDateValue, setMinDateValue] = useState20(value ? value[0] : "");
7727
+ const [maxDateValue, setMaxDateValue] = useState20(value ? value[1] : "");
7728
+ const [error, setError] = useState20("");
7729
+ useDebounce5(
7730
+ () => {
7731
+ if (minDateValue && maxDateValue && !error) {
7732
+ onChange([minDateValue, maxDateValue]);
7733
+ } else {
7734
+ onChange([]);
7735
+ }
7736
+ },
7737
+ 500,
7738
+ [minDateValue, maxDateValue]
7739
+ );
7740
+ useEffect19(() => {
7741
+ if (!minDateValue || !maxDateValue) {
7742
+ return;
7689
7743
  }
7690
- }
7744
+ const minDate = new Date(minDateValue);
7745
+ const maxDate = new Date(maxDateValue);
7746
+ if (maxDate < minDate) {
7747
+ setError("The max date cannot be lower than the min date");
7748
+ return;
7749
+ }
7750
+ if (maxDate && !minDate) {
7751
+ setError("Please enter both a low and high date");
7752
+ return;
7753
+ }
7754
+ const minDateString = minDate.toDateString();
7755
+ const maxDateString = maxDate.toDateString();
7756
+ if (minDateString === maxDateString || maxDateString === minDateString) {
7757
+ setError("The min and max date cannot be the same");
7758
+ return;
7759
+ }
7760
+ if (minDate > maxDate) {
7761
+ setError("The min date cannot be higher than the max date");
7762
+ return;
7763
+ }
7764
+ if (error) {
7765
+ setError("");
7766
+ }
7767
+ if (minDate && maxDate) {
7768
+ setMinDateValue(minDateValue);
7769
+ setMaxDateValue(maxDateValue);
7770
+ } else {
7771
+ setMinDateValue("");
7772
+ setMaxDateValue("");
7773
+ }
7774
+ }, [minDateValue, maxDateValue, setError]);
7775
+ return /* @__PURE__ */ jsxs42(Fragment14, { children: [
7776
+ /* @__PURE__ */ jsxs42("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
7777
+ /* @__PURE__ */ jsx71(
7778
+ Input7,
7779
+ {
7780
+ label: `${ariaLabel}-min-date`,
7781
+ type: "date",
7782
+ showLabel: false,
7783
+ value: minDateValue,
7784
+ onChange: (e) => setMinDateValue(e.currentTarget.value),
7785
+ "aria-invalid": !error ? false : true,
7786
+ disabled,
7787
+ readOnly,
7788
+ "data-testid": "value-low"
7789
+ }
7790
+ ),
7791
+ /* @__PURE__ */ jsx71(
7792
+ Input7,
7793
+ {
7794
+ label: `${ariaLabel}-max-date`,
7795
+ type: "date",
7796
+ showLabel: false,
7797
+ value: maxDateValue,
7798
+ onChange: (e) => setMaxDateValue(e.currentTarget.value),
7799
+ "aria-invalid": !error ? false : true,
7800
+ disabled,
7801
+ readOnly,
7802
+ "data-testid": "value-high"
7803
+ }
7804
+ )
7805
+ ] }),
7806
+ /* @__PURE__ */ jsx71(ErrorContainer, { errorMessage: error })
7807
+ ] });
7808
+ };
7691
7809
 
7692
- @media (prefers-reduced-motion: no-preference) {
7693
- animation: ${fadeInLtr} var(--duration-fast) var(--timing-ease-out);
7694
- }
7695
- `;
7696
- var ConditionalInputRow = css38`
7697
- display: flex;
7698
- gap: var(--spacing-sm);
7699
- flex-wrap: wrap;
7810
+ // src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
7811
+ import {
7812
+ convertComboBoxGroupsToSelectableGroups,
7813
+ getComboBoxSelectedSelectableGroups,
7814
+ InputComboBox
7815
+ } from "@uniformdev/design-system";
7816
+ import { useMemo as useMemo17 } from "react";
7700
7817
 
7701
- ${cq("380px")} {
7702
- & > div:nth-child(-n + 2) {
7703
- width: calc(50% - var(--spacing-sm));
7704
- }
7818
+ // src/components/SearchAndFilter/editors/shared/readOnlyAttributes.tsx
7819
+ var readOnlyAttributes = {
7820
+ isSearchable: false,
7821
+ menuIsOpen: false,
7822
+ isClearable: false
7823
+ };
7705
7824
 
7706
- & > div:nth-child(n + 3) {
7707
- width: calc(100% - 48px);
7825
+ // src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
7826
+ import { jsx as jsx72 } from "@emotion/react/jsx-runtime";
7827
+ var FilterMultiChoiceEditor = ({
7828
+ value,
7829
+ options,
7830
+ disabled,
7831
+ readOnly,
7832
+ valueTestId,
7833
+ ...props
7834
+ }) => {
7835
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
7836
+ const isClearable = !readOnly || !disabled;
7837
+ const { groupedOptions, selectedOptions } = useMemo17(
7838
+ () => convertComboBoxGroupsToSelectableGroups({ options: options != null ? options : [], selectedItems: new Set(value) }),
7839
+ [options, value]
7840
+ );
7841
+ return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
7842
+ InputComboBox,
7843
+ {
7844
+ ...props,
7845
+ placeholder: "Type to search...",
7846
+ options: groupedOptions,
7847
+ isMulti: true,
7848
+ isClearable,
7849
+ isDisabled: disabled,
7850
+ onChange: (e) => {
7851
+ const selectedValues = getComboBoxSelectedSelectableGroups(e);
7852
+ return props.onChange([...selectedValues]);
7853
+ },
7854
+ value: selectedOptions,
7855
+ "aria-readonly": readOnly,
7856
+ styles: {
7857
+ menu(base) {
7858
+ return {
7859
+ ...base,
7860
+ minWidth: "max-content"
7861
+ };
7862
+ }
7863
+ },
7864
+ ...readOnlyProps
7708
7865
  }
7709
- }
7710
- ${cq("764px")} {
7711
- display: grid;
7712
- grid-template-columns: 200px 160px 1fr 32px;
7866
+ ) });
7867
+ };
7713
7868
 
7714
- & > div:nth-child(n) {
7715
- width: auto;
7716
- }
7717
- }
7718
- `;
7719
- var SearchInput = css38`
7720
- max-height: 40px;
7721
- min-height: unset;
7722
- `;
7723
- var BindableKeywordSearchInputStyles = css38`
7724
- position: relative;
7725
- width: 100%;
7726
-
7727
- & [data-lexical-editor='true'] {
7728
- padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
7729
- font-size: var(--fs-sm);
7730
- border-radius: var(--rounded-full);
7731
- max-height: 40px;
7732
- min-height: unset;
7733
- width: 100%;
7734
- position: relative;
7735
- white-space: nowrap;
7736
- }
7737
- `;
7738
- var ClearSearchButtonContainer = css38`
7739
- align-items: center;
7740
- display: flex;
7741
- position: absolute;
7742
- inset: 0 var(--spacing-lg) 0 auto;
7743
- `;
7744
- var ClearSearchButtonStyles = css38`
7745
- background: none;
7746
- border: none;
7747
- padding: 0;
7748
- pointer-events: all;
7749
- `;
7750
- var FilterButton = css38`
7751
- align-items: center;
7752
- background: var(--white);
7753
- border: 1px solid var(--gray-300);
7754
- border-radius: var(--rounded-full);
7755
- color: var(--typography-base);
7756
- display: flex;
7757
- font-size: var(--fs-sm);
7758
- gap: var(--spacing-sm);
7759
- padding: var(--spacing-sm) var(--spacing-base);
7760
- max-height: 40px;
7761
- transition: color var(--duration-fast) var(--timing-ease-out),
7762
- background-color var(--duration-fast) var(--timing-ease-out),
7763
- border-color var(--duration-fast) var(--timing-ease-out),
7764
- box-shadow var(--duration-fast) var(--timing-ease-out);
7765
-
7766
- svg {
7767
- color: var(--gray-300);
7768
- transition: color var(--duration-fast) var(--timing-ease-out);
7769
- }
7770
-
7771
- &:hover,
7772
- :where([aria-expanded='true']) {
7773
- outline: none;
7774
- background: var(--gray-200);
7775
- border-color: var(--gray-300);
7776
-
7777
- svg {
7778
- color: var(--typography-base);
7779
- }
7780
- }
7781
-
7782
- &:disabled {
7783
- opacity: var(--opacity-50);
7784
- }
7785
- `;
7786
- var FilterButtonText = css38`
7787
- overflow: hidden;
7788
- text-overflow: ellipsis;
7789
- white-space: nowrap;
7790
- max-width: 14ch;
7791
- `;
7792
- var FilterButtonSelected = css38`
7793
- background: var(--gray-100);
7794
- border-color: var(--gray-300);
7795
-
7796
- svg {
7797
- color: var(--accent-dark);
7798
- }
7799
- `;
7800
- var FilterButtonWithOptions = css38`
7801
- :where([aria-expanded='true']) {
7802
- background: var(--purple-rain-100);
7803
- border-color: var(--accent-light);
7804
- color: var(--typography-base);
7805
- box-shadow: var(--elevation-100);
7806
-
7807
- svg {
7808
- color: var(--accent-dark);
7809
- }
7810
- }
7811
- `;
7812
- var SearchIcon = css38`
7813
- color: var(--icon-color);
7814
- position: absolute;
7815
- inset: 0 var(--spacing-base) 0 auto;
7816
- margin: auto;
7817
- transition: color var(--duration-fast) var(--timing-ease-out);
7818
- `;
7819
- var AddConditionalBtn = css38`
7820
- align-items: center;
7821
- background: transparent;
7822
- border: none;
7823
- color: var(--primary-action-default);
7824
- display: flex;
7825
- gap: var(--spacing-sm);
7826
- transition: color var(--duration-fast) var(--timing-ease-out);
7827
- padding: 0;
7828
-
7829
- &:hover,
7830
- &:focus {
7831
- color: var(--primary-action-hover);
7832
- }
7833
-
7834
- &:disabled {
7835
- color: var(--gray-400);
7836
- }
7837
- `;
7838
- var Title = css38`
7839
- color: var(--typography-light);
7840
-
7841
- &:focus {
7842
- outline: none;
7843
- }
7844
- `;
7845
- var ResetConditionsBtn = css38`
7846
- background: transparent;
7847
- border: none;
7848
- color: var(--action-destructive-default);
7849
- transition: color var(--duration-fast) var(--timing-ease-out);
7850
- padding: 0;
7851
-
7852
- &:hover,
7853
- &:focus {
7854
- color: var(--action-destructive-hover);
7855
- }
7856
- `;
7857
- var IconBtn = css38`
7858
- background: transparent;
7859
- border: none;
7860
- padding: var(--spacing-sm);
7861
- `;
7862
- var SearchAndFilterOptionsContainer = css38`
7863
- background: var(--gray-50);
7864
- border: 1px solid var(--gray-300);
7865
- border-radius: var(--rounded-base);
7866
- container-type: inline-size;
7867
- display: flex;
7868
- flex-direction: column;
7869
- gap: var(--spacing-sm);
7870
- padding: var(--spacing-md) 0 var(--spacing-base);
7871
- will-change: height;
7872
- position: relative;
7873
- z-index: 1;
7874
- `;
7875
- var SearchAndFilterOptionsInnerContainer = css38`
7876
- display: flex;
7877
- flex-direction: column;
7878
- gap: var(--spacing-sm);
7879
- padding-inline: var(--spacing-md);
7880
- `;
7881
- var SearchAndFilterButtonGroup = css38`
7882
- margin-top: var(--spacing-xs);
7883
- margin-left: calc(56px + var(--spacing-md));
7884
- `;
7885
-
7886
- // src/components/SearchAndFilter/FilterButton.tsx
7887
- import { jsx as jsx69, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
7888
- var FilterButton2 = ({
7889
- text = "Filters",
7890
- icon = "filter-add",
7891
- filterCount,
7892
- hasSelectedValue,
7893
- dataTestId,
7894
- ...props
7895
- }) => {
7896
- return /* @__PURE__ */ jsxs42(
7897
- "button",
7898
- {
7899
- type: "button",
7900
- css: [
7901
- FilterButton,
7902
- hasSelectedValue ? FilterButtonSelected : void 0,
7903
- filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
7904
- ],
7905
- ...props,
7906
- "data-testid": dataTestId,
7907
- children: [
7908
- /* @__PURE__ */ jsx69(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
7909
- /* @__PURE__ */ jsx69("span", { css: FilterButtonText, children: text }),
7910
- filterCount ? /* @__PURE__ */ jsx69(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
7911
- ]
7912
- }
7913
- );
7914
- };
7915
-
7916
- // src/components/SearchAndFilter/FilterControls.tsx
7917
- import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
7918
- import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
7919
- import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
7920
- import { useEffect as useEffect21, useRef as useRef16, useState as useState21 } from "react";
7921
- import { useDebounce as useDebounce5 } from "react-use";
7922
- import { v4 as v43 } from "uuid";
7923
-
7924
- // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
7925
- import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
7869
+ // src/components/SearchAndFilter/editors/FilterSingleChoiceEditor.tsx
7926
7870
  import {
7927
- createContext as createContext6,
7928
- useCallback as useCallback6,
7929
- useContext as useContext8,
7930
- useDeferredValue as useDeferredValue2,
7931
- useEffect as useEffect20,
7932
- useMemo as useMemo17,
7933
- useState as useState20
7934
- } from "react";
7935
-
7936
- // src/components/SearchAndFilter/FilterEditor.tsx
7937
- import { FieldMessage, Input as Input6, InputComboBox, StatusBullet } from "@uniformdev/design-system";
7938
- import { useEffect as useEffect19, useState as useState19 } from "react";
7939
- import { useDebounce as useDebounce4 } from "react-use";
7940
- import { Fragment as Fragment14, jsx as jsx70, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
7941
- var readOnlyAttributes = {
7942
- isSearchable: false,
7943
- menuIsOpen: false,
7944
- isClearable: false
7945
- };
7946
- var FilterMultiChoiceEditor = ({
7947
- value,
7948
- options,
7949
- disabled,
7950
- readOnly,
7951
- valueTestId,
7952
- ...props
7953
- }) => {
7954
- const readOnlyProps = readOnly ? readOnlyAttributes : {};
7955
- const isClearable = !readOnly || !disabled;
7956
- return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
7957
- InputComboBox,
7958
- {
7959
- ...props,
7960
- placeholder: "Type to search...",
7961
- options,
7962
- isMulti: true,
7963
- isClearable,
7964
- isDisabled: disabled,
7965
- onChange: (e) => {
7966
- var _a;
7967
- return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
7968
- },
7969
- value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
7970
- "aria-readonly": readOnly,
7971
- styles: {
7972
- menu(base) {
7973
- return {
7974
- ...base,
7975
- minWidth: "max-content"
7976
- };
7977
- }
7978
- },
7979
- ...readOnlyProps
7980
- }
7981
- ) });
7982
- };
7871
+ convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups2,
7872
+ InputComboBox as InputComboBox2
7873
+ } from "@uniformdev/design-system";
7874
+ import { useMemo as useMemo18 } from "react";
7875
+ import { jsx as jsx73 } from "@emotion/react/jsx-runtime";
7983
7876
  var FilterSingleChoiceEditor = ({
7984
7877
  options,
7985
7878
  value,
@@ -7988,91 +7881,30 @@ var FilterSingleChoiceEditor = ({
7988
7881
  onChange,
7989
7882
  valueTestId
7990
7883
  }) => {
7991
- var _a;
7992
7884
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
7993
- return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
7994
- InputComboBox,
7885
+ const { groupedOptions, selectedOptions } = useMemo18(
7886
+ () => convertComboBoxGroupsToSelectableGroups2({
7887
+ options: options != null ? options : [],
7888
+ selectedItems: new Set(value ? [value] : void 0),
7889
+ selectionMode: "single"
7890
+ }),
7891
+ [options, value]
7892
+ );
7893
+ return /* @__PURE__ */ jsx73("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx73(
7894
+ InputComboBox2,
7995
7895
  {
7996
7896
  placeholder: "Type to search...",
7997
- options,
7897
+ options: groupedOptions,
7998
7898
  isClearable: true,
7999
7899
  onChange: (e) => {
8000
- var _a2;
8001
- return onChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
8002
- },
8003
- isDisabled: disabled,
8004
- value: (_a = options == null ? void 0 : options.find((option) => option.value === value)) != null ? _a : null,
8005
- "aria-readonly": readOnly,
8006
- styles: {
8007
- menu(base) {
8008
- return {
8009
- ...base,
8010
- minWidth: "max-content"
8011
- };
7900
+ if (Array.isArray(e == null ? void 0 : e.value)) {
7901
+ return;
8012
7902
  }
7903
+ return onChange(e == null ? void 0 : e.value);
8013
7904
  },
8014
- ...readOnlyProps
8015
- }
8016
- ) });
8017
- };
8018
- var CustomOptions = ({ label, value }) => {
8019
- return /* @__PURE__ */ jsx70(StatusBullet, { status: label, message: value });
8020
- };
8021
- var StatusMultiEditor = ({
8022
- options,
8023
- value,
8024
- disabled,
8025
- readOnly,
8026
- onChange,
8027
- valueTestId
8028
- }) => {
8029
- const readOnlyProps = readOnly ? readOnlyAttributes : {};
8030
- return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
8031
- InputComboBox,
8032
- {
8033
- options,
8034
- isMulti: true,
8035
- onChange: (e) => {
8036
- var _a;
8037
- return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
8038
- },
8039
- formatOptionLabel: CustomOptions,
8040
- "aria-readonly": readOnly,
8041
- value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
8042
7905
  isDisabled: disabled,
8043
- styles: {
8044
- menu(base) {
8045
- return {
8046
- ...base,
8047
- minWidth: "max-content"
8048
- };
8049
- }
8050
- },
8051
- ...readOnlyProps
8052
- }
8053
- ) });
8054
- };
8055
- var StatusSingleEditor = ({
8056
- options,
8057
- value,
8058
- disabled,
8059
- readOnly,
8060
- onChange,
8061
- valueTestId
8062
- }) => {
8063
- const readOnlyProps = readOnly ? readOnlyAttributes : {};
8064
- return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
8065
- InputComboBox,
8066
- {
8067
- options,
8068
- onChange: (e) => {
8069
- var _a;
8070
- return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
8071
- },
8072
- formatOptionLabel: CustomOptions,
7906
+ value: selectedOptions,
8073
7907
  "aria-readonly": readOnly,
8074
- value: options == null ? void 0 : options.find((option) => option.value === value),
8075
- isDisabled: disabled,
8076
7908
  styles: {
8077
7909
  menu(base) {
8078
7910
  return {
@@ -8085,28 +7917,43 @@ var StatusSingleEditor = ({
8085
7917
  }
8086
7918
  ) });
8087
7919
  };
8088
- var TextEditor = ({
8089
- onChange,
7920
+
7921
+ // src/components/SearchAndFilter/editors/NumberEditor.tsx
7922
+ import { Input as Input8 } from "@uniformdev/design-system";
7923
+ import { useState as useState21 } from "react";
7924
+ import { useDebounce as useDebounce6 } from "react-use";
7925
+ import { jsx as jsx74 } from "@emotion/react/jsx-runtime";
7926
+ var NumberEditor = ({
8090
7927
  ariaLabel,
7928
+ onChange,
7929
+ disabled,
8091
7930
  value,
8092
7931
  readOnly,
8093
7932
  valueTestId
8094
7933
  }) => {
8095
- const [innerValue, setInnerValue] = useState19(value != null ? value : "");
8096
- useDebounce4(() => onChange(innerValue), 500, [innerValue]);
8097
- return /* @__PURE__ */ jsx70(
8098
- Input6,
7934
+ const [innerValue, setInnerValue] = useState21(value != null ? value : "");
7935
+ useDebounce6(() => onChange(innerValue), 500, [innerValue]);
7936
+ return /* @__PURE__ */ jsx74(
7937
+ Input8,
8099
7938
  {
8100
- showLabel: false,
8101
7939
  label: ariaLabel,
7940
+ type: "number",
7941
+ showLabel: false,
7942
+ min: 0,
8102
7943
  onChange: (e) => setInnerValue(e.currentTarget.value),
8103
- placeholder: "Enter phrase to search\u2026",
7944
+ disabled,
8104
7945
  value: innerValue,
8105
7946
  readOnly,
8106
7947
  "data-testid": valueTestId
8107
7948
  }
8108
7949
  );
8109
7950
  };
7951
+
7952
+ // src/components/SearchAndFilter/editors/NumberRangeEditor.tsx
7953
+ import { Input as Input9 } from "@uniformdev/design-system";
7954
+ import { useEffect as useEffect20, useState as useState22 } from "react";
7955
+ import { useDebounce as useDebounce7 } from "react-use";
7956
+ import { Fragment as Fragment15, jsx as jsx75, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
8110
7957
  var NumberRangeEditor = ({
8111
7958
  onChange,
8112
7959
  disabled,
@@ -8115,10 +7962,10 @@ var NumberRangeEditor = ({
8115
7962
  readOnly,
8116
7963
  valueTestId
8117
7964
  }) => {
8118
- const [minValue, setMinValue] = useState19("");
8119
- const [maxValue, setMaxValue] = useState19("");
8120
- const [error, setError] = useState19("");
8121
- useDebounce4(
7965
+ const [minValue, setMinValue] = useState22("");
7966
+ const [maxValue, setMaxValue] = useState22("");
7967
+ const [error, setError] = useState22("");
7968
+ useDebounce7(
8122
7969
  () => {
8123
7970
  if (minValue && maxValue && !error) {
8124
7971
  onChange([minValue, maxValue]);
@@ -8129,7 +7976,7 @@ var NumberRangeEditor = ({
8129
7976
  500,
8130
7977
  [minValue, maxValue]
8131
7978
  );
8132
- useEffect19(() => {
7979
+ useEffect20(() => {
8133
7980
  if (!maxValue && !minValue) {
8134
7981
  return;
8135
7982
  }
@@ -8151,10 +7998,10 @@ var NumberRangeEditor = ({
8151
7998
  setMaxValue(maxValue);
8152
7999
  }
8153
8000
  }, [maxValue, minValue, setError]);
8154
- return /* @__PURE__ */ jsxs43(Fragment14, { children: [
8001
+ return /* @__PURE__ */ jsxs43(Fragment15, { children: [
8155
8002
  /* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8156
- /* @__PURE__ */ jsx70(
8157
- Input6,
8003
+ /* @__PURE__ */ jsx75(
8004
+ Input9,
8158
8005
  {
8159
8006
  label: `${ariaLabel}-min`,
8160
8007
  type: "number",
@@ -8169,8 +8016,8 @@ var NumberRangeEditor = ({
8169
8016
  "data-testid": "value-low"
8170
8017
  }
8171
8018
  ),
8172
- /* @__PURE__ */ jsx70(
8173
- Input6,
8019
+ /* @__PURE__ */ jsx75(
8020
+ Input9,
8174
8021
  {
8175
8022
  type: "number",
8176
8023
  label: `${ariaLabel}-max`,
@@ -8186,149 +8033,448 @@ var NumberRangeEditor = ({
8186
8033
  }
8187
8034
  )
8188
8035
  ] }),
8189
- /* @__PURE__ */ jsx70(ErrorContainer, { errorMessage: error })
8036
+ /* @__PURE__ */ jsx75(ErrorContainer, { errorMessage: error })
8190
8037
  ] });
8191
8038
  };
8192
- var NumberEditor = ({
8193
- ariaLabel,
8039
+
8040
+ // src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
8041
+ import {
8042
+ convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups3,
8043
+ getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups2,
8044
+ InputComboBox as InputComboBox3
8045
+ } from "@uniformdev/design-system";
8046
+ import { useMemo as useMemo19 } from "react";
8047
+
8048
+ // src/components/SearchAndFilter/editors/shared/CustomOptions.tsx
8049
+ import { StatusBullet } from "@uniformdev/design-system";
8050
+ import { jsx as jsx76 } from "@emotion/react/jsx-runtime";
8051
+ var CustomOptions = ({ label, value }) => {
8052
+ return /* @__PURE__ */ jsx76(
8053
+ StatusBullet,
8054
+ {
8055
+ status: label,
8056
+ message: Array.isArray(value) ? value.join(",") : value
8057
+ }
8058
+ );
8059
+ };
8060
+
8061
+ // src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
8062
+ import { jsx as jsx77 } from "@emotion/react/jsx-runtime";
8063
+ var StatusMultiEditor = ({
8064
+ options,
8065
+ value,
8066
+ disabled,
8067
+ readOnly,
8194
8068
  onChange,
8069
+ valueTestId
8070
+ }) => {
8071
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8072
+ const { groupedOptions, selectedOptions } = useMemo19(
8073
+ () => convertComboBoxGroupsToSelectableGroups3({ options: options != null ? options : [], selectedItems: new Set(value) }),
8074
+ [options, value]
8075
+ );
8076
+ return /* @__PURE__ */ jsx77("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx77(
8077
+ InputComboBox3,
8078
+ {
8079
+ options: groupedOptions != null ? groupedOptions : [],
8080
+ isMulti: true,
8081
+ onChange: (e) => {
8082
+ const selectedValues = getComboBoxSelectedSelectableGroups2(e);
8083
+ return onChange([...selectedValues]);
8084
+ },
8085
+ formatOptionLabel: CustomOptions,
8086
+ "aria-readonly": readOnly,
8087
+ value: selectedOptions,
8088
+ isDisabled: disabled,
8089
+ styles: {
8090
+ menu(base) {
8091
+ return {
8092
+ ...base,
8093
+ minWidth: "max-content"
8094
+ };
8095
+ }
8096
+ },
8097
+ ...readOnlyProps
8098
+ }
8099
+ ) });
8100
+ };
8101
+
8102
+ // src/components/SearchAndFilter/editors/StatusSingleEditor.tsx
8103
+ import {
8104
+ convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups4,
8105
+ InputComboBox as InputComboBox4
8106
+ } from "@uniformdev/design-system";
8107
+ import { useMemo as useMemo20 } from "react";
8108
+ import { jsx as jsx78 } from "@emotion/react/jsx-runtime";
8109
+ var StatusSingleEditor = ({
8110
+ options,
8111
+ value,
8195
8112
  disabled,
8113
+ readOnly,
8114
+ onChange,
8115
+ valueTestId
8116
+ }) => {
8117
+ const readOnlyProps = readOnly ? readOnlyAttributes : {};
8118
+ const { groupedOptions, selectedOptions } = useMemo20(
8119
+ () => convertComboBoxGroupsToSelectableGroups4({
8120
+ options: options != null ? options : [],
8121
+ selectedItems: new Set(value ? [value] : void 0),
8122
+ selectionMode: "single"
8123
+ }),
8124
+ [options, value]
8125
+ );
8126
+ return /* @__PURE__ */ jsx78("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx78(
8127
+ InputComboBox4,
8128
+ {
8129
+ options: groupedOptions,
8130
+ onChange: (e) => {
8131
+ if (Array.isArray(e == null ? void 0 : e.value)) {
8132
+ return;
8133
+ }
8134
+ return onChange(e == null ? void 0 : e.value);
8135
+ },
8136
+ formatOptionLabel: CustomOptions,
8137
+ "aria-readonly": readOnly,
8138
+ value: selectedOptions,
8139
+ isDisabled: disabled,
8140
+ styles: {
8141
+ menu(base) {
8142
+ return {
8143
+ ...base,
8144
+ minWidth: "max-content"
8145
+ };
8146
+ }
8147
+ },
8148
+ ...readOnlyProps
8149
+ }
8150
+ ) });
8151
+ };
8152
+
8153
+ // src/components/SearchAndFilter/editors/TextEditor.tsx
8154
+ import { Input as Input10 } from "@uniformdev/design-system";
8155
+ import { useState as useState23 } from "react";
8156
+ import { useDebounce as useDebounce8 } from "react-use";
8157
+ import { jsx as jsx79 } from "@emotion/react/jsx-runtime";
8158
+ var TextEditor = ({
8159
+ onChange,
8160
+ ariaLabel,
8196
8161
  value,
8197
8162
  readOnly,
8198
8163
  valueTestId
8199
8164
  }) => {
8200
- const [innerValue, setInnerValue] = useState19(value != null ? value : "");
8201
- useDebounce4(() => onChange(innerValue), 500, [innerValue]);
8202
- return /* @__PURE__ */ jsx70(
8203
- Input6,
8165
+ const [innerValue, setInnerValue] = useState23(value != null ? value : "");
8166
+ useDebounce8(() => onChange(innerValue), 500, [innerValue]);
8167
+ return /* @__PURE__ */ jsx79(
8168
+ Input10,
8204
8169
  {
8205
- label: ariaLabel,
8206
- type: "number",
8207
8170
  showLabel: false,
8208
- min: 0,
8171
+ label: ariaLabel,
8209
8172
  onChange: (e) => setInnerValue(e.currentTarget.value),
8210
- disabled,
8173
+ placeholder: "Enter phrase to search\u2026",
8211
8174
  value: innerValue,
8212
8175
  readOnly,
8213
8176
  "data-testid": valueTestId
8214
8177
  }
8215
- );
8216
- };
8217
- var DateEditor = ({
8218
- onChange,
8219
- ariaLabel,
8220
- disabled,
8221
- value,
8222
- readOnly,
8223
- valueTestId
8178
+ );
8179
+ };
8180
+
8181
+ // src/components/SearchAndFilter/FilterButton.tsx
8182
+ import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
8183
+
8184
+ // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
8185
+ import { css as css38 } from "@emotion/react";
8186
+ import { cq, fadeInLtr } from "@uniformdev/design-system";
8187
+ var SearchAndFilterControlsWrapper = (gridColumns) => css38`
8188
+ align-items: stretch;
8189
+ display: grid;
8190
+ grid-template-columns: ${gridColumns};
8191
+ gap: var(--spacing-sm);
8192
+ `;
8193
+ var SearchAndFilterOutterControlWrapper = (gridColumns) => css38`
8194
+ align-items: stretch;
8195
+ display: grid;
8196
+ grid-template-columns: ${gridColumns};
8197
+ gap: var(--spacing-sm);
8198
+ `;
8199
+ var ConditionalFilterRow = css38`
8200
+ align-items: baseline;
8201
+ display: grid;
8202
+ grid-template-columns: 35px 1fr;
8203
+ gap: var(--spacing-sm);
8204
+ margin-left: var(--spacing-base);
8205
+
8206
+ ${cq("380px")} {
8207
+ &:after {
8208
+ content: '';
8209
+ display: block;
8210
+ height: 1px;
8211
+ background: var(--gray-300);
8212
+ width: calc(100% - var(--spacing-base));
8213
+ margin-left: var(--spacing-base);
8214
+ }
8215
+ &:last-of-type:after {
8216
+ display: none;
8217
+ }
8218
+ }
8219
+
8220
+ &:nth-of-type(2) {
8221
+ margin-left: 0;
8222
+ grid-template-columns: 50px 1fr;
8223
+ }
8224
+
8225
+ ${cq("580px")} {
8226
+ &:after {
8227
+ display: none;
8228
+ }
8229
+ }
8230
+
8231
+ @media (prefers-reduced-motion: no-preference) {
8232
+ animation: ${fadeInLtr} var(--duration-fast) var(--timing-ease-out);
8233
+ }
8234
+ `;
8235
+ var ConditionalInputRow = css38`
8236
+ display: flex;
8237
+ gap: var(--spacing-sm);
8238
+ flex-wrap: wrap;
8239
+
8240
+ ${cq("380px")} {
8241
+ & > div:nth-child(-n + 2) {
8242
+ width: calc(50% - var(--spacing-sm));
8243
+ }
8244
+
8245
+ & > div:nth-child(n + 3) {
8246
+ width: calc(100% - 48px);
8247
+ }
8248
+ }
8249
+ ${cq("764px")} {
8250
+ align-items: flex-start;
8251
+ display: grid;
8252
+ grid-template-columns: 200px 160px 1fr 32px;
8253
+
8254
+ & > div:nth-child(n) {
8255
+ width: auto;
8256
+ }
8257
+ }
8258
+ `;
8259
+ var SearchInput = css38`
8260
+ max-height: 40px;
8261
+ min-height: unset;
8262
+ `;
8263
+ var BindableKeywordSearchInputStyles = css38`
8264
+ position: relative;
8265
+ width: 100%;
8266
+
8267
+ & [data-lexical-editor='true'] {
8268
+ padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
8269
+ font-size: var(--fs-sm);
8270
+ border-radius: var(--rounded-full);
8271
+ max-height: 40px;
8272
+ min-height: unset;
8273
+ width: 100%;
8274
+ position: relative;
8275
+ white-space: nowrap;
8276
+ }
8277
+ `;
8278
+ var ClearSearchButtonContainer = css38`
8279
+ align-items: center;
8280
+ display: flex;
8281
+ position: absolute;
8282
+ inset: 0 var(--spacing-lg) 0 auto;
8283
+ `;
8284
+ var ClearSearchButtonStyles = css38`
8285
+ background: none;
8286
+ border: none;
8287
+ padding: 0;
8288
+ pointer-events: all;
8289
+ `;
8290
+ var FilterButton = css38`
8291
+ align-items: center;
8292
+ background: var(--white);
8293
+ border: 1px solid var(--gray-300);
8294
+ border-radius: var(--rounded-full);
8295
+ color: var(--typography-base);
8296
+ display: flex;
8297
+ font-size: var(--fs-sm);
8298
+ gap: var(--spacing-sm);
8299
+ padding: var(--spacing-sm) var(--spacing-base);
8300
+ max-height: 40px;
8301
+ transition: color var(--duration-fast) var(--timing-ease-out),
8302
+ background-color var(--duration-fast) var(--timing-ease-out),
8303
+ border-color var(--duration-fast) var(--timing-ease-out),
8304
+ box-shadow var(--duration-fast) var(--timing-ease-out);
8305
+
8306
+ svg {
8307
+ color: var(--gray-300);
8308
+ transition: color var(--duration-fast) var(--timing-ease-out);
8309
+ }
8310
+
8311
+ &:hover,
8312
+ :where([aria-expanded='true']) {
8313
+ outline: none;
8314
+ background: var(--gray-200);
8315
+ border-color: var(--gray-300);
8316
+
8317
+ svg {
8318
+ color: var(--typography-base);
8319
+ }
8320
+ }
8321
+
8322
+ &:disabled {
8323
+ opacity: var(--opacity-50);
8324
+ }
8325
+ `;
8326
+ var FilterButtonText = css38`
8327
+ overflow: hidden;
8328
+ text-overflow: ellipsis;
8329
+ white-space: nowrap;
8330
+ max-width: 14ch;
8331
+ `;
8332
+ var FilterButtonSelected = css38`
8333
+ background: var(--gray-100);
8334
+ border-color: var(--gray-300);
8335
+
8336
+ svg {
8337
+ color: var(--accent-dark);
8338
+ }
8339
+ `;
8340
+ var FilterButtonWithOptions = css38`
8341
+ :where([aria-expanded='true']) {
8342
+ background: var(--purple-rain-100);
8343
+ border-color: var(--accent-light);
8344
+ color: var(--typography-base);
8345
+ box-shadow: var(--elevation-100);
8346
+
8347
+ svg {
8348
+ color: var(--accent-dark);
8349
+ }
8350
+ }
8351
+ `;
8352
+ var SearchIcon = css38`
8353
+ color: var(--icon-color);
8354
+ position: absolute;
8355
+ inset: 0 var(--spacing-base) 0 auto;
8356
+ margin: auto;
8357
+ transition: color var(--duration-fast) var(--timing-ease-out);
8358
+ `;
8359
+ var AddConditionalBtn = css38`
8360
+ align-items: center;
8361
+ background: transparent;
8362
+ border: none;
8363
+ color: var(--primary-action-default);
8364
+ display: flex;
8365
+ gap: var(--spacing-sm);
8366
+ transition: color var(--duration-fast) var(--timing-ease-out);
8367
+ padding: 0;
8368
+
8369
+ &:hover,
8370
+ &:focus {
8371
+ color: var(--primary-action-hover);
8372
+ }
8373
+
8374
+ &:disabled {
8375
+ color: var(--gray-400);
8376
+ }
8377
+ `;
8378
+ var Title = css38`
8379
+ color: var(--typography-light);
8380
+
8381
+ &:focus {
8382
+ outline: none;
8383
+ }
8384
+ `;
8385
+ var ResetConditionsBtn = css38`
8386
+ background: transparent;
8387
+ border: none;
8388
+ color: var(--action-destructive-default);
8389
+ transition: color var(--duration-fast) var(--timing-ease-out);
8390
+ padding: 0;
8391
+
8392
+ &:hover,
8393
+ &:focus {
8394
+ color: var(--action-destructive-hover);
8395
+ }
8396
+ `;
8397
+ var IconBtn = css38`
8398
+ background: transparent;
8399
+ border: none;
8400
+ padding: var(--spacing-sm);
8401
+ `;
8402
+ var SearchAndFilterOptionsContainer = css38`
8403
+ background: var(--gray-50);
8404
+ border: 1px solid var(--gray-300);
8405
+ border-radius: var(--rounded-base);
8406
+ container-type: inline-size;
8407
+ display: flex;
8408
+ flex-direction: column;
8409
+ gap: var(--spacing-sm);
8410
+ padding: var(--spacing-md) 0 var(--spacing-base);
8411
+ will-change: height;
8412
+ position: relative;
8413
+ z-index: 1;
8414
+ `;
8415
+ var SearchAndFilterOptionsInnerContainer = css38`
8416
+ display: flex;
8417
+ flex-direction: column;
8418
+ gap: var(--spacing-sm);
8419
+ padding-inline: var(--spacing-md);
8420
+ `;
8421
+ var SearchAndFilterButtonGroup = css38`
8422
+ margin-top: var(--spacing-xs);
8423
+ margin-left: calc(56px + var(--spacing-md));
8424
+ `;
8425
+
8426
+ // src/components/SearchAndFilter/FilterButton.tsx
8427
+ import { jsx as jsx80, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
8428
+ var FilterButton2 = ({
8429
+ text = "Filters",
8430
+ icon = "filter-add",
8431
+ filterCount,
8432
+ hasSelectedValue,
8433
+ dataTestId,
8434
+ ...props
8224
8435
  }) => {
8225
- const [innerValue, setInnerValue] = useState19(value != null ? value : "");
8226
- useDebounce4(() => onChange(innerValue), 500, [innerValue]);
8227
- return /* @__PURE__ */ jsx70(
8228
- Input6,
8436
+ return /* @__PURE__ */ jsxs44(
8437
+ "button",
8229
8438
  {
8230
- type: "date",
8231
- label: ariaLabel,
8232
- showLabel: false,
8233
- onChange: (e) => setInnerValue(e.currentTarget.value),
8234
- disabled,
8235
- value: innerValue,
8236
- readOnly,
8237
- "data-testid": valueTestId
8439
+ type: "button",
8440
+ css: [
8441
+ FilterButton,
8442
+ hasSelectedValue ? FilterButtonSelected : void 0,
8443
+ filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
8444
+ ],
8445
+ ...props,
8446
+ "data-testid": dataTestId,
8447
+ children: [
8448
+ /* @__PURE__ */ jsx80(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
8449
+ /* @__PURE__ */ jsx80("span", { css: FilterButtonText, children: text }),
8450
+ filterCount ? /* @__PURE__ */ jsx80(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
8451
+ ]
8238
8452
  }
8239
8453
  );
8240
8454
  };
8241
- var DateRangeEditor = ({
8242
- ariaLabel,
8243
- onChange,
8244
- disabled,
8245
- value,
8246
- readOnly,
8247
- valueTestId
8248
- }) => {
8249
- const [minDateValue, setMinDateValue] = useState19(value ? value[0] : "");
8250
- const [maxDateValue, setMaxDateValue] = useState19(value ? value[1] : "");
8251
- const [error, setError] = useState19("");
8252
- useDebounce4(
8253
- () => {
8254
- if (minDateValue && maxDateValue && !error) {
8255
- onChange([minDateValue, maxDateValue]);
8256
- } else {
8257
- onChange([]);
8258
- }
8259
- },
8260
- 500,
8261
- [minDateValue, maxDateValue]
8262
- );
8263
- useEffect19(() => {
8264
- if (!minDateValue || !maxDateValue) {
8265
- return;
8266
- }
8267
- const minDate = new Date(minDateValue);
8268
- const maxDate = new Date(maxDateValue);
8269
- if (maxDate < minDate) {
8270
- setError("The max date cannot be lower than the min date");
8271
- return;
8272
- }
8273
- if (maxDate && !minDate) {
8274
- setError("Please enter both a low and high date");
8275
- return;
8276
- }
8277
- const minDateString = minDate.toDateString();
8278
- const maxDateString = maxDate.toDateString();
8279
- if (minDateString === maxDateString || maxDateString === minDateString) {
8280
- setError("The min and max date cannot be the same");
8281
- return;
8282
- }
8283
- if (minDate > maxDate) {
8284
- setError("The min date cannot be higher than the max date");
8285
- return;
8286
- }
8287
- if (error) {
8288
- setError("");
8289
- }
8290
- if (minDate && maxDate) {
8291
- setMinDateValue(minDateValue);
8292
- setMaxDateValue(maxDateValue);
8293
- } else {
8294
- setMinDateValue("");
8295
- setMaxDateValue("");
8296
- }
8297
- }, [minDateValue, maxDateValue, setError]);
8298
- return /* @__PURE__ */ jsxs43(Fragment14, { children: [
8299
- /* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
8300
- /* @__PURE__ */ jsx70(
8301
- Input6,
8302
- {
8303
- label: `${ariaLabel}-min-date`,
8304
- type: "date",
8305
- showLabel: false,
8306
- value: minDateValue,
8307
- onChange: (e) => setMinDateValue(e.currentTarget.value),
8308
- "aria-invalid": !error ? false : true,
8309
- disabled,
8310
- readOnly,
8311
- "data-testid": "value-low"
8312
- }
8313
- ),
8314
- /* @__PURE__ */ jsx70(
8315
- Input6,
8316
- {
8317
- label: `${ariaLabel}-max-date`,
8318
- type: "date",
8319
- showLabel: false,
8320
- value: maxDateValue,
8321
- onChange: (e) => setMaxDateValue(e.currentTarget.value),
8322
- "aria-invalid": !error ? false : true,
8323
- disabled,
8324
- readOnly,
8325
- "data-testid": "value-high"
8326
- }
8327
- )
8328
- ] }),
8329
- /* @__PURE__ */ jsx70(ErrorContainer, { errorMessage: error })
8330
- ] });
8331
- };
8455
+
8456
+ // src/components/SearchAndFilter/FilterControls.tsx
8457
+ import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
8458
+ import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
8459
+ import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
8460
+ import { useEffect as useEffect22, useRef as useRef16, useState as useState25 } from "react";
8461
+ import { useDebounce as useDebounce9 } from "react-use";
8462
+ import { v4 as v43 } from "uuid";
8463
+
8464
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8465
+ import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
8466
+ import {
8467
+ createContext as createContext6,
8468
+ useCallback as useCallback6,
8469
+ useContext as useContext8,
8470
+ useDeferredValue as useDeferredValue2,
8471
+ useEffect as useEffect21,
8472
+ useMemo as useMemo21,
8473
+ useState as useState24
8474
+ } from "react";
8475
+
8476
+ // src/components/SearchAndFilter/FilterEditor.tsx
8477
+ import { jsx as jsx81 } from "@emotion/react/jsx-runtime";
8332
8478
  var FilterEditorRenderer = ({ editorType, ...props }) => {
8333
8479
  const { filterMapper: contextFilterMapper } = useSearchAndFilter();
8334
8480
  const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
@@ -8338,7 +8484,7 @@ var FilterEditorRenderer = ({ editorType, ...props }) => {
8338
8484
  if (editorType === "empty") {
8339
8485
  return null;
8340
8486
  }
8341
- return /* @__PURE__ */ jsx70(Editor, { ...props });
8487
+ return /* @__PURE__ */ jsx81(Editor, { ...props });
8342
8488
  };
8343
8489
  var filterMapper = {
8344
8490
  multiChoice: FilterMultiChoiceEditor,
@@ -8355,9 +8501,9 @@ var filterMapper = {
8355
8501
  function withInputVariables(WrappedComponent) {
8356
8502
  const WithInputVariables = (props) => {
8357
8503
  if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
8358
- return /* @__PURE__ */ jsx70(WrappedComponent, { ...props });
8504
+ return /* @__PURE__ */ jsx81(WrappedComponent, { ...props });
8359
8505
  }
8360
- return /* @__PURE__ */ jsx70(
8506
+ return /* @__PURE__ */ jsx81(
8361
8507
  InputVariables,
8362
8508
  {
8363
8509
  disableInlineMenu: true,
@@ -8365,7 +8511,7 @@ function withInputVariables(WrappedComponent) {
8365
8511
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
8366
8512
  value: props.value,
8367
8513
  disabled: props.disabled,
8368
- inputWhenNoVariables: /* @__PURE__ */ jsx70(WrappedComponent, { ...props })
8514
+ inputWhenNoVariables: /* @__PURE__ */ jsx81(WrappedComponent, { ...props })
8369
8515
  }
8370
8516
  );
8371
8517
  };
@@ -8375,16 +8521,16 @@ function withInputVariablesForMultiValue(WrappedComponent) {
8375
8521
  const WithInputVariables = (props) => {
8376
8522
  var _a;
8377
8523
  if (!props.bindable || props.disabled || props.readOnly) {
8378
- return /* @__PURE__ */ jsx70(WrappedComponent, { ...props });
8524
+ return /* @__PURE__ */ jsx81(WrappedComponent, { ...props });
8379
8525
  }
8380
- return /* @__PURE__ */ jsx70(
8526
+ return /* @__PURE__ */ jsx81(
8381
8527
  InputVariables,
8382
8528
  {
8383
8529
  disableInlineMenu: true,
8384
8530
  showMenuPosition: "inline-right",
8385
8531
  onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
8386
8532
  value: (_a = props.value) == null ? void 0 : _a[0],
8387
- inputWhenNoVariables: /* @__PURE__ */ jsx70(WrappedComponent, { ...props })
8533
+ inputWhenNoVariables: /* @__PURE__ */ jsx81(WrappedComponent, { ...props })
8388
8534
  }
8389
8535
  );
8390
8536
  };
@@ -8398,26 +8544,9 @@ var bindableFiltersMapper = {
8398
8544
  text: withInputVariables(TextEditor),
8399
8545
  number: withInputVariables(NumberEditor)
8400
8546
  };
8401
- var ErrorContainer = ({ errorMessage }) => {
8402
- return /* @__PURE__ */ jsx70(
8403
- "div",
8404
- {
8405
- css: {
8406
- gridColumn: "span 6",
8407
- order: 6
8408
- },
8409
- children: /* @__PURE__ */ jsx70(FieldMessage, { errorMessage })
8410
- }
8411
- );
8412
- };
8413
- var twoColumnGrid = {
8414
- display: "grid",
8415
- gridTemplateColumns: "1fr 1fr",
8416
- gap: "var(--spacing-sm);"
8417
- };
8418
8547
 
8419
8548
  // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
8420
- import { jsx as jsx71 } from "@emotion/react/jsx-runtime";
8549
+ import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
8421
8550
  var SearchAndFilterContext = createContext6({
8422
8551
  searchTerm: "",
8423
8552
  setSearchTerm: () => {
@@ -8453,9 +8582,9 @@ var SearchAndFilterProvider = ({
8453
8582
  children,
8454
8583
  allowBindingSearchTerm
8455
8584
  }) => {
8456
- const [searchTerm, setSearchTerm] = useState20(defaultSearchTerm);
8585
+ const [searchTerm, setSearchTerm] = useState24(defaultSearchTerm);
8457
8586
  const deferredSearchTerm = useDeferredValue2(searchTerm);
8458
- const [filterVisibility, setFilterVisibility] = useState20(filterVisible);
8587
+ const [filterVisibility, setFilterVisibility] = useState24(filterVisible);
8459
8588
  const handleSearchTerm = useCallback6(
8460
8589
  (term) => {
8461
8590
  setSearchTerm(term);
@@ -8481,13 +8610,13 @@ var SearchAndFilterProvider = ({
8481
8610
  },
8482
8611
  [filters, onChange]
8483
8612
  );
8484
- const validFilterQuery = useMemo17(() => {
8613
+ const validFilterQuery = useMemo21(() => {
8485
8614
  const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
8486
8615
  if (hasValidFilters) {
8487
8616
  return filters;
8488
8617
  }
8489
8618
  }, [filters]);
8490
- useEffect20(() => {
8619
+ useEffect21(() => {
8491
8620
  if (filterVisibility) {
8492
8621
  const handleEscKeyFilterClose = (e) => {
8493
8622
  if (e.key === "Escape") {
@@ -8500,7 +8629,7 @@ var SearchAndFilterProvider = ({
8500
8629
  };
8501
8630
  }
8502
8631
  }, [filterVisibility]);
8503
- return /* @__PURE__ */ jsx71(
8632
+ return /* @__PURE__ */ jsx82(
8504
8633
  SearchAndFilterContext.Provider,
8505
8634
  {
8506
8635
  value: {
@@ -8519,7 +8648,7 @@ var SearchAndFilterProvider = ({
8519
8648
  filterMapper: filterMapper2,
8520
8649
  allowBindingSearchTerm
8521
8650
  },
8522
- children: /* @__PURE__ */ jsx71(VerticalRhythm5, { children })
8651
+ children: /* @__PURE__ */ jsx82(VerticalRhythm5, { children })
8523
8652
  }
8524
8653
  );
8525
8654
  };
@@ -8529,7 +8658,7 @@ var useSearchAndFilter = () => {
8529
8658
  };
8530
8659
 
8531
8660
  // src/components/SearchAndFilter/FilterControls.tsx
8532
- import { Fragment as Fragment15, jsx as jsx72, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
8661
+ import { Fragment as Fragment16, jsx as jsx83, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
8533
8662
  var FilterControls = ({
8534
8663
  children,
8535
8664
  hideSearchInput
@@ -8544,23 +8673,23 @@ var FilterControls = ({
8544
8673
  } = useSearchAndFilter();
8545
8674
  const editorRef = useRef16(null);
8546
8675
  const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
8547
- const [idToResetInputVariables, setIdToResetInputVariables] = useState21("data-resource-search-term-input");
8548
- const [localeSearchTerm, setLocaleSearchTerm] = useState21(searchTerm);
8549
- useDebounce5(
8676
+ const [idToResetInputVariables, setIdToResetInputVariables] = useState25("data-resource-search-term-input");
8677
+ const [localeSearchTerm, setLocaleSearchTerm] = useState25(searchTerm);
8678
+ useDebounce9(
8550
8679
  () => {
8551
8680
  setSearchTerm(localeSearchTerm);
8552
8681
  },
8553
8682
  300,
8554
8683
  [localeSearchTerm]
8555
8684
  );
8556
- useEffect21(() => {
8685
+ useEffect22(() => {
8557
8686
  if (searchTerm === "") {
8558
8687
  setLocaleSearchTerm("");
8559
8688
  setIdToResetInputVariables(`data-resource-search-term-input-${v43()}`);
8560
8689
  }
8561
8690
  }, [searchTerm]);
8562
- return /* @__PURE__ */ jsxs44(Fragment15, { children: [
8563
- /* @__PURE__ */ jsx72(
8691
+ return /* @__PURE__ */ jsxs45(Fragment16, { children: [
8692
+ /* @__PURE__ */ jsx83(
8564
8693
  FilterButton2,
8565
8694
  {
8566
8695
  "aria-controls": "search-and-filter-options",
@@ -8573,8 +8702,8 @@ var FilterControls = ({
8573
8702
  dataTestId: "filters-button"
8574
8703
  }
8575
8704
  ),
8576
- hideSearchInput ? null : /* @__PURE__ */ jsxs44("div", { css: BindableKeywordSearchInputStyles, children: [
8577
- /* @__PURE__ */ jsx72(
8705
+ hideSearchInput ? null : /* @__PURE__ */ jsxs45("div", { css: BindableKeywordSearchInputStyles, children: [
8706
+ /* @__PURE__ */ jsx83(
8578
8707
  InputVariables,
8579
8708
  {
8580
8709
  label: "",
@@ -8584,7 +8713,7 @@ var FilterControls = ({
8584
8713
  value: localeSearchTerm,
8585
8714
  onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
8586
8715
  disableVariables: !allowBindingSearchTerm,
8587
- inputWhenNoVariables: /* @__PURE__ */ jsx72(
8716
+ inputWhenNoVariables: /* @__PURE__ */ jsx83(
8588
8717
  InputKeywordSearch2,
8589
8718
  {
8590
8719
  placeholder: "Search...",
@@ -8597,7 +8726,7 @@ var FilterControls = ({
8597
8726
  )
8598
8727
  }
8599
8728
  ),
8600
- hasVariableInSearchTerm ? /* @__PURE__ */ jsx72("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx72(
8729
+ hasVariableInSearchTerm ? /* @__PURE__ */ jsx83("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx83(
8601
8730
  "button",
8602
8731
  {
8603
8732
  css: ClearSearchButtonStyles,
@@ -8611,7 +8740,7 @@ var FilterControls = ({
8611
8740
  },
8612
8741
  type: "button",
8613
8742
  "data-testid": "keyword-search-clear-button",
8614
- children: /* @__PURE__ */ jsx72(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
8743
+ children: /* @__PURE__ */ jsx83(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
8615
8744
  }
8616
8745
  ) }) : null
8617
8746
  ] }),
@@ -8620,21 +8749,21 @@ var FilterControls = ({
8620
8749
  };
8621
8750
 
8622
8751
  // src/components/SearchAndFilter/FilterItem.tsx
8623
- import { Icon as Icon8, InputComboBox as InputComboBox2 } from "@uniformdev/design-system";
8624
- import { useMemo as useMemo18 } from "react";
8752
+ import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
8753
+ import { useMemo as useMemo22 } from "react";
8625
8754
 
8626
8755
  // src/components/SearchAndFilter/FilterMenu.tsx
8627
8756
  import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
8628
- import React13, { useEffect as useEffect22 } from "react";
8629
- import { jsx as jsx73, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
8757
+ import React13, { useEffect as useEffect23 } from "react";
8758
+ import { jsx as jsx84, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8630
8759
  var SearchAndFilterOptionsContainer2 = ({
8631
8760
  buttonRow,
8632
8761
  additionalFiltersContainer,
8633
8762
  children
8634
8763
  }) => {
8635
- return /* @__PURE__ */ jsxs45("div", { css: SearchAndFilterOptionsContainer, children: [
8636
- /* @__PURE__ */ jsx73("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8637
- buttonRow ? /* @__PURE__ */ jsx73(
8764
+ return /* @__PURE__ */ jsxs46("div", { css: SearchAndFilterOptionsContainer, children: [
8765
+ /* @__PURE__ */ jsx84("div", { css: SearchAndFilterOptionsInnerContainer, children }),
8766
+ buttonRow ? /* @__PURE__ */ jsx84(
8638
8767
  HorizontalRhythm8,
8639
8768
  {
8640
8769
  css: SearchAndFilterButtonGroup,
@@ -8644,7 +8773,7 @@ var SearchAndFilterOptionsContainer2 = ({
8644
8773
  children: buttonRow
8645
8774
  }
8646
8775
  ) : null,
8647
- additionalFiltersContainer ? /* @__PURE__ */ jsx73("div", { children: additionalFiltersContainer }) : null
8776
+ additionalFiltersContainer ? /* @__PURE__ */ jsx84("div", { children: additionalFiltersContainer }) : null
8648
8777
  ] });
8649
8778
  };
8650
8779
  var FilterMenu = ({
@@ -8658,21 +8787,21 @@ var FilterMenu = ({
8658
8787
  }) => {
8659
8788
  const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
8660
8789
  const innerMenuRef = React13.useRef(null);
8661
- useEffect22(() => {
8790
+ useEffect23(() => {
8662
8791
  var _a;
8663
8792
  if (filterVisibility) {
8664
8793
  (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
8665
8794
  }
8666
8795
  }, [filterVisibility]);
8667
- return /* @__PURE__ */ jsx73(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs45(
8796
+ return /* @__PURE__ */ jsx84(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs46(
8668
8797
  SearchAndFilterOptionsContainer2,
8669
8798
  {
8670
8799
  buttonRow: menuControls,
8671
8800
  additionalFiltersContainer,
8672
8801
  children: [
8673
- /* @__PURE__ */ jsxs45(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
8674
- /* @__PURE__ */ jsx73("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
8675
- (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx73(
8802
+ /* @__PURE__ */ jsxs46(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
8803
+ /* @__PURE__ */ jsx84("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
8804
+ (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx84(
8676
8805
  "button",
8677
8806
  {
8678
8807
  type: "button",
@@ -8693,7 +8822,7 @@ var FilterMenu = ({
8693
8822
  };
8694
8823
 
8695
8824
  // src/components/SearchAndFilter/FilterItem.tsx
8696
- import { jsx as jsx74, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
8825
+ import { jsx as jsx85, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
8697
8826
  var FilterItem = ({
8698
8827
  index,
8699
8828
  paramOptions,
@@ -8709,7 +8838,7 @@ var FilterItem = ({
8709
8838
  const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
8710
8839
  const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
8711
8840
  const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
8712
- const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo18(() => {
8841
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo22(() => {
8713
8842
  var _a2;
8714
8843
  const currentSelectedFilter = filterOptions.find((item) => {
8715
8844
  var _a3;
@@ -8736,11 +8865,11 @@ var FilterItem = ({
8736
8865
  menuIsOpen: false,
8737
8866
  isClearable: false
8738
8867
  } : {};
8739
- return /* @__PURE__ */ jsxs46("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8740
- /* @__PURE__ */ jsx74("span", { children: index === 0 ? "Where" : "and" }),
8741
- /* @__PURE__ */ jsxs46("div", { css: ConditionalInputRow, children: [
8742
- /* @__PURE__ */ jsx74(
8743
- InputComboBox2,
8868
+ return /* @__PURE__ */ jsxs47("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
8869
+ /* @__PURE__ */ jsx85("span", { children: index === 0 ? "Where" : "and" }),
8870
+ /* @__PURE__ */ jsxs47("div", { css: ConditionalInputRow, children: [
8871
+ /* @__PURE__ */ jsx85(
8872
+ InputComboBox5,
8744
8873
  {
8745
8874
  "aria-label": label,
8746
8875
  options: paramOptions,
@@ -8766,8 +8895,8 @@ var FilterItem = ({
8766
8895
  name: `filter-field-${index}`
8767
8896
  }
8768
8897
  ),
8769
- /* @__PURE__ */ jsx74(
8770
- InputComboBox2,
8898
+ /* @__PURE__ */ jsx85(
8899
+ InputComboBox5,
8771
8900
  {
8772
8901
  "aria-label": operatorLabel,
8773
8902
  options: operatorOptions,
@@ -8790,7 +8919,7 @@ var FilterItem = ({
8790
8919
  name: `filter-operator-${index}`
8791
8920
  }
8792
8921
  ),
8793
- /* @__PURE__ */ jsx74(
8922
+ /* @__PURE__ */ jsx85(
8794
8923
  FilterEditorRenderer,
8795
8924
  {
8796
8925
  "aria-label": metaDataLabel,
@@ -8804,7 +8933,7 @@ var FilterItem = ({
8804
8933
  valueTestId: "filter-value"
8805
8934
  }
8806
8935
  ),
8807
- readOnly || index === 0 ? null : /* @__PURE__ */ jsx74(
8936
+ readOnly || index === 0 ? null : /* @__PURE__ */ jsx85(
8808
8937
  "button",
8809
8938
  {
8810
8939
  type: "button",
@@ -8812,7 +8941,7 @@ var FilterItem = ({
8812
8941
  "aria-label": "delete filter",
8813
8942
  css: IconBtn,
8814
8943
  "data-testid": "delete-filter",
8815
- children: /* @__PURE__ */ jsx74(Icon8, { icon: "trash", iconColor: "red", size: "1rem" })
8944
+ children: /* @__PURE__ */ jsx85(Icon8, { icon: "trash", iconColor: "red", size: "1rem" })
8816
8945
  }
8817
8946
  )
8818
8947
  ] })
@@ -8828,13 +8957,13 @@ var FilterItems = ({
8828
8957
  const next = [...filters];
8829
8958
  next[index] = { ...next[index], [prop]: value };
8830
8959
  if (prop === "operator") {
8831
- if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
8960
+ if (!Array.isArray(value) && ["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
8832
8961
  next[index].value = next[index].value[0];
8833
8962
  }
8834
8963
  if (filters[index].operator === "ndef" || filters[index].operator === "def") {
8835
8964
  next[index].value = "";
8836
8965
  }
8837
- if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
8966
+ if (!Array.isArray(value) && ["between"].includes(value) && Array.isArray(next[index].value) === false) {
8838
8967
  next[index].value = [next[index].value, ""];
8839
8968
  }
8840
8969
  if (value === "def" || value === "true") {
@@ -8854,12 +8983,12 @@ var FilterItems = ({
8854
8983
  }
8855
8984
  setFilters(next);
8856
8985
  };
8857
- return /* @__PURE__ */ jsx74(
8986
+ return /* @__PURE__ */ jsx85(
8858
8987
  FilterMenu,
8859
8988
  {
8860
8989
  id: "search-and-filter-options",
8861
8990
  dataTestId: "search-and-filter-options",
8862
- menuControls: /* @__PURE__ */ jsxs46(
8991
+ menuControls: /* @__PURE__ */ jsxs47(
8863
8992
  "button",
8864
8993
  {
8865
8994
  type: "button",
@@ -8867,7 +8996,7 @@ var FilterItems = ({
8867
8996
  onClick: handleAddFilter,
8868
8997
  "data-testid": "add-filter",
8869
8998
  children: [
8870
- /* @__PURE__ */ jsx74(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
8999
+ /* @__PURE__ */ jsx85(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
8871
9000
  addButtonText
8872
9001
  ]
8873
9002
  }
@@ -8881,7 +9010,7 @@ var FilterItems = ({
8881
9010
  })) == null ? void 0 : _a.options) != null ? _b : [];
8882
9011
  const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
8883
9012
  const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
8884
- return /* @__PURE__ */ jsx74(
9013
+ return /* @__PURE__ */ jsx85(
8885
9014
  FilterItem,
8886
9015
  {
8887
9016
  index: i,
@@ -8904,7 +9033,7 @@ import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
8904
9033
 
8905
9034
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
8906
9035
  import { Button as Button6, Callout as Callout6, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
8907
- import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
9036
+ import { Fragment as Fragment17, jsx as jsx86, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
8908
9037
  var SearchAndFilterResultContainer = ({
8909
9038
  buttonText,
8910
9039
  clearButtonLabel = "clear",
@@ -8934,31 +9063,40 @@ var SearchAndFilterResultContainer = ({
8934
9063
  handleResetFilters();
8935
9064
  }
8936
9065
  };
8937
- return /* @__PURE__ */ jsxs47(Fragment16, { children: [
8938
- /* @__PURE__ */ jsxs47(HorizontalRhythm9, { children: [
8939
- /* @__PURE__ */ jsxs47("span", { children: [
9066
+ return /* @__PURE__ */ jsxs48(Fragment17, { children: [
9067
+ /* @__PURE__ */ jsxs48(HorizontalRhythm9, { children: [
9068
+ /* @__PURE__ */ jsxs48("span", { children: [
8940
9069
  totalResults,
8941
9070
  " results ",
8942
9071
  searchTerm ? `for "${searchTerm}"` : null
8943
9072
  ] }),
8944
- !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx75(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
9073
+ !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx86(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
8945
9074
  ] }),
8946
- totalResults === 0 ? /* @__PURE__ */ jsxs47(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
8947
- calloutText ? /* @__PURE__ */ jsx75(Paragraph, { children: calloutText }) : null,
8948
- hideClearButton ? null : /* @__PURE__ */ jsx75(Button6, { buttonType: "tertiaryOutline", size: "xs", onClick: handleClearSearch, children: buttonText != null ? buttonText : "Clear search" })
9075
+ totalResults === 0 ? /* @__PURE__ */ jsxs48(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
9076
+ calloutText ? /* @__PURE__ */ jsx86(Paragraph, { children: calloutText }) : null,
9077
+ hideClearButton ? null : /* @__PURE__ */ jsx86(
9078
+ Button6,
9079
+ {
9080
+ buttonType: "tertiaryOutline",
9081
+ size: "xs",
9082
+ onClick: handleClearSearch,
9083
+ "data-testid": "clear-search",
9084
+ children: buttonText != null ? buttonText : "Clear search"
9085
+ }
9086
+ )
8949
9087
  ] }) : null
8950
9088
  ] });
8951
9089
  };
8952
9090
 
8953
9091
  // src/components/SearchAndFilter/SearchAndFilter.tsx
8954
- import { jsx as jsx76, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
9092
+ import { jsx as jsx87, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
8955
9093
  var SearchAndFilter = ({
8956
9094
  filters,
8957
9095
  filterOptions,
8958
9096
  filterVisible,
8959
9097
  filterControls,
8960
9098
  viewSwitchControls,
8961
- resultsContainerView = /* @__PURE__ */ jsx76(SearchAndFilterResultContainer, {}),
9099
+ resultsContainerView = /* @__PURE__ */ jsx87(SearchAndFilterResultContainer, {}),
8962
9100
  filterMapper: filterMapper2 = filterMapper,
8963
9101
  additionalFiltersContainer,
8964
9102
  onChange,
@@ -8968,7 +9106,7 @@ var SearchAndFilter = ({
8968
9106
  allowBindingSearchTerm = false,
8969
9107
  resetFilterValues = []
8970
9108
  }) => {
8971
- return /* @__PURE__ */ jsx76(
9109
+ return /* @__PURE__ */ jsx87(
8972
9110
  SearchAndFilterProvider,
8973
9111
  {
8974
9112
  filters,
@@ -8981,18 +9119,18 @@ var SearchAndFilter = ({
8981
9119
  resetFilterValues,
8982
9120
  filterMapper: filterMapper2,
8983
9121
  allowBindingSearchTerm,
8984
- children: /* @__PURE__ */ jsxs48(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
8985
- /* @__PURE__ */ jsxs48("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
8986
- /* @__PURE__ */ jsx76(
9122
+ children: /* @__PURE__ */ jsxs49(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
9123
+ /* @__PURE__ */ jsxs49("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
9124
+ /* @__PURE__ */ jsx87(
8987
9125
  "div",
8988
9126
  {
8989
9127
  css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
8990
- children: !filterControls ? /* @__PURE__ */ jsx76(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
9128
+ children: !filterControls ? /* @__PURE__ */ jsx87(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
8991
9129
  }
8992
9130
  ),
8993
9131
  viewSwitchControls
8994
9132
  ] }),
8995
- /* @__PURE__ */ jsx76(FilterItems, { additionalFiltersContainer }),
9133
+ /* @__PURE__ */ jsx87(FilterItems, { additionalFiltersContainer }),
8996
9134
  resultsContainerView
8997
9135
  ] })
8998
9136
  }
@@ -9001,9 +9139,9 @@ var SearchAndFilter = ({
9001
9139
 
9002
9140
  // src/components/SearchAndFilter/SearchOnlyFilter.tsx
9003
9141
  import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
9004
- import { createContext as createContext7, useState as useState22 } from "react";
9005
- import { useDebounce as useDebounce6 } from "react-use";
9006
- import { jsx as jsx77 } from "@emotion/react/jsx-runtime";
9142
+ import { createContext as createContext7, useState as useState26 } from "react";
9143
+ import { useDebounce as useDebounce10 } from "react-use";
9144
+ import { jsx as jsx88 } from "@emotion/react/jsx-runtime";
9007
9145
  var SearchOnlyContext = createContext7({
9008
9146
  searchTerm: "",
9009
9147
  setSearchTerm: () => {
@@ -9011,8 +9149,8 @@ var SearchOnlyContext = createContext7({
9011
9149
  });
9012
9150
  var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9013
9151
  const { searchTerm, setSearchTerm } = useSearchAndFilter();
9014
- const [localeSearchTerm, setLocaleSearchTerm] = useState22("");
9015
- useDebounce6(
9152
+ const [localeSearchTerm, setLocaleSearchTerm] = useState26("");
9153
+ useDebounce10(
9016
9154
  () => {
9017
9155
  setSearchTerm(localeSearchTerm);
9018
9156
  onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
@@ -9020,14 +9158,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9020
9158
  300,
9021
9159
  [localeSearchTerm]
9022
9160
  );
9023
- return /* @__PURE__ */ jsx77(
9161
+ return /* @__PURE__ */ jsx88(
9024
9162
  SearchOnlyContext.Provider,
9025
9163
  {
9026
9164
  value: {
9027
9165
  searchTerm,
9028
9166
  setSearchTerm: setLocaleSearchTerm
9029
9167
  },
9030
- children: /* @__PURE__ */ jsx77("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx77(
9168
+ children: /* @__PURE__ */ jsx88("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx88(
9031
9169
  InputKeywordSearch3,
9032
9170
  {
9033
9171
  placeholder: "Search...",
@@ -9042,7 +9180,7 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
9042
9180
  };
9043
9181
 
9044
9182
  // src/components/SearchAndFilter/SortItems.tsx
9045
- import { InputComboBox as InputComboBox3, InputSelect as InputSelect8, SegmentedControl, VerticalRhythm as VerticalRhythm8 } from "@uniformdev/design-system";
9183
+ import { InputComboBox as InputComboBox6, InputSelect as InputSelect8, SegmentedControl, VerticalRhythm as VerticalRhythm8 } from "@uniformdev/design-system";
9046
9184
 
9047
9185
  // src/components/SearchAndFilter/styles/SortItems.styles.ts
9048
9186
  import { css as css39 } from "@emotion/react";
@@ -9278,7 +9416,7 @@ var InputVariableWrapper = css39`
9278
9416
  `;
9279
9417
 
9280
9418
  // src/components/SearchAndFilter/SortItems.tsx
9281
- import { jsx as jsx78, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
9419
+ import { jsx as jsx89, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
9282
9420
  var SortItems = ({
9283
9421
  sortByLabel = "Sort by",
9284
9422
  localeLabel = "Show locale",
@@ -9300,11 +9438,11 @@ var SortItems = ({
9300
9438
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
9301
9439
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
9302
9440
  const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
9303
- return /* @__PURE__ */ jsxs49("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9304
- /* @__PURE__ */ jsxs49(VerticalRhythm8, { gap: "xs", children: [
9305
- /* @__PURE__ */ jsx78("span", { css: Title2, children: sortByLabel }),
9306
- /* @__PURE__ */ jsxs49("div", { css: SortFilterInputRow, children: [
9307
- /* @__PURE__ */ jsx78(
9441
+ return /* @__PURE__ */ jsxs50("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
9442
+ /* @__PURE__ */ jsxs50(VerticalRhythm8, { gap: "xs", children: [
9443
+ /* @__PURE__ */ jsx89("span", { css: Title2, children: sortByLabel }),
9444
+ /* @__PURE__ */ jsxs50("div", { css: SortFilterInputRow, children: [
9445
+ /* @__PURE__ */ jsx89(
9308
9446
  InputVariables,
9309
9447
  {
9310
9448
  disableInlineMenu: disableSortBinding,
@@ -9312,8 +9450,8 @@ var SortItems = ({
9312
9450
  value: sortField,
9313
9451
  valueToResetTo: "created_at",
9314
9452
  onChange: (e) => onSortChange(`${e}_${sortDirection}`),
9315
- inputWhenNoVariables: /* @__PURE__ */ jsx78(
9316
- InputComboBox3,
9453
+ inputWhenNoVariables: /* @__PURE__ */ jsx89(
9454
+ InputComboBox6,
9317
9455
  {
9318
9456
  id: "sort-by-field",
9319
9457
  "aria-label": "Sort by",
@@ -9335,7 +9473,7 @@ var SortItems = ({
9335
9473
  )
9336
9474
  }
9337
9475
  ),
9338
- /* @__PURE__ */ jsx78(
9476
+ /* @__PURE__ */ jsx89(
9339
9477
  InputVariables,
9340
9478
  {
9341
9479
  disableInlineMenu: disableSortBinding,
@@ -9343,7 +9481,7 @@ var SortItems = ({
9343
9481
  valueToResetTo: "DESC",
9344
9482
  showMenuPosition: disableSortBinding ? void 0 : "inline-right",
9345
9483
  onChange: (e) => onSortChange(`${sortField}_${e}`),
9346
- inputWhenNoVariables: /* @__PURE__ */ jsx78(
9484
+ inputWhenNoVariables: /* @__PURE__ */ jsx89(
9347
9485
  SegmentedControl,
9348
9486
  {
9349
9487
  noCheckmark: true,
@@ -9375,14 +9513,14 @@ var SortItems = ({
9375
9513
  )
9376
9514
  ] })
9377
9515
  ] }),
9378
- hideLocaleOptions ? null : /* @__PURE__ */ jsx78(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx78(
9516
+ hideLocaleOptions ? null : /* @__PURE__ */ jsx89(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx89(
9379
9517
  InputVariables,
9380
9518
  {
9381
9519
  label: localeLabelValue,
9382
9520
  value: localeValue,
9383
9521
  showMenuPosition: "inline-right",
9384
9522
  onChange: (e) => onLocaleChange(e != null ? e : ""),
9385
- inputWhenNoVariables: /* @__PURE__ */ jsx78(
9523
+ inputWhenNoVariables: /* @__PURE__ */ jsx89(
9386
9524
  InputSelect8,
9387
9525
  {
9388
9526
  name: "localeReturned",
@@ -9413,7 +9551,7 @@ function createLocationValidator(setValue, validate) {
9413
9551
 
9414
9552
  // src/utils/useContentDataResourceLocaleInfo.ts
9415
9553
  import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
9416
- import { useEffect as useEffect23, useRef as useRef17 } from "react";
9554
+ import { useEffect as useEffect24, useRef as useRef17 } from "react";
9417
9555
  function useContentDataResourceLocaleInfo({
9418
9556
  locale,
9419
9557
  setLocale,
@@ -9425,7 +9563,7 @@ function useContentDataResourceLocaleInfo({
9425
9563
  const { flatVariables } = useVariables();
9426
9564
  const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
9427
9565
  const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
9428
- useEffect23(() => {
9566
+ useEffect24(() => {
9429
9567
  if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
9430
9568
  setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
9431
9569
  }
@@ -9440,8 +9578,8 @@ import {
9440
9578
  Callout as Callout7,
9441
9579
  DrawerContent,
9442
9580
  Heading,
9443
- Input as Input7,
9444
- InputComboBox as InputComboBox4,
9581
+ Input as Input11,
9582
+ InputComboBox as InputComboBox7,
9445
9583
  InputKeywordSearch as InputKeywordSearch4,
9446
9584
  InputSelect as InputSelect9,
9447
9585
  InputToggle as InputToggle3,
@@ -9507,8 +9645,8 @@ export {
9507
9645
  Heading,
9508
9646
  INSERT_VARIABLE_COMMAND,
9509
9647
  icons_exports as Icons,
9510
- Input7 as Input,
9511
- InputComboBox4 as InputComboBox,
9648
+ Input11 as Input,
9649
+ InputComboBox7 as InputComboBox,
9512
9650
  InputKeywordSearch4 as InputKeywordSearch,
9513
9651
  InputSelect9 as InputSelect,
9514
9652
  InputToggle3 as InputToggle,
@@ -9600,6 +9738,7 @@ export {
9600
9738
  VariablesList,
9601
9739
  VariablesPlugin,
9602
9740
  VariablesProvider,
9741
+ WORKFLOW_STAGES_OPERATORS,
9603
9742
  badgeIcon,
9604
9743
  bindableFiltersMapper,
9605
9744
  convertConnectedDataToVariable,