@uniformdev/design-system 19.136.0 → 19.137.1-alpha.4

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
@@ -20261,7 +20261,7 @@ var NUMBER_OPERATORS = [
20261
20261
  editorType: "number"
20262
20262
  },
20263
20263
  {
20264
- label: "is empty...",
20264
+ label: "is empty",
20265
20265
  value: "ndef",
20266
20266
  editorType: "empty"
20267
20267
  },
@@ -20271,7 +20271,7 @@ var NUMBER_OPERATORS = [
20271
20271
  editorType: "numberRange"
20272
20272
  },
20273
20273
  {
20274
- label: "is not empty...",
20274
+ label: "is not empty",
20275
20275
  value: "def",
20276
20276
  editorType: "empty"
20277
20277
  }
@@ -20308,7 +20308,7 @@ var DATE_OPERATORS = [
20308
20308
  editorType: "date"
20309
20309
  },
20310
20310
  {
20311
- label: "is empty...",
20311
+ label: "is empty",
20312
20312
  value: "ndef",
20313
20313
  editorType: "empty"
20314
20314
  },
@@ -20318,7 +20318,7 @@ var DATE_OPERATORS = [
20318
20318
  editorType: "date"
20319
20319
  },
20320
20320
  {
20321
- label: "is not empty...",
20321
+ label: "is not empty",
20322
20322
  value: "def",
20323
20323
  editorType: "empty"
20324
20324
  }
@@ -20330,7 +20330,7 @@ var TEXTBOX_OPERATORS = [
20330
20330
  editorType: "text"
20331
20331
  },
20332
20332
  {
20333
- label: "is empty...",
20333
+ label: "is empty",
20334
20334
  value: "ndef",
20335
20335
  editorType: "empty"
20336
20336
  },
@@ -20345,7 +20345,7 @@ var TEXTBOX_OPERATORS = [
20345
20345
  editorType: "text"
20346
20346
  },
20347
20347
  {
20348
- label: "is not empty...",
20348
+ label: "is not empty",
20349
20349
  value: "def",
20350
20350
  editorType: "empty"
20351
20351
  }
@@ -20406,7 +20406,7 @@ var SYSTEM_DATE_OPERATORS = [
20406
20406
  ];
20407
20407
  var RICHTEXT_OPERATORS = [
20408
20408
  {
20409
- label: "is empty...",
20409
+ label: "is empty",
20410
20410
  value: "ndef",
20411
20411
  editorType: "empty"
20412
20412
  },
@@ -20416,7 +20416,7 @@ var RICHTEXT_OPERATORS = [
20416
20416
  editorType: "text"
20417
20417
  },
20418
20418
  {
20419
- label: "is not empty...",
20419
+ label: "is not empty",
20420
20420
  value: "def",
20421
20421
  editorType: "empty"
20422
20422
  }
@@ -20544,7 +20544,7 @@ var ConditionalInputRow = css92`
20544
20544
  width: calc(100% - 48px);
20545
20545
  }
20546
20546
  }
20547
- ${cq("580px")} {
20547
+ ${cq("764px")} {
20548
20548
  display: grid;
20549
20549
  grid-template-columns: 200px 160px 1fr 32px;
20550
20550
 
@@ -20740,8 +20740,8 @@ var FilterButton2 = ({
20740
20740
  };
20741
20741
 
20742
20742
  // src/components/SearchAndFilter/FilterControls.tsx
20743
- import { useEffect as useEffect18, useState as useState17 } from "react";
20744
- import { useDebounce as useDebounce2 } from "react-use";
20743
+ import { useEffect as useEffect19, useState as useState18 } from "react";
20744
+ import { useDebounce as useDebounce3 } from "react-use";
20745
20745
 
20746
20746
  // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
20747
20747
  import {
@@ -20749,204 +20749,14 @@ import {
20749
20749
  useCallback as useCallback10,
20750
20750
  useContext as useContext7,
20751
20751
  useDeferredValue as useDeferredValue2,
20752
- useEffect as useEffect17,
20752
+ useEffect as useEffect18,
20753
20753
  useMemo as useMemo6,
20754
- useState as useState16
20754
+ useState as useState17
20755
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";
20946
20756
 
20947
20757
  // src/components/SearchAndFilter/FilterEditor.tsx
20948
- import { useEffect as useEffect19, useState as useState18 } from "react";
20949
- import { useDebounce as useDebounce3 } from "react-use";
20758
+ import { useEffect as useEffect17, useState as useState16 } from "react";
20759
+ import { useDebounce as useDebounce2 } from "react-use";
20950
20760
 
20951
20761
  // src/components/Validation/StatusBullet.styles.ts
20952
20762
  import { css as css93 } from "@emotion/react";
@@ -21028,7 +20838,7 @@ var StatusDeleted = css93`
21028
20838
  `;
21029
20839
 
21030
20840
  // src/components/Validation/StatusBullet.tsx
21031
- import { jsx as jsx121 } from "@emotion/react/jsx-runtime";
20841
+ import { jsx as jsx119 } from "@emotion/react/jsx-runtime";
21032
20842
  var StatusBullet = ({
21033
20843
  status,
21034
20844
  hideText = false,
@@ -21048,7 +20858,7 @@ var StatusBullet = ({
21048
20858
  Deleted: StatusDeleted
21049
20859
  };
21050
20860
  const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
21051
- return /* @__PURE__ */ jsx121(
20861
+ return /* @__PURE__ */ jsx119(
21052
20862
  "span",
21053
20863
  {
21054
20864
  role: "status",
@@ -21061,7 +20871,7 @@ var StatusBullet = ({
21061
20871
  };
21062
20872
 
21063
20873
  // src/components/SearchAndFilter/FilterEditor.tsx
21064
- import { Fragment as Fragment20, jsx as jsx122, jsxs as jsxs82 } from "@emotion/react/jsx-runtime";
20874
+ import { Fragment as Fragment19, jsx as jsx120, jsxs as jsxs81 } from "@emotion/react/jsx-runtime";
21065
20875
  var readOnlyAttributes = {
21066
20876
  isSearchable: false,
21067
20877
  menuIsOpen: false,
@@ -21070,13 +20880,13 @@ var readOnlyAttributes = {
21070
20880
  var FilterMultiChoiceEditor = ({
21071
20881
  value,
21072
20882
  options,
21073
- isDisabled,
20883
+ disabled: disabled2,
21074
20884
  readOnly,
21075
20885
  valueTestId,
21076
20886
  ...props
21077
20887
  }) => {
21078
20888
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
21079
- return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20889
+ return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21080
20890
  InputComboBox,
21081
20891
  {
21082
20892
  ...props,
@@ -21084,12 +20894,12 @@ var FilterMultiChoiceEditor = ({
21084
20894
  options,
21085
20895
  isMulti: true,
21086
20896
  isClearable: true,
21087
- isDisabled,
20897
+ isDisabled: disabled2,
21088
20898
  onChange: (e) => {
21089
20899
  var _a;
21090
- return props.onChange((_a = e.map((item) => item.value)) != null ? _a : []);
20900
+ return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
21091
20901
  },
21092
- value,
20902
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
21093
20903
  "aria-readonly": readOnly,
21094
20904
  styles: {
21095
20905
  menu(base) {
@@ -21106,13 +20916,13 @@ var FilterMultiChoiceEditor = ({
21106
20916
  var FilterSingleChoiceEditor = ({
21107
20917
  options,
21108
20918
  value,
21109
- isDisabled,
20919
+ disabled: disabled2,
21110
20920
  readOnly,
21111
20921
  onChange,
21112
20922
  valueTestId
21113
20923
  }) => {
21114
20924
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
21115
- return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20925
+ return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21116
20926
  InputComboBox,
21117
20927
  {
21118
20928
  placeholder: "Type to search...",
@@ -21122,8 +20932,8 @@ var FilterSingleChoiceEditor = ({
21122
20932
  var _a;
21123
20933
  return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
21124
20934
  },
21125
- isDisabled,
21126
- value,
20935
+ isDisabled: disabled2,
20936
+ value: options == null ? void 0 : options.find((option) => option.value === value),
21127
20937
  "aria-readonly": readOnly,
21128
20938
  styles: {
21129
20939
  menu(base) {
@@ -21138,18 +20948,18 @@ var FilterSingleChoiceEditor = ({
21138
20948
  ) });
21139
20949
  };
21140
20950
  var CustomOptions = ({ label, value }) => {
21141
- return /* @__PURE__ */ jsx122(StatusBullet, { status: label, message: value });
20951
+ return /* @__PURE__ */ jsx120(StatusBullet, { status: label, message: value });
21142
20952
  };
21143
20953
  var StatusMultiEditor = ({
21144
20954
  options,
21145
20955
  value,
21146
- isDisabled,
20956
+ disabled: disabled2,
21147
20957
  readOnly,
21148
20958
  onChange,
21149
20959
  valueTestId
21150
20960
  }) => {
21151
20961
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
21152
- return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20962
+ return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21153
20963
  InputComboBox,
21154
20964
  {
21155
20965
  options,
@@ -21159,9 +20969,9 @@ var StatusMultiEditor = ({
21159
20969
  return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
21160
20970
  },
21161
20971
  formatOptionLabel: CustomOptions,
21162
- value,
21163
- isDisabled,
21164
20972
  "aria-readonly": readOnly,
20973
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
20974
+ isDisabled: disabled2,
21165
20975
  styles: {
21166
20976
  menu(base) {
21167
20977
  return {
@@ -21177,13 +20987,13 @@ var StatusMultiEditor = ({
21177
20987
  var StatusSingleEditor = ({
21178
20988
  options,
21179
20989
  value,
21180
- isDisabled,
20990
+ disabled: disabled2,
21181
20991
  readOnly,
21182
20992
  onChange,
21183
20993
  valueTestId
21184
20994
  }) => {
21185
20995
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
21186
- return /* @__PURE__ */ jsx122("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx122(
20996
+ return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
21187
20997
  InputComboBox,
21188
20998
  {
21189
20999
  options,
@@ -21192,9 +21002,9 @@ var StatusSingleEditor = ({
21192
21002
  return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
21193
21003
  },
21194
21004
  formatOptionLabel: CustomOptions,
21195
- value,
21196
- isDisabled,
21197
21005
  "aria-readonly": readOnly,
21006
+ value: options == null ? void 0 : options.find((option) => option.value === value),
21007
+ isDisabled: disabled2,
21198
21008
  styles: {
21199
21009
  menu(base) {
21200
21010
  return {
@@ -21207,9 +21017,15 @@ var StatusSingleEditor = ({
21207
21017
  }
21208
21018
  ) });
21209
21019
  };
21210
- var TextEditor = ({ onChange, ariaLabel, value, readOnly, valueTestId }) => {
21211
- useDebounce3(() => onChange, 500, [value]);
21212
- return /* @__PURE__ */ jsx122(
21020
+ var TextEditor = ({
21021
+ onChange,
21022
+ ariaLabel,
21023
+ value,
21024
+ readOnly,
21025
+ valueTestId
21026
+ }) => {
21027
+ useDebounce2(() => onChange, 500, [value]);
21028
+ return /* @__PURE__ */ jsx120(
21213
21029
  Input,
21214
21030
  {
21215
21031
  showLabel: false,
@@ -21230,10 +21046,10 @@ var NumberRangeEditor = ({
21230
21046
  readOnly,
21231
21047
  valueTestId
21232
21048
  }) => {
21233
- const [minValue, setMinValue] = useState18("");
21234
- const [maxValue, setMaxValue] = useState18("");
21235
- const [error, setError] = useState18("");
21236
- useEffect19(() => {
21049
+ const [minValue, setMinValue] = useState16("");
21050
+ const [maxValue, setMaxValue] = useState16("");
21051
+ const [error, setError] = useState16("");
21052
+ useEffect17(() => {
21237
21053
  if (!maxValue && !minValue) {
21238
21054
  return;
21239
21055
  }
@@ -21252,9 +21068,9 @@ var NumberRangeEditor = ({
21252
21068
  setError("");
21253
21069
  onChange([minValue, maxValue]);
21254
21070
  }, [maxValue, minValue, setError]);
21255
- return /* @__PURE__ */ jsxs82(Fragment20, { children: [
21256
- /* @__PURE__ */ jsxs82("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21257
- /* @__PURE__ */ jsx122(
21071
+ return /* @__PURE__ */ jsxs81(Fragment19, { children: [
21072
+ /* @__PURE__ */ jsxs81("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21073
+ /* @__PURE__ */ jsx120(
21258
21074
  Input,
21259
21075
  {
21260
21076
  label: `${ariaLabel}-min`,
@@ -21269,7 +21085,7 @@ var NumberRangeEditor = ({
21269
21085
  readOnly
21270
21086
  }
21271
21087
  ),
21272
- /* @__PURE__ */ jsx122(
21088
+ /* @__PURE__ */ jsx120(
21273
21089
  Input,
21274
21090
  {
21275
21091
  type: "number",
@@ -21285,7 +21101,7 @@ var NumberRangeEditor = ({
21285
21101
  }
21286
21102
  )
21287
21103
  ] }),
21288
- /* @__PURE__ */ jsx122(ErrorContainer, { errorMessage: error })
21104
+ /* @__PURE__ */ jsx120(ErrorContainer, { errorMessage: error })
21289
21105
  ] });
21290
21106
  };
21291
21107
  var NumberEditor = ({
@@ -21296,7 +21112,7 @@ var NumberEditor = ({
21296
21112
  readOnly,
21297
21113
  valueTestId
21298
21114
  }) => {
21299
- return /* @__PURE__ */ jsx122(
21115
+ return /* @__PURE__ */ jsx120(
21300
21116
  Input,
21301
21117
  {
21302
21118
  label: ariaLabel,
@@ -21319,7 +21135,7 @@ var DateEditor = ({
21319
21135
  readOnly,
21320
21136
  valueTestId
21321
21137
  }) => {
21322
- return /* @__PURE__ */ jsx122(
21138
+ return /* @__PURE__ */ jsx120(
21323
21139
  Input,
21324
21140
  {
21325
21141
  type: "date",
@@ -21341,10 +21157,10 @@ var DateRangeEditor = ({
21341
21157
  readOnly,
21342
21158
  valueTestId
21343
21159
  }) => {
21344
- const [minDateValue, setMinDateValue] = useState18(value ? value[0] : "");
21345
- const [maxDateValue, setMaxDateValue] = useState18(value ? value[1] : "");
21346
- const [error, setError] = useState18("");
21347
- useEffect19(() => {
21160
+ const [minDateValue, setMinDateValue] = useState16(value ? value[0] : "");
21161
+ const [maxDateValue, setMaxDateValue] = useState16(value ? value[1] : "");
21162
+ const [error, setError] = useState16("");
21163
+ useEffect17(() => {
21348
21164
  if (!minDateValue || !maxDateValue) {
21349
21165
  return;
21350
21166
  }
@@ -21375,9 +21191,9 @@ var DateRangeEditor = ({
21375
21191
  setError("");
21376
21192
  onChange([minDateValue, maxDateValue]);
21377
21193
  }, [minDateValue, maxDateValue, setError]);
21378
- return /* @__PURE__ */ jsxs82(Fragment20, { children: [
21379
- /* @__PURE__ */ jsxs82("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21380
- /* @__PURE__ */ jsx122(
21194
+ return /* @__PURE__ */ jsxs81(Fragment19, { children: [
21195
+ /* @__PURE__ */ jsxs81("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
21196
+ /* @__PURE__ */ jsx120(
21381
21197
  Input,
21382
21198
  {
21383
21199
  label: `${ariaLabel}-min-date`,
@@ -21390,7 +21206,7 @@ var DateRangeEditor = ({
21390
21206
  readOnly
21391
21207
  }
21392
21208
  ),
21393
- /* @__PURE__ */ jsx122(
21209
+ /* @__PURE__ */ jsx120(
21394
21210
  Input,
21395
21211
  {
21396
21212
  label: `${ariaLabel}-max-date`,
@@ -21404,18 +21220,19 @@ var DateRangeEditor = ({
21404
21220
  }
21405
21221
  )
21406
21222
  ] }),
21407
- /* @__PURE__ */ jsx122(ErrorContainer, { errorMessage: error })
21223
+ /* @__PURE__ */ jsx120(ErrorContainer, { errorMessage: error })
21408
21224
  ] });
21409
21225
  };
21410
21226
  var FilterEditorRenderer = ({ editorType, ...props }) => {
21411
- const Editor = filterMapper[editorType];
21227
+ const { filterMapper: contextFilterMapper } = useSearchAndFilter();
21228
+ const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
21412
21229
  if (!Editor) {
21413
21230
  return null;
21414
21231
  }
21415
21232
  if (editorType === "empty") {
21416
21233
  return null;
21417
21234
  }
21418
- return /* @__PURE__ */ jsx122(Editor, { ...props, disabled: props.isDisabled });
21235
+ return /* @__PURE__ */ jsx120(Editor, { ...props });
21419
21236
  };
21420
21237
  var filterMapper = {
21421
21238
  multiChoice: FilterMultiChoiceEditor,
@@ -21430,14 +21247,14 @@ var filterMapper = {
21430
21247
  empty: null
21431
21248
  };
21432
21249
  var ErrorContainer = ({ errorMessage }) => {
21433
- return /* @__PURE__ */ jsx122(
21250
+ return /* @__PURE__ */ jsx120(
21434
21251
  "div",
21435
21252
  {
21436
21253
  css: {
21437
21254
  gridColumn: "span 6",
21438
21255
  order: 6
21439
21256
  },
21440
- children: /* @__PURE__ */ jsx122(FieldMessage, { errorMessage })
21257
+ children: /* @__PURE__ */ jsx120(FieldMessage, { errorMessage })
21441
21258
  }
21442
21259
  );
21443
21260
  };
@@ -21447,6 +21264,201 @@ var twoColumnGrid = {
21447
21264
  gap: "var(--spacing-sm);"
21448
21265
  };
21449
21266
 
21267
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
21268
+ import { jsx as jsx121 } from "@emotion/react/jsx-runtime";
21269
+ var SearchAndFilterContext = createContext6({
21270
+ searchTerm: "",
21271
+ setSearchTerm: () => {
21272
+ },
21273
+ filterVisibility: void 0,
21274
+ setFilterVisibility: () => {
21275
+ },
21276
+ filters: [],
21277
+ setFilters: () => {
21278
+ },
21279
+ handleAddFilter: () => {
21280
+ },
21281
+ handleResetFilters: () => {
21282
+ },
21283
+ handleDeleteFilter: () => {
21284
+ },
21285
+ handleLocaleChange: () => {
21286
+ },
21287
+ setSortBy: () => {
21288
+ },
21289
+ sortByValue: "",
21290
+ filterOptions: [],
21291
+ sortOptions: [],
21292
+ validFilterQuery: [],
21293
+ filterMapper: {},
21294
+ totalResults: 0,
21295
+ localeOptions: [],
21296
+ localeValue: ""
21297
+ });
21298
+ var SearchAndFilterProvider = ({
21299
+ filters,
21300
+ filterOptions,
21301
+ sortOptions,
21302
+ defaultSortByValue,
21303
+ defaultLocale = "",
21304
+ localeOptions,
21305
+ onLocaleChange,
21306
+ filterVisible = false,
21307
+ onSearchChange,
21308
+ onChange,
21309
+ onSortChange,
21310
+ resetFilterValues = [{ field: "", operator: "", value: "" }],
21311
+ totalResults,
21312
+ filterMapper: filterMapper2 = filterMapper,
21313
+ children
21314
+ }) => {
21315
+ const [searchTerm, setSearchTerm] = useState17("");
21316
+ const deferredSearchTerm = useDeferredValue2(searchTerm);
21317
+ const [filterVisibility, setFilterVisibility] = useState17(filterVisible);
21318
+ const [sortByValue, setSortByValue] = useState17(defaultSortByValue);
21319
+ const [localeValue, setLocale] = useState17(defaultLocale);
21320
+ const handleSearchTerm = useCallback10(
21321
+ (term) => {
21322
+ setSearchTerm(term);
21323
+ onSearchChange == null ? void 0 : onSearchChange(term);
21324
+ },
21325
+ [setSearchTerm, onSearchChange]
21326
+ );
21327
+ const handleLocaleChange = useCallback10(
21328
+ (locale) => {
21329
+ setLocale(locale);
21330
+ onLocaleChange == null ? void 0 : onLocaleChange(locale);
21331
+ },
21332
+ [onLocaleChange]
21333
+ );
21334
+ const handleOnSortChange = useCallback10(
21335
+ (sort) => {
21336
+ setSortByValue(sort);
21337
+ onSortChange(sort);
21338
+ },
21339
+ [onSortChange]
21340
+ );
21341
+ const handleToggleFilterVisibilty = useCallback10(
21342
+ (visible) => setFilterVisibility(visible),
21343
+ [setFilterVisibility]
21344
+ );
21345
+ const handleAddFilter = useCallback10(() => {
21346
+ onChange([...filters, { field: "", operator: "", value: "" }]);
21347
+ }, [filters, onChange]);
21348
+ const handleResetFilters = useCallback10(() => {
21349
+ onChange(resetFilterValues);
21350
+ }, [onChange, resetFilterValues]);
21351
+ const handleDeleteFilter = useCallback10(
21352
+ (index) => {
21353
+ const remainingFilters = filters.filter((_, i) => i !== index);
21354
+ onChange(remainingFilters);
21355
+ },
21356
+ [filters, onChange]
21357
+ );
21358
+ const validFilterQuery = useMemo6(() => {
21359
+ const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
21360
+ if (hasValidFilters) {
21361
+ return filters;
21362
+ }
21363
+ }, [filters]);
21364
+ useEffect18(() => {
21365
+ if (filterVisibility) {
21366
+ const handleEscKeyFilterClose = (e) => {
21367
+ if (e.key === "Escape") {
21368
+ setFilterVisibility(false);
21369
+ }
21370
+ };
21371
+ document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
21372
+ return () => {
21373
+ document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
21374
+ };
21375
+ }
21376
+ }, [filterVisibility]);
21377
+ return /* @__PURE__ */ jsx121(
21378
+ SearchAndFilterContext.Provider,
21379
+ {
21380
+ value: {
21381
+ searchTerm: deferredSearchTerm,
21382
+ setSearchTerm: (e) => handleSearchTerm(e),
21383
+ setSortBy: (e) => handleOnSortChange(e),
21384
+ sortByValue,
21385
+ filterVisibility,
21386
+ setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
21387
+ filters,
21388
+ setFilters: (e) => onChange(e),
21389
+ handleAddFilter,
21390
+ handleResetFilters,
21391
+ handleDeleteFilter,
21392
+ filterOptions,
21393
+ sortOptions,
21394
+ validFilterQuery,
21395
+ totalResults,
21396
+ localeOptions,
21397
+ localeValue,
21398
+ handleLocaleChange,
21399
+ filterMapper: filterMapper2
21400
+ },
21401
+ children: /* @__PURE__ */ jsx121(VerticalRhythm, { children })
21402
+ }
21403
+ );
21404
+ };
21405
+ var useSearchAndFilter = () => {
21406
+ const value = useContext7(SearchAndFilterContext);
21407
+ return { ...value };
21408
+ };
21409
+
21410
+ // src/components/SearchAndFilter/FilterControls.tsx
21411
+ import { Fragment as Fragment20, jsx as jsx122, jsxs as jsxs82 } from "@emotion/react/jsx-runtime";
21412
+ var FilterControls = ({
21413
+ children,
21414
+ hideSearchInput
21415
+ }) => {
21416
+ const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
21417
+ const [localeSearchTerm, setLocaleSearchTerm] = useState18("");
21418
+ useDebounce3(
21419
+ () => {
21420
+ setSearchTerm(localeSearchTerm);
21421
+ },
21422
+ 300,
21423
+ [localeSearchTerm, searchTerm]
21424
+ );
21425
+ useEffect19(() => {
21426
+ if (searchTerm === "") {
21427
+ setLocaleSearchTerm("");
21428
+ }
21429
+ }, [searchTerm]);
21430
+ return /* @__PURE__ */ jsxs82(Fragment20, { children: [
21431
+ /* @__PURE__ */ jsx122(
21432
+ FilterButton2,
21433
+ {
21434
+ "aria-controls": "search-and-filter-options",
21435
+ "aria-label": "filter options",
21436
+ "aria-haspopup": "true",
21437
+ text: "Filter/Sort",
21438
+ "aria-expanded": filterVisibility === true,
21439
+ filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
21440
+ onClick: () => setFilterVisibility(!filterVisibility),
21441
+ dataTestId: "filters-button"
21442
+ }
21443
+ ),
21444
+ hideSearchInput ? null : /* @__PURE__ */ jsx122(
21445
+ InputKeywordSearch,
21446
+ {
21447
+ placeholder: "Search...",
21448
+ onSearchTextChanged: (e) => setLocaleSearchTerm(e),
21449
+ value: localeSearchTerm,
21450
+ compact: true,
21451
+ rounded: true,
21452
+ css: SearchInput
21453
+ }
21454
+ ),
21455
+ children
21456
+ ] });
21457
+ };
21458
+
21459
+ // src/components/SearchAndFilter/FilterItem.tsx
21460
+ import { useMemo as useMemo8 } from "react";
21461
+
21450
21462
  // src/components/SearchAndFilter/FilterMenu.tsx
21451
21463
  import React24, { useEffect as useEffect20 } from "react";
21452
21464
  import { jsx as jsx123, jsxs as jsxs83 } from "@emotion/react/jsx-runtime";
@@ -21830,7 +21842,7 @@ var FilterItem = ({
21830
21842
  const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
21831
21843
  const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
21832
21844
  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(() => {
21845
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo8(() => {
21834
21846
  var _a2;
21835
21847
  const currentSelectedFilter = filterOptions.find((item) => {
21836
21848
  var _a3;
@@ -21843,19 +21855,14 @@ var FilterItem = ({
21843
21855
  const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
21844
21856
  return filters[index].operator === item.value;
21845
21857
  });
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
21858
  return {
21853
21859
  selectedFieldValue: selectedFieldValue2,
21854
21860
  selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
21855
- selectedMetaValue: selectedMetaValue2.length > 0 ? selectedMetaValue2 : filters[index].value,
21856
- readOnly: isCurrentFieldReadOnly
21861
+ selectedMetaValue: filters[index].value,
21862
+ readOnly: isCurrentFieldReadOnly,
21863
+ bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
21857
21864
  };
21858
- }, [filters, filterOptions, index, operatorOptions, valueOptions]);
21865
+ }, [filters, filterOptions, index, operatorOptions]);
21859
21866
  const readOnlyProps = readOnly ? {
21860
21867
  "aria-readonly": true,
21861
21868
  isSearchable: false,
@@ -21924,7 +21931,8 @@ var FilterItem = ({
21924
21931
  options: valueOptions,
21925
21932
  onChange: (e) => onValueChange(e != null ? e : ""),
21926
21933
  readOnly,
21927
- isDisabled: !filters[index].operator,
21934
+ bindable,
21935
+ disabled: !filters[index].operator,
21928
21936
  value: selectedMetaValue,
21929
21937
  valueTestId: "filter-value"
21930
21938
  }
@@ -22081,6 +22089,7 @@ var SearchAndFilter = ({
22081
22089
  viewSwitchControls,
22082
22090
  resultsContainerView = /* @__PURE__ */ jsx128(SearchAndFilterResultContainer, {}),
22083
22091
  children = /* @__PURE__ */ jsx128(FilterItems, {}),
22092
+ filterMapper: filterMapper2 = filterMapper,
22084
22093
  onChange,
22085
22094
  onSearchChange,
22086
22095
  onSortChange,
@@ -22106,6 +22115,7 @@ var SearchAndFilter = ({
22106
22115
  defaultLocale,
22107
22116
  localeOptions,
22108
22117
  onLocaleChange,
22118
+ filterMapper: filterMapper2,
22109
22119
  children: /* @__PURE__ */ jsxs88(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
22110
22120
  /* @__PURE__ */ jsxs88("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
22111
22121
  /* @__PURE__ */ jsx128(
@@ -22741,6 +22751,8 @@ export {
22741
22751
  CurrentDrawerContext,
22742
22752
  DATE_OPERATORS,
22743
22753
  DashedBox,
22754
+ DateEditor,
22755
+ DateRangeEditor,
22744
22756
  DateTimePicker,
22745
22757
  DateTimePickerVariant,
22746
22758
  DebouncedInputKeywordSearch,
@@ -22756,9 +22768,12 @@ export {
22756
22768
  Fieldset,
22757
22769
  FilterButton2 as FilterButton,
22758
22770
  FilterControls,
22771
+ FilterEditorRenderer,
22759
22772
  FilterItem,
22760
22773
  FilterItems,
22761
22774
  FilterMenu,
22775
+ FilterMultiChoiceEditor,
22776
+ FilterSingleChoiceEditor,
22762
22777
  Heading,
22763
22778
  HexModalBackground,
22764
22779
  HorizontalRhythm,
@@ -22805,6 +22820,8 @@ export {
22805
22820
  ModalDialog,
22806
22821
  MultilineChip,
22807
22822
  NUMBER_OPERATORS,
22823
+ NumberEditor,
22824
+ NumberRangeEditor,
22808
22825
  PUBLISH_STATUS_FIELD_OPERATORS,
22809
22826
  PageHeaderSection,
22810
22827
  Pagination,
@@ -22858,6 +22875,8 @@ export {
22858
22875
  ShortcutRevealer,
22859
22876
  Skeleton,
22860
22877
  StatusBullet,
22878
+ StatusMultiEditor,
22879
+ StatusSingleEditor,
22861
22880
  SuccessMessage,
22862
22881
  Switch,
22863
22882
  TAKEOVER_STACK_ID,
@@ -22874,6 +22893,7 @@ export {
22874
22893
  TableRow,
22875
22894
  Tabs,
22876
22895
  TakeoverDrawerRenderer,
22896
+ TextEditor,
22877
22897
  Textarea,
22878
22898
  Theme,
22879
22899
  Tile2 as Tile,
@@ -22918,6 +22938,7 @@ export {
22918
22938
  fadeInRtl,
22919
22939
  fadeInTop,
22920
22940
  fadeOutBottom,
22941
+ filterMapper,
22921
22942
  fullWidthScreenIcon,
22922
22943
  getDrawerAttributes,
22923
22944
  getParentPath,