@uniformdev/design-system 19.135.0 → 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
@@ -20715,7 +20741,7 @@ var FilterButton2 = ({
20715
20741
 
20716
20742
  // src/components/SearchAndFilter/FilterControls.tsx
20717
20743
  import { useEffect as useEffect18, useState as useState17 } from "react";
20718
- import { useDebounce as useDebounce2, useEffectOnce } from "react-use";
20744
+ import { useDebounce as useDebounce2 } from "react-use";
20719
20745
 
20720
20746
  // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
20721
20747
  import {
@@ -20744,31 +20770,39 @@ var SearchAndFilterContext = createContext6({
20744
20770
  },
20745
20771
  handleDeleteFilter: () => {
20746
20772
  },
20773
+ handleLocaleChange: () => {
20774
+ },
20747
20775
  setSortBy: () => {
20748
20776
  },
20749
20777
  sortByValue: "",
20750
20778
  filterOptions: [],
20751
20779
  sortOptions: [],
20752
20780
  validFilterQuery: [],
20753
- totalResults: 0
20781
+ totalResults: 0,
20782
+ localeOptions: [],
20783
+ localeValue: ""
20754
20784
  });
20755
20785
  var SearchAndFilterProvider = ({
20756
20786
  filters,
20757
20787
  filterOptions,
20758
20788
  sortOptions,
20759
20789
  defaultSortByValue,
20760
- filterMode: filterMode3 = void 0,
20790
+ defaultLocale = "",
20791
+ localeOptions,
20792
+ onLocaleChange,
20793
+ filterVisible = false,
20761
20794
  onSearchChange,
20762
20795
  onChange,
20763
20796
  onSortChange,
20764
- resetFilterValues = [],
20797
+ resetFilterValues = [{ field: "", operator: "", value: "" }],
20765
20798
  totalResults,
20766
20799
  children
20767
20800
  }) => {
20768
20801
  const [searchTerm, setSearchTerm] = useState16("");
20769
20802
  const deferredSearchTerm = useDeferredValue2(searchTerm);
20770
- const [filterVisibility, setFilterVisibility] = useState16(filterMode3);
20803
+ const [filterVisibility, setFilterVisibility] = useState16(filterVisible);
20771
20804
  const [sortByValue, setSortByValue] = useState16(defaultSortByValue);
20805
+ const [localeValue, setLocale] = useState16(defaultLocale);
20772
20806
  const handleSearchTerm = useCallback10(
20773
20807
  (term) => {
20774
20808
  setSearchTerm(term);
@@ -20776,6 +20810,13 @@ var SearchAndFilterProvider = ({
20776
20810
  },
20777
20811
  [setSearchTerm, onSearchChange]
20778
20812
  );
20813
+ const handleLocaleChange = useCallback10(
20814
+ (locale) => {
20815
+ setLocale(locale);
20816
+ onLocaleChange == null ? void 0 : onLocaleChange(locale);
20817
+ },
20818
+ [onLocaleChange]
20819
+ );
20779
20820
  const handleOnSortChange = useCallback10(
20780
20821
  (sort) => {
20781
20822
  setSortByValue(sort);
@@ -20784,7 +20825,7 @@ var SearchAndFilterProvider = ({
20784
20825
  [onSortChange]
20785
20826
  );
20786
20827
  const handleToggleFilterVisibilty = useCallback10(
20787
- (mode) => setFilterVisibility(mode),
20828
+ (visible) => setFilterVisibility(visible),
20788
20829
  [setFilterVisibility]
20789
20830
  );
20790
20831
  const handleAddFilter = useCallback10(() => {
@@ -20810,7 +20851,7 @@ var SearchAndFilterProvider = ({
20810
20851
  if (filterVisibility) {
20811
20852
  const handleEscKeyFilterClose = (e) => {
20812
20853
  if (e.key === "Escape") {
20813
- setFilterVisibility(void 0);
20854
+ setFilterVisibility(false);
20814
20855
  }
20815
20856
  };
20816
20857
  document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
@@ -20837,7 +20878,10 @@ var SearchAndFilterProvider = ({
20837
20878
  filterOptions,
20838
20879
  sortOptions,
20839
20880
  validFilterQuery,
20840
- totalResults
20881
+ totalResults,
20882
+ localeOptions,
20883
+ localeValue,
20884
+ handleLocaleChange
20841
20885
  },
20842
20886
  children: /* @__PURE__ */ jsx119(VerticalRhythm, { children })
20843
20887
  }
@@ -20852,22 +20896,10 @@ var useSearchAndFilter = () => {
20852
20896
  import { Fragment as Fragment19, jsx as jsx120, jsxs as jsxs81 } from "@emotion/react/jsx-runtime";
20853
20897
  var FilterControls = ({
20854
20898
  children,
20855
- defaultSortByValue,
20856
20899
  hideSearchInput
20857
20900
  }) => {
20858
- var _a, _b, _c;
20859
- const {
20860
- setFilterVisibility,
20861
- filterVisibility,
20862
- setSearchTerm,
20863
- validFilterQuery,
20864
- searchTerm,
20865
- sortByValue,
20866
- filterOptions
20867
- } = useSearchAndFilter();
20868
- const [initialSortValue, setInitialSortValue] = useState17(sortByValue);
20901
+ const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
20869
20902
  const [localeSearchTerm, setLocaleSearchTerm] = useState17("");
20870
- const [userHasChangedSortByValue, setUserHasChangedSortByValue] = useState17(false);
20871
20903
  useDebounce2(
20872
20904
  () => {
20873
20905
  setSearchTerm(localeSearchTerm);
@@ -20880,26 +20912,6 @@ var FilterControls = ({
20880
20912
  setLocaleSearchTerm("");
20881
20913
  }
20882
20914
  }, [searchTerm]);
20883
- const handleFilterToggle = (mode) => {
20884
- if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
20885
- return setFilterVisibility(void 0);
20886
- }
20887
- return setFilterVisibility(mode);
20888
- };
20889
- const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
20890
- const sortDirection = sortValue == null ? void 0 : sortValue.pop();
20891
- const sortField = sortValue == null ? void 0 : sortValue.join("_");
20892
- const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
20893
- 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;
20894
- const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
20895
- useEffectOnce(() => {
20896
- setInitialSortValue(sortByValue);
20897
- });
20898
- useEffect18(() => {
20899
- if (initialSortValue !== sortByValue) {
20900
- setUserHasChangedSortByValue(true);
20901
- }
20902
- }, [initialSortValue, sortByValue]);
20903
20915
  return /* @__PURE__ */ jsxs81(Fragment19, { children: [
20904
20916
  /* @__PURE__ */ jsx120(
20905
20917
  FilterButton2,
@@ -20907,26 +20919,13 @@ var FilterControls = ({
20907
20919
  "aria-controls": "search-and-filter-options",
20908
20920
  "aria-label": "filter options",
20909
20921
  "aria-haspopup": "true",
20910
- "aria-expanded": filterVisibility === "filters",
20922
+ text: "Filter/Sort",
20923
+ "aria-expanded": filterVisibility === true,
20911
20924
  filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
20912
- onClick: () => handleFilterToggle("filters"),
20925
+ onClick: () => setFilterVisibility(!filterVisibility),
20913
20926
  dataTestId: "filters-button"
20914
20927
  }
20915
20928
  ),
20916
- /* @__PURE__ */ jsx120(
20917
- FilterButton2,
20918
- {
20919
- "aria-controls": "search-and-filter-sortBy",
20920
- "aria-label": "sort by options",
20921
- "aria-haspopup": "true",
20922
- text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
20923
- icon: sortByIcon,
20924
- "aria-expanded": filterVisibility === "sort",
20925
- hasSelectedValue: sortByValue !== "",
20926
- onClick: () => handleFilterToggle("sort"),
20927
- dataTestId: "sort-by-button"
20928
- }
20929
- ),
20930
20929
  hideSearchInput ? null : /* @__PURE__ */ jsx120(
20931
20930
  InputKeywordSearch,
20932
20931
  {
@@ -20943,7 +20942,7 @@ var FilterControls = ({
20943
20942
  };
20944
20943
 
20945
20944
  // src/components/SearchAndFilter/FilterItem.tsx
20946
- import { useMemo as useMemo7 } from "react";
20945
+ import { useMemo as useMemo8 } from "react";
20947
20946
 
20948
20947
  // src/components/SearchAndFilter/FilterEditor.tsx
20949
20948
  import { useEffect as useEffect19, useState as useState18 } from "react";
@@ -21162,6 +21161,7 @@ var StatusMultiEditor = ({
21162
21161
  formatOptionLabel: CustomOptions,
21163
21162
  value,
21164
21163
  isDisabled,
21164
+ "aria-readonly": readOnly,
21165
21165
  styles: {
21166
21166
  menu(base) {
21167
21167
  return {
@@ -21194,6 +21194,7 @@ var StatusSingleEditor = ({
21194
21194
  formatOptionLabel: CustomOptions,
21195
21195
  value,
21196
21196
  isDisabled,
21197
+ "aria-readonly": readOnly,
21197
21198
  styles: {
21198
21199
  menu(base) {
21199
21200
  return {
@@ -21451,6 +21452,7 @@ import React24, { useEffect as useEffect20 } from "react";
21451
21452
  import { jsx as jsx123, jsxs as jsxs83 } from "@emotion/react/jsx-runtime";
21452
21453
  var SearchAndFilterOptionsContainer2 = ({
21453
21454
  buttonRow,
21455
+ sortControls,
21454
21456
  children
21455
21457
  }) => {
21456
21458
  return /* @__PURE__ */ jsxs83("div", { css: SearchAndFilterOptionsContainer, children: [
@@ -21464,17 +21466,20 @@ var SearchAndFilterOptionsContainer2 = ({
21464
21466
  justify: "space-between",
21465
21467
  children: buttonRow
21466
21468
  }
21467
- ) : null
21469
+ ) : null,
21470
+ sortControls ? /* @__PURE__ */ jsx123("div", { children: sortControls }) : null
21468
21471
  ] });
21469
21472
  };
21470
21473
  var FilterMenu = ({
21471
21474
  id,
21472
21475
  filterTitle = "Show results",
21473
21476
  menuControls,
21477
+ sortControls,
21474
21478
  children,
21475
- dataTestId
21479
+ dataTestId,
21480
+ resetButtonText = "reset"
21476
21481
  }) => {
21477
- const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
21482
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
21478
21483
  const innerMenuRef = React24.useRef(null);
21479
21484
  useEffect20(() => {
21480
21485
  var _a;
@@ -21482,247 +21487,31 @@ var FilterMenu = ({
21482
21487
  (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
21483
21488
  }
21484
21489
  }, [filterVisibility]);
21485
- return /* @__PURE__ */ jsx123(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs83(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
21486
- /* @__PURE__ */ jsx123("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
21487
- /* @__PURE__ */ jsx123(
21488
- "button",
21489
- {
21490
- type: "button",
21491
- "aria-label": "close filters",
21492
- css: [CloseBtn],
21493
- onClick: () => setFilterVisibility(void 0),
21494
- "data-testid": "close-filters",
21495
- children: /* @__PURE__ */ jsx123(Icon, { icon: "close", iconColor: "currentColor", size: "1.1rem" })
21496
- }
21497
- ),
21498
- children
21499
- ] }) : null });
21500
- };
21501
-
21502
- // src/components/SearchAndFilter/FilterItem.tsx
21503
- import { Fragment as Fragment21, jsx as jsx124, jsxs as jsxs84 } from "@emotion/react/jsx-runtime";
21504
- var FilterItem = ({
21505
- index,
21506
- paramOptions,
21507
- operatorOptions,
21508
- valueOptions,
21509
- onParamChange,
21510
- onOperatorChange,
21511
- onValueChange
21512
- }) => {
21513
- var _a, _b;
21514
- const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
21515
- const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
21516
- const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
21517
- const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
21518
- const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
21519
- const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = useMemo7(() => {
21520
- var _a2;
21521
- const currentSelectedFilter = filterOptions.find((item) => {
21522
- var _a3;
21523
- return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
21524
- });
21525
- const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
21526
- return filters[index].field === item.value;
21527
- });
21528
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
21529
- const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
21530
- return filters[index].operator === item.value;
21531
- });
21532
- const selectedMetaValue2 = valueOptions.filter((item) => {
21533
- if (Array.isArray(filters[index].value) && item.value) {
21534
- return filters[index].value.includes(item.value);
21535
- }
21536
- return filters[index].value === item.value;
21537
- });
21538
- return {
21539
- selectedFieldValue: selectedFieldValue2,
21540
- selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
21541
- selectedMetaValue: selectedMetaValue2.length > 0 ? selectedMetaValue2 : filters[index].value,
21542
- readOnly: isCurrentFieldReadOnly
21543
- };
21544
- }, [filters, filterOptions, index, operatorOptions, valueOptions]);
21545
- const readOnlyProps = readOnly ? {
21546
- "aria-readonly": true,
21547
- isSearchable: false,
21548
- menuIsOpen: false,
21549
- isClearable: false
21550
- } : {};
21551
- return /* @__PURE__ */ jsxs84("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
21552
- /* @__PURE__ */ jsx124("span", { children: index === 0 ? "Where" : "and" }),
21553
- /* @__PURE__ */ jsxs84("div", { css: ConditionalInputRow, children: [
21554
- /* @__PURE__ */ jsx124(
21555
- InputComboBox,
21556
- {
21557
- "aria-label": label,
21558
- options: paramOptions,
21559
- onChange: (e) => {
21560
- var _a2;
21561
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
21562
- },
21563
- isOptionDisabled: (option) => {
21564
- var _a2;
21565
- return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
21566
- },
21567
- styles: {
21568
- menu(base) {
21569
- return {
21570
- ...base,
21571
- minWidth: "max-content"
21572
- };
21573
- }
21574
- },
21575
- value: selectedFieldValue,
21576
- ...readOnlyProps,
21577
- id: "filter-field"
21578
- }
21579
- ),
21580
- /* @__PURE__ */ jsx124(
21581
- InputComboBox,
21582
- {
21583
- "aria-label": operatorLabel,
21584
- options: operatorOptions,
21585
- onChange: (e) => {
21586
- var _a2;
21587
- return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
21588
- },
21589
- isDisabled: !filters[index].field,
21590
- value: selectedOperatorValue,
21591
- styles: {
21592
- menu(base) {
21593
- return {
21594
- ...base,
21595
- minWidth: "max-content"
21596
- };
21597
- }
21598
- },
21599
- ...readOnlyProps,
21600
- id: "filter-operator"
21601
- }
21602
- ),
21603
- /* @__PURE__ */ jsx124(
21604
- FilterEditorRenderer,
21605
- {
21606
- "aria-label": metaDataLabel,
21607
- editorType: metaDataPossibleOptions,
21608
- options: valueOptions,
21609
- onChange: (e) => onValueChange(e != null ? e : ""),
21610
- readOnly,
21611
- isDisabled: !filters[index].operator,
21612
- value: selectedMetaValue,
21613
- valueTestId: "filter-value"
21614
- }
21615
- ),
21616
- readOnly ? null : /* @__PURE__ */ jsx124(
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(
21617
21494
  "button",
21618
21495
  {
21619
21496
  type: "button",
21620
- onClick: () => handleDeleteFilter(index),
21621
- "aria-label": "delete filter",
21622
- css: IconBtn,
21623
- "data-testid": "delete-filter",
21624
- children: /* @__PURE__ */ jsx124(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
21625
- }
21626
- )
21627
- ] })
21628
- ] });
21629
- };
21630
- var FilterItems = ({
21631
- addButtonText = "add condition",
21632
- resetButtonText = "reset filters"
21633
- }) => {
21634
- const { filterOptions, filters, setFilters, handleAddFilter, handleResetFilters, setFilterVisibility } = useSearchAndFilter();
21635
- const handleUpdateFilter = (index, prop, value) => {
21636
- var _a, _b, _c, _d, _e;
21637
- const next = [...filters];
21638
- next[index] = { ...next[index], [prop]: value };
21639
- if (prop === "operator") {
21640
- if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
21641
- next[index].value = next[index].value[0];
21642
- }
21643
- if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
21644
- next[index].value = [next[index].value, ""];
21645
- }
21646
- if (value === "def" || value === "true") {
21647
- next[index].value = "true";
21648
- }
21649
- if (value === "ndef" || value === "false") {
21650
- next[index].value = "false";
21651
- }
21652
- }
21653
- if (prop === "field") {
21654
- const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
21655
- var _a2;
21656
- return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
21657
- })) == 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";
21658
- next[index].operator = firstOperatorInAvailableOperators;
21659
- next[index].value = "";
21660
- }
21661
- setFilters(next);
21662
- };
21663
- return /* @__PURE__ */ jsx124(
21664
- FilterMenu,
21665
- {
21666
- id: "search-and-filter-options",
21667
- dataTestId: "search-and-filter-options",
21668
- menuControls: /* @__PURE__ */ jsxs84(Fragment21, { children: [
21669
- /* @__PURE__ */ jsxs84(
21670
- "button",
21671
- {
21672
- type: "button",
21673
- css: AddConditionalBtn,
21674
- onClick: handleAddFilter,
21675
- "data-testid": "add-filter",
21676
- children: [
21677
- /* @__PURE__ */ jsx124(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
21678
- addButtonText
21679
- ]
21680
- }
21681
- ),
21682
- (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx124(
21683
- "button",
21684
- {
21685
- type: "button",
21686
- css: ResetConditionsBtn,
21687
- onClick: () => {
21688
- handleResetFilters();
21689
- setFilterVisibility(void 0);
21690
- },
21691
- "data-testid": "reset-filters",
21692
- children: resetButtonText
21693
- }
21694
- ) : null
21695
- ] }),
21696
- children: filters.map((item, i) => {
21697
- var _a, _b, _c, _d, _e, _f;
21698
- const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
21699
- var _a2;
21700
- return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
21701
- })) == null ? void 0 : _a.options) != null ? _b : [];
21702
- const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
21703
- const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
21704
- return /* @__PURE__ */ jsx124(
21705
- FilterItem,
21706
- {
21707
- index: i,
21708
- paramOptions: filterOptions,
21709
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
21710
- operatorOptions: possibleOperators,
21711
- onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
21712
- onValueChange: (e) => handleUpdateFilter(i, "value", e),
21713
- valueOptions: possibleValueOptions
21497
+ css: ResetConditionsBtn,
21498
+ onClick: () => {
21499
+ handleResetFilters();
21500
+ setFilterVisibility(false);
21714
21501
  },
21715
- i
21716
- );
21717
- })
21718
- }
21719
- );
21502
+ "data-testid": "reset-filters",
21503
+ children: resetButtonText
21504
+ }
21505
+ ) : null
21506
+ ] }),
21507
+ children
21508
+ ] }) : null });
21720
21509
  };
21721
21510
 
21722
21511
  // src/components/SegmentedControl/SegmentedControl.tsx
21723
21512
  import { css as css95 } from "@emotion/react";
21724
21513
  import { CgCheck as CgCheck4 } from "@react-icons/all-files/cg/CgCheck";
21725
- import { useCallback as useCallback11, useMemo as useMemo8 } from "react";
21514
+ import { useCallback as useCallback11, useMemo as useMemo7 } from "react";
21726
21515
 
21727
21516
  // src/components/SegmentedControl/SegmentedControl.styles.ts
21728
21517
  import { css as css94 } from "@emotion/react";
@@ -21846,7 +21635,7 @@ var segmentedControlLabelContentStyles = css94`
21846
21635
  var segmentedControlLabelTextStyles = css94``;
21847
21636
 
21848
21637
  // src/components/SegmentedControl/SegmentedControl.tsx
21849
- 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";
21850
21639
  var SegmentedControl = ({
21851
21640
  name,
21852
21641
  options,
@@ -21856,6 +21645,8 @@ var SegmentedControl = ({
21856
21645
  disabled: disabled2 = false,
21857
21646
  orientation = "horizontal",
21858
21647
  size = "md",
21648
+ hideOptionText = false,
21649
+ iconSize = "1.5em",
21859
21650
  ...props
21860
21651
  }) => {
21861
21652
  const onOptionChange = useCallback11(
@@ -21866,18 +21657,19 @@ var SegmentedControl = ({
21866
21657
  },
21867
21658
  [options, onChange]
21868
21659
  );
21869
- const sizeStyles = useMemo8(() => {
21660
+ const sizeStyles = useMemo7(() => {
21870
21661
  const map = {
21871
21662
  sm: css95({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
21872
21663
  md: css95({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
21873
- 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)" })
21874
21666
  };
21875
21667
  return map[size];
21876
21668
  }, [size]);
21877
- const isIconOnly = useMemo8(() => {
21669
+ const isIconOnly = useMemo7(() => {
21878
21670
  return options.every((option) => option && option.icon && !option.label);
21879
21671
  }, [options]);
21880
- return /* @__PURE__ */ jsx125(
21672
+ return /* @__PURE__ */ jsx124(
21881
21673
  "div",
21882
21674
  {
21883
21675
  css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
@@ -21890,45 +21682,53 @@ var SegmentedControl = ({
21890
21682
  }
21891
21683
  const text = option.label ? option.label : option.icon ? null : String(option.value);
21892
21684
  const isDisabled = disabled2 || option.disabled;
21893
- return /* @__PURE__ */ jsx125(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx125("div", { css: segmentedControlItemStyles, "data-testid": "container-segmented-control", children: /* @__PURE__ */ jsxs85(
21894
- "label",
21685
+ return /* @__PURE__ */ jsx124(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx124(
21686
+ "div",
21895
21687
  {
21896
- css: [
21897
- segmentedControlLabelStyles(option.value === value, isDisabled),
21898
- sizeStyles,
21899
- isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
21900
- ],
21901
- children: [
21902
- /* @__PURE__ */ jsx125(
21903
- "input",
21904
- {
21905
- css: segmentedControlInputStyles,
21906
- type: "radio",
21907
- name,
21908
- value: index,
21909
- checked: option.value === value,
21910
- onChange: onOptionChange,
21911
- disabled: isDisabled
21912
- }
21913
- ),
21914
- option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx125(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
21915
- /* @__PURE__ */ jsxs85("span", { css: segmentedControlLabelContentStyles, children: [
21916
- !option.icon ? null : /* @__PURE__ */ jsx125(Icon, { icon: option.icon, size: "1.5em", iconColor: "currentColor" }),
21917
- !text ? null : /* @__PURE__ */ jsx125("span", { css: segmentedControlLabelTextStyles, children: text })
21918
- ] })
21919
- ]
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
+ )
21920
21719
  }
21921
- ) }) }, JSON.stringify(option.value));
21720
+ ) }, JSON.stringify(option.value));
21922
21721
  })
21923
21722
  }
21924
21723
  );
21925
21724
  };
21926
21725
 
21927
21726
  // src/components/SearchAndFilter/SortItems.tsx
21928
- import { jsx as jsx126, jsxs as jsxs86 } from "@emotion/react/jsx-runtime";
21929
- var SortItems = () => {
21727
+ import { jsx as jsx125, jsxs as jsxs85 } from "@emotion/react/jsx-runtime";
21728
+ var SortItems = ({ sortByLabel = "Sort by", localeLabel = "Locale returned" }) => {
21930
21729
  var _a, _b;
21931
- const { sortOptions, setSortBy, sortByValue } = useSearchAndFilter();
21730
+ const { sortOptions, setSortBy, sortByValue, localeValue, localeOptions, handleLocaleChange } = useSearchAndFilter();
21731
+ const hideLocaleOptions = !localeOptions;
21932
21732
  const values = sortByValue.split("_");
21933
21733
  const sortDirection = values.pop();
21934
21734
  const sortField = values.join("_");
@@ -21936,57 +21736,290 @@ var SortItems = () => {
21936
21736
  var _a2;
21937
21737
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
21938
21738
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
21939
- return /* @__PURE__ */ jsx126(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", dataTestId: "sorting-options", children: /* @__PURE__ */ jsxs86("div", { css: SortFilterInputRow, children: [
21940
- /* @__PURE__ */ jsx126(
21941
- InputComboBox,
21942
- {
21943
- options: sortOptions,
21944
- onChange: (e) => {
21945
- const fieldName = e == null ? void 0 : e.value;
21946
- setSortBy(`${fieldName}_${sortDirection}`);
21947
- },
21948
- styles: {
21949
- menu(base) {
21950
- return {
21951
- ...base,
21952
- minWidth: "max-content"
21953
- };
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
21954
21762
  }
21955
- },
21956
- value: currentSelectedOption,
21957
- id: "sort-by-field"
21958
- }
21959
- ),
21960
- /* @__PURE__ */ jsx126(
21961
- SegmentedControl,
21962
- {
21963
- noCheckmark: true,
21964
- name: "sortBy",
21965
- options: [
21966
- { label: "Ascending", value: `ASC` },
21967
- { label: "Descending", value: `DESC` }
21968
- ],
21969
- onChange: (e) => setSortBy(`${sortField}_${e}`),
21970
- value: sortDirection,
21971
- "data-testid": "ordering-options"
21972
- }
21973
- )
21974
- ] }) });
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
+ ] });
21975
21814
  };
21976
21815
 
21977
- // src/components/SearchAndFilter/FilterModeView.tsx
21978
- import { jsx as jsx127 } from "@emotion/react/jsx-runtime";
21979
- var FilterModeView = () => {
21980
- const { filterVisibility } = useSearchAndFilter();
21981
- const modeView = {
21982
- filters: /* @__PURE__ */ jsx127(FilterItems, {}),
21983
- 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);
21984
21975
  };
21985
- 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
+ );
21986
22019
  };
21987
22020
 
21988
22021
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
21989
- 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";
21990
22023
  var SearchAndFilterResultContainer = ({
21991
22024
  buttonText,
21992
22025
  clearButtonLabel = "clear",
@@ -22020,46 +22053,49 @@ var SearchAndFilterResultContainer = ({
22020
22053
  if (totalResults && totalResults > 0) {
22021
22054
  return null;
22022
22055
  }
22023
- return /* @__PURE__ */ jsxs87(Fragment22, { children: [
22056
+ return /* @__PURE__ */ jsxs87(Fragment21, { children: [
22024
22057
  /* @__PURE__ */ jsxs87(HorizontalRhythm, { children: [
22025
22058
  /* @__PURE__ */ jsxs87("span", { children: [
22026
22059
  totalResults,
22027
22060
  " results ",
22028
22061
  searchTerm ? `for "${searchTerm}"` : null
22029
22062
  ] }),
22030
- !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 })
22031
22064
  ] }),
22032
22065
  totalResults === 0 ? /* @__PURE__ */ jsxs87(Callout, { title: calloutTitle2 != null ? calloutTitle2 : automateCalloutTitle(), type: "note", children: [
22033
- calloutText ? /* @__PURE__ */ jsx128(Paragraph, { children: calloutText }) : null,
22034
- /* @__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" })
22035
22068
  ] }) : null
22036
22069
  ] });
22037
22070
  };
22038
22071
 
22039
22072
  // src/components/SearchAndFilter/SearchAndFilter.tsx
22040
- 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";
22041
22074
  var SearchAndFilter = ({
22042
22075
  filters,
22043
22076
  filterOptions,
22044
- filterMode: filterMode3,
22077
+ filterVisible,
22045
22078
  sortOptions,
22046
22079
  defaultSortByValue,
22047
22080
  filterControls,
22048
22081
  viewSwitchControls,
22049
- resultsContainerView = /* @__PURE__ */ jsx129(SearchAndFilterResultContainer, {}),
22050
- children = /* @__PURE__ */ jsx129(FilterModeView, {}),
22082
+ resultsContainerView = /* @__PURE__ */ jsx128(SearchAndFilterResultContainer, {}),
22083
+ children = /* @__PURE__ */ jsx128(FilterItems, {}),
22051
22084
  onChange,
22052
22085
  onSearchChange,
22053
22086
  onSortChange,
22087
+ onLocaleChange,
22054
22088
  totalResults,
22055
- resetFilterValues = []
22089
+ resetFilterValues = [],
22090
+ defaultLocale,
22091
+ localeOptions
22056
22092
  }) => {
22057
- return /* @__PURE__ */ jsx129(
22093
+ return /* @__PURE__ */ jsx128(
22058
22094
  SearchAndFilterProvider,
22059
22095
  {
22060
22096
  filters,
22061
22097
  filterOptions,
22062
- filterMode: filterMode3,
22098
+ filterVisible,
22063
22099
  defaultSortByValue,
22064
22100
  sortOptions,
22065
22101
  onChange,
@@ -22067,15 +22103,18 @@ var SearchAndFilter = ({
22067
22103
  onSortChange,
22068
22104
  totalResults,
22069
22105
  resetFilterValues,
22106
+ defaultLocale,
22107
+ localeOptions,
22108
+ onLocaleChange,
22070
22109
  children: /* @__PURE__ */ jsxs88(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
22071
22110
  /* @__PURE__ */ jsxs88("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
22072
- /* @__PURE__ */ jsx129(
22111
+ /* @__PURE__ */ jsx128(
22073
22112
  "div",
22074
22113
  {
22075
22114
  css: SearchAndFilterControlsWrapper(
22076
- viewSwitchControls ? "auto auto 1fr 0.5fr" : "auto auto 1fr"
22115
+ viewSwitchControls ? "auto 1fr 0.05fr" : "auto auto 1fr"
22077
22116
  ),
22078
- children: !filterControls ? /* @__PURE__ */ jsx129(FilterControls, { hideSearchInput: !onSearchChange, defaultSortByValue }) : filterControls
22117
+ children: !filterControls ? /* @__PURE__ */ jsx128(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
22079
22118
  }
22080
22119
  ),
22081
22120
  viewSwitchControls
@@ -22090,7 +22129,7 @@ var SearchAndFilter = ({
22090
22129
  // src/components/SearchAndFilter/SearchOnlyFilter.tsx
22091
22130
  import { createContext as createContext7, useState as useState19 } from "react";
22092
22131
  import { useDebounce as useDebounce4 } from "react-use";
22093
- import { jsx as jsx130 } from "@emotion/react/jsx-runtime";
22132
+ import { jsx as jsx129 } from "@emotion/react/jsx-runtime";
22094
22133
  var SearchOnlyContext = createContext7({
22095
22134
  searchTerm: "",
22096
22135
  setSearchTerm: () => {
@@ -22107,14 +22146,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
22107
22146
  300,
22108
22147
  [localeSearchTerm]
22109
22148
  );
22110
- return /* @__PURE__ */ jsx130(
22149
+ return /* @__PURE__ */ jsx129(
22111
22150
  SearchOnlyContext.Provider,
22112
22151
  {
22113
22152
  value: {
22114
22153
  searchTerm,
22115
22154
  setSearchTerm: setLocaleSearchTerm
22116
22155
  },
22117
- 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(
22118
22157
  InputKeywordSearch,
22119
22158
  {
22120
22159
  placeholder: "Search...",
@@ -22140,7 +22179,7 @@ var skeletonStyles = css96`
22140
22179
  `;
22141
22180
 
22142
22181
  // src/components/Skeleton/Skeleton.tsx
22143
- import { jsx as jsx131 } from "@emotion/react/jsx-runtime";
22182
+ import { jsx as jsx130 } from "@emotion/react/jsx-runtime";
22144
22183
  var Skeleton = ({
22145
22184
  width = "100%",
22146
22185
  height = "1.25rem",
@@ -22148,7 +22187,7 @@ var Skeleton = ({
22148
22187
  circle = false,
22149
22188
  children,
22150
22189
  ...otherProps
22151
- }) => /* @__PURE__ */ jsx131(
22190
+ }) => /* @__PURE__ */ jsx130(
22152
22191
  "div",
22153
22192
  {
22154
22193
  css: [
@@ -22255,19 +22294,19 @@ var SwitchText = css97`
22255
22294
  `;
22256
22295
 
22257
22296
  // src/components/Switch/Switch.tsx
22258
- 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";
22259
22298
  var Switch = React26.forwardRef(
22260
22299
  ({ label, infoText, toggleText, children, ...inputProps }, ref) => {
22261
22300
  let additionalText = infoText;
22262
22301
  if (infoText && toggleText) {
22263
22302
  additionalText = inputProps.checked ? toggleText : infoText;
22264
22303
  }
22265
- return /* @__PURE__ */ jsxs89(Fragment23, { children: [
22304
+ return /* @__PURE__ */ jsxs89(Fragment22, { children: [
22266
22305
  /* @__PURE__ */ jsxs89("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
22267
- /* @__PURE__ */ jsx132("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
22268
- /* @__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 })
22269
22308
  ] }),
22270
- additionalText ? /* @__PURE__ */ jsx132("p", { css: SwitchText, children: additionalText }) : null,
22309
+ additionalText ? /* @__PURE__ */ jsx131("p", { css: SwitchText, children: additionalText }) : null,
22271
22310
  children
22272
22311
  ] });
22273
22312
  }
@@ -22304,40 +22343,40 @@ var tableCellHead = css98`
22304
22343
  `;
22305
22344
 
22306
22345
  // src/components/Table/Table.tsx
22307
- import { jsx as jsx133 } from "@emotion/react/jsx-runtime";
22346
+ import { jsx as jsx132 } from "@emotion/react/jsx-runtime";
22308
22347
  var Table = React27.forwardRef(
22309
22348
  ({ children, cellPadding, ...otherProps }, ref) => {
22310
- return /* @__PURE__ */ jsx133("table", { ref, css: table({ cellPadding }), ...otherProps, children });
22349
+ return /* @__PURE__ */ jsx132("table", { ref, css: table({ cellPadding }), ...otherProps, children });
22311
22350
  }
22312
22351
  );
22313
22352
  var TableHead = React27.forwardRef(
22314
22353
  ({ children, ...otherProps }, ref) => {
22315
- return /* @__PURE__ */ jsx133("thead", { ref, css: tableHead, ...otherProps, children });
22354
+ return /* @__PURE__ */ jsx132("thead", { ref, css: tableHead, ...otherProps, children });
22316
22355
  }
22317
22356
  );
22318
22357
  var TableBody = React27.forwardRef(
22319
22358
  ({ children, ...otherProps }, ref) => {
22320
- return /* @__PURE__ */ jsx133("tbody", { ref, ...otherProps, children });
22359
+ return /* @__PURE__ */ jsx132("tbody", { ref, ...otherProps, children });
22321
22360
  }
22322
22361
  );
22323
22362
  var TableFoot = React27.forwardRef(
22324
22363
  ({ children, ...otherProps }, ref) => {
22325
- return /* @__PURE__ */ jsx133("tfoot", { ref, ...otherProps, children });
22364
+ return /* @__PURE__ */ jsx132("tfoot", { ref, ...otherProps, children });
22326
22365
  }
22327
22366
  );
22328
22367
  var TableRow = React27.forwardRef(
22329
22368
  ({ children, ...otherProps }, ref) => {
22330
- return /* @__PURE__ */ jsx133("tr", { ref, css: tableRow, ...otherProps, children });
22369
+ return /* @__PURE__ */ jsx132("tr", { ref, css: tableRow, ...otherProps, children });
22331
22370
  }
22332
22371
  );
22333
22372
  var TableCellHead = React27.forwardRef(
22334
22373
  ({ children, ...otherProps }, ref) => {
22335
- return /* @__PURE__ */ jsx133("th", { ref, css: tableCellHead, ...otherProps, children });
22374
+ return /* @__PURE__ */ jsx132("th", { ref, css: tableCellHead, ...otherProps, children });
22336
22375
  }
22337
22376
  );
22338
22377
  var TableCellData = React27.forwardRef(
22339
22378
  ({ children, ...otherProps }, ref) => {
22340
- return /* @__PURE__ */ jsx133("td", { ref, ...otherProps, children });
22379
+ return /* @__PURE__ */ jsx132("td", { ref, ...otherProps, children });
22341
22380
  }
22342
22381
  );
22343
22382
 
@@ -22377,7 +22416,7 @@ var tabButtonGroupStyles = css99`
22377
22416
  `;
22378
22417
 
22379
22418
  // src/components/Tabs/Tabs.tsx
22380
- import { jsx as jsx134 } from "@emotion/react/jsx-runtime";
22419
+ import { jsx as jsx133 } from "@emotion/react/jsx-runtime";
22381
22420
  var useCurrentTab = () => {
22382
22421
  const context = useAriakitTabStore();
22383
22422
  if (!context) {
@@ -22415,23 +22454,23 @@ var Tabs = ({
22415
22454
  tab.setSelectedId(selected);
22416
22455
  }
22417
22456
  }, [selected, tab]);
22418
- return /* @__PURE__ */ jsx134(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
22457
+ return /* @__PURE__ */ jsx133(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
22419
22458
  };
22420
22459
  var TabButtonGroup = ({ children, ...props }) => {
22421
- return /* @__PURE__ */ jsx134(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
22460
+ return /* @__PURE__ */ jsx133(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
22422
22461
  };
22423
22462
  var TabButton = ({
22424
22463
  children,
22425
22464
  id,
22426
22465
  ...props
22427
22466
  }) => {
22428
- return /* @__PURE__ */ jsx134(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
22467
+ return /* @__PURE__ */ jsx133(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
22429
22468
  };
22430
22469
  var TabContent = ({
22431
22470
  children,
22432
22471
  ...props
22433
22472
  }) => {
22434
- return /* @__PURE__ */ jsx134(AriakitTabPanel, { ...props, children });
22473
+ return /* @__PURE__ */ jsx133(AriakitTabPanel, { ...props, children });
22435
22474
  };
22436
22475
 
22437
22476
  // src/components/Toast/Toast.tsx
@@ -22662,9 +22701,9 @@ var toastContainerStyles = css100`
22662
22701
  `;
22663
22702
 
22664
22703
  // src/components/Toast/Toast.tsx
22665
- import { jsx as jsx135 } from "@emotion/react/jsx-runtime";
22704
+ import { jsx as jsx134 } from "@emotion/react/jsx-runtime";
22666
22705
  var ToastContainer = ({ limit = 4 }) => {
22667
- return /* @__PURE__ */ jsx135(
22706
+ return /* @__PURE__ */ jsx134(
22668
22707
  ToastifyContainer,
22669
22708
  {
22670
22709
  css: toastContainerStyles,
@@ -22766,6 +22805,7 @@ export {
22766
22805
  ModalDialog,
22767
22806
  MultilineChip,
22768
22807
  NUMBER_OPERATORS,
22808
+ PUBLISH_STATUS_FIELD_OPERATORS,
22769
22809
  PageHeaderSection,
22770
22810
  Pagination,
22771
22811
  Paragraph,