@uniformdev/design-system 19.135.0 → 19.136.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/index.js CHANGED
@@ -1371,6 +1371,8 @@ __export(src_exports, {
1371
1371
  CurrentDrawerContext: () => CurrentDrawerContext,
1372
1372
  DATE_OPERATORS: () => DATE_OPERATORS,
1373
1373
  DashedBox: () => DashedBox,
1374
+ DateEditor: () => DateEditor,
1375
+ DateRangeEditor: () => DateRangeEditor,
1374
1376
  DateTimePicker: () => DateTimePicker,
1375
1377
  DateTimePickerVariant: () => DateTimePickerVariant,
1376
1378
  DebouncedInputKeywordSearch: () => DebouncedInputKeywordSearch,
@@ -1386,9 +1388,12 @@ __export(src_exports, {
1386
1388
  Fieldset: () => Fieldset,
1387
1389
  FilterButton: () => FilterButton2,
1388
1390
  FilterControls: () => FilterControls,
1391
+ FilterEditorRenderer: () => FilterEditorRenderer,
1389
1392
  FilterItem: () => FilterItem,
1390
1393
  FilterItems: () => FilterItems,
1391
1394
  FilterMenu: () => FilterMenu,
1395
+ FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
1396
+ FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
1392
1397
  Heading: () => Heading,
1393
1398
  HexModalBackground: () => HexModalBackground,
1394
1399
  HorizontalRhythm: () => HorizontalRhythm,
@@ -1435,6 +1440,9 @@ __export(src_exports, {
1435
1440
  ModalDialog: () => ModalDialog,
1436
1441
  MultilineChip: () => MultilineChip,
1437
1442
  NUMBER_OPERATORS: () => NUMBER_OPERATORS,
1443
+ NumberEditor: () => NumberEditor,
1444
+ NumberRangeEditor: () => NumberRangeEditor,
1445
+ PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
1438
1446
  PageHeaderSection: () => PageHeaderSection,
1439
1447
  Pagination: () => Pagination,
1440
1448
  Paragraph: () => Paragraph,
@@ -1487,6 +1495,8 @@ __export(src_exports, {
1487
1495
  ShortcutRevealer: () => ShortcutRevealer,
1488
1496
  Skeleton: () => Skeleton,
1489
1497
  StatusBullet: () => StatusBullet,
1498
+ StatusMultiEditor: () => StatusMultiEditor,
1499
+ StatusSingleEditor: () => StatusSingleEditor,
1490
1500
  SuccessMessage: () => SuccessMessage,
1491
1501
  Switch: () => Switch,
1492
1502
  TAKEOVER_STACK_ID: () => TAKEOVER_STACK_ID,
@@ -1503,6 +1513,7 @@ __export(src_exports, {
1503
1513
  TableRow: () => TableRow,
1504
1514
  Tabs: () => Tabs,
1505
1515
  TakeoverDrawerRenderer: () => TakeoverDrawerRenderer,
1516
+ TextEditor: () => TextEditor,
1506
1517
  Textarea: () => Textarea,
1507
1518
  Theme: () => Theme,
1508
1519
  Tile: () => Tile2,
@@ -1547,6 +1558,7 @@ __export(src_exports, {
1547
1558
  fadeInRtl: () => fadeInRtl,
1548
1559
  fadeInTop: () => fadeInTop,
1549
1560
  fadeOutBottom: () => fadeOutBottom,
1561
+ filterMapper: () => filterMapper,
1550
1562
  fullWidthScreenIcon: () => fullWidthScreenIcon,
1551
1563
  getDrawerAttributes: () => getDrawerAttributes,
1552
1564
  getParentPath: () => getParentPath,
@@ -22288,6 +22300,28 @@ var SYSTEM_FIELD_OPERATORS = [
22288
22300
  editorType: "multiChoice"
22289
22301
  }
22290
22302
  ];
22303
+ var PUBLISH_STATUS_FIELD_OPERATORS = [
22304
+ {
22305
+ label: "is...",
22306
+ value: "eq",
22307
+ editorType: "statusSingleChoice"
22308
+ },
22309
+ {
22310
+ label: "is any of...",
22311
+ value: "in",
22312
+ editorType: "statusMultiChoice"
22313
+ },
22314
+ {
22315
+ label: "is not...",
22316
+ value: "neq",
22317
+ editorType: "statusSingleChoice"
22318
+ },
22319
+ {
22320
+ label: "is none of...",
22321
+ value: "nin",
22322
+ editorType: "statusMultiChoice"
22323
+ }
22324
+ ];
22291
22325
 
22292
22326
  // src/components/SearchAndFilter/FilterButton.tsx
22293
22327
  init_emotion_jsx_shim();
@@ -22330,7 +22364,7 @@ var ConditionalFilterRow = import_react139.css`
22330
22364
  }
22331
22365
  }
22332
22366
 
22333
- &:first-of-type {
22367
+ &:nth-of-type(2) {
22334
22368
  margin-left: 0;
22335
22369
  grid-template-columns: 50px 1fr;
22336
22370
  }
@@ -22484,15 +22518,6 @@ var IconBtn = import_react139.css`
22484
22518
  border: none;
22485
22519
  padding: var(--spacing-sm);
22486
22520
  `;
22487
- var CloseBtn = import_react139.css`
22488
- color: var(--gray-500);
22489
- background: transparent;
22490
- border: none;
22491
- padding: 0;
22492
- position: absolute;
22493
- top: var(--spacing-base);
22494
- right: var(--spacing-base);
22495
- `;
22496
22521
  var SearchAndFilterOptionsContainer = import_react139.css`
22497
22522
  background: var(--gray-50);
22498
22523
  border: 1px solid var(--gray-300);
@@ -22501,7 +22526,7 @@ var SearchAndFilterOptionsContainer = import_react139.css`
22501
22526
  display: flex;
22502
22527
  flex-direction: column;
22503
22528
  gap: var(--spacing-sm);
22504
- padding: var(--spacing-md) var(--spacing-md) var(--spacing-base);
22529
+ padding: var(--spacing-md) 0 var(--spacing-base);
22505
22530
  will-change: height;
22506
22531
  position: relative;
22507
22532
  z-index: 1;
@@ -22510,14 +22535,27 @@ var SearchAndFilterOptionsInnerContainer = import_react139.css`
22510
22535
  display: flex;
22511
22536
  flex-direction: column;
22512
22537
  gap: var(--spacing-sm);
22538
+ padding-inline: var(--spacing-md);
22513
22539
  `;
22514
22540
  var SearchAndFilterButtonGroup = import_react139.css`
22515
- margin-top: var(--spacing-base);
22541
+ margin-top: var(--spacing-xs);
22542
+ margin-left: calc(56px + var(--spacing-md));
22543
+ `;
22544
+ var SortFilterWrapper = (hiddenLocaleInput) => import_react139.css`
22545
+ border-top: 1px solid var(--gray-300);
22546
+ align-items: center;
22547
+ display: grid;
22548
+ grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr 200px"};
22549
+ gap: var(--spacing-xl);
22550
+ padding: var(--spacing-base) var(--spacing-md) 0;
22551
+ position: relative;
22552
+ z-index: 0;
22516
22553
  `;
22517
22554
  var SortFilterInputRow = import_react139.css`
22518
22555
  align-items: center;
22519
- display: flex;
22520
- gap: var(--spacing-sm);
22556
+ display: grid;
22557
+ grid-template-columns: 1fr auto;
22558
+ gap: var(--spacing-base);
22521
22559
  `;
22522
22560
 
22523
22561
  // src/components/SearchAndFilter/FilterButton.tsx
@@ -22552,243 +22590,25 @@ var FilterButton2 = ({
22552
22590
 
22553
22591
  // src/components/SearchAndFilter/FilterControls.tsx
22554
22592
  init_emotion_jsx_shim();
22555
- var import_react141 = require("react");
22556
- var import_react_use3 = require("react-use");
22593
+ var import_react143 = require("react");
22594
+ var import_react_use4 = require("react-use");
22557
22595
 
22558
22596
  // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
22559
22597
  init_emotion_jsx_shim();
22560
- var import_react140 = require("react");
22561
- var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
22562
- var SearchAndFilterContext = (0, import_react140.createContext)({
22563
- searchTerm: "",
22564
- setSearchTerm: () => {
22565
- },
22566
- filterVisibility: void 0,
22567
- setFilterVisibility: () => {
22568
- },
22569
- filters: [],
22570
- setFilters: () => {
22571
- },
22572
- handleAddFilter: () => {
22573
- },
22574
- handleResetFilters: () => {
22575
- },
22576
- handleDeleteFilter: () => {
22577
- },
22578
- setSortBy: () => {
22579
- },
22580
- sortByValue: "",
22581
- filterOptions: [],
22582
- sortOptions: [],
22583
- validFilterQuery: [],
22584
- totalResults: 0
22585
- });
22586
- var SearchAndFilterProvider = ({
22587
- filters,
22588
- filterOptions,
22589
- sortOptions,
22590
- defaultSortByValue,
22591
- filterMode: filterMode3 = void 0,
22592
- onSearchChange,
22593
- onChange,
22594
- onSortChange,
22595
- resetFilterValues = [],
22596
- totalResults,
22597
- children
22598
- }) => {
22599
- const [searchTerm, setSearchTerm] = (0, import_react140.useState)("");
22600
- const deferredSearchTerm = (0, import_react140.useDeferredValue)(searchTerm);
22601
- const [filterVisibility, setFilterVisibility] = (0, import_react140.useState)(filterMode3);
22602
- const [sortByValue, setSortByValue] = (0, import_react140.useState)(defaultSortByValue);
22603
- const handleSearchTerm = (0, import_react140.useCallback)(
22604
- (term) => {
22605
- setSearchTerm(term);
22606
- onSearchChange == null ? void 0 : onSearchChange(term);
22607
- },
22608
- [setSearchTerm, onSearchChange]
22609
- );
22610
- const handleOnSortChange = (0, import_react140.useCallback)(
22611
- (sort) => {
22612
- setSortByValue(sort);
22613
- onSortChange(sort);
22614
- },
22615
- [onSortChange]
22616
- );
22617
- const handleToggleFilterVisibilty = (0, import_react140.useCallback)(
22618
- (mode) => setFilterVisibility(mode),
22619
- [setFilterVisibility]
22620
- );
22621
- const handleAddFilter = (0, import_react140.useCallback)(() => {
22622
- onChange([...filters, { field: "", operator: "", value: "" }]);
22623
- }, [filters, onChange]);
22624
- const handleResetFilters = (0, import_react140.useCallback)(() => {
22625
- onChange(resetFilterValues);
22626
- }, [onChange, resetFilterValues]);
22627
- const handleDeleteFilter = (0, import_react140.useCallback)(
22628
- (index) => {
22629
- const remainingFilters = filters.filter((_, i) => i !== index);
22630
- onChange(remainingFilters);
22631
- },
22632
- [filters, onChange]
22633
- );
22634
- const validFilterQuery = (0, import_react140.useMemo)(() => {
22635
- const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
22636
- if (hasValidFilters) {
22637
- return filters;
22638
- }
22639
- }, [filters]);
22640
- (0, import_react140.useEffect)(() => {
22641
- if (filterVisibility) {
22642
- const handleEscKeyFilterClose = (e) => {
22643
- if (e.key === "Escape") {
22644
- setFilterVisibility(void 0);
22645
- }
22646
- };
22647
- document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
22648
- return () => {
22649
- document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
22650
- };
22651
- }
22652
- }, [filterVisibility]);
22653
- return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
22654
- SearchAndFilterContext.Provider,
22655
- {
22656
- value: {
22657
- searchTerm: deferredSearchTerm,
22658
- setSearchTerm: (e) => handleSearchTerm(e),
22659
- setSortBy: (e) => handleOnSortChange(e),
22660
- sortByValue,
22661
- filterVisibility,
22662
- setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
22663
- filters,
22664
- setFilters: (e) => onChange(e),
22665
- handleAddFilter,
22666
- handleResetFilters,
22667
- handleDeleteFilter,
22668
- filterOptions,
22669
- sortOptions,
22670
- validFilterQuery,
22671
- totalResults
22672
- },
22673
- children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VerticalRhythm, { children })
22674
- }
22675
- );
22676
- };
22677
- var useSearchAndFilter = () => {
22678
- const value = (0, import_react140.useContext)(SearchAndFilterContext);
22679
- return { ...value };
22680
- };
22681
-
22682
- // src/components/SearchAndFilter/FilterControls.tsx
22683
- var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
22684
- var FilterControls = ({
22685
- children,
22686
- defaultSortByValue,
22687
- hideSearchInput
22688
- }) => {
22689
- var _a, _b, _c;
22690
- const {
22691
- setFilterVisibility,
22692
- filterVisibility,
22693
- setSearchTerm,
22694
- validFilterQuery,
22695
- searchTerm,
22696
- sortByValue,
22697
- filterOptions
22698
- } = useSearchAndFilter();
22699
- const [initialSortValue, setInitialSortValue] = (0, import_react141.useState)(sortByValue);
22700
- const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react141.useState)("");
22701
- const [userHasChangedSortByValue, setUserHasChangedSortByValue] = (0, import_react141.useState)(false);
22702
- (0, import_react_use3.useDebounce)(
22703
- () => {
22704
- setSearchTerm(localeSearchTerm);
22705
- },
22706
- 300,
22707
- [localeSearchTerm, searchTerm]
22708
- );
22709
- (0, import_react141.useEffect)(() => {
22710
- if (searchTerm === "") {
22711
- setLocaleSearchTerm("");
22712
- }
22713
- }, [searchTerm]);
22714
- const handleFilterToggle = (mode) => {
22715
- if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
22716
- return setFilterVisibility(void 0);
22717
- }
22718
- return setFilterVisibility(mode);
22719
- };
22720
- const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
22721
- const sortDirection = sortValue == null ? void 0 : sortValue.pop();
22722
- const sortField = sortValue == null ? void 0 : sortValue.join("_");
22723
- const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
22724
- 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;
22725
- const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
22726
- (0, import_react_use3.useEffectOnce)(() => {
22727
- setInitialSortValue(sortByValue);
22728
- });
22729
- (0, import_react141.useEffect)(() => {
22730
- if (initialSortValue !== sortByValue) {
22731
- setUserHasChangedSortByValue(true);
22732
- }
22733
- }, [initialSortValue, sortByValue]);
22734
- return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
22735
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
22736
- FilterButton2,
22737
- {
22738
- "aria-controls": "search-and-filter-options",
22739
- "aria-label": "filter options",
22740
- "aria-haspopup": "true",
22741
- "aria-expanded": filterVisibility === "filters",
22742
- filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
22743
- onClick: () => handleFilterToggle("filters"),
22744
- dataTestId: "filters-button"
22745
- }
22746
- ),
22747
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
22748
- FilterButton2,
22749
- {
22750
- "aria-controls": "search-and-filter-sortBy",
22751
- "aria-label": "sort by options",
22752
- "aria-haspopup": "true",
22753
- text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
22754
- icon: sortByIcon,
22755
- "aria-expanded": filterVisibility === "sort",
22756
- hasSelectedValue: sortByValue !== "",
22757
- onClick: () => handleFilterToggle("sort"),
22758
- dataTestId: "sort-by-button"
22759
- }
22760
- ),
22761
- hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
22762
- InputKeywordSearch,
22763
- {
22764
- placeholder: "Search...",
22765
- onSearchTextChanged: (e) => setLocaleSearchTerm(e),
22766
- value: localeSearchTerm,
22767
- compact: true,
22768
- rounded: true,
22769
- css: SearchInput
22770
- }
22771
- ),
22772
- children
22773
- ] });
22774
- };
22775
-
22776
- // src/components/SearchAndFilter/FilterItem.tsx
22777
- init_emotion_jsx_shim();
22778
- var import_react145 = require("react");
22598
+ var import_react142 = require("react");
22779
22599
 
22780
22600
  // src/components/SearchAndFilter/FilterEditor.tsx
22781
22601
  init_emotion_jsx_shim();
22782
- var import_react143 = require("react");
22783
- var import_react_use4 = require("react-use");
22602
+ var import_react141 = require("react");
22603
+ var import_react_use3 = require("react-use");
22784
22604
 
22785
22605
  // src/components/Validation/StatusBullet.tsx
22786
22606
  init_emotion_jsx_shim();
22787
22607
 
22788
22608
  // src/components/Validation/StatusBullet.styles.ts
22789
22609
  init_emotion_jsx_shim();
22790
- var import_react142 = require("@emotion/react");
22791
- var StatusBulletContainer = import_react142.css`
22610
+ var import_react140 = require("@emotion/react");
22611
+ var StatusBulletContainer = import_react140.css`
22792
22612
  align-items: center;
22793
22613
  align-self: center;
22794
22614
  color: var(--gray-500);
@@ -22805,33 +22625,33 @@ var StatusBulletContainer = import_react142.css`
22805
22625
  display: block;
22806
22626
  }
22807
22627
  `;
22808
- var StatusBulletBase = import_react142.css`
22628
+ var StatusBulletBase = import_react140.css`
22809
22629
  font-size: var(--fs-sm);
22810
22630
  &:before {
22811
22631
  width: var(--fs-xs);
22812
22632
  height: var(--fs-xs);
22813
22633
  }
22814
22634
  `;
22815
- var StatusBulletSmall = import_react142.css`
22635
+ var StatusBulletSmall = import_react140.css`
22816
22636
  font-size: var(--fs-xs);
22817
22637
  &:before {
22818
22638
  width: var(--fs-xxs);
22819
22639
  height: var(--fs-xxs);
22820
22640
  }
22821
22641
  `;
22822
- var StatusDraft = import_react142.css`
22642
+ var StatusDraft = import_react140.css`
22823
22643
  &:before {
22824
22644
  background: var(--white);
22825
22645
  box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
22826
22646
  }
22827
22647
  `;
22828
- var StatusModified = import_react142.css`
22648
+ var StatusModified = import_react140.css`
22829
22649
  &:before {
22830
22650
  background: linear-gradient(to right, var(--white) 50%, var(--primary-action-default) 50% 100%);
22831
22651
  box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
22832
22652
  }
22833
22653
  `;
22834
- var StatusError = import_react142.css`
22654
+ var StatusError = import_react140.css`
22835
22655
  color: var(--error);
22836
22656
  &:before {
22837
22657
  /* TODO: replace this with an svg icon */
@@ -22844,29 +22664,29 @@ var StatusError = import_react142.css`
22844
22664
  );
22845
22665
  }
22846
22666
  `;
22847
- var StatusPublished = import_react142.css`
22667
+ var StatusPublished = import_react140.css`
22848
22668
  &:before {
22849
22669
  background: var(--primary-action-default);
22850
22670
  }
22851
22671
  `;
22852
- var StatusOrphan = import_react142.css`
22672
+ var StatusOrphan = import_react140.css`
22853
22673
  &:before {
22854
22674
  background: var(--brand-secondary-5);
22855
22675
  }
22856
22676
  `;
22857
- var StatusUnknown = import_react142.css`
22677
+ var StatusUnknown = import_react140.css`
22858
22678
  &:before {
22859
22679
  background: var(--gray-800);
22860
22680
  }
22861
22681
  `;
22862
- var StatusDeleted = import_react142.css`
22682
+ var StatusDeleted = import_react140.css`
22863
22683
  &:before {
22864
22684
  background: var(--error);
22865
22685
  }
22866
22686
  `;
22867
22687
 
22868
22688
  // src/components/Validation/StatusBullet.tsx
22869
- var import_jsx_runtime121 = require("@emotion/react/jsx-runtime");
22689
+ var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
22870
22690
  var StatusBullet = ({
22871
22691
  status,
22872
22692
  hideText = false,
@@ -22886,7 +22706,7 @@ var StatusBullet = ({
22886
22706
  Deleted: StatusDeleted
22887
22707
  };
22888
22708
  const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
22889
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
22709
+ return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
22890
22710
  "span",
22891
22711
  {
22892
22712
  role: "status",
@@ -22899,7 +22719,7 @@ var StatusBullet = ({
22899
22719
  };
22900
22720
 
22901
22721
  // src/components/SearchAndFilter/FilterEditor.tsx
22902
- var import_jsx_runtime122 = require("@emotion/react/jsx-runtime");
22722
+ var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
22903
22723
  var readOnlyAttributes = {
22904
22724
  isSearchable: false,
22905
22725
  menuIsOpen: false,
@@ -22908,13 +22728,13 @@ var readOnlyAttributes = {
22908
22728
  var FilterMultiChoiceEditor = ({
22909
22729
  value,
22910
22730
  options,
22911
- isDisabled,
22731
+ disabled: disabled2,
22912
22732
  readOnly,
22913
22733
  valueTestId,
22914
22734
  ...props
22915
22735
  }) => {
22916
22736
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
22917
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22737
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
22918
22738
  InputComboBox,
22919
22739
  {
22920
22740
  ...props,
@@ -22922,12 +22742,12 @@ var FilterMultiChoiceEditor = ({
22922
22742
  options,
22923
22743
  isMulti: true,
22924
22744
  isClearable: true,
22925
- isDisabled,
22745
+ isDisabled: disabled2,
22926
22746
  onChange: (e) => {
22927
22747
  var _a;
22928
- return props.onChange((_a = e.map((item) => item.value)) != null ? _a : []);
22748
+ return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
22929
22749
  },
22930
- value,
22750
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
22931
22751
  "aria-readonly": readOnly,
22932
22752
  styles: {
22933
22753
  menu(base) {
@@ -22944,13 +22764,13 @@ var FilterMultiChoiceEditor = ({
22944
22764
  var FilterSingleChoiceEditor = ({
22945
22765
  options,
22946
22766
  value,
22947
- isDisabled,
22767
+ disabled: disabled2,
22948
22768
  readOnly,
22949
22769
  onChange,
22950
22770
  valueTestId
22951
22771
  }) => {
22952
22772
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
22953
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22773
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
22954
22774
  InputComboBox,
22955
22775
  {
22956
22776
  placeholder: "Type to search...",
@@ -22960,8 +22780,8 @@ var FilterSingleChoiceEditor = ({
22960
22780
  var _a;
22961
22781
  return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
22962
22782
  },
22963
- isDisabled,
22964
- value,
22783
+ isDisabled: disabled2,
22784
+ value: options == null ? void 0 : options.find((option) => option.value === value),
22965
22785
  "aria-readonly": readOnly,
22966
22786
  styles: {
22967
22787
  menu(base) {
@@ -22976,18 +22796,18 @@ var FilterSingleChoiceEditor = ({
22976
22796
  ) });
22977
22797
  };
22978
22798
  var CustomOptions = ({ label, value }) => {
22979
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(StatusBullet, { status: label, message: value });
22799
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(StatusBullet, { status: label, message: value });
22980
22800
  };
22981
22801
  var StatusMultiEditor = ({
22982
22802
  options,
22983
22803
  value,
22984
- isDisabled,
22804
+ disabled: disabled2,
22985
22805
  readOnly,
22986
22806
  onChange,
22987
22807
  valueTestId
22988
22808
  }) => {
22989
22809
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
22990
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22810
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
22991
22811
  InputComboBox,
22992
22812
  {
22993
22813
  options,
@@ -22997,8 +22817,9 @@ var StatusMultiEditor = ({
22997
22817
  return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
22998
22818
  },
22999
22819
  formatOptionLabel: CustomOptions,
23000
- value,
23001
- isDisabled,
22820
+ "aria-readonly": readOnly,
22821
+ value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
22822
+ isDisabled: disabled2,
23002
22823
  styles: {
23003
22824
  menu(base) {
23004
22825
  return {
@@ -23014,13 +22835,13 @@ var StatusMultiEditor = ({
23014
22835
  var StatusSingleEditor = ({
23015
22836
  options,
23016
22837
  value,
23017
- isDisabled,
22838
+ disabled: disabled2,
23018
22839
  readOnly,
23019
22840
  onChange,
23020
22841
  valueTestId
23021
22842
  }) => {
23022
22843
  const readOnlyProps = readOnly ? readOnlyAttributes : {};
23023
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22844
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23024
22845
  InputComboBox,
23025
22846
  {
23026
22847
  options,
@@ -23029,8 +22850,9 @@ var StatusSingleEditor = ({
23029
22850
  return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
23030
22851
  },
23031
22852
  formatOptionLabel: CustomOptions,
23032
- value,
23033
- isDisabled,
22853
+ "aria-readonly": readOnly,
22854
+ value: options == null ? void 0 : options.find((option) => option.value === value),
22855
+ isDisabled: disabled2,
23034
22856
  styles: {
23035
22857
  menu(base) {
23036
22858
  return {
@@ -23043,9 +22865,15 @@ var StatusSingleEditor = ({
23043
22865
  }
23044
22866
  ) });
23045
22867
  };
23046
- var TextEditor = ({ onChange, ariaLabel, value, readOnly, valueTestId }) => {
23047
- (0, import_react_use4.useDebounce)(() => onChange, 500, [value]);
23048
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22868
+ var TextEditor = ({
22869
+ onChange,
22870
+ ariaLabel,
22871
+ value,
22872
+ readOnly,
22873
+ valueTestId
22874
+ }) => {
22875
+ (0, import_react_use3.useDebounce)(() => onChange, 500, [value]);
22876
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23049
22877
  Input,
23050
22878
  {
23051
22879
  showLabel: false,
@@ -23066,10 +22894,10 @@ var NumberRangeEditor = ({
23066
22894
  readOnly,
23067
22895
  valueTestId
23068
22896
  }) => {
23069
- const [minValue, setMinValue] = (0, import_react143.useState)("");
23070
- const [maxValue, setMaxValue] = (0, import_react143.useState)("");
23071
- const [error, setError] = (0, import_react143.useState)("");
23072
- (0, import_react143.useEffect)(() => {
22897
+ const [minValue, setMinValue] = (0, import_react141.useState)("");
22898
+ const [maxValue, setMaxValue] = (0, import_react141.useState)("");
22899
+ const [error, setError] = (0, import_react141.useState)("");
22900
+ (0, import_react141.useEffect)(() => {
23073
22901
  if (!maxValue && !minValue) {
23074
22902
  return;
23075
22903
  }
@@ -23088,9 +22916,9 @@ var NumberRangeEditor = ({
23088
22916
  setError("");
23089
22917
  onChange([minValue, maxValue]);
23090
22918
  }, [maxValue, minValue, setError]);
23091
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
23092
- /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
23093
- /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22919
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
22920
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
22921
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23094
22922
  Input,
23095
22923
  {
23096
22924
  label: `${ariaLabel}-min`,
@@ -23105,7 +22933,7 @@ var NumberRangeEditor = ({
23105
22933
  readOnly
23106
22934
  }
23107
22935
  ),
23108
- /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22936
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23109
22937
  Input,
23110
22938
  {
23111
22939
  type: "number",
@@ -23121,7 +22949,7 @@ var NumberRangeEditor = ({
23121
22949
  }
23122
22950
  )
23123
22951
  ] }),
23124
- /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ErrorContainer, { errorMessage: error })
22952
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
23125
22953
  ] });
23126
22954
  };
23127
22955
  var NumberEditor = ({
@@ -23132,7 +22960,7 @@ var NumberEditor = ({
23132
22960
  readOnly,
23133
22961
  valueTestId
23134
22962
  }) => {
23135
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22963
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23136
22964
  Input,
23137
22965
  {
23138
22966
  label: ariaLabel,
@@ -23155,7 +22983,7 @@ var DateEditor = ({
23155
22983
  readOnly,
23156
22984
  valueTestId
23157
22985
  }) => {
23158
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
22986
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23159
22987
  Input,
23160
22988
  {
23161
22989
  type: "date",
@@ -23177,10 +23005,10 @@ var DateRangeEditor = ({
23177
23005
  readOnly,
23178
23006
  valueTestId
23179
23007
  }) => {
23180
- const [minDateValue, setMinDateValue] = (0, import_react143.useState)(value ? value[0] : "");
23181
- const [maxDateValue, setMaxDateValue] = (0, import_react143.useState)(value ? value[1] : "");
23182
- const [error, setError] = (0, import_react143.useState)("");
23183
- (0, import_react143.useEffect)(() => {
23008
+ const [minDateValue, setMinDateValue] = (0, import_react141.useState)(value ? value[0] : "");
23009
+ const [maxDateValue, setMaxDateValue] = (0, import_react141.useState)(value ? value[1] : "");
23010
+ const [error, setError] = (0, import_react141.useState)("");
23011
+ (0, import_react141.useEffect)(() => {
23184
23012
  if (!minDateValue || !maxDateValue) {
23185
23013
  return;
23186
23014
  }
@@ -23211,9 +23039,9 @@ var DateRangeEditor = ({
23211
23039
  setError("");
23212
23040
  onChange([minDateValue, maxDateValue]);
23213
23041
  }, [minDateValue, maxDateValue, setError]);
23214
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
23215
- /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
23216
- /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
23042
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
23043
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
23044
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23217
23045
  Input,
23218
23046
  {
23219
23047
  label: `${ariaLabel}-min-date`,
@@ -23226,7 +23054,7 @@ var DateRangeEditor = ({
23226
23054
  readOnly
23227
23055
  }
23228
23056
  ),
23229
- /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
23057
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23230
23058
  Input,
23231
23059
  {
23232
23060
  label: `${ariaLabel}-max-date`,
@@ -23240,18 +23068,19 @@ var DateRangeEditor = ({
23240
23068
  }
23241
23069
  )
23242
23070
  ] }),
23243
- /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ErrorContainer, { errorMessage: error })
23071
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
23244
23072
  ] });
23245
23073
  };
23246
23074
  var FilterEditorRenderer = ({ editorType, ...props }) => {
23247
- const Editor = filterMapper[editorType];
23075
+ const { filterMapper: contextFilterMapper } = useSearchAndFilter();
23076
+ const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
23248
23077
  if (!Editor) {
23249
23078
  return null;
23250
23079
  }
23251
23080
  if (editorType === "empty") {
23252
23081
  return null;
23253
23082
  }
23254
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Editor, { ...props, disabled: props.isDisabled });
23083
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Editor, { ...props });
23255
23084
  };
23256
23085
  var filterMapper = {
23257
23086
  multiChoice: FilterMultiChoiceEditor,
@@ -23266,14 +23095,14 @@ var filterMapper = {
23266
23095
  empty: null
23267
23096
  };
23268
23097
  var ErrorContainer = ({ errorMessage }) => {
23269
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
23098
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
23270
23099
  "div",
23271
23100
  {
23272
23101
  css: {
23273
23102
  gridColumn: "span 6",
23274
23103
  order: 6
23275
23104
  },
23276
- children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(FieldMessage, { errorMessage })
23105
+ children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(FieldMessage, { errorMessage })
23277
23106
  }
23278
23107
  );
23279
23108
  };
@@ -23283,299 +23112,277 @@ var twoColumnGrid = {
23283
23112
  gap: "var(--spacing-sm);"
23284
23113
  };
23285
23114
 
23286
- // src/components/SearchAndFilter/FilterMenu.tsx
23287
- init_emotion_jsx_shim();
23288
- var import_react144 = __toESM(require("react"));
23289
- var import_jsx_runtime123 = require("@emotion/react/jsx-runtime");
23290
- var SearchAndFilterOptionsContainer2 = ({
23291
- buttonRow,
23292
- children
23293
- }) => {
23294
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
23295
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
23296
- buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
23297
- HorizontalRhythm,
23298
- {
23299
- css: SearchAndFilterButtonGroup,
23300
- gap: "sm",
23301
- align: "center",
23302
- justify: "space-between",
23303
- children: buttonRow
23304
- }
23305
- ) : null
23306
- ] });
23307
- };
23308
- var FilterMenu = ({
23309
- id,
23310
- filterTitle = "Show results",
23311
- menuControls,
23312
- children,
23313
- dataTestId
23115
+ // src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
23116
+ var import_jsx_runtime121 = require("@emotion/react/jsx-runtime");
23117
+ var SearchAndFilterContext = (0, import_react142.createContext)({
23118
+ searchTerm: "",
23119
+ setSearchTerm: () => {
23120
+ },
23121
+ filterVisibility: void 0,
23122
+ setFilterVisibility: () => {
23123
+ },
23124
+ filters: [],
23125
+ setFilters: () => {
23126
+ },
23127
+ handleAddFilter: () => {
23128
+ },
23129
+ handleResetFilters: () => {
23130
+ },
23131
+ handleDeleteFilter: () => {
23132
+ },
23133
+ handleLocaleChange: () => {
23134
+ },
23135
+ setSortBy: () => {
23136
+ },
23137
+ sortByValue: "",
23138
+ filterOptions: [],
23139
+ sortOptions: [],
23140
+ validFilterQuery: [],
23141
+ filterMapper: {},
23142
+ totalResults: 0,
23143
+ localeOptions: [],
23144
+ localeValue: ""
23145
+ });
23146
+ var SearchAndFilterProvider = ({
23147
+ filters,
23148
+ filterOptions,
23149
+ sortOptions,
23150
+ defaultSortByValue,
23151
+ defaultLocale = "",
23152
+ localeOptions,
23153
+ onLocaleChange,
23154
+ filterVisible = false,
23155
+ onSearchChange,
23156
+ onChange,
23157
+ onSortChange,
23158
+ resetFilterValues = [{ field: "", operator: "", value: "" }],
23159
+ totalResults,
23160
+ filterMapper: filterMapper2 = filterMapper,
23161
+ children
23314
23162
  }) => {
23315
- const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
23316
- const innerMenuRef = import_react144.default.useRef(null);
23317
- (0, import_react144.useEffect)(() => {
23318
- var _a;
23163
+ const [searchTerm, setSearchTerm] = (0, import_react142.useState)("");
23164
+ const deferredSearchTerm = (0, import_react142.useDeferredValue)(searchTerm);
23165
+ const [filterVisibility, setFilterVisibility] = (0, import_react142.useState)(filterVisible);
23166
+ const [sortByValue, setSortByValue] = (0, import_react142.useState)(defaultSortByValue);
23167
+ const [localeValue, setLocale] = (0, import_react142.useState)(defaultLocale);
23168
+ const handleSearchTerm = (0, import_react142.useCallback)(
23169
+ (term) => {
23170
+ setSearchTerm(term);
23171
+ onSearchChange == null ? void 0 : onSearchChange(term);
23172
+ },
23173
+ [setSearchTerm, onSearchChange]
23174
+ );
23175
+ const handleLocaleChange = (0, import_react142.useCallback)(
23176
+ (locale) => {
23177
+ setLocale(locale);
23178
+ onLocaleChange == null ? void 0 : onLocaleChange(locale);
23179
+ },
23180
+ [onLocaleChange]
23181
+ );
23182
+ const handleOnSortChange = (0, import_react142.useCallback)(
23183
+ (sort) => {
23184
+ setSortByValue(sort);
23185
+ onSortChange(sort);
23186
+ },
23187
+ [onSortChange]
23188
+ );
23189
+ const handleToggleFilterVisibilty = (0, import_react142.useCallback)(
23190
+ (visible) => setFilterVisibility(visible),
23191
+ [setFilterVisibility]
23192
+ );
23193
+ const handleAddFilter = (0, import_react142.useCallback)(() => {
23194
+ onChange([...filters, { field: "", operator: "", value: "" }]);
23195
+ }, [filters, onChange]);
23196
+ const handleResetFilters = (0, import_react142.useCallback)(() => {
23197
+ onChange(resetFilterValues);
23198
+ }, [onChange, resetFilterValues]);
23199
+ const handleDeleteFilter = (0, import_react142.useCallback)(
23200
+ (index) => {
23201
+ const remainingFilters = filters.filter((_, i) => i !== index);
23202
+ onChange(remainingFilters);
23203
+ },
23204
+ [filters, onChange]
23205
+ );
23206
+ const validFilterQuery = (0, import_react142.useMemo)(() => {
23207
+ const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
23208
+ if (hasValidFilters) {
23209
+ return filters;
23210
+ }
23211
+ }, [filters]);
23212
+ (0, import_react142.useEffect)(() => {
23319
23213
  if (filterVisibility) {
23320
- (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
23214
+ const handleEscKeyFilterClose = (e) => {
23215
+ if (e.key === "Escape") {
23216
+ setFilterVisibility(false);
23217
+ }
23218
+ };
23219
+ document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
23220
+ return () => {
23221
+ document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
23222
+ };
23321
23223
  }
23322
23224
  }, [filterVisibility]);
23323
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
23324
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
23325
- /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
23326
- "button",
23225
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
23226
+ SearchAndFilterContext.Provider,
23227
+ {
23228
+ value: {
23229
+ searchTerm: deferredSearchTerm,
23230
+ setSearchTerm: (e) => handleSearchTerm(e),
23231
+ setSortBy: (e) => handleOnSortChange(e),
23232
+ sortByValue,
23233
+ filterVisibility,
23234
+ setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
23235
+ filters,
23236
+ setFilters: (e) => onChange(e),
23237
+ handleAddFilter,
23238
+ handleResetFilters,
23239
+ handleDeleteFilter,
23240
+ filterOptions,
23241
+ sortOptions,
23242
+ validFilterQuery,
23243
+ totalResults,
23244
+ localeOptions,
23245
+ localeValue,
23246
+ handleLocaleChange,
23247
+ filterMapper: filterMapper2
23248
+ },
23249
+ children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(VerticalRhythm, { children })
23250
+ }
23251
+ );
23252
+ };
23253
+ var useSearchAndFilter = () => {
23254
+ const value = (0, import_react142.useContext)(SearchAndFilterContext);
23255
+ return { ...value };
23256
+ };
23257
+
23258
+ // src/components/SearchAndFilter/FilterControls.tsx
23259
+ var import_jsx_runtime122 = require("@emotion/react/jsx-runtime");
23260
+ var FilterControls = ({
23261
+ children,
23262
+ hideSearchInput
23263
+ }) => {
23264
+ const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
23265
+ const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react143.useState)("");
23266
+ (0, import_react_use4.useDebounce)(
23267
+ () => {
23268
+ setSearchTerm(localeSearchTerm);
23269
+ },
23270
+ 300,
23271
+ [localeSearchTerm, searchTerm]
23272
+ );
23273
+ (0, import_react143.useEffect)(() => {
23274
+ if (searchTerm === "") {
23275
+ setLocaleSearchTerm("");
23276
+ }
23277
+ }, [searchTerm]);
23278
+ return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
23279
+ /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
23280
+ FilterButton2,
23327
23281
  {
23328
- type: "button",
23329
- "aria-label": "close filters",
23330
- css: [CloseBtn],
23331
- onClick: () => setFilterVisibility(void 0),
23332
- "data-testid": "close-filters",
23333
- children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Icon, { icon: "close", iconColor: "currentColor", size: "1.1rem" })
23282
+ "aria-controls": "search-and-filter-options",
23283
+ "aria-label": "filter options",
23284
+ "aria-haspopup": "true",
23285
+ text: "Filter/Sort",
23286
+ "aria-expanded": filterVisibility === true,
23287
+ filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
23288
+ onClick: () => setFilterVisibility(!filterVisibility),
23289
+ dataTestId: "filters-button"
23290
+ }
23291
+ ),
23292
+ hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
23293
+ InputKeywordSearch,
23294
+ {
23295
+ placeholder: "Search...",
23296
+ onSearchTextChanged: (e) => setLocaleSearchTerm(e),
23297
+ value: localeSearchTerm,
23298
+ compact: true,
23299
+ rounded: true,
23300
+ css: SearchInput
23334
23301
  }
23335
23302
  ),
23336
23303
  children
23337
- ] }) : null });
23304
+ ] });
23338
23305
  };
23339
23306
 
23340
23307
  // src/components/SearchAndFilter/FilterItem.tsx
23341
- var import_jsx_runtime124 = require("@emotion/react/jsx-runtime");
23342
- var FilterItem = ({
23343
- index,
23344
- paramOptions,
23345
- operatorOptions,
23346
- valueOptions,
23347
- onParamChange,
23348
- onOperatorChange,
23349
- onValueChange
23308
+ init_emotion_jsx_shim();
23309
+ var import_react148 = require("react");
23310
+
23311
+ // src/components/SearchAndFilter/FilterMenu.tsx
23312
+ init_emotion_jsx_shim();
23313
+ var import_react144 = __toESM(require("react"));
23314
+ var import_jsx_runtime123 = require("@emotion/react/jsx-runtime");
23315
+ var SearchAndFilterOptionsContainer2 = ({
23316
+ buttonRow,
23317
+ sortControls,
23318
+ children
23350
23319
  }) => {
23351
- var _a, _b;
23352
- const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
23353
- const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
23354
- const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
23355
- const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
23356
- const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
23357
- const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = (0, import_react145.useMemo)(() => {
23358
- var _a2;
23359
- const currentSelectedFilter = filterOptions.find((item) => {
23360
- var _a3;
23361
- return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
23362
- });
23363
- const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
23364
- return filters[index].field === item.value;
23365
- });
23366
- const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
23367
- const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
23368
- return filters[index].operator === item.value;
23369
- });
23370
- const selectedMetaValue2 = valueOptions.filter((item) => {
23371
- if (Array.isArray(filters[index].value) && item.value) {
23372
- return filters[index].value.includes(item.value);
23320
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
23321
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
23322
+ buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
23323
+ HorizontalRhythm,
23324
+ {
23325
+ css: SearchAndFilterButtonGroup,
23326
+ gap: "sm",
23327
+ align: "center",
23328
+ justify: "space-between",
23329
+ children: buttonRow
23373
23330
  }
23374
- return filters[index].value === item.value;
23375
- });
23376
- return {
23377
- selectedFieldValue: selectedFieldValue2,
23378
- selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
23379
- selectedMetaValue: selectedMetaValue2.length > 0 ? selectedMetaValue2 : filters[index].value,
23380
- readOnly: isCurrentFieldReadOnly
23381
- };
23382
- }, [filters, filterOptions, index, operatorOptions, valueOptions]);
23383
- const readOnlyProps = readOnly ? {
23384
- "aria-readonly": true,
23385
- isSearchable: false,
23386
- menuIsOpen: false,
23387
- isClearable: false
23388
- } : {};
23389
- return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
23390
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { children: index === 0 ? "Where" : "and" }),
23391
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { css: ConditionalInputRow, children: [
23392
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23393
- InputComboBox,
23394
- {
23395
- "aria-label": label,
23396
- options: paramOptions,
23397
- onChange: (e) => {
23398
- var _a2;
23399
- onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
23400
- },
23401
- isOptionDisabled: (option) => {
23402
- var _a2;
23403
- return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
23404
- },
23405
- styles: {
23406
- menu(base) {
23407
- return {
23408
- ...base,
23409
- minWidth: "max-content"
23410
- };
23411
- }
23412
- },
23413
- value: selectedFieldValue,
23414
- ...readOnlyProps,
23415
- id: "filter-field"
23416
- }
23417
- ),
23418
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23419
- InputComboBox,
23420
- {
23421
- "aria-label": operatorLabel,
23422
- options: operatorOptions,
23423
- onChange: (e) => {
23424
- var _a2;
23425
- return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
23426
- },
23427
- isDisabled: !filters[index].field,
23428
- value: selectedOperatorValue,
23429
- styles: {
23430
- menu(base) {
23431
- return {
23432
- ...base,
23433
- minWidth: "max-content"
23434
- };
23435
- }
23436
- },
23437
- ...readOnlyProps,
23438
- id: "filter-operator"
23439
- }
23440
- ),
23441
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23442
- FilterEditorRenderer,
23443
- {
23444
- "aria-label": metaDataLabel,
23445
- editorType: metaDataPossibleOptions,
23446
- options: valueOptions,
23447
- onChange: (e) => onValueChange(e != null ? e : ""),
23448
- readOnly,
23449
- isDisabled: !filters[index].operator,
23450
- value: selectedMetaValue,
23451
- valueTestId: "filter-value"
23452
- }
23453
- ),
23454
- readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23455
- "button",
23456
- {
23457
- type: "button",
23458
- onClick: () => handleDeleteFilter(index),
23459
- "aria-label": "delete filter",
23460
- css: IconBtn,
23461
- "data-testid": "delete-filter",
23462
- children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
23463
- }
23464
- )
23465
- ] })
23331
+ ) : null,
23332
+ sortControls ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { children: sortControls }) : null
23466
23333
  ] });
23467
23334
  };
23468
- var FilterItems = ({
23469
- addButtonText = "add condition",
23470
- resetButtonText = "reset filters"
23335
+ var FilterMenu = ({
23336
+ id,
23337
+ filterTitle = "Show results",
23338
+ menuControls,
23339
+ sortControls,
23340
+ children,
23341
+ dataTestId,
23342
+ resetButtonText = "reset"
23471
23343
  }) => {
23472
- const { filterOptions, filters, setFilters, handleAddFilter, handleResetFilters, setFilterVisibility } = useSearchAndFilter();
23473
- const handleUpdateFilter = (index, prop, value) => {
23474
- var _a, _b, _c, _d, _e;
23475
- const next = [...filters];
23476
- next[index] = { ...next[index], [prop]: value };
23477
- if (prop === "operator") {
23478
- if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
23479
- next[index].value = next[index].value[0];
23480
- }
23481
- if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
23482
- next[index].value = [next[index].value, ""];
23483
- }
23484
- if (value === "def" || value === "true") {
23485
- next[index].value = "true";
23486
- }
23487
- if (value === "ndef" || value === "false") {
23488
- next[index].value = "false";
23489
- }
23490
- }
23491
- if (prop === "field") {
23492
- const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
23493
- var _a2;
23494
- return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
23495
- })) == 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";
23496
- next[index].operator = firstOperatorInAvailableOperators;
23497
- next[index].value = "";
23498
- }
23499
- setFilters(next);
23500
- };
23501
- return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23502
- FilterMenu,
23503
- {
23504
- id: "search-and-filter-options",
23505
- dataTestId: "search-and-filter-options",
23506
- menuControls: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
23507
- /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
23508
- "button",
23509
- {
23510
- type: "button",
23511
- css: AddConditionalBtn,
23512
- onClick: handleAddFilter,
23513
- "data-testid": "add-filter",
23514
- children: [
23515
- /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
23516
- addButtonText
23517
- ]
23518
- }
23519
- ),
23520
- (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23521
- "button",
23522
- {
23523
- type: "button",
23524
- css: ResetConditionsBtn,
23525
- onClick: () => {
23526
- handleResetFilters();
23527
- setFilterVisibility(void 0);
23528
- },
23529
- "data-testid": "reset-filters",
23530
- children: resetButtonText
23531
- }
23532
- ) : null
23533
- ] }),
23534
- children: filters.map((item, i) => {
23535
- var _a, _b, _c, _d, _e, _f;
23536
- const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
23537
- var _a2;
23538
- return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
23539
- })) == null ? void 0 : _a.options) != null ? _b : [];
23540
- const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
23541
- const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
23542
- return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23543
- FilterItem,
23544
- {
23545
- index: i,
23546
- paramOptions: filterOptions,
23547
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
23548
- operatorOptions: possibleOperators,
23549
- onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
23550
- onValueChange: (e) => handleUpdateFilter(i, "value", e),
23551
- valueOptions: possibleValueOptions
23552
- },
23553
- i
23554
- );
23555
- })
23344
+ const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
23345
+ const innerMenuRef = import_react144.default.useRef(null);
23346
+ (0, import_react144.useEffect)(() => {
23347
+ var _a;
23348
+ if (filterVisibility) {
23349
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
23556
23350
  }
23557
- );
23351
+ }, [filterVisibility]);
23352
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, sortControls, children: [
23353
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
23354
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
23355
+ (filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
23356
+ "button",
23357
+ {
23358
+ type: "button",
23359
+ css: ResetConditionsBtn,
23360
+ onClick: () => {
23361
+ handleResetFilters();
23362
+ setFilterVisibility(false);
23363
+ },
23364
+ "data-testid": "reset-filters",
23365
+ children: resetButtonText
23366
+ }
23367
+ ) : null
23368
+ ] }),
23369
+ children
23370
+ ] }) : null });
23558
23371
  };
23559
23372
 
23560
- // src/components/SearchAndFilter/SearchAndFilter.tsx
23561
- init_emotion_jsx_shim();
23562
-
23563
- // src/components/SearchAndFilter/FilterModeView.tsx
23564
- init_emotion_jsx_shim();
23565
-
23566
23373
  // src/components/SearchAndFilter/SortItems.tsx
23567
23374
  init_emotion_jsx_shim();
23568
23375
 
23569
23376
  // src/components/SegmentedControl/SegmentedControl.tsx
23570
23377
  init_emotion_jsx_shim();
23571
- var import_react147 = require("@emotion/react");
23378
+ var import_react146 = require("@emotion/react");
23572
23379
  var import_CgCheck5 = require("@react-icons/all-files/cg/CgCheck");
23573
- var import_react148 = require("react");
23380
+ var import_react147 = require("react");
23574
23381
 
23575
23382
  // src/components/SegmentedControl/SegmentedControl.styles.ts
23576
23383
  init_emotion_jsx_shim();
23577
- var import_react146 = require("@emotion/react");
23578
- var segmentedControlStyles = import_react146.css`
23384
+ var import_react145 = require("@emotion/react");
23385
+ var segmentedControlStyles = import_react145.css`
23579
23386
  --segmented-control-rounded-value: var(--rounded-base);
23580
23387
  --segmented-control-border-width: 1px;
23581
23388
  --segmented-control-selected-color: var(--brand-secondary-3);
@@ -23594,14 +23401,14 @@ var segmentedControlStyles = import_react146.css`
23594
23401
  border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
23595
23402
  font-size: var(--fs-xs);
23596
23403
  `;
23597
- var segmentedControlVerticalStyles = import_react146.css`
23404
+ var segmentedControlVerticalStyles = import_react145.css`
23598
23405
  flex-direction: column;
23599
23406
  --segmented-control-first-border-radius: var(--segmented-control-rounded-value)
23600
23407
  var(--segmented-control-rounded-value) 0 0;
23601
23408
  --segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
23602
23409
  var(--segmented-control-rounded-value);
23603
23410
  `;
23604
- var segmentedControlItemStyles = import_react146.css`
23411
+ var segmentedControlItemStyles = import_react145.css`
23605
23412
  &:first-of-type label {
23606
23413
  border-radius: var(--segmented-control-first-border-radius);
23607
23414
  }
@@ -23609,10 +23416,10 @@ var segmentedControlItemStyles = import_react146.css`
23609
23416
  border-radius: var(--segmented-control-last-border-radius);
23610
23417
  }
23611
23418
  `;
23612
- var segmentedControlInputStyles = import_react146.css`
23419
+ var segmentedControlInputStyles = import_react145.css`
23613
23420
  ${accessibleHidden}
23614
23421
  `;
23615
- var segmentedControlLabelStyles = (checked, disabled2) => import_react146.css`
23422
+ var segmentedControlLabelStyles = (checked, disabled2) => import_react145.css`
23616
23423
  position: relative;
23617
23424
  display: flex;
23618
23425
  align-items: center;
@@ -23679,23 +23486,23 @@ var segmentedControlLabelStyles = (checked, disabled2) => import_react146.css`
23679
23486
  `}
23680
23487
  }
23681
23488
  `;
23682
- var segmentedControlLabelIconOnlyStyles = import_react146.css`
23489
+ var segmentedControlLabelIconOnlyStyles = import_react145.css`
23683
23490
  padding-inline: 0.5em;
23684
23491
  `;
23685
- var segmentedControlLabelCheckStyles = import_react146.css`
23492
+ var segmentedControlLabelCheckStyles = import_react145.css`
23686
23493
  opacity: 0.5;
23687
23494
  `;
23688
- var segmentedControlLabelContentStyles = import_react146.css`
23495
+ var segmentedControlLabelContentStyles = import_react145.css`
23689
23496
  display: flex;
23690
23497
  align-items: center;
23691
23498
  justify-content: center;
23692
23499
  gap: var(--spacing-sm);
23693
23500
  height: 100%;
23694
23501
  `;
23695
- var segmentedControlLabelTextStyles = import_react146.css``;
23502
+ var segmentedControlLabelTextStyles = import_react145.css``;
23696
23503
 
23697
23504
  // src/components/SegmentedControl/SegmentedControl.tsx
23698
- var import_jsx_runtime125 = require("@emotion/react/jsx-runtime");
23505
+ var import_jsx_runtime124 = require("@emotion/react/jsx-runtime");
23699
23506
  var SegmentedControl = ({
23700
23507
  name,
23701
23508
  options,
@@ -23705,9 +23512,11 @@ var SegmentedControl = ({
23705
23512
  disabled: disabled2 = false,
23706
23513
  orientation = "horizontal",
23707
23514
  size = "md",
23515
+ hideOptionText = false,
23516
+ iconSize = "1.5em",
23708
23517
  ...props
23709
23518
  }) => {
23710
- const onOptionChange = (0, import_react148.useCallback)(
23519
+ const onOptionChange = (0, import_react147.useCallback)(
23711
23520
  (event) => {
23712
23521
  if (event.target.checked) {
23713
23522
  onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
@@ -23715,18 +23524,19 @@ var SegmentedControl = ({
23715
23524
  },
23716
23525
  [options, onChange]
23717
23526
  );
23718
- const sizeStyles = (0, import_react148.useMemo)(() => {
23527
+ const sizeStyles = (0, import_react147.useMemo)(() => {
23719
23528
  const map = {
23720
- sm: (0, import_react147.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
23721
- md: (0, import_react147.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
23722
- lg: (0, import_react147.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" })
23529
+ sm: (0, import_react146.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
23530
+ md: (0, import_react146.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
23531
+ lg: (0, import_react146.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
23532
+ xl: (0, import_react146.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
23723
23533
  };
23724
23534
  return map[size];
23725
23535
  }, [size]);
23726
- const isIconOnly = (0, import_react148.useMemo)(() => {
23536
+ const isIconOnly = (0, import_react147.useMemo)(() => {
23727
23537
  return options.every((option) => option && option.icon && !option.label);
23728
23538
  }, [options]);
23729
- return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
23539
+ return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23730
23540
  "div",
23731
23541
  {
23732
23542
  css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
@@ -23739,45 +23549,53 @@ var SegmentedControl = ({
23739
23549
  }
23740
23550
  const text = option.label ? option.label : option.icon ? null : String(option.value);
23741
23551
  const isDisabled = disabled2 || option.disabled;
23742
- return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { css: segmentedControlItemStyles, "data-testid": "container-segmented-control", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
23743
- "label",
23552
+ return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23553
+ "div",
23744
23554
  {
23745
- css: [
23746
- segmentedControlLabelStyles(option.value === value, isDisabled),
23747
- sizeStyles,
23748
- isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
23749
- ],
23750
- children: [
23751
- /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
23752
- "input",
23753
- {
23754
- css: segmentedControlInputStyles,
23755
- type: "radio",
23756
- name,
23757
- value: index,
23758
- checked: option.value === value,
23759
- onChange: onOptionChange,
23760
- disabled: isDisabled
23761
- }
23762
- ),
23763
- option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_CgCheck5.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
23764
- /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
23765
- !option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Icon, { icon: option.icon, size: "1.5em", iconColor: "currentColor" }),
23766
- !text ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
23767
- ] })
23768
- ]
23555
+ css: segmentedControlItemStyles,
23556
+ "data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
23557
+ children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
23558
+ "label",
23559
+ {
23560
+ css: [
23561
+ segmentedControlLabelStyles(option.value === value, isDisabled),
23562
+ sizeStyles,
23563
+ isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
23564
+ ],
23565
+ children: [
23566
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
23567
+ "input",
23568
+ {
23569
+ css: segmentedControlInputStyles,
23570
+ type: "radio",
23571
+ name,
23572
+ value: index,
23573
+ checked: option.value === value,
23574
+ onChange: onOptionChange,
23575
+ disabled: isDisabled
23576
+ }
23577
+ ),
23578
+ option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_CgCheck5.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
23579
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
23580
+ !option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
23581
+ !text || hideOptionText ? null : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
23582
+ ] })
23583
+ ]
23584
+ }
23585
+ )
23769
23586
  }
23770
- ) }) }, JSON.stringify(option.value));
23587
+ ) }, JSON.stringify(option.value));
23771
23588
  })
23772
23589
  }
23773
23590
  );
23774
23591
  };
23775
23592
 
23776
23593
  // src/components/SearchAndFilter/SortItems.tsx
23777
- var import_jsx_runtime126 = require("@emotion/react/jsx-runtime");
23778
- var SortItems = () => {
23594
+ var import_jsx_runtime125 = require("@emotion/react/jsx-runtime");
23595
+ var SortItems = ({ sortByLabel = "Sort by", localeLabel = "Locale returned" }) => {
23779
23596
  var _a, _b;
23780
- const { sortOptions, setSortBy, sortByValue } = useSearchAndFilter();
23597
+ const { sortOptions, setSortBy, sortByValue, localeValue, localeOptions, handleLocaleChange } = useSearchAndFilter();
23598
+ const hideLocaleOptions = !localeOptions;
23781
23599
  const values = sortByValue.split("_");
23782
23600
  const sortDirection = values.pop();
23783
23601
  const sortField = values.join("_");
@@ -23785,58 +23603,290 @@ var SortItems = () => {
23785
23603
  var _a2;
23786
23604
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
23787
23605
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
23788
- return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", dataTestId: "sorting-options", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { css: SortFilterInputRow, children: [
23789
- /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23790
- InputComboBox,
23791
- {
23792
- options: sortOptions,
23793
- onChange: (e) => {
23794
- const fieldName = e == null ? void 0 : e.value;
23795
- setSortBy(`${fieldName}_${sortDirection}`);
23796
- },
23797
- styles: {
23798
- menu(base) {
23799
- return {
23800
- ...base,
23801
- minWidth: "max-content"
23802
- };
23606
+ return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
23607
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(VerticalRhythm, { gap: "xs", children: [
23608
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { css: Title, children: sortByLabel }),
23609
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { css: SortFilterInputRow, children: [
23610
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
23611
+ InputComboBox,
23612
+ {
23613
+ id: "sort-by-field",
23614
+ "aria-label": "Sort by",
23615
+ options: sortOptions,
23616
+ onChange: (e) => {
23617
+ const fieldName = e == null ? void 0 : e.value;
23618
+ setSortBy(`${fieldName}_${sortDirection}`);
23619
+ },
23620
+ styles: {
23621
+ menu(base) {
23622
+ return {
23623
+ ...base,
23624
+ minWidth: "max-content"
23625
+ };
23626
+ }
23627
+ },
23628
+ value: currentSelectedOption
23803
23629
  }
23804
- },
23805
- value: currentSelectedOption,
23806
- id: "sort-by-field"
23807
- }
23808
- ),
23809
- /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23810
- SegmentedControl,
23811
- {
23812
- noCheckmark: true,
23813
- name: "sortBy",
23814
- options: [
23815
- { label: "Ascending", value: `ASC` },
23816
- { label: "Descending", value: `DESC` }
23817
- ],
23818
- onChange: (e) => setSortBy(`${sortField}_${e}`),
23819
- value: sortDirection,
23820
- "data-testid": "ordering-options"
23821
- }
23822
- )
23823
- ] }) });
23630
+ ),
23631
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
23632
+ SegmentedControl,
23633
+ {
23634
+ noCheckmark: true,
23635
+ name: "sortBy",
23636
+ hideOptionText: true,
23637
+ iconSize: "1rem",
23638
+ size: "xl",
23639
+ options: [
23640
+ {
23641
+ label: "Ascending",
23642
+ icon: "arrow-up",
23643
+ value: `ASC`,
23644
+ tooltip: "Ascending (e.g. A-Z, newest to oldest)",
23645
+ "data-testid": "sort-ascending"
23646
+ },
23647
+ {
23648
+ label: "Descending",
23649
+ icon: "arrow-down",
23650
+ value: `DESC`,
23651
+ tooltip: "Descending (e.g. Z-A, oldest to newest)",
23652
+ "data-testid": "sort-descending"
23653
+ }
23654
+ ],
23655
+ onChange: (e) => setSortBy(`${sortField}_${e}`),
23656
+ value: sortDirection
23657
+ }
23658
+ )
23659
+ ] })
23660
+ ] }),
23661
+ hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(VerticalRhythm, { gap: "xs", children: [
23662
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { css: Title, children: localeLabel }),
23663
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
23664
+ InputSelect,
23665
+ {
23666
+ name: "localeReturned",
23667
+ "aria-label": "Locale returned",
23668
+ label: "Locale returned",
23669
+ showLabel: false,
23670
+ "data-testid": "context-locale",
23671
+ onChange: (e) => {
23672
+ var _a2;
23673
+ return handleLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
23674
+ },
23675
+ options: localeOptions,
23676
+ value: localeValue
23677
+ }
23678
+ )
23679
+ ] })
23680
+ ] });
23824
23681
  };
23825
23682
 
23826
- // src/components/SearchAndFilter/FilterModeView.tsx
23827
- var import_jsx_runtime127 = require("@emotion/react/jsx-runtime");
23828
- var FilterModeView = () => {
23829
- const { filterVisibility } = useSearchAndFilter();
23830
- const modeView = {
23831
- filters: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(FilterItems, {}),
23832
- sort: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(SortItems, {})
23683
+ // src/components/SearchAndFilter/FilterItem.tsx
23684
+ var import_jsx_runtime126 = require("@emotion/react/jsx-runtime");
23685
+ var FilterItem = ({
23686
+ index,
23687
+ paramOptions,
23688
+ operatorOptions,
23689
+ valueOptions,
23690
+ onParamChange,
23691
+ onOperatorChange,
23692
+ onValueChange
23693
+ }) => {
23694
+ var _a, _b;
23695
+ const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
23696
+ const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
23697
+ const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
23698
+ const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
23699
+ const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
23700
+ const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react148.useMemo)(() => {
23701
+ var _a2;
23702
+ const currentSelectedFilter = filterOptions.find((item) => {
23703
+ var _a3;
23704
+ return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
23705
+ });
23706
+ const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
23707
+ return filters[index].field === item.value;
23708
+ });
23709
+ const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
23710
+ const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
23711
+ return filters[index].operator === item.value;
23712
+ });
23713
+ return {
23714
+ selectedFieldValue: selectedFieldValue2,
23715
+ selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
23716
+ selectedMetaValue: filters[index].value,
23717
+ readOnly: isCurrentFieldReadOnly,
23718
+ bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
23719
+ };
23720
+ }, [filters, filterOptions, index, operatorOptions]);
23721
+ const readOnlyProps = readOnly ? {
23722
+ "aria-readonly": true,
23723
+ isSearchable: false,
23724
+ menuIsOpen: false,
23725
+ isClearable: false
23726
+ } : {};
23727
+ return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
23728
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("span", { children: index === 0 ? "Where" : "and" }),
23729
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { css: ConditionalInputRow, children: [
23730
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23731
+ InputComboBox,
23732
+ {
23733
+ "aria-label": label,
23734
+ options: paramOptions,
23735
+ onChange: (e) => {
23736
+ var _a2;
23737
+ onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
23738
+ },
23739
+ isOptionDisabled: (option) => {
23740
+ var _a2;
23741
+ return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
23742
+ },
23743
+ styles: {
23744
+ menu(base) {
23745
+ return {
23746
+ ...base,
23747
+ minWidth: "max-content"
23748
+ };
23749
+ }
23750
+ },
23751
+ value: selectedFieldValue,
23752
+ ...readOnlyProps,
23753
+ id: "filter-field",
23754
+ name: `filter-field-${index}`
23755
+ }
23756
+ ),
23757
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23758
+ InputComboBox,
23759
+ {
23760
+ "aria-label": operatorLabel,
23761
+ options: operatorOptions,
23762
+ onChange: (e) => {
23763
+ var _a2;
23764
+ return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
23765
+ },
23766
+ isDisabled: !filters[index].field,
23767
+ value: selectedOperatorValue,
23768
+ styles: {
23769
+ menu(base) {
23770
+ return {
23771
+ ...base,
23772
+ minWidth: "max-content"
23773
+ };
23774
+ }
23775
+ },
23776
+ ...readOnlyProps,
23777
+ id: "filter-operator",
23778
+ name: `filter-operator-${index}`
23779
+ }
23780
+ ),
23781
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23782
+ FilterEditorRenderer,
23783
+ {
23784
+ "aria-label": metaDataLabel,
23785
+ editorType: metaDataPossibleOptions,
23786
+ options: valueOptions,
23787
+ onChange: (e) => onValueChange(e != null ? e : ""),
23788
+ readOnly,
23789
+ bindable,
23790
+ disabled: !filters[index].operator,
23791
+ value: selectedMetaValue,
23792
+ valueTestId: "filter-value"
23793
+ }
23794
+ ),
23795
+ readOnly || index === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23796
+ "button",
23797
+ {
23798
+ type: "button",
23799
+ onClick: () => handleDeleteFilter(index),
23800
+ "aria-label": "delete filter",
23801
+ css: IconBtn,
23802
+ "data-testid": "delete-filter",
23803
+ children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
23804
+ }
23805
+ )
23806
+ ] })
23807
+ ] });
23808
+ };
23809
+ var FilterItems = ({ addButtonText = "add condition" }) => {
23810
+ const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
23811
+ const handleUpdateFilter = (index, prop, value) => {
23812
+ var _a, _b, _c, _d, _e;
23813
+ const next = [...filters];
23814
+ next[index] = { ...next[index], [prop]: value };
23815
+ if (prop === "operator") {
23816
+ if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
23817
+ next[index].value = next[index].value[0];
23818
+ }
23819
+ if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
23820
+ next[index].value = [next[index].value, ""];
23821
+ }
23822
+ if (value === "def" || value === "true") {
23823
+ next[index].value = "true";
23824
+ }
23825
+ if (value === "ndef" || value === "false") {
23826
+ next[index].value = "false";
23827
+ }
23828
+ }
23829
+ if (prop === "field") {
23830
+ const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
23831
+ var _a2;
23832
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
23833
+ })) == 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";
23834
+ next[index].operator = firstOperatorInAvailableOperators;
23835
+ next[index].value = "";
23836
+ }
23837
+ setFilters(next);
23833
23838
  };
23834
- return filterVisibility ? modeView[filterVisibility] : null;
23839
+ return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23840
+ FilterMenu,
23841
+ {
23842
+ id: "search-and-filter-options",
23843
+ dataTestId: "search-and-filter-options",
23844
+ menuControls: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(
23845
+ "button",
23846
+ {
23847
+ type: "button",
23848
+ css: AddConditionalBtn,
23849
+ onClick: handleAddFilter,
23850
+ "data-testid": "add-filter",
23851
+ children: [
23852
+ /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
23853
+ addButtonText
23854
+ ]
23855
+ }
23856
+ ),
23857
+ sortControls: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SortItems, {}),
23858
+ children: filters.map((item, i) => {
23859
+ var _a, _b, _c, _d, _e, _f;
23860
+ const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
23861
+ var _a2;
23862
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
23863
+ })) == null ? void 0 : _a.options) != null ? _b : [];
23864
+ const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
23865
+ const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
23866
+ return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23867
+ FilterItem,
23868
+ {
23869
+ index: i,
23870
+ paramOptions: filterOptions,
23871
+ onParamChange: (e) => handleUpdateFilter(i, "field", e),
23872
+ operatorOptions: possibleOperators,
23873
+ onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
23874
+ onValueChange: (e) => handleUpdateFilter(i, "value", e),
23875
+ valueOptions: possibleValueOptions
23876
+ },
23877
+ i
23878
+ );
23879
+ })
23880
+ }
23881
+ );
23835
23882
  };
23836
23883
 
23884
+ // src/components/SearchAndFilter/SearchAndFilter.tsx
23885
+ init_emotion_jsx_shim();
23886
+
23837
23887
  // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
23838
23888
  init_emotion_jsx_shim();
23839
- var import_jsx_runtime128 = require("@emotion/react/jsx-runtime");
23889
+ var import_jsx_runtime127 = require("@emotion/react/jsx-runtime");
23840
23890
  var SearchAndFilterResultContainer = ({
23841
23891
  buttonText,
23842
23892
  clearButtonLabel = "clear",
@@ -23870,46 +23920,50 @@ var SearchAndFilterResultContainer = ({
23870
23920
  if (totalResults && totalResults > 0) {
23871
23921
  return null;
23872
23922
  }
23873
- return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(import_jsx_runtime128.Fragment, { children: [
23874
- /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(HorizontalRhythm, { children: [
23875
- /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("span", { children: [
23923
+ return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [
23924
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(HorizontalRhythm, { children: [
23925
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("span", { children: [
23876
23926
  totalResults,
23877
23927
  " results ",
23878
23928
  searchTerm ? `for "${searchTerm}"` : null
23879
23929
  ] }),
23880
- !searchTerm ? null : /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
23930
+ !searchTerm ? null : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
23881
23931
  ] }),
23882
- totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(Callout, { title: calloutTitle2 != null ? calloutTitle2 : automateCalloutTitle(), type: "note", children: [
23883
- calloutText ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Paragraph, { children: calloutText }) : null,
23884
- /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Button, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
23932
+ totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(Callout, { title: calloutTitle2 != null ? calloutTitle2 : automateCalloutTitle(), type: "note", children: [
23933
+ calloutText ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Paragraph, { children: calloutText }) : null,
23934
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Button, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
23885
23935
  ] }) : null
23886
23936
  ] });
23887
23937
  };
23888
23938
 
23889
23939
  // src/components/SearchAndFilter/SearchAndFilter.tsx
23890
- var import_jsx_runtime129 = require("@emotion/react/jsx-runtime");
23940
+ var import_jsx_runtime128 = require("@emotion/react/jsx-runtime");
23891
23941
  var SearchAndFilter = ({
23892
23942
  filters,
23893
23943
  filterOptions,
23894
- filterMode: filterMode3,
23944
+ filterVisible,
23895
23945
  sortOptions,
23896
23946
  defaultSortByValue,
23897
23947
  filterControls,
23898
23948
  viewSwitchControls,
23899
- resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(SearchAndFilterResultContainer, {}),
23900
- children = /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(FilterModeView, {}),
23949
+ resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(SearchAndFilterResultContainer, {}),
23950
+ children = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(FilterItems, {}),
23951
+ filterMapper: filterMapper2 = filterMapper,
23901
23952
  onChange,
23902
23953
  onSearchChange,
23903
23954
  onSortChange,
23955
+ onLocaleChange,
23904
23956
  totalResults,
23905
- resetFilterValues = []
23957
+ resetFilterValues = [],
23958
+ defaultLocale,
23959
+ localeOptions
23906
23960
  }) => {
23907
- return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
23961
+ return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
23908
23962
  SearchAndFilterProvider,
23909
23963
  {
23910
23964
  filters,
23911
23965
  filterOptions,
23912
- filterMode: filterMode3,
23966
+ filterVisible,
23913
23967
  defaultSortByValue,
23914
23968
  sortOptions,
23915
23969
  onChange,
@@ -23917,15 +23971,19 @@ var SearchAndFilter = ({
23917
23971
  onSortChange,
23918
23972
  totalResults,
23919
23973
  resetFilterValues,
23920
- children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
23921
- /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
23922
- /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
23974
+ defaultLocale,
23975
+ localeOptions,
23976
+ onLocaleChange,
23977
+ filterMapper: filterMapper2,
23978
+ children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
23979
+ /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
23980
+ /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
23923
23981
  "div",
23924
23982
  {
23925
23983
  css: SearchAndFilterControlsWrapper(
23926
- viewSwitchControls ? "auto auto 1fr 0.5fr" : "auto auto 1fr"
23984
+ viewSwitchControls ? "auto 1fr 0.05fr" : "auto auto 1fr"
23927
23985
  ),
23928
- children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(FilterControls, { hideSearchInput: !onSearchChange, defaultSortByValue }) : filterControls
23986
+ children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
23929
23987
  }
23930
23988
  ),
23931
23989
  viewSwitchControls
@@ -23941,7 +23999,7 @@ var SearchAndFilter = ({
23941
23999
  init_emotion_jsx_shim();
23942
24000
  var import_react149 = require("react");
23943
24001
  var import_react_use5 = require("react-use");
23944
- var import_jsx_runtime130 = require("@emotion/react/jsx-runtime");
24002
+ var import_jsx_runtime129 = require("@emotion/react/jsx-runtime");
23945
24003
  var SearchOnlyContext = (0, import_react149.createContext)({
23946
24004
  searchTerm: "",
23947
24005
  setSearchTerm: () => {
@@ -23958,14 +24016,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
23958
24016
  300,
23959
24017
  [localeSearchTerm]
23960
24018
  );
23961
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
24019
+ return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
23962
24020
  SearchOnlyContext.Provider,
23963
24021
  {
23964
24022
  value: {
23965
24023
  searchTerm,
23966
24024
  setSearchTerm: setLocaleSearchTerm
23967
24025
  },
23968
- children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
24026
+ children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
23969
24027
  InputKeywordSearch,
23970
24028
  {
23971
24029
  placeholder: "Search...",
@@ -23995,7 +24053,7 @@ var skeletonStyles = import_react150.css`
23995
24053
  `;
23996
24054
 
23997
24055
  // src/components/Skeleton/Skeleton.tsx
23998
- var import_jsx_runtime131 = require("@emotion/react/jsx-runtime");
24056
+ var import_jsx_runtime130 = require("@emotion/react/jsx-runtime");
23999
24057
  var Skeleton = ({
24000
24058
  width = "100%",
24001
24059
  height = "1.25rem",
@@ -24003,7 +24061,7 @@ var Skeleton = ({
24003
24061
  circle = false,
24004
24062
  children,
24005
24063
  ...otherProps
24006
- }) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
24064
+ }) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
24007
24065
  "div",
24008
24066
  {
24009
24067
  css: [
@@ -24112,19 +24170,19 @@ var SwitchText = import_react151.css`
24112
24170
  `;
24113
24171
 
24114
24172
  // src/components/Switch/Switch.tsx
24115
- var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
24173
+ var import_jsx_runtime131 = require("@emotion/react/jsx-runtime");
24116
24174
  var Switch = React26.forwardRef(
24117
24175
  ({ label, infoText, toggleText, children, ...inputProps }, ref) => {
24118
24176
  let additionalText = infoText;
24119
24177
  if (infoText && toggleText) {
24120
24178
  additionalText = inputProps.checked ? toggleText : infoText;
24121
24179
  }
24122
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
24123
- /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
24124
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
24125
- /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { css: SwitchInputLabel, children: label })
24180
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
24181
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
24182
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
24183
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { css: SwitchInputLabel, children: label })
24126
24184
  ] }),
24127
- additionalText ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("p", { css: SwitchText, children: additionalText }) : null,
24185
+ additionalText ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("p", { css: SwitchText, children: additionalText }) : null,
24128
24186
  children
24129
24187
  ] });
24130
24188
  }
@@ -24163,40 +24221,40 @@ var tableCellHead = import_react152.css`
24163
24221
  `;
24164
24222
 
24165
24223
  // src/components/Table/Table.tsx
24166
- var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
24224
+ var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
24167
24225
  var Table = React27.forwardRef(
24168
24226
  ({ children, cellPadding, ...otherProps }, ref) => {
24169
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("table", { ref, css: table({ cellPadding }), ...otherProps, children });
24227
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("table", { ref, css: table({ cellPadding }), ...otherProps, children });
24170
24228
  }
24171
24229
  );
24172
24230
  var TableHead = React27.forwardRef(
24173
24231
  ({ children, ...otherProps }, ref) => {
24174
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("thead", { ref, css: tableHead, ...otherProps, children });
24232
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("thead", { ref, css: tableHead, ...otherProps, children });
24175
24233
  }
24176
24234
  );
24177
24235
  var TableBody = React27.forwardRef(
24178
24236
  ({ children, ...otherProps }, ref) => {
24179
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("tbody", { ref, ...otherProps, children });
24237
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("tbody", { ref, ...otherProps, children });
24180
24238
  }
24181
24239
  );
24182
24240
  var TableFoot = React27.forwardRef(
24183
24241
  ({ children, ...otherProps }, ref) => {
24184
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("tfoot", { ref, ...otherProps, children });
24242
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("tfoot", { ref, ...otherProps, children });
24185
24243
  }
24186
24244
  );
24187
24245
  var TableRow = React27.forwardRef(
24188
24246
  ({ children, ...otherProps }, ref) => {
24189
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("tr", { ref, css: tableRow, ...otherProps, children });
24247
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("tr", { ref, css: tableRow, ...otherProps, children });
24190
24248
  }
24191
24249
  );
24192
24250
  var TableCellHead = React27.forwardRef(
24193
24251
  ({ children, ...otherProps }, ref) => {
24194
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("th", { ref, css: tableCellHead, ...otherProps, children });
24252
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("th", { ref, css: tableCellHead, ...otherProps, children });
24195
24253
  }
24196
24254
  );
24197
24255
  var TableCellData = React27.forwardRef(
24198
24256
  ({ children, ...otherProps }, ref) => {
24199
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("td", { ref, ...otherProps, children });
24257
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("td", { ref, ...otherProps, children });
24200
24258
  }
24201
24259
  );
24202
24260
 
@@ -24232,7 +24290,7 @@ var tabButtonGroupStyles = import_react153.css`
24232
24290
  `;
24233
24291
 
24234
24292
  // src/components/Tabs/Tabs.tsx
24235
- var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
24293
+ var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
24236
24294
  var useCurrentTab = () => {
24237
24295
  const context = (0, import_react154.useTabStore)();
24238
24296
  if (!context) {
@@ -24270,23 +24328,23 @@ var Tabs = ({
24270
24328
  tab.setSelectedId(selected);
24271
24329
  }
24272
24330
  }, [selected, tab]);
24273
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react154.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
24331
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
24274
24332
  };
24275
24333
  var TabButtonGroup = ({ children, ...props }) => {
24276
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react154.TabList, { ...props, css: tabButtonGroupStyles, children });
24334
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.TabList, { ...props, css: tabButtonGroupStyles, children });
24277
24335
  };
24278
24336
  var TabButton = ({
24279
24337
  children,
24280
24338
  id,
24281
24339
  ...props
24282
24340
  }) => {
24283
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react154.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
24341
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
24284
24342
  };
24285
24343
  var TabContent = ({
24286
24344
  children,
24287
24345
  ...props
24288
24346
  }) => {
24289
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_react154.TabPanel, { ...props, children });
24347
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.TabPanel, { ...props, children });
24290
24348
  };
24291
24349
 
24292
24350
  // src/components/Toast/Toast.tsx
@@ -24519,9 +24577,9 @@ var toastContainerStyles = import_react156.css`
24519
24577
  `;
24520
24578
 
24521
24579
  // src/components/Toast/Toast.tsx
24522
- var import_jsx_runtime135 = require("@emotion/react/jsx-runtime");
24580
+ var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
24523
24581
  var ToastContainer = ({ limit = 4 }) => {
24524
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
24582
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
24525
24583
  import_react_toastify.ToastContainer,
24526
24584
  {
24527
24585
  css: toastContainerStyles,
@@ -24560,6 +24618,8 @@ var ToastContainer = ({ limit = 4 }) => {
24560
24618
  CurrentDrawerContext,
24561
24619
  DATE_OPERATORS,
24562
24620
  DashedBox,
24621
+ DateEditor,
24622
+ DateRangeEditor,
24563
24623
  DateTimePicker,
24564
24624
  DateTimePickerVariant,
24565
24625
  DebouncedInputKeywordSearch,
@@ -24575,9 +24635,12 @@ var ToastContainer = ({ limit = 4 }) => {
24575
24635
  Fieldset,
24576
24636
  FilterButton,
24577
24637
  FilterControls,
24638
+ FilterEditorRenderer,
24578
24639
  FilterItem,
24579
24640
  FilterItems,
24580
24641
  FilterMenu,
24642
+ FilterMultiChoiceEditor,
24643
+ FilterSingleChoiceEditor,
24581
24644
  Heading,
24582
24645
  HexModalBackground,
24583
24646
  HorizontalRhythm,
@@ -24624,6 +24687,9 @@ var ToastContainer = ({ limit = 4 }) => {
24624
24687
  ModalDialog,
24625
24688
  MultilineChip,
24626
24689
  NUMBER_OPERATORS,
24690
+ NumberEditor,
24691
+ NumberRangeEditor,
24692
+ PUBLISH_STATUS_FIELD_OPERATORS,
24627
24693
  PageHeaderSection,
24628
24694
  Pagination,
24629
24695
  Paragraph,
@@ -24676,6 +24742,8 @@ var ToastContainer = ({ limit = 4 }) => {
24676
24742
  ShortcutRevealer,
24677
24743
  Skeleton,
24678
24744
  StatusBullet,
24745
+ StatusMultiEditor,
24746
+ StatusSingleEditor,
24679
24747
  SuccessMessage,
24680
24748
  Switch,
24681
24749
  TAKEOVER_STACK_ID,
@@ -24692,6 +24760,7 @@ var ToastContainer = ({ limit = 4 }) => {
24692
24760
  TableRow,
24693
24761
  Tabs,
24694
24762
  TakeoverDrawerRenderer,
24763
+ TextEditor,
24695
24764
  Textarea,
24696
24765
  Theme,
24697
24766
  Tile,
@@ -24736,6 +24805,7 @@ var ToastContainer = ({ limit = 4 }) => {
24736
24805
  fadeInRtl,
24737
24806
  fadeInTop,
24738
24807
  fadeOutBottom,
24808
+ filterMapper,
24739
24809
  fullWidthScreenIcon,
24740
24810
  getDrawerAttributes,
24741
24811
  getParentPath,