@uniformdev/design-system 19.134.3-alpha.28 → 19.136.0

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/esm/index.js CHANGED
@@ -20455,6 +20455,28 @@ var SYSTEM_FIELD_OPERATORS = [
20455
20455
  editorType: "multiChoice"
20456
20456
  }
20457
20457
  ];
20458
+ var PUBLISH_STATUS_FIELD_OPERATORS = [
20459
+ {
20460
+ label: "is...",
20461
+ value: "eq",
20462
+ editorType: "statusSingleChoice"
20463
+ },
20464
+ {
20465
+ label: "is any of...",
20466
+ value: "in",
20467
+ editorType: "statusMultiChoice"
20468
+ },
20469
+ {
20470
+ label: "is not...",
20471
+ value: "neq",
20472
+ editorType: "statusSingleChoice"
20473
+ },
20474
+ {
20475
+ label: "is none of...",
20476
+ value: "nin",
20477
+ editorType: "statusMultiChoice"
20478
+ }
20479
+ ];
20458
20480
 
20459
20481
  // src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
20460
20482
  import { css as css92 } from "@emotion/react";
@@ -20493,7 +20515,7 @@ var ConditionalFilterRow = css92`
20493
20515
  }
20494
20516
  }
20495
20517
 
20496
- &:first-of-type {
20518
+ &:nth-of-type(2) {
20497
20519
  margin-left: 0;
20498
20520
  grid-template-columns: 50px 1fr;
20499
20521
  }
@@ -20647,15 +20669,6 @@ var IconBtn = css92`
20647
20669
  border: none;
20648
20670
  padding: var(--spacing-sm);
20649
20671
  `;
20650
- var CloseBtn = css92`
20651
- color: var(--gray-500);
20652
- background: transparent;
20653
- border: none;
20654
- padding: 0;
20655
- position: absolute;
20656
- top: var(--spacing-base);
20657
- right: var(--spacing-base);
20658
- `;
20659
20672
  var SearchAndFilterOptionsContainer = css92`
20660
20673
  background: var(--gray-50);
20661
20674
  border: 1px solid var(--gray-300);
@@ -20664,7 +20677,7 @@ var SearchAndFilterOptionsContainer = css92`
20664
20677
  display: flex;
20665
20678
  flex-direction: column;
20666
20679
  gap: var(--spacing-sm);
20667
- padding: var(--spacing-md) var(--spacing-md) var(--spacing-base);
20680
+ padding: var(--spacing-md) 0 var(--spacing-base);
20668
20681
  will-change: height;
20669
20682
  position: relative;
20670
20683
  z-index: 1;
@@ -20673,14 +20686,27 @@ var SearchAndFilterOptionsInnerContainer = css92`
20673
20686
  display: flex;
20674
20687
  flex-direction: column;
20675
20688
  gap: var(--spacing-sm);
20689
+ padding-inline: var(--spacing-md);
20676
20690
  `;
20677
20691
  var SearchAndFilterButtonGroup = css92`
20678
- margin-top: var(--spacing-base);
20692
+ margin-top: var(--spacing-xs);
20693
+ margin-left: calc(56px + var(--spacing-md));
20694
+ `;
20695
+ var SortFilterWrapper = (hiddenLocaleInput) => css92`
20696
+ border-top: 1px solid var(--gray-300);
20697
+ align-items: center;
20698
+ display: grid;
20699
+ grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr 200px"};
20700
+ gap: var(--spacing-xl);
20701
+ padding: var(--spacing-base) var(--spacing-md) 0;
20702
+ position: relative;
20703
+ z-index: 0;
20679
20704
  `;
20680
20705
  var SortFilterInputRow = css92`
20681
20706
  align-items: center;
20682
- display: flex;
20683
- gap: var(--spacing-sm);
20707
+ display: grid;
20708
+ grid-template-columns: 1fr auto;
20709
+ gap: var(--spacing-base);
20684
20710
  `;
20685
20711
 
20686
20712
  // src/components/SearchAndFilter/FilterButton.tsx
@@ -20714,8 +20740,8 @@ var FilterButton2 = ({
20714
20740
  };
20715
20741
 
20716
20742
  // src/components/SearchAndFilter/FilterControls.tsx
20717
- import { useEffect as useEffect19, useState as useState18 } from "react";
20718
- import { useDebounce as useDebounce3, useEffectOnce } from "react-use";
20743
+ import { useEffect as useEffect18, useState as useState17 } from "react";
20744
+ import { useDebounce as useDebounce2 } from "react-use";
20719
20745
 
20720
20746
  // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
20721
20747
  import {
@@ -20723,14 +20749,204 @@ import {
20723
20749
  useCallback as useCallback10,
20724
20750
  useContext as useContext7,
20725
20751
  useDeferredValue as useDeferredValue2,
20726
- useEffect as useEffect18,
20752
+ useEffect as useEffect17,
20727
20753
  useMemo as useMemo6,
20728
- useState as useState17
20754
+ useState as useState16
20729
20755
  } from "react";
20756
+ import { jsx as jsx119 } from "@emotion/react/jsx-runtime";
20757
+ var SearchAndFilterContext = createContext6({
20758
+ searchTerm: "",
20759
+ setSearchTerm: () => {
20760
+ },
20761
+ filterVisibility: void 0,
20762
+ setFilterVisibility: () => {
20763
+ },
20764
+ filters: [],
20765
+ setFilters: () => {
20766
+ },
20767
+ handleAddFilter: () => {
20768
+ },
20769
+ handleResetFilters: () => {
20770
+ },
20771
+ handleDeleteFilter: () => {
20772
+ },
20773
+ handleLocaleChange: () => {
20774
+ },
20775
+ setSortBy: () => {
20776
+ },
20777
+ sortByValue: "",
20778
+ filterOptions: [],
20779
+ sortOptions: [],
20780
+ validFilterQuery: [],
20781
+ totalResults: 0,
20782
+ localeOptions: [],
20783
+ localeValue: ""
20784
+ });
20785
+ var SearchAndFilterProvider = ({
20786
+ filters,
20787
+ filterOptions,
20788
+ sortOptions,
20789
+ defaultSortByValue,
20790
+ defaultLocale = "",
20791
+ localeOptions,
20792
+ onLocaleChange,
20793
+ filterVisible = false,
20794
+ onSearchChange,
20795
+ onChange,
20796
+ onSortChange,
20797
+ resetFilterValues = [{ field: "", operator: "", value: "" }],
20798
+ totalResults,
20799
+ children
20800
+ }) => {
20801
+ const [searchTerm, setSearchTerm] = useState16("");
20802
+ const deferredSearchTerm = useDeferredValue2(searchTerm);
20803
+ const [filterVisibility, setFilterVisibility] = useState16(filterVisible);
20804
+ const [sortByValue, setSortByValue] = useState16(defaultSortByValue);
20805
+ const [localeValue, setLocale] = useState16(defaultLocale);
20806
+ const handleSearchTerm = useCallback10(
20807
+ (term) => {
20808
+ setSearchTerm(term);
20809
+ onSearchChange == null ? void 0 : onSearchChange(term);
20810
+ },
20811
+ [setSearchTerm, onSearchChange]
20812
+ );
20813
+ const handleLocaleChange = useCallback10(
20814
+ (locale) => {
20815
+ setLocale(locale);
20816
+ onLocaleChange == null ? void 0 : onLocaleChange(locale);
20817
+ },
20818
+ [onLocaleChange]
20819
+ );
20820
+ const handleOnSortChange = useCallback10(
20821
+ (sort) => {
20822
+ setSortByValue(sort);
20823
+ onSortChange(sort);
20824
+ },
20825
+ [onSortChange]
20826
+ );
20827
+ const handleToggleFilterVisibilty = useCallback10(
20828
+ (visible) => setFilterVisibility(visible),
20829
+ [setFilterVisibility]
20830
+ );
20831
+ const handleAddFilter = useCallback10(() => {
20832
+ onChange([...filters, { field: "", operator: "", value: "" }]);
20833
+ }, [filters, onChange]);
20834
+ const handleResetFilters = useCallback10(() => {
20835
+ onChange(resetFilterValues);
20836
+ }, [onChange, resetFilterValues]);
20837
+ const handleDeleteFilter = useCallback10(
20838
+ (index) => {
20839
+ const remainingFilters = filters.filter((_, i) => i !== index);
20840
+ onChange(remainingFilters);
20841
+ },
20842
+ [filters, onChange]
20843
+ );
20844
+ const validFilterQuery = useMemo6(() => {
20845
+ const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
20846
+ if (hasValidFilters) {
20847
+ return filters;
20848
+ }
20849
+ }, [filters]);
20850
+ useEffect17(() => {
20851
+ if (filterVisibility) {
20852
+ const handleEscKeyFilterClose = (e) => {
20853
+ if (e.key === "Escape") {
20854
+ setFilterVisibility(false);
20855
+ }
20856
+ };
20857
+ document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
20858
+ return () => {
20859
+ document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
20860
+ };
20861
+ }
20862
+ }, [filterVisibility]);
20863
+ return /* @__PURE__ */ jsx119(
20864
+ SearchAndFilterContext.Provider,
20865
+ {
20866
+ value: {
20867
+ searchTerm: deferredSearchTerm,
20868
+ setSearchTerm: (e) => handleSearchTerm(e),
20869
+ setSortBy: (e) => handleOnSortChange(e),
20870
+ sortByValue,
20871
+ filterVisibility,
20872
+ setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
20873
+ filters,
20874
+ setFilters: (e) => onChange(e),
20875
+ handleAddFilter,
20876
+ handleResetFilters,
20877
+ handleDeleteFilter,
20878
+ filterOptions,
20879
+ sortOptions,
20880
+ validFilterQuery,
20881
+ totalResults,
20882
+ localeOptions,
20883
+ localeValue,
20884
+ handleLocaleChange
20885
+ },
20886
+ children: /* @__PURE__ */ jsx119(VerticalRhythm, { children })
20887
+ }
20888
+ );
20889
+ };
20890
+ var useSearchAndFilter = () => {
20891
+ const value = useContext7(SearchAndFilterContext);
20892
+ return { ...value };
20893
+ };
20894
+
20895
+ // src/components/SearchAndFilter/FilterControls.tsx
20896
+ import { Fragment as Fragment19, jsx as jsx120, jsxs as jsxs81 } from "@emotion/react/jsx-runtime";
20897
+ var FilterControls = ({
20898
+ children,
20899
+ hideSearchInput
20900
+ }) => {
20901
+ const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
20902
+ const [localeSearchTerm, setLocaleSearchTerm] = useState17("");
20903
+ useDebounce2(
20904
+ () => {
20905
+ setSearchTerm(localeSearchTerm);
20906
+ },
20907
+ 300,
20908
+ [localeSearchTerm, searchTerm]
20909
+ );
20910
+ useEffect18(() => {
20911
+ if (searchTerm === "") {
20912
+ setLocaleSearchTerm("");
20913
+ }
20914
+ }, [searchTerm]);
20915
+ return /* @__PURE__ */ jsxs81(Fragment19, { children: [
20916
+ /* @__PURE__ */ jsx120(
20917
+ FilterButton2,
20918
+ {
20919
+ "aria-controls": "search-and-filter-options",
20920
+ "aria-label": "filter options",
20921
+ "aria-haspopup": "true",
20922
+ text: "Filter/Sort",
20923
+ "aria-expanded": filterVisibility === true,
20924
+ filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
20925
+ onClick: () => setFilterVisibility(!filterVisibility),
20926
+ dataTestId: "filters-button"
20927
+ }
20928
+ ),
20929
+ hideSearchInput ? null : /* @__PURE__ */ jsx120(
20930
+ InputKeywordSearch,
20931
+ {
20932
+ placeholder: "Search...",
20933
+ onSearchTextChanged: (e) => setLocaleSearchTerm(e),
20934
+ value: localeSearchTerm,
20935
+ compact: true,
20936
+ rounded: true,
20937
+ css: SearchInput
20938
+ }
20939
+ ),
20940
+ children
20941
+ ] });
20942
+ };
20943
+
20944
+ // src/components/SearchAndFilter/FilterItem.tsx
20945
+ import { useMemo as useMemo8 } from "react";
20730
20946
 
20731
20947
  // src/components/SearchAndFilter/FilterEditor.tsx
20732
- import { useEffect as useEffect17, useState as useState16 } from "react";
20733
- import { useDebounce as useDebounce2 } from "react-use";
20948
+ import { useEffect as useEffect19, useState as useState18 } from "react";
20949
+ import { useDebounce as useDebounce3 } from "react-use";
20734
20950
 
20735
20951
  // src/components/Validation/StatusBullet.styles.ts
20736
20952
  import { css as css93 } from "@emotion/react";
@@ -20812,7 +21028,7 @@ var StatusDeleted = css93`
20812
21028
  `;
20813
21029
 
20814
21030
  // src/components/Validation/StatusBullet.tsx
20815
- import { jsx as jsx119 } from "@emotion/react/jsx-runtime";
21031
+ import { jsx as jsx121 } from "@emotion/react/jsx-runtime";
20816
21032
  var StatusBullet = ({
20817
21033
  status,
20818
21034
  hideText = false,
@@ -20832,7 +21048,7 @@ var StatusBullet = ({
20832
21048
  Deleted: StatusDeleted
20833
21049
  };
20834
21050
  const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
20835
- return /* @__PURE__ */ jsx119(
21051
+ return /* @__PURE__ */ jsx121(
20836
21052
  "span",
20837
21053
  {
20838
21054
  role: "status",
@@ -20845,7 +21061,7 @@ var StatusBullet = ({
20845
21061
  };
20846
21062
 
20847
21063
  // src/components/SearchAndFilter/FilterEditor.tsx
20848
- import { Fragment as Fragment19, jsx as jsx120, jsxs as jsxs81 } from "@emotion/react/jsx-runtime";
21064
+ import { Fragment as Fragment20, jsx as jsx122, jsxs as jsxs82 } from "@emotion/react/jsx-runtime";
20849
21065
  var readOnlyAttributes = {
20850
21066
  isSearchable: false,
20851
21067
  menuIsOpen: false,
@@ -20854,13 +21070,13 @@ var readOnlyAttributes = {
20854
21070
  var FilterMultiChoiceEditor = ({
20855
21071
  value,
20856
21072
  options,
20857
- disabled: disabled2,
21073
+ isDisabled,
20858
21074
  readOnly,
20859
21075
  valueTestId,
20860
21076
  ...props
20861
21077
  }) => {
20862
21078
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
20863
- return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21079
+ return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20864
21080
  InputComboBox,
20865
21081
  {
20866
21082
  ...props,
@@ -20868,12 +21084,12 @@ var FilterMultiChoiceEditor = ({
20868
21084
  options,
20869
21085
  isMulti: true,
20870
21086
  isClearable: true,
20871
- isDisabled: disabled2,
21087
+ isDisabled,
20872
21088
  onChange: (e) => {
20873
21089
  var _a;
20874
- return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
21090
+ return props.onChange((_a = e.map((item) => item.value)) != null ? _a : []);
20875
21091
  },
20876
- value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
21092
+ value,
20877
21093
  "aria-readonly": readOnly,
20878
21094
  styles: {
20879
21095
  menu(base) {
@@ -20890,13 +21106,13 @@ var FilterMultiChoiceEditor = ({
20890
21106
  var FilterSingleChoiceEditor = ({
20891
21107
  options,
20892
21108
  value,
20893
- disabled: disabled2,
21109
+ isDisabled,
20894
21110
  readOnly,
20895
21111
  onChange,
20896
21112
  valueTestId
20897
21113
  }) => {
20898
21114
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
20899
- return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21115
+ return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20900
21116
  InputComboBox,
20901
21117
  {
20902
21118
  placeholder: "Type to search...",
@@ -20906,8 +21122,8 @@ var FilterSingleChoiceEditor = ({
20906
21122
  var _a;
20907
21123
  return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
20908
21124
  },
20909
- isDisabled: disabled2,
20910
- value: options == null ? void 0 : options.find((option) => option.value === value),
21125
+ isDisabled,
21126
+ value,
20911
21127
  "aria-readonly": readOnly,
20912
21128
  styles: {
20913
21129
  menu(base) {
@@ -20922,18 +21138,18 @@ var FilterSingleChoiceEditor = ({
20922
21138
  ) });
20923
21139
  };
20924
21140
  var CustomOptions = ({ label, value }) => {
20925
- return /* @__PURE__ */ jsx120(StatusBullet, { status: label, message: value });
21141
+ return /* @__PURE__ */ jsx122(StatusBullet, { status: label, message: value });
20926
21142
  };
20927
21143
  var StatusMultiEditor = ({
20928
21144
  options,
20929
21145
  value,
20930
- disabled: disabled2,
21146
+ isDisabled,
20931
21147
  readOnly,
20932
21148
  onChange,
20933
21149
  valueTestId
20934
21150
  }) => {
20935
21151
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
20936
- return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21152
+ return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20937
21153
  InputComboBox,
20938
21154
  {
20939
21155
  options,
@@ -20943,8 +21159,9 @@ var StatusMultiEditor = ({
20943
21159
  return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
20944
21160
  },
20945
21161
  formatOptionLabel: CustomOptions,
20946
- value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
20947
- isDisabled: disabled2,
21162
+ value,
21163
+ isDisabled,
21164
+ "aria-readonly": readOnly,
20948
21165
  styles: {
20949
21166
  menu(base) {
20950
21167
  return {
@@ -20960,13 +21177,13 @@ var StatusMultiEditor = ({
20960
21177
  var StatusSingleEditor = ({
20961
21178
  options,
20962
21179
  value,
20963
- disabled: disabled2,
21180
+ isDisabled,
20964
21181
  readOnly,
20965
21182
  onChange,
20966
21183
  valueTestId
20967
21184
  }) => {
20968
21185
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
20969
- return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21186
+ return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20970
21187
  InputComboBox,
20971
21188
  {
20972
21189
  options,
@@ -20975,8 +21192,9 @@ var StatusSingleEditor = ({
20975
21192
  return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
20976
21193
  },
20977
21194
  formatOptionLabel: CustomOptions,
20978
- value: options == null ? void 0 : options.find((option) => option.value === value),
20979
- isDisabled: disabled2,
21195
+ value,
21196
+ isDisabled,
21197
+ "aria-readonly": readOnly,
20980
21198
  styles: {
20981
21199
  menu(base) {
20982
21200
  return {
@@ -20989,15 +21207,9 @@ var StatusSingleEditor = ({
20989
21207
  }
20990
21208
  ) });
20991
21209
  };
20992
- var TextEditor = ({
20993
- onChange,
20994
- ariaLabel,
20995
- value,
20996
- readOnly,
20997
- valueTestId
20998
- }) => {
20999
- useDebounce2(() => onChange, 500, [value]);
21000
- return /* @__PURE__ */ jsx120(
21210
+ var TextEditor = ({ onChange, ariaLabel, value, readOnly, valueTestId }) => {
21211
+ useDebounce3(() => onChange, 500, [value]);
21212
+ return /* @__PURE__ */ jsx122(
21001
21213
  Input,
21002
21214
  {
21003
21215
  showLabel: false,
@@ -21018,10 +21230,10 @@ var NumberRangeEditor = ({
21018
21230
  readOnly,
21019
21231
  valueTestId
21020
21232
  }) => {
21021
- const [minValue, setMinValue] = useState16("");
21022
- const [maxValue, setMaxValue] = useState16("");
21023
- const [error, setError] = useState16("");
21024
- useEffect17(() => {
21233
+ const [minValue, setMinValue] = useState18("");
21234
+ const [maxValue, setMaxValue] = useState18("");
21235
+ const [error, setError] = useState18("");
21236
+ useEffect19(() => {
21025
21237
  if (!maxValue && !minValue) {
21026
21238
  return;
21027
21239
  }
@@ -21040,9 +21252,9 @@ var NumberRangeEditor = ({
21040
21252
  setError("");
21041
21253
  onChange([minValue, maxValue]);
21042
21254
  }, [maxValue, minValue, setError]);
21043
- return /* @__PURE__ */ jsxs81(Fragment19, { children: [
21044
- /* @__PURE__ */ jsxs81("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21045
- /* @__PURE__ */ jsx120(
21255
+ return /* @__PURE__ */ jsxs82(Fragment20, { children: [
21256
+ /* @__PURE__ */ jsxs82("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21257
+ /* @__PURE__ */ jsx122(
21046
21258
  Input,
21047
21259
  {
21048
21260
  label: `${ariaLabel}-min`,
@@ -21057,7 +21269,7 @@ var NumberRangeEditor = ({
21057
21269
  readOnly
21058
21270
  }
21059
21271
  ),
21060
- /* @__PURE__ */ jsx120(
21272
+ /* @__PURE__ */ jsx122(
21061
21273
  Input,
21062
21274
  {
21063
21275
  type: "number",
@@ -21073,7 +21285,7 @@ var NumberRangeEditor = ({
21073
21285
  }
21074
21286
  )
21075
21287
  ] }),
21076
- /* @__PURE__ */ jsx120(ErrorContainer, { errorMessage: error })
21288
+ /* @__PURE__ */ jsx122(ErrorContainer, { errorMessage: error })
21077
21289
  ] });
21078
21290
  };
21079
21291
  var NumberEditor = ({
@@ -21084,7 +21296,7 @@ var NumberEditor = ({
21084
21296
  readOnly,
21085
21297
  valueTestId
21086
21298
  }) => {
21087
- return /* @__PURE__ */ jsx120(
21299
+ return /* @__PURE__ */ jsx122(
21088
21300
  Input,
21089
21301
  {
21090
21302
  label: ariaLabel,
@@ -21107,7 +21319,7 @@ var DateEditor = ({
21107
21319
  readOnly,
21108
21320
  valueTestId
21109
21321
  }) => {
21110
- return /* @__PURE__ */ jsx120(
21322
+ return /* @__PURE__ */ jsx122(
21111
21323
  Input,
21112
21324
  {
21113
21325
  type: "date",
@@ -21129,10 +21341,10 @@ var DateRangeEditor = ({
21129
21341
  readOnly,
21130
21342
  valueTestId
21131
21343
  }) => {
21132
- const [minDateValue, setMinDateValue] = useState16(value ? value[0] : "");
21133
- const [maxDateValue, setMaxDateValue] = useState16(value ? value[1] : "");
21134
- const [error, setError] = useState16("");
21135
- useEffect17(() => {
21344
+ const [minDateValue, setMinDateValue] = useState18(value ? value[0] : "");
21345
+ const [maxDateValue, setMaxDateValue] = useState18(value ? value[1] : "");
21346
+ const [error, setError] = useState18("");
21347
+ useEffect19(() => {
21136
21348
  if (!minDateValue || !maxDateValue) {
21137
21349
  return;
21138
21350
  }
@@ -21163,9 +21375,9 @@ var DateRangeEditor = ({
21163
21375
  setError("");
21164
21376
  onChange([minDateValue, maxDateValue]);
21165
21377
  }, [minDateValue, maxDateValue, setError]);
21166
- return /* @__PURE__ */ jsxs81(Fragment19, { children: [
21167
- /* @__PURE__ */ jsxs81("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21168
- /* @__PURE__ */ jsx120(
21378
+ return /* @__PURE__ */ jsxs82(Fragment20, { children: [
21379
+ /* @__PURE__ */ jsxs82("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21380
+ /* @__PURE__ */ jsx122(
21169
21381
  Input,
21170
21382
  {
21171
21383
  label: `${ariaLabel}-min-date`,
@@ -21178,7 +21390,7 @@ var DateRangeEditor = ({
21178
21390
  readOnly
21179
21391
  }
21180
21392
  ),
21181
- /* @__PURE__ */ jsx120(
21393
+ /* @__PURE__ */ jsx122(
21182
21394
  Input,
21183
21395
  {
21184
21396
  label: `${ariaLabel}-max-date`,
@@ -21192,19 +21404,18 @@ var DateRangeEditor = ({
21192
21404
  }
21193
21405
  )
21194
21406
  ] }),
21195
- /* @__PURE__ */ jsx120(ErrorContainer, { errorMessage: error })
21407
+ /* @__PURE__ */ jsx122(ErrorContainer, { errorMessage: error })
21196
21408
  ] });
21197
21409
  };
21198
21410
  var FilterEditorRenderer = ({ editorType, ...props }) => {
21199
- const { filterMapper: contextFilterMapper } = useSearchAndFilter();
21200
- const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
21411
+ const Editor = filterMapper[editorType];
21201
21412
  if (!Editor) {
21202
21413
  return null;
21203
21414
  }
21204
21415
  if (editorType === "empty") {
21205
21416
  return null;
21206
21417
  }
21207
- return /* @__PURE__ */ jsx120(Editor, { ...props });
21418
+ return /* @__PURE__ */ jsx122(Editor, { ...props, disabled: props.isDisabled });
21208
21419
  };
21209
21420
  var filterMapper = {
21210
21421
  multiChoice: FilterMultiChoiceEditor,
@@ -21219,14 +21430,14 @@ var filterMapper = {
21219
21430
  empty: null
21220
21431
  };
21221
21432
  var ErrorContainer = ({ errorMessage }) => {
21222
- return /* @__PURE__ */ jsx120(
21433
+ return /* @__PURE__ */ jsx122(
21223
21434
  "div",
21224
21435
  {
21225
21436
  css: {
21226
21437
  gridColumn: "span 6",
21227
21438
  order: 6
21228
21439
  },
21229
- children: /* @__PURE__ */ jsx120(FieldMessage, { errorMessage })
21440
+ children: /* @__PURE__ */ jsx122(FieldMessage, { errorMessage })
21230
21441
  }
21231
21442
  );
21232
21443
  };
@@ -21236,233 +21447,12 @@ var twoColumnGrid = {
21236
21447
  gap: "var(--spacing-sm);"
21237
21448
  };
21238
21449
 
21239
- // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
21240
- import { jsx as jsx121 } from "@emotion/react/jsx-runtime";
21241
- var SearchAndFilterContext = createContext6({
21242
- searchTerm: "",
21243
- setSearchTerm: () => {
21244
- },
21245
- filterVisibility: void 0,
21246
- setFilterVisibility: () => {
21247
- },
21248
- filters: [],
21249
- setFilters: () => {
21250
- },
21251
- handleAddFilter: () => {
21252
- },
21253
- handleResetFilters: () => {
21254
- },
21255
- handleDeleteFilter: () => {
21256
- },
21257
- setSortBy: () => {
21258
- },
21259
- sortByValue: "",
21260
- filterOptions: [],
21261
- sortOptions: [],
21262
- validFilterQuery: [],
21263
- filterMapper: {},
21264
- totalResults: 0
21265
- });
21266
- var SearchAndFilterProvider = ({
21267
- filters,
21268
- filterOptions,
21269
- sortOptions,
21270
- defaultSortByValue,
21271
- filterMode: filterMode3 = void 0,
21272
- onSearchChange,
21273
- onChange,
21274
- onSortChange,
21275
- resetFilterValues = [],
21276
- totalResults,
21277
- filterMapper: filterMapper2 = filterMapper,
21278
- children
21279
- }) => {
21280
- const [searchTerm, setSearchTerm] = useState17("");
21281
- const deferredSearchTerm = useDeferredValue2(searchTerm);
21282
- const [filterVisibility, setFilterVisibility] = useState17(filterMode3);
21283
- const [sortByValue, setSortByValue] = useState17(defaultSortByValue);
21284
- const handleSearchTerm = useCallback10(
21285
- (term) => {
21286
- setSearchTerm(term);
21287
- onSearchChange == null ? void 0 : onSearchChange(term);
21288
- },
21289
- [setSearchTerm, onSearchChange]
21290
- );
21291
- const handleOnSortChange = useCallback10(
21292
- (sort) => {
21293
- setSortByValue(sort);
21294
- onSortChange(sort);
21295
- },
21296
- [onSortChange]
21297
- );
21298
- const handleToggleFilterVisibilty = useCallback10(
21299
- (mode) => setFilterVisibility(mode),
21300
- [setFilterVisibility]
21301
- );
21302
- const handleAddFilter = useCallback10(() => {
21303
- onChange([...filters, { field: "", operator: "", value: "" }]);
21304
- }, [filters, onChange]);
21305
- const handleResetFilters = useCallback10(() => {
21306
- onChange(resetFilterValues);
21307
- }, [onChange, resetFilterValues]);
21308
- const handleDeleteFilter = useCallback10(
21309
- (index) => {
21310
- const remainingFilters = filters.filter((_, i) => i !== index);
21311
- onChange(remainingFilters);
21312
- },
21313
- [filters, onChange]
21314
- );
21315
- const validFilterQuery = useMemo6(() => {
21316
- const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
21317
- if (hasValidFilters) {
21318
- return filters;
21319
- }
21320
- }, [filters]);
21321
- useEffect18(() => {
21322
- if (filterVisibility) {
21323
- const handleEscKeyFilterClose = (e) => {
21324
- if (e.key === "Escape") {
21325
- setFilterVisibility(void 0);
21326
- }
21327
- };
21328
- document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
21329
- return () => {
21330
- document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
21331
- };
21332
- }
21333
- }, [filterVisibility]);
21334
- return /* @__PURE__ */ jsx121(
21335
- SearchAndFilterContext.Provider,
21336
- {
21337
- value: {
21338
- searchTerm: deferredSearchTerm,
21339
- setSearchTerm: (e) => handleSearchTerm(e),
21340
- setSortBy: (e) => handleOnSortChange(e),
21341
- sortByValue,
21342
- filterVisibility,
21343
- setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
21344
- filters,
21345
- setFilters: (e) => onChange(e),
21346
- handleAddFilter,
21347
- handleResetFilters,
21348
- handleDeleteFilter,
21349
- filterOptions,
21350
- sortOptions,
21351
- validFilterQuery,
21352
- totalResults,
21353
- filterMapper: filterMapper2
21354
- },
21355
- children: /* @__PURE__ */ jsx121(VerticalRhythm, { children })
21356
- }
21357
- );
21358
- };
21359
- var useSearchAndFilter = () => {
21360
- const value = useContext7(SearchAndFilterContext);
21361
- return { ...value };
21362
- };
21363
-
21364
- // src/components/SearchAndFilter/FilterControls.tsx
21365
- import { Fragment as Fragment20, jsx as jsx122, jsxs as jsxs82 } from "@emotion/react/jsx-runtime";
21366
- var FilterControls = ({
21367
- children,
21368
- defaultSortByValue,
21369
- hideSearchInput
21370
- }) => {
21371
- var _a, _b, _c;
21372
- const {
21373
- setFilterVisibility,
21374
- filterVisibility,
21375
- setSearchTerm,
21376
- validFilterQuery,
21377
- searchTerm,
21378
- sortByValue,
21379
- filterOptions
21380
- } = useSearchAndFilter();
21381
- const [initialSortValue, setInitialSortValue] = useState18(sortByValue);
21382
- const [localeSearchTerm, setLocaleSearchTerm] = useState18("");
21383
- const [userHasChangedSortByValue, setUserHasChangedSortByValue] = useState18(false);
21384
- useDebounce3(
21385
- () => {
21386
- setSearchTerm(localeSearchTerm);
21387
- },
21388
- 300,
21389
- [localeSearchTerm, searchTerm]
21390
- );
21391
- useEffect19(() => {
21392
- if (searchTerm === "") {
21393
- setLocaleSearchTerm("");
21394
- }
21395
- }, [searchTerm]);
21396
- const handleFilterToggle = (mode) => {
21397
- if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
21398
- return setFilterVisibility(void 0);
21399
- }
21400
- return setFilterVisibility(mode);
21401
- };
21402
- const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
21403
- const sortDirection = sortValue == null ? void 0 : sortValue.pop();
21404
- const sortField = sortValue == null ? void 0 : sortValue.join("_");
21405
- const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
21406
- const sortByValueLabel = (_c = (_b = (_a = filterOptions == null ? void 0 : filterOptions.find((op) => op.value === sortOn)) == null ? void 0 : _a.options) == null ? void 0 : _b.find((f) => f.value === sortField)) == null ? void 0 : _c.label;
21407
- const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
21408
- useEffectOnce(() => {
21409
- setInitialSortValue(sortByValue);
21410
- });
21411
- useEffect19(() => {
21412
- if (initialSortValue !== sortByValue) {
21413
- setUserHasChangedSortByValue(true);
21414
- }
21415
- }, [initialSortValue, sortByValue]);
21416
- return /* @__PURE__ */ jsxs82(Fragment20, { children: [
21417
- /* @__PURE__ */ jsx122(
21418
- FilterButton2,
21419
- {
21420
- "aria-controls": "search-and-filter-options",
21421
- "aria-label": "filter options",
21422
- "aria-haspopup": "true",
21423
- "aria-expanded": filterVisibility === "filters",
21424
- filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
21425
- onClick: () => handleFilterToggle("filters"),
21426
- dataTestId: "filters-button"
21427
- }
21428
- ),
21429
- /* @__PURE__ */ jsx122(
21430
- FilterButton2,
21431
- {
21432
- "aria-controls": "search-and-filter-sortBy",
21433
- "aria-label": "sort by options",
21434
- "aria-haspopup": "true",
21435
- text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
21436
- icon: sortByIcon,
21437
- "aria-expanded": filterVisibility === "sort",
21438
- hasSelectedValue: sortByValue !== "",
21439
- onClick: () => handleFilterToggle("sort"),
21440
- dataTestId: "sort-by-button"
21441
- }
21442
- ),
21443
- hideSearchInput ? null : /* @__PURE__ */ jsx122(
21444
- InputKeywordSearch,
21445
- {
21446
- placeholder: "Search...",
21447
- onSearchTextChanged: (e) => setLocaleSearchTerm(e),
21448
- value: localeSearchTerm,
21449
- compact: true,
21450
- rounded: true,
21451
- css: SearchInput
21452
- }
21453
- ),
21454
- children
21455
- ] });
21456
- };
21457
-
21458
- // src/components/SearchAndFilter/FilterItem.tsx
21459
- import { useMemo as useMemo7 } from "react";
21460
-
21461
21450
  // src/components/SearchAndFilter/FilterMenu.tsx
21462
21451
  import React24, { useEffect as useEffect20 } from "react";
21463
21452
  import { jsx as jsx123, jsxs as jsxs83 } from "@emotion/react/jsx-runtime";
21464
21453
  var SearchAndFilterOptionsContainer2 = ({
21465
21454
  buttonRow,
21455
+ sortControls,
21466
21456
  children
21467
21457
  }) => {
21468
21458
  return /* @__PURE__ */ jsxs83("div", { css: SearchAndFilterOptionsContainer, children: [
@@ -21476,261 +21466,52 @@ var SearchAndFilterOptionsContainer2 = ({
21476
21466
  justify: "space-between",
21477
21467
  children: buttonRow
21478
21468
  }
21479
- ) : null
21480
- ] });
21481
- };
21482
- var FilterMenu = ({
21483
- id,
21484
- filterTitle = "Show results",
21485
- menuControls,
21486
- children,
21487
- dataTestId
21488
- }) => {
21489
- const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
21490
- const innerMenuRef = React24.useRef(null);
21491
- useEffect20(() => {
21492
- var _a;
21493
- if (filterVisibility) {
21494
- (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
21495
- }
21496
- }, [filterVisibility]);
21497
- return /* @__PURE__ */ jsx123(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs83(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
21498
- /* @__PURE__ */ jsx123("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
21499
- /* @__PURE__ */ jsx123(
21500
- "button",
21501
- {
21502
- type: "button",
21503
- "aria-label": "close filters",
21504
- css: [CloseBtn],
21505
- onClick: () => setFilterVisibility(void 0),
21506
- "data-testid": "close-filters",
21507
- children: /* @__PURE__ */ jsx123(Icon, { icon: "close", iconColor: "currentColor", size: "1.1rem" })
21508
- }
21509
- ),
21510
- children
21511
- ] }) : null });
21512
- };
21513
-
21514
- // src/components/SearchAndFilter/FilterItem.tsx
21515
- import { Fragment as Fragment21, jsx as jsx124, jsxs as jsxs84 } from "@emotion/react/jsx-runtime";
21516
- var FilterItem = ({
21517
- index,
21518
- paramOptions,
21519
- operatorOptions,
21520
- valueOptions,
21521
- onParamChange,
21522
- onOperatorChange,
21523
- onValueChange
21524
- }) => {
21525
- var _a, _b;
21526
- const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
21527
- const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
21528
- const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
21529
- const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
21530
- const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
21531
- const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo7(() => {
21532
- var _a2;
21533
- const currentSelectedFilter = filterOptions.find((item) => {
21534
- var _a3;
21535
- return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
21536
- });
21537
- const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
21538
- return filters[index].field === item.value;
21539
- });
21540
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
21541
- const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
21542
- return filters[index].operator === item.value;
21543
- });
21544
- return {
21545
- selectedFieldValue: selectedFieldValue2,
21546
- selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
21547
- selectedMetaValue: filters[index].value,
21548
- readOnly: isCurrentFieldReadOnly,
21549
- bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
21550
- };
21551
- }, [filters, filterOptions, index, operatorOptions]);
21552
- const readOnlyProps = readOnly ? {
21553
- "aria-readonly": true,
21554
- isSearchable: false,
21555
- menuIsOpen: false,
21556
- isClearable: false
21557
- } : {};
21558
- return /* @__PURE__ */ jsxs84("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
21559
- /* @__PURE__ */ jsx124("span", { children: index === 0 ? "Where" : "and" }),
21560
- /* @__PURE__ */ jsxs84("div", { css: ConditionalInputRow, children: [
21561
- /* @__PURE__ */ jsx124(
21562
- InputComboBox,
21563
- {
21564
- "aria-label": label,
21565
- options: paramOptions,
21566
- onChange: (e) => {
21567
- var _a2;
21568
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
21569
- },
21570
- isOptionDisabled: (option) => {
21571
- var _a2;
21572
- return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
21573
- },
21574
- styles: {
21575
- menu(base) {
21576
- return {
21577
- ...base,
21578
- minWidth: "max-content"
21579
- };
21580
- }
21581
- },
21582
- value: selectedFieldValue,
21583
- ...readOnlyProps,
21584
- id: "filter-field"
21585
- }
21586
- ),
21587
- /* @__PURE__ */ jsx124(
21588
- InputComboBox,
21589
- {
21590
- "aria-label": operatorLabel,
21591
- options: operatorOptions,
21592
- onChange: (e) => {
21593
- var _a2;
21594
- return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
21595
- },
21596
- isDisabled: !filters[index].field,
21597
- value: selectedOperatorValue,
21598
- styles: {
21599
- menu(base) {
21600
- return {
21601
- ...base,
21602
- minWidth: "max-content"
21603
- };
21604
- }
21605
- },
21606
- ...readOnlyProps,
21607
- id: "filter-operator"
21608
- }
21609
- ),
21610
- /* @__PURE__ */ jsx124(
21611
- FilterEditorRenderer,
21612
- {
21613
- "aria-label": metaDataLabel,
21614
- editorType: metaDataPossibleOptions,
21615
- options: valueOptions,
21616
- onChange: (e) => onValueChange(e != null ? e : ""),
21617
- readOnly,
21618
- bindable,
21619
- disabled: !filters[index].operator,
21620
- value: selectedMetaValue,
21621
- valueTestId: "filter-value"
21622
- }
21623
- ),
21624
- readOnly ? null : /* @__PURE__ */ jsx124(
21625
- "button",
21626
- {
21627
- type: "button",
21628
- onClick: () => handleDeleteFilter(index),
21629
- "aria-label": "delete filter",
21630
- css: IconBtn,
21631
- "data-testid": "delete-filter",
21632
- children: /* @__PURE__ */ jsx124(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
21633
- }
21634
- )
21635
- ] })
21636
- ] });
21637
- };
21638
- var FilterItems = ({
21639
- addButtonText = "add condition",
21640
- resetButtonText = "reset filters"
21641
- }) => {
21642
- const { filterOptions, filters, setFilters, handleAddFilter, handleResetFilters, setFilterVisibility } = useSearchAndFilter();
21643
- const handleUpdateFilter = (index, prop, value) => {
21644
- var _a, _b, _c, _d, _e;
21645
- const next = [...filters];
21646
- next[index] = { ...next[index], [prop]: value };
21647
- if (prop === "operator") {
21648
- if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
21649
- next[index].value = next[index].value[0];
21650
- }
21651
- if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
21652
- next[index].value = [next[index].value, ""];
21653
- }
21654
- if (value === "def" || value === "true") {
21655
- next[index].value = "true";
21656
- }
21657
- if (value === "ndef" || value === "false") {
21658
- next[index].value = "false";
21659
- }
21660
- }
21661
- if (prop === "field") {
21662
- const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
21663
- var _a2;
21664
- return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
21665
- })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
21666
- next[index].operator = firstOperatorInAvailableOperators;
21667
- next[index].value = "";
21668
- }
21669
- setFilters(next);
21670
- };
21671
- return /* @__PURE__ */ jsx124(
21672
- FilterMenu,
21673
- {
21674
- id: "search-and-filter-options",
21675
- dataTestId: "search-and-filter-options",
21676
- menuControls: /* @__PURE__ */ jsxs84(Fragment21, { children: [
21677
- /* @__PURE__ */ jsxs84(
21678
- "button",
21679
- {
21680
- type: "button",
21681
- css: AddConditionalBtn,
21682
- onClick: handleAddFilter,
21683
- "data-testid": "add-filter",
21684
- children: [
21685
- /* @__PURE__ */ jsx124(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
21686
- addButtonText
21687
- ]
21688
- }
21689
- ),
21690
- (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx124(
21691
- "button",
21692
- {
21693
- type: "button",
21694
- css: ResetConditionsBtn,
21695
- onClick: () => {
21696
- handleResetFilters();
21697
- setFilterVisibility(void 0);
21698
- },
21699
- "data-testid": "reset-filters",
21700
- children: resetButtonText
21701
- }
21702
- ) : null
21703
- ] }),
21704
- children: filters.map((item, i) => {
21705
- var _a, _b, _c, _d, _e, _f;
21706
- const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
21707
- var _a2;
21708
- return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
21709
- })) == null ? void 0 : _a.options) != null ? _b : [];
21710
- const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
21711
- const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
21712
- return /* @__PURE__ */ jsx124(
21713
- FilterItem,
21714
- {
21715
- index: i,
21716
- paramOptions: filterOptions,
21717
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
21718
- operatorOptions: possibleOperators,
21719
- onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
21720
- onValueChange: (e) => handleUpdateFilter(i, "value", e),
21721
- valueOptions: possibleValueOptions
21722
- },
21723
- i
21724
- );
21725
- })
21469
+ ) : null,
21470
+ sortControls ? /* @__PURE__ */ jsx123("div", { children: sortControls }) : null
21471
+ ] });
21472
+ };
21473
+ var FilterMenu = ({
21474
+ id,
21475
+ filterTitle = "Show results",
21476
+ menuControls,
21477
+ sortControls,
21478
+ children,
21479
+ dataTestId,
21480
+ resetButtonText = "reset"
21481
+ }) => {
21482
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
21483
+ const innerMenuRef = React24.useRef(null);
21484
+ useEffect20(() => {
21485
+ var _a;
21486
+ if (filterVisibility) {
21487
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
21726
21488
  }
21727
- );
21489
+ }, [filterVisibility]);
21490
+ return /* @__PURE__ */ jsx123(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs83(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, sortControls, children: [
21491
+ /* @__PURE__ */ jsxs83(HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
21492
+ /* @__PURE__ */ jsx123("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
21493
+ (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx123(
21494
+ "button",
21495
+ {
21496
+ type: "button",
21497
+ css: ResetConditionsBtn,
21498
+ onClick: () => {
21499
+ handleResetFilters();
21500
+ setFilterVisibility(false);
21501
+ },
21502
+ "data-testid": "reset-filters",
21503
+ children: resetButtonText
21504
+ }
21505
+ ) : null
21506
+ ] }),
21507
+ children
21508
+ ] }) : null });
21728
21509
  };
21729
21510
 
21730
21511
  // src/components/SegmentedControl/SegmentedControl.tsx
21731
21512
  import { css as css95 } from "@emotion/react";
21732
21513
  import { CgCheck as CgCheck4 } from "@react-icons/all-files/cg/CgCheck";
21733
- import { useCallback as useCallback11, useMemo as useMemo8 } from "react";
21514
+ import { useCallback as useCallback11, useMemo as useMemo7 } from "react";
21734
21515
 
21735
21516
  // src/components/SegmentedControl/SegmentedControl.styles.ts
21736
21517
  import { css as css94 } from "@emotion/react";
@@ -21854,7 +21635,7 @@ var segmentedControlLabelContentStyles = css94`
21854
21635
  var segmentedControlLabelTextStyles = css94``;
21855
21636
 
21856
21637
  // src/components/SegmentedControl/SegmentedControl.tsx
21857
- import { jsx as jsx125, jsxs as jsxs85 } from "@emotion/react/jsx-runtime";
21638
+ import { jsx as jsx124, jsxs as jsxs84 } from "@emotion/react/jsx-runtime";
21858
21639
  var SegmentedControl = ({
21859
21640
  name,
21860
21641
  options,
@@ -21864,6 +21645,8 @@ var SegmentedControl = ({
21864
21645
  disabled: disabled2 = false,
21865
21646
  orientation = "horizontal",
21866
21647
  size = "md",
21648
+ hideOptionText = false,
21649
+ iconSize = "1.5em",
21867
21650
  ...props
21868
21651
  }) => {
21869
21652
  const onOptionChange = useCallback11(
@@ -21874,18 +21657,19 @@ var SegmentedControl = ({
21874
21657
  },
21875
21658
  [options, onChange]
21876
21659
  );
21877
- const sizeStyles = useMemo8(() => {
21660
+ const sizeStyles = useMemo7(() => {
21878
21661
  const map = {
21879
21662
  sm: css95({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
21880
21663
  md: css95({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
21881
- lg: css95({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" })
21664
+ lg: css95({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
21665
+ xl: css95({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
21882
21666
  };
21883
21667
  return map[size];
21884
21668
  }, [size]);
21885
- const isIconOnly = useMemo8(() => {
21669
+ const isIconOnly = useMemo7(() => {
21886
21670
  return options.every((option) => option && option.icon && !option.label);
21887
21671
  }, [options]);
21888
- return /* @__PURE__ */ jsx125(
21672
+ return /* @__PURE__ */ jsx124(
21889
21673
  "div",
21890
21674
  {
21891
21675
  css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
@@ -21898,45 +21682,53 @@ var SegmentedControl = ({
21898
21682
  }
21899
21683
  const text = option.label ? option.label : option.icon ? null : String(option.value);
21900
21684
  const isDisabled = disabled2 || option.disabled;
21901
- return /* @__PURE__ */ jsx125(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx125("div", { css: segmentedControlItemStyles, "data-testid": "container-segmented-control", children: /* @__PURE__ */ jsxs85(
21902
- "label",
21685
+ return /* @__PURE__ */ jsx124(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx124(
21686
+ "div",
21903
21687
  {
21904
- css: [
21905
- segmentedControlLabelStyles(option.value === value, isDisabled),
21906
- sizeStyles,
21907
- isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
21908
- ],
21909
- children: [
21910
- /* @__PURE__ */ jsx125(
21911
- "input",
21912
- {
21913
- css: segmentedControlInputStyles,
21914
- type: "radio",
21915
- name,
21916
- value: index,
21917
- checked: option.value === value,
21918
- onChange: onOptionChange,
21919
- disabled: isDisabled
21920
- }
21921
- ),
21922
- option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx125(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
21923
- /* @__PURE__ */ jsxs85("span", { css: segmentedControlLabelContentStyles, children: [
21924
- !option.icon ? null : /* @__PURE__ */ jsx125(Icon, { icon: option.icon, size: "1.5em", iconColor: "currentColor" }),
21925
- !text ? null : /* @__PURE__ */ jsx125("span", { css: segmentedControlLabelTextStyles, children: text })
21926
- ] })
21927
- ]
21688
+ css: segmentedControlItemStyles,
21689
+ "data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
21690
+ children: /* @__PURE__ */ jsxs84(
21691
+ "label",
21692
+ {
21693
+ css: [
21694
+ segmentedControlLabelStyles(option.value === value, isDisabled),
21695
+ sizeStyles,
21696
+ isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
21697
+ ],
21698
+ children: [
21699
+ /* @__PURE__ */ jsx124(
21700
+ "input",
21701
+ {
21702
+ css: segmentedControlInputStyles,
21703
+ type: "radio",
21704
+ name,
21705
+ value: index,
21706
+ checked: option.value === value,
21707
+ onChange: onOptionChange,
21708
+ disabled: isDisabled
21709
+ }
21710
+ ),
21711
+ option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx124(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
21712
+ /* @__PURE__ */ jsxs84("span", { css: segmentedControlLabelContentStyles, children: [
21713
+ !option.icon ? null : /* @__PURE__ */ jsx124(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
21714
+ !text || hideOptionText ? null : /* @__PURE__ */ jsx124("span", { css: segmentedControlLabelTextStyles, children: text })
21715
+ ] })
21716
+ ]
21717
+ }
21718
+ )
21928
21719
  }
21929
- ) }) }, JSON.stringify(option.value));
21720
+ ) }, JSON.stringify(option.value));
21930
21721
  })
21931
21722
  }
21932
21723
  );
21933
21724
  };
21934
21725
 
21935
21726
  // src/components/SearchAndFilter/SortItems.tsx
21936
- import { jsx as jsx126, jsxs as jsxs86 } from "@emotion/react/jsx-runtime";
21937
- var SortItems = () => {
21727
+ import { jsx as jsx125, jsxs as jsxs85 } from "@emotion/react/jsx-runtime";
21728
+ var SortItems = ({ sortByLabel = "Sort by", localeLabel = "Locale returned" }) => {
21938
21729
  var _a, _b;
21939
- const { sortOptions, setSortBy, sortByValue } = useSearchAndFilter();
21730
+ const { sortOptions, setSortBy, sortByValue, localeValue, localeOptions, handleLocaleChange } = useSearchAndFilter();
21731
+ const hideLocaleOptions = !localeOptions;
21940
21732
  const values = sortByValue.split("_");
21941
21733
  const sortDirection = values.pop();
21942
21734
  const sortField = values.join("_");
@@ -21944,57 +21736,290 @@ var SortItems = () => {
21944
21736
  var _a2;
21945
21737
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
21946
21738
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
21947
- return /* @__PURE__ */ jsx126(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", dataTestId: "sorting-options", children: /* @__PURE__ */ jsxs86("div", { css: SortFilterInputRow, children: [
21948
- /* @__PURE__ */ jsx126(
21949
- InputComboBox,
21950
- {
21951
- options: sortOptions,
21952
- onChange: (e) => {
21953
- const fieldName = e == null ? void 0 : e.value;
21954
- setSortBy(`${fieldName}_${sortDirection}`);
21955
- },
21956
- styles: {
21957
- menu(base) {
21958
- return {
21959
- ...base,
21960
- minWidth: "max-content"
21961
- };
21739
+ return /* @__PURE__ */ jsxs85("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
21740
+ /* @__PURE__ */ jsxs85(VerticalRhythm, { gap: "xs", children: [
21741
+ /* @__PURE__ */ jsx125("span", { css: Title, children: sortByLabel }),
21742
+ /* @__PURE__ */ jsxs85("div", { css: SortFilterInputRow, children: [
21743
+ /* @__PURE__ */ jsx125(
21744
+ InputComboBox,
21745
+ {
21746
+ id: "sort-by-field",
21747
+ "aria-label": "Sort by",
21748
+ options: sortOptions,
21749
+ onChange: (e) => {
21750
+ const fieldName = e == null ? void 0 : e.value;
21751
+ setSortBy(`${fieldName}_${sortDirection}`);
21752
+ },
21753
+ styles: {
21754
+ menu(base) {
21755
+ return {
21756
+ ...base,
21757
+ minWidth: "max-content"
21758
+ };
21759
+ }
21760
+ },
21761
+ value: currentSelectedOption
21962
21762
  }
21963
- },
21964
- value: currentSelectedOption,
21965
- id: "sort-by-field"
21966
- }
21967
- ),
21968
- /* @__PURE__ */ jsx126(
21969
- SegmentedControl,
21970
- {
21971
- noCheckmark: true,
21972
- name: "sortBy",
21973
- options: [
21974
- { label: "Ascending", value: `ASC` },
21975
- { label: "Descending", value: `DESC` }
21976
- ],
21977
- onChange: (e) => setSortBy(`${sortField}_${e}`),
21978
- value: sortDirection,
21979
- "data-testid": "ordering-options"
21980
- }
21981
- )
21982
- ] }) });
21763
+ ),
21764
+ /* @__PURE__ */ jsx125(
21765
+ SegmentedControl,
21766
+ {
21767
+ noCheckmark: true,
21768
+ name: "sortBy",
21769
+ hideOptionText: true,
21770
+ iconSize: "1rem",
21771
+ size: "xl",
21772
+ options: [
21773
+ {
21774
+ label: "Ascending",
21775
+ icon: "arrow-up",
21776
+ value: `ASC`,
21777
+ tooltip: "Ascending (e.g. A-Z, newest to oldest)",
21778
+ "data-testid": "sort-ascending"
21779
+ },
21780
+ {
21781
+ label: "Descending",
21782
+ icon: "arrow-down",
21783
+ value: `DESC`,
21784
+ tooltip: "Descending (e.g. Z-A, oldest to newest)",
21785
+ "data-testid": "sort-descending"
21786
+ }
21787
+ ],
21788
+ onChange: (e) => setSortBy(`${sortField}_${e}`),
21789
+ value: sortDirection
21790
+ }
21791
+ )
21792
+ ] })
21793
+ ] }),
21794
+ hideLocaleOptions ? null : /* @__PURE__ */ jsxs85(VerticalRhythm, { gap: "xs", children: [
21795
+ /* @__PURE__ */ jsx125("span", { css: Title, children: localeLabel }),
21796
+ /* @__PURE__ */ jsx125(
21797
+ InputSelect,
21798
+ {
21799
+ name: "localeReturned",
21800
+ "aria-label": "Locale returned",
21801
+ label: "Locale returned",
21802
+ showLabel: false,
21803
+ "data-testid": "context-locale",
21804
+ onChange: (e) => {
21805
+ var _a2;
21806
+ return handleLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
21807
+ },
21808
+ options: localeOptions,
21809
+ value: localeValue
21810
+ }
21811
+ )
21812
+ ] })
21813
+ ] });
21983
21814
  };
21984
21815
 
21985
- // src/components/SearchAndFilter/FilterModeView.tsx
21986
- import { jsx as jsx127 } from "@emotion/react/jsx-runtime";
21987
- var FilterModeView = () => {
21988
- const { filterVisibility } = useSearchAndFilter();
21989
- const modeView = {
21990
- filters: /* @__PURE__ */ jsx127(FilterItems, {}),
21991
- sort: /* @__PURE__ */ jsx127(SortItems, {})
21816
+ // src/components/SearchAndFilter/FilterItem.tsx
21817
+ import { jsx as jsx126, jsxs as jsxs86 } from "@emotion/react/jsx-runtime";
21818
+ var FilterItem = ({
21819
+ index,
21820
+ paramOptions,
21821
+ operatorOptions,
21822
+ valueOptions,
21823
+ onParamChange,
21824
+ onOperatorChange,
21825
+ onValueChange
21826
+ }) => {
21827
+ var _a, _b;
21828
+ const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
21829
+ const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
21830
+ const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
21831
+ const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
21832
+ const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
21833
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = useMemo8(() => {
21834
+ var _a2;
21835
+ const currentSelectedFilter = filterOptions.find((item) => {
21836
+ var _a3;
21837
+ return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
21838
+ });
21839
+ const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
21840
+ return filters[index].field === item.value;
21841
+ });
21842
+ const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
21843
+ const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
21844
+ return filters[index].operator === item.value;
21845
+ });
21846
+ const selectedMetaValue2 = valueOptions.filter((item) => {
21847
+ if (Array.isArray(filters[index].value) && item.value) {
21848
+ return filters[index].value.includes(item.value);
21849
+ }
21850
+ return filters[index].value === item.value;
21851
+ });
21852
+ return {
21853
+ selectedFieldValue: selectedFieldValue2,
21854
+ selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
21855
+ selectedMetaValue: selectedMetaValue2.length > 0 ? selectedMetaValue2 : filters[index].value,
21856
+ readOnly: isCurrentFieldReadOnly
21857
+ };
21858
+ }, [filters, filterOptions, index, operatorOptions, valueOptions]);
21859
+ const readOnlyProps = readOnly ? {
21860
+ "aria-readonly": true,
21861
+ isSearchable: false,
21862
+ menuIsOpen: false,
21863
+ isClearable: false
21864
+ } : {};
21865
+ return /* @__PURE__ */ jsxs86("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
21866
+ /* @__PURE__ */ jsx126("span", { children: index === 0 ? "Where" : "and" }),
21867
+ /* @__PURE__ */ jsxs86("div", { css: ConditionalInputRow, children: [
21868
+ /* @__PURE__ */ jsx126(
21869
+ InputComboBox,
21870
+ {
21871
+ "aria-label": label,
21872
+ options: paramOptions,
21873
+ onChange: (e) => {
21874
+ var _a2;
21875
+ onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
21876
+ },
21877
+ isOptionDisabled: (option) => {
21878
+ var _a2;
21879
+ return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
21880
+ },
21881
+ styles: {
21882
+ menu(base) {
21883
+ return {
21884
+ ...base,
21885
+ minWidth: "max-content"
21886
+ };
21887
+ }
21888
+ },
21889
+ value: selectedFieldValue,
21890
+ ...readOnlyProps,
21891
+ id: "filter-field",
21892
+ name: `filter-field-${index}`
21893
+ }
21894
+ ),
21895
+ /* @__PURE__ */ jsx126(
21896
+ InputComboBox,
21897
+ {
21898
+ "aria-label": operatorLabel,
21899
+ options: operatorOptions,
21900
+ onChange: (e) => {
21901
+ var _a2;
21902
+ return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
21903
+ },
21904
+ isDisabled: !filters[index].field,
21905
+ value: selectedOperatorValue,
21906
+ styles: {
21907
+ menu(base) {
21908
+ return {
21909
+ ...base,
21910
+ minWidth: "max-content"
21911
+ };
21912
+ }
21913
+ },
21914
+ ...readOnlyProps,
21915
+ id: "filter-operator",
21916
+ name: `filter-operator-${index}`
21917
+ }
21918
+ ),
21919
+ /* @__PURE__ */ jsx126(
21920
+ FilterEditorRenderer,
21921
+ {
21922
+ "aria-label": metaDataLabel,
21923
+ editorType: metaDataPossibleOptions,
21924
+ options: valueOptions,
21925
+ onChange: (e) => onValueChange(e != null ? e : ""),
21926
+ readOnly,
21927
+ isDisabled: !filters[index].operator,
21928
+ value: selectedMetaValue,
21929
+ valueTestId: "filter-value"
21930
+ }
21931
+ ),
21932
+ readOnly || index === 0 ? null : /* @__PURE__ */ jsx126(
21933
+ "button",
21934
+ {
21935
+ type: "button",
21936
+ onClick: () => handleDeleteFilter(index),
21937
+ "aria-label": "delete filter",
21938
+ css: IconBtn,
21939
+ "data-testid": "delete-filter",
21940
+ children: /* @__PURE__ */ jsx126(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
21941
+ }
21942
+ )
21943
+ ] })
21944
+ ] });
21945
+ };
21946
+ var FilterItems = ({ addButtonText = "add condition" }) => {
21947
+ const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
21948
+ const handleUpdateFilter = (index, prop, value) => {
21949
+ var _a, _b, _c, _d, _e;
21950
+ const next = [...filters];
21951
+ next[index] = { ...next[index], [prop]: value };
21952
+ if (prop === "operator") {
21953
+ if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
21954
+ next[index].value = next[index].value[0];
21955
+ }
21956
+ if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
21957
+ next[index].value = [next[index].value, ""];
21958
+ }
21959
+ if (value === "def" || value === "true") {
21960
+ next[index].value = "true";
21961
+ }
21962
+ if (value === "ndef" || value === "false") {
21963
+ next[index].value = "false";
21964
+ }
21965
+ }
21966
+ if (prop === "field") {
21967
+ const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
21968
+ var _a2;
21969
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
21970
+ })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
21971
+ next[index].operator = firstOperatorInAvailableOperators;
21972
+ next[index].value = "";
21973
+ }
21974
+ setFilters(next);
21992
21975
  };
21993
- return filterVisibility ? modeView[filterVisibility] : null;
21976
+ return /* @__PURE__ */ jsx126(
21977
+ FilterMenu,
21978
+ {
21979
+ id: "search-and-filter-options",
21980
+ dataTestId: "search-and-filter-options",
21981
+ menuControls: /* @__PURE__ */ jsxs86(
21982
+ "button",
21983
+ {
21984
+ type: "button",
21985
+ css: AddConditionalBtn,
21986
+ onClick: handleAddFilter,
21987
+ "data-testid": "add-filter",
21988
+ children: [
21989
+ /* @__PURE__ */ jsx126(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
21990
+ addButtonText
21991
+ ]
21992
+ }
21993
+ ),
21994
+ sortControls: /* @__PURE__ */ jsx126(SortItems, {}),
21995
+ children: filters.map((item, i) => {
21996
+ var _a, _b, _c, _d, _e, _f;
21997
+ const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
21998
+ var _a2;
21999
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
22000
+ })) == null ? void 0 : _a.options) != null ? _b : [];
22001
+ const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
22002
+ const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
22003
+ return /* @__PURE__ */ jsx126(
22004
+ FilterItem,
22005
+ {
22006
+ index: i,
22007
+ paramOptions: filterOptions,
22008
+ onParamChange: (e) => handleUpdateFilter(i, "field", e),
22009
+ operatorOptions: possibleOperators,
22010
+ onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
22011
+ onValueChange: (e) => handleUpdateFilter(i, "value", e),
22012
+ valueOptions: possibleValueOptions
22013
+ },
22014
+ i
22015
+ );
22016
+ })
22017
+ }
22018
+ );
21994
22019
  };
21995
22020
 
21996
22021
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
21997
- import { Fragment as Fragment22, jsx as jsx128, jsxs as jsxs87 } from "@emotion/react/jsx-runtime";
22022
+ import { Fragment as Fragment21, jsx as jsx127, jsxs as jsxs87 } from "@emotion/react/jsx-runtime";
21998
22023
  var SearchAndFilterResultContainer = ({
21999
22024
  buttonText,
22000
22025
  clearButtonLabel = "clear",
@@ -22028,47 +22053,49 @@ var SearchAndFilterResultContainer = ({
22028
22053
  if (totalResults && totalResults > 0) {
22029
22054
  return null;
22030
22055
  }
22031
- return /* @__PURE__ */ jsxs87(Fragment22, { children: [
22056
+ return /* @__PURE__ */ jsxs87(Fragment21, { children: [
22032
22057
  /* @__PURE__ */ jsxs87(HorizontalRhythm, { children: [
22033
22058
  /* @__PURE__ */ jsxs87("span", { children: [
22034
22059
  totalResults,
22035
22060
  " results ",
22036
22061
  searchTerm ? `for "${searchTerm}"` : null
22037
22062
  ] }),
22038
- !searchTerm ? null : /* @__PURE__ */ jsx128(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
22063
+ !searchTerm ? null : /* @__PURE__ */ jsx127(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
22039
22064
  ] }),
22040
22065
  totalResults === 0 ? /* @__PURE__ */ jsxs87(Callout, { title: calloutTitle2 != null ? calloutTitle2 : automateCalloutTitle(), type: "note", children: [
22041
- calloutText ? /* @__PURE__ */ jsx128(Paragraph, { children: calloutText }) : null,
22042
- /* @__PURE__ */ jsx128(Button, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
22066
+ calloutText ? /* @__PURE__ */ jsx127(Paragraph, { children: calloutText }) : null,
22067
+ /* @__PURE__ */ jsx127(Button, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
22043
22068
  ] }) : null
22044
22069
  ] });
22045
22070
  };
22046
22071
 
22047
22072
  // src/components/SearchAndFilter/SearchAndFilter.tsx
22048
- import { jsx as jsx129, jsxs as jsxs88 } from "@emotion/react/jsx-runtime";
22073
+ import { jsx as jsx128, jsxs as jsxs88 } from "@emotion/react/jsx-runtime";
22049
22074
  var SearchAndFilter = ({
22050
22075
  filters,
22051
22076
  filterOptions,
22052
- filterMode: filterMode3,
22077
+ filterVisible,
22053
22078
  sortOptions,
22054
22079
  defaultSortByValue,
22055
22080
  filterControls,
22056
22081
  viewSwitchControls,
22057
- resultsContainerView = /* @__PURE__ */ jsx129(SearchAndFilterResultContainer, {}),
22058
- children = /* @__PURE__ */ jsx129(FilterModeView, {}),
22059
- filterMapper: filterMapper2 = filterMapper,
22082
+ resultsContainerView = /* @__PURE__ */ jsx128(SearchAndFilterResultContainer, {}),
22083
+ children = /* @__PURE__ */ jsx128(FilterItems, {}),
22060
22084
  onChange,
22061
22085
  onSearchChange,
22062
22086
  onSortChange,
22087
+ onLocaleChange,
22063
22088
  totalResults,
22064
- resetFilterValues = []
22089
+ resetFilterValues = [],
22090
+ defaultLocale,
22091
+ localeOptions
22065
22092
  }) => {
22066
- return /* @__PURE__ */ jsx129(
22093
+ return /* @__PURE__ */ jsx128(
22067
22094
  SearchAndFilterProvider,
22068
22095
  {
22069
22096
  filters,
22070
22097
  filterOptions,
22071
- filterMode: filterMode3,
22098
+ filterVisible,
22072
22099
  defaultSortByValue,
22073
22100
  sortOptions,
22074
22101
  onChange,
@@ -22076,16 +22103,18 @@ var SearchAndFilter = ({
22076
22103
  onSortChange,
22077
22104
  totalResults,
22078
22105
  resetFilterValues,
22079
- filterMapper: filterMapper2,
22106
+ defaultLocale,
22107
+ localeOptions,
22108
+ onLocaleChange,
22080
22109
  children: /* @__PURE__ */ jsxs88(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
22081
22110
  /* @__PURE__ */ jsxs88("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
22082
- /* @__PURE__ */ jsx129(
22111
+ /* @__PURE__ */ jsx128(
22083
22112
  "div",
22084
22113
  {
22085
22114
  css: SearchAndFilterControlsWrapper(
22086
- viewSwitchControls ? "auto auto 1fr 0.5fr" : "auto auto 1fr"
22115
+ viewSwitchControls ? "auto 1fr 0.05fr" : "auto auto 1fr"
22087
22116
  ),
22088
- children: !filterControls ? /* @__PURE__ */ jsx129(FilterControls, { hideSearchInput: !onSearchChange, defaultSortByValue }) : filterControls
22117
+ children: !filterControls ? /* @__PURE__ */ jsx128(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
22089
22118
  }
22090
22119
  ),
22091
22120
  viewSwitchControls
@@ -22100,7 +22129,7 @@ var SearchAndFilter = ({
22100
22129
  // src/components/SearchAndFilter/SearchOnlyFilter.tsx
22101
22130
  import { createContext as createContext7, useState as useState19 } from "react";
22102
22131
  import { useDebounce as useDebounce4 } from "react-use";
22103
- import { jsx as jsx130 } from "@emotion/react/jsx-runtime";
22132
+ import { jsx as jsx129 } from "@emotion/react/jsx-runtime";
22104
22133
  var SearchOnlyContext = createContext7({
22105
22134
  searchTerm: "",
22106
22135
  setSearchTerm: () => {
@@ -22117,14 +22146,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
22117
22146
  300,
22118
22147
  [localeSearchTerm]
22119
22148
  );
22120
- return /* @__PURE__ */ jsx130(
22149
+ return /* @__PURE__ */ jsx129(
22121
22150
  SearchOnlyContext.Provider,
22122
22151
  {
22123
22152
  value: {
22124
22153
  searchTerm,
22125
22154
  setSearchTerm: setLocaleSearchTerm
22126
22155
  },
22127
- children: /* @__PURE__ */ jsx130("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx130(
22156
+ children: /* @__PURE__ */ jsx129("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx129(
22128
22157
  InputKeywordSearch,
22129
22158
  {
22130
22159
  placeholder: "Search...",
@@ -22150,7 +22179,7 @@ var skeletonStyles = css96`
22150
22179
  `;
22151
22180
 
22152
22181
  // src/components/Skeleton/Skeleton.tsx
22153
- import { jsx as jsx131 } from "@emotion/react/jsx-runtime";
22182
+ import { jsx as jsx130 } from "@emotion/react/jsx-runtime";
22154
22183
  var Skeleton = ({
22155
22184
  width = "100%",
22156
22185
  height = "1.25rem",
@@ -22158,7 +22187,7 @@ var Skeleton = ({
22158
22187
  circle = false,
22159
22188
  children,
22160
22189
  ...otherProps
22161
- }) => /* @__PURE__ */ jsx131(
22190
+ }) => /* @__PURE__ */ jsx130(
22162
22191
  "div",
22163
22192
  {
22164
22193
  css: [
@@ -22265,19 +22294,19 @@ var SwitchText = css97`
22265
22294
  `;
22266
22295
 
22267
22296
  // src/components/Switch/Switch.tsx
22268
- import { Fragment as Fragment23, jsx as jsx132, jsxs as jsxs89 } from "@emotion/react/jsx-runtime";
22297
+ import { Fragment as Fragment22, jsx as jsx131, jsxs as jsxs89 } from "@emotion/react/jsx-runtime";
22269
22298
  var Switch = React26.forwardRef(
22270
22299
  ({ label, infoText, toggleText, children, ...inputProps }, ref) => {
22271
22300
  let additionalText = infoText;
22272
22301
  if (infoText && toggleText) {
22273
22302
  additionalText = inputProps.checked ? toggleText : infoText;
22274
22303
  }
22275
- return /* @__PURE__ */ jsxs89(Fragment23, { children: [
22304
+ return /* @__PURE__ */ jsxs89(Fragment22, { children: [
22276
22305
  /* @__PURE__ */ jsxs89("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
22277
- /* @__PURE__ */ jsx132("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
22278
- /* @__PURE__ */ jsx132("span", { css: SwitchInputLabel, children: label })
22306
+ /* @__PURE__ */ jsx131("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
22307
+ /* @__PURE__ */ jsx131("span", { css: SwitchInputLabel, children: label })
22279
22308
  ] }),
22280
- additionalText ? /* @__PURE__ */ jsx132("p", { css: SwitchText, children: additionalText }) : null,
22309
+ additionalText ? /* @__PURE__ */ jsx131("p", { css: SwitchText, children: additionalText }) : null,
22281
22310
  children
22282
22311
  ] });
22283
22312
  }
@@ -22314,40 +22343,40 @@ var tableCellHead = css98`
22314
22343
  `;
22315
22344
 
22316
22345
  // src/components/Table/Table.tsx
22317
- import { jsx as jsx133 } from "@emotion/react/jsx-runtime";
22346
+ import { jsx as jsx132 } from "@emotion/react/jsx-runtime";
22318
22347
  var Table = React27.forwardRef(
22319
22348
  ({ children, cellPadding, ...otherProps }, ref) => {
22320
- return /* @__PURE__ */ jsx133("table", { ref, css: table({ cellPadding }), ...otherProps, children });
22349
+ return /* @__PURE__ */ jsx132("table", { ref, css: table({ cellPadding }), ...otherProps, children });
22321
22350
  }
22322
22351
  );
22323
22352
  var TableHead = React27.forwardRef(
22324
22353
  ({ children, ...otherProps }, ref) => {
22325
- return /* @__PURE__ */ jsx133("thead", { ref, css: tableHead, ...otherProps, children });
22354
+ return /* @__PURE__ */ jsx132("thead", { ref, css: tableHead, ...otherProps, children });
22326
22355
  }
22327
22356
  );
22328
22357
  var TableBody = React27.forwardRef(
22329
22358
  ({ children, ...otherProps }, ref) => {
22330
- return /* @__PURE__ */ jsx133("tbody", { ref, ...otherProps, children });
22359
+ return /* @__PURE__ */ jsx132("tbody", { ref, ...otherProps, children });
22331
22360
  }
22332
22361
  );
22333
22362
  var TableFoot = React27.forwardRef(
22334
22363
  ({ children, ...otherProps }, ref) => {
22335
- return /* @__PURE__ */ jsx133("tfoot", { ref, ...otherProps, children });
22364
+ return /* @__PURE__ */ jsx132("tfoot", { ref, ...otherProps, children });
22336
22365
  }
22337
22366
  );
22338
22367
  var TableRow = React27.forwardRef(
22339
22368
  ({ children, ...otherProps }, ref) => {
22340
- return /* @__PURE__ */ jsx133("tr", { ref, css: tableRow, ...otherProps, children });
22369
+ return /* @__PURE__ */ jsx132("tr", { ref, css: tableRow, ...otherProps, children });
22341
22370
  }
22342
22371
  );
22343
22372
  var TableCellHead = React27.forwardRef(
22344
22373
  ({ children, ...otherProps }, ref) => {
22345
- return /* @__PURE__ */ jsx133("th", { ref, css: tableCellHead, ...otherProps, children });
22374
+ return /* @__PURE__ */ jsx132("th", { ref, css: tableCellHead, ...otherProps, children });
22346
22375
  }
22347
22376
  );
22348
22377
  var TableCellData = React27.forwardRef(
22349
22378
  ({ children, ...otherProps }, ref) => {
22350
- return /* @__PURE__ */ jsx133("td", { ref, ...otherProps, children });
22379
+ return /* @__PURE__ */ jsx132("td", { ref, ...otherProps, children });
22351
22380
  }
22352
22381
  );
22353
22382
 
@@ -22387,7 +22416,7 @@ var tabButtonGroupStyles = css99`
22387
22416
  `;
22388
22417
 
22389
22418
  // src/components/Tabs/Tabs.tsx
22390
- import { jsx as jsx134 } from "@emotion/react/jsx-runtime";
22419
+ import { jsx as jsx133 } from "@emotion/react/jsx-runtime";
22391
22420
  var useCurrentTab = () => {
22392
22421
  const context = useAriakitTabStore();
22393
22422
  if (!context) {
@@ -22425,23 +22454,23 @@ var Tabs = ({
22425
22454
  tab.setSelectedId(selected);
22426
22455
  }
22427
22456
  }, [selected, tab]);
22428
- return /* @__PURE__ */ jsx134(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
22457
+ return /* @__PURE__ */ jsx133(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
22429
22458
  };
22430
22459
  var TabButtonGroup = ({ children, ...props }) => {
22431
- return /* @__PURE__ */ jsx134(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
22460
+ return /* @__PURE__ */ jsx133(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
22432
22461
  };
22433
22462
  var TabButton = ({
22434
22463
  children,
22435
22464
  id,
22436
22465
  ...props
22437
22466
  }) => {
22438
- return /* @__PURE__ */ jsx134(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
22467
+ return /* @__PURE__ */ jsx133(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
22439
22468
  };
22440
22469
  var TabContent = ({
22441
22470
  children,
22442
22471
  ...props
22443
22472
  }) => {
22444
- return /* @__PURE__ */ jsx134(AriakitTabPanel, { ...props, children });
22473
+ return /* @__PURE__ */ jsx133(AriakitTabPanel, { ...props, children });
22445
22474
  };
22446
22475
 
22447
22476
  // src/components/Toast/Toast.tsx
@@ -22672,9 +22701,9 @@ var toastContainerStyles = css100`
22672
22701
  `;
22673
22702
 
22674
22703
  // src/components/Toast/Toast.tsx
22675
- import { jsx as jsx135 } from "@emotion/react/jsx-runtime";
22704
+ import { jsx as jsx134 } from "@emotion/react/jsx-runtime";
22676
22705
  var ToastContainer = ({ limit = 4 }) => {
22677
- return /* @__PURE__ */ jsx135(
22706
+ return /* @__PURE__ */ jsx134(
22678
22707
  ToastifyContainer,
22679
22708
  {
22680
22709
  css: toastContainerStyles,
@@ -22712,8 +22741,6 @@ export {
22712
22741
  CurrentDrawerContext,
22713
22742
  DATE_OPERATORS,
22714
22743
  DashedBox,
22715
- DateEditor,
22716
- DateRangeEditor,
22717
22744
  DateTimePicker,
22718
22745
  DateTimePickerVariant,
22719
22746
  DebouncedInputKeywordSearch,
@@ -22729,12 +22756,9 @@ export {
22729
22756
  Fieldset,
22730
22757
  FilterButton2 as FilterButton,
22731
22758
  FilterControls,
22732
- FilterEditorRenderer,
22733
22759
  FilterItem,
22734
22760
  FilterItems,
22735
22761
  FilterMenu,
22736
- FilterMultiChoiceEditor,
22737
- FilterSingleChoiceEditor,
22738
22762
  Heading,
22739
22763
  HexModalBackground,
22740
22764
  HorizontalRhythm,
@@ -22781,8 +22805,7 @@ export {
22781
22805
  ModalDialog,
22782
22806
  MultilineChip,
22783
22807
  NUMBER_OPERATORS,
22784
- NumberEditor,
22785
- NumberRangeEditor,
22808
+ PUBLISH_STATUS_FIELD_OPERATORS,
22786
22809
  PageHeaderSection,
22787
22810
  Pagination,
22788
22811
  Paragraph,
@@ -22835,8 +22858,6 @@ export {
22835
22858
  ShortcutRevealer,
22836
22859
  Skeleton,
22837
22860
  StatusBullet,
22838
- StatusMultiEditor,
22839
- StatusSingleEditor,
22840
22861
  SuccessMessage,
22841
22862
  Switch,
22842
22863
  TAKEOVER_STACK_ID,
@@ -22853,7 +22874,6 @@ export {
22853
22874
  TableRow,
22854
22875
  Tabs,
22855
22876
  TakeoverDrawerRenderer,
22856
- TextEditor,
22857
22877
  Textarea,
22858
22878
  Theme,
22859
22879
  Tile2 as Tile,
@@ -22898,7 +22918,6 @@ export {
22898
22918
  fadeInRtl,
22899
22919
  fadeInTop,
22900
22920
  fadeOutBottom,
22901
- filterMapper,
22902
22921
  fullWidthScreenIcon,
22903
22922
  getDrawerAttributes,
22904
22923
  getParentPath,