@uniformdev/design-system 19.117.1-alpha.2 → 19.117.2-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -20298,8 +20298,8 @@ var SearchAndFilterContainer = css92``;
20298
20298
  var SearchAndFilterControlsWrapper = css92`
20299
20299
  align-items: stretch;
20300
20300
  display: grid;
20301
- grid-template-columns: auto 1fr 1fr;
20302
- gap: var(--spacing-base);
20301
+ grid-template-columns: auto auto 1fr 0.5fr;
20302
+ gap: var(--spacing-sm);
20303
20303
  `;
20304
20304
  var SearchAndFilterOutterControlWrapper = css92`
20305
20305
  align-items: stretch;
@@ -20311,7 +20311,6 @@ var ConditionalFilterRow = css92`
20311
20311
  display: grid;
20312
20312
  grid-template-columns: 35px 1fr;
20313
20313
  gap: var(--spacing-sm);
20314
- padding: 0 var(--spacing-sm);
20315
20314
  margin-left: var(--spacing-base);
20316
20315
 
20317
20316
  ${cq("380px")} {
@@ -20338,7 +20337,7 @@ var ConditionalInputRow = css92`
20338
20337
  }
20339
20338
  ${cq("580px")} {
20340
20339
  display: grid;
20341
- grid-template-columns: repeat(4, minmax(160px, auto)) 32px;
20340
+ grid-template-columns: 200px 160px repeat(2, minmax(160px, 240px)) 32px;
20342
20341
  }
20343
20342
  `;
20344
20343
  var SearchInput = css92`
@@ -20358,36 +20357,48 @@ var FilterButton = css92`
20358
20357
  gap: var(--spacing-sm);
20359
20358
  padding: var(--spacing-sm) var(--spacing-base);
20360
20359
  transition: color var(--duration-fast) var(--timing-ease-out),
20361
- background-color var(--duration-fast) var(--timing-ease-out);
20360
+ background-color var(--duration-fast) var(--timing-ease-out),
20361
+ border-color var(--duration-fast) var(--timing-ease-out),
20362
+ box-shadow var(--duration-fast) var(--timing-ease-out);
20362
20363
 
20363
20364
  svg {
20364
20365
  color: var(--gray-300);
20365
20366
  transition: color var(--duration-fast) var(--timing-ease-out);
20366
20367
  }
20367
20368
 
20368
- &:focus,
20369
- &:hover {
20369
+ &:hover,
20370
+ :where([aria-expanded='true']) {
20370
20371
  outline: none;
20371
- background: var(--gray-300);
20372
+ background: var(--gray-200);
20373
+ border-color: var(--gray-300);
20372
20374
 
20373
20375
  svg {
20374
20376
  color: var(--typography-base);
20375
20377
  }
20376
20378
  }
20377
20379
 
20378
- :where([aria-expanded='true']) {
20379
- background: var(--purple-rain-100);
20380
+ &:disabled {
20381
+ opacity: var(--opacity-50);
20382
+ }
20383
+ `;
20384
+ var FilterButtonSelected = css92`
20385
+ background: var(--gray-100);
20386
+ border-color: var(--gray-300);
20380
20387
 
20381
- svg {
20382
- color: var(--typography-base);
20383
- }
20388
+ svg {
20389
+ color: var(--accent-dark);
20384
20390
  }
20385
20391
  `;
20386
20392
  var FilterButtonWithOptions = css92`
20387
- background: var(--purple-rain-100);
20388
- color: var(--typography-base);
20389
- svg {
20393
+ :where([aria-expanded='true']) {
20394
+ background: var(--purple-rain-100);
20395
+ border-color: var(--accent-light);
20390
20396
  color: var(--typography-base);
20397
+ box-shadow: var(--elevation-100);
20398
+
20399
+ svg {
20400
+ color: var(--accent-dark);
20401
+ }
20391
20402
  }
20392
20403
  `;
20393
20404
  var SearchIcon = css92`
@@ -20412,9 +20423,17 @@ var AddConditionalBtn = css92`
20412
20423
  &:focus {
20413
20424
  color: var(--primary-action-hover);
20414
20425
  }
20426
+
20427
+ &:disabled {
20428
+ color: var(--gray-400);
20429
+ }
20415
20430
  `;
20416
20431
  var Title = css92`
20417
20432
  color: var(--typography-light);
20433
+
20434
+ &:focus {
20435
+ outline: none;
20436
+ }
20418
20437
  `;
20419
20438
  var ResetConditionsBtn = css92`
20420
20439
  background: transparent;
@@ -20453,40 +20472,39 @@ var SearchAndFilterOptionsContainer = css92`
20453
20472
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-base);
20454
20473
  will-change: height;
20455
20474
  position: relative;
20456
- z-index: var(--z-50);
20475
+ z-index: 1;
20457
20476
  `;
20458
20477
  var SearchAndFilterOptionsInnerContainer = css92`
20459
20478
  display: flex;
20460
20479
  flex-direction: column;
20461
20480
  gap: var(--spacing-sm);
20462
- // TODO: this is nice for responsive but is causing issue with the dropdown
20463
- // ${scrollbarStyles}
20464
- // overflow-x: auto;
20465
- // overflow-y: visible;
20466
20481
  `;
20467
20482
  var SearchAndFilterButtonGroup = css92`
20468
20483
  margin-top: var(--spacing-base);
20469
20484
  `;
20470
- var SelectOpen = css92`
20471
- position: relative;
20472
- .input-combobox__menu {
20473
- background: red;
20474
- z-index: 99999 !important;
20475
- }
20476
- `;
20477
20485
 
20478
20486
  // src/components/SearchAndFilter/FilterButton.tsx
20479
20487
  import { jsx as jsx117, jsxs as jsxs79 } from "@emotion/react/jsx-runtime";
20480
- var FilterButton2 = ({ text = "Filters", filterCount, ...props }) => {
20488
+ var FilterButton2 = ({
20489
+ text = "Filters",
20490
+ icon = "filter-add",
20491
+ filterCount,
20492
+ hasSelectedValue,
20493
+ ...props
20494
+ }) => {
20481
20495
  return /* @__PURE__ */ jsxs79(
20482
20496
  "button",
20483
20497
  {
20484
20498
  type: "button",
20485
- css: [FilterButton, filterCount ? FilterButtonWithOptions : void 0],
20499
+ css: [
20500
+ FilterButton,
20501
+ hasSelectedValue ? FilterButtonSelected : void 0,
20502
+ filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
20503
+ ],
20486
20504
  ...props,
20487
20505
  "data-testid": "filters-button",
20488
20506
  children: [
20489
- /* @__PURE__ */ jsx117(Icon, { icon: "filter-add", iconColor: "currentColor", size: "1rem" }),
20507
+ /* @__PURE__ */ jsx117(Icon, { icon, iconColor: "currentColor", size: "1rem" }),
20490
20508
  text,
20491
20509
  filterCount ? /* @__PURE__ */ jsx117(Counter, { count: filterCount, bgColor: "var(--white)" }) : null
20492
20510
  ]
@@ -20513,7 +20531,7 @@ var SearchAndFilterContext = createContext6({
20513
20531
  searchTerm: "",
20514
20532
  setSearchTerm: () => {
20515
20533
  },
20516
- filterVisibility: false,
20534
+ filterVisibility: void 0,
20517
20535
  setFilterVisibility: () => {
20518
20536
  },
20519
20537
  filters: [],
@@ -20525,21 +20543,29 @@ var SearchAndFilterContext = createContext6({
20525
20543
  },
20526
20544
  handleDeleteFilter: () => {
20527
20545
  },
20546
+ setSortBy: () => {
20547
+ },
20548
+ sortByValue: "",
20528
20549
  filterOptions: [],
20550
+ sortOptions: [],
20529
20551
  validFilterQuery: [],
20530
20552
  totalResults: 0
20531
20553
  });
20532
20554
  var SearchAndFilterProvider = ({
20533
20555
  filters,
20534
20556
  filterOptions,
20557
+ sortOptions,
20558
+ defaultSortByValue,
20535
20559
  onSearchChange,
20536
20560
  onChange,
20561
+ onSortChange,
20537
20562
  totalResults,
20538
20563
  children
20539
20564
  }) => {
20540
20565
  const [searchTerm, setSearchTerm] = useState16("");
20541
20566
  const deferredSearchTerm = useDeferredValue2(searchTerm);
20542
- const [filterVisibility, setFilterVisibility] = useState16(false);
20567
+ const [filterVisibility, setFilterVisibility] = useState16(void 0);
20568
+ const [sortByValue, setSortByValue] = useState16(defaultSortByValue);
20543
20569
  const handleSearchTerm = useCallback10(
20544
20570
  (term) => {
20545
20571
  setSearchTerm(term);
@@ -20547,8 +20573,15 @@ var SearchAndFilterProvider = ({
20547
20573
  },
20548
20574
  [setSearchTerm, onSearchChange]
20549
20575
  );
20576
+ const handleOnSortChange = useCallback10(
20577
+ (sort) => {
20578
+ setSortByValue(sort);
20579
+ onSortChange(sort);
20580
+ },
20581
+ [onSortChange]
20582
+ );
20550
20583
  const handleToggleFilterVisibilty = useCallback10(
20551
- (visible) => setFilterVisibility(visible),
20584
+ (mode) => setFilterVisibility(mode),
20552
20585
  [setFilterVisibility]
20553
20586
  );
20554
20587
  const handleAddFilter = useCallback10(() => {
@@ -20574,7 +20607,7 @@ var SearchAndFilterProvider = ({
20574
20607
  if (filterVisibility) {
20575
20608
  const handleEscKeyFilterClose = (e) => {
20576
20609
  if (e.key === "Escape") {
20577
- setFilterVisibility(false);
20610
+ setFilterVisibility(void 0);
20578
20611
  }
20579
20612
  };
20580
20613
  document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
@@ -20582,21 +20615,24 @@ var SearchAndFilterProvider = ({
20582
20615
  document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
20583
20616
  };
20584
20617
  }
20585
- }, [filterVisibility, setFilterVisibility]);
20618
+ }, [filterVisibility]);
20586
20619
  return /* @__PURE__ */ jsx118(
20587
20620
  SearchAndFilterContext.Provider,
20588
20621
  {
20589
20622
  value: {
20590
20623
  searchTerm: deferredSearchTerm,
20591
20624
  setSearchTerm: (e) => handleSearchTerm(e),
20625
+ setSortBy: (e) => handleOnSortChange(e),
20626
+ sortByValue,
20592
20627
  filterVisibility,
20593
20628
  setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
20594
20629
  filters,
20595
20630
  setFilters: (e) => onChange(e),
20596
- handleAddFilter: () => handleAddFilter(),
20597
- handleResetFilters: () => handleResetFilters(),
20598
- handleDeleteFilter: (index) => handleDeleteFilter(index),
20631
+ handleAddFilter,
20632
+ handleResetFilters,
20633
+ handleDeleteFilter,
20599
20634
  filterOptions,
20635
+ sortOptions,
20600
20636
  validFilterQuery,
20601
20637
  totalResults
20602
20638
  },
@@ -20611,8 +20647,10 @@ var useSearchAndFilter = () => {
20611
20647
 
20612
20648
  // src/components/SearchAndFilter/FilterControls.tsx
20613
20649
  import { Fragment as Fragment19, jsx as jsx119, jsxs as jsxs80 } from "@emotion/react/jsx-runtime";
20614
- var FilterControls = ({ children }) => {
20615
- const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
20650
+ var FilterControls = ({
20651
+ children
20652
+ }) => {
20653
+ const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm, sortByValue } = useSearchAndFilter();
20616
20654
  const [localeSearchTerm, setLocaleSearchTerm] = useState17("");
20617
20655
  useDebounce2(
20618
20656
  () => {
@@ -20626,6 +20664,15 @@ var FilterControls = ({ children }) => {
20626
20664
  setLocaleSearchTerm("");
20627
20665
  }
20628
20666
  }, [searchTerm]);
20667
+ const handleFilterToggle = (mode) => {
20668
+ if (filterVisibility && ["sort", "filters"].includes(filterVisibility)) {
20669
+ return setFilterVisibility(void 0);
20670
+ }
20671
+ return setFilterVisibility(mode);
20672
+ };
20673
+ const sortByValues = sortByValue ? sortByValue == null ? void 0 : sortByValue.split("_") : "Sort";
20674
+ const sortByValueLabel = Array.isArray(sortByValues) ? sortByValue == null ? void 0 : sortByValue.split("_")[0] : "Sort";
20675
+ const sortByIcon = Array.isArray(sortByValues) ? sortByValues[1] === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
20629
20676
  return /* @__PURE__ */ jsxs80(Fragment19, { children: [
20630
20677
  /* @__PURE__ */ jsx119(
20631
20678
  FilterButton2,
@@ -20633,9 +20680,23 @@ var FilterControls = ({ children }) => {
20633
20680
  "aria-controls": "search-and-filter-options",
20634
20681
  "aria-label": "filter options",
20635
20682
  "aria-haspopup": "true",
20636
- "aria-expanded": filterVisibility,
20683
+ "aria-expanded": filterVisibility === "filters",
20637
20684
  filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
20638
- onClick: () => setFilterVisibility(!filterVisibility)
20685
+ onClick: () => handleFilterToggle("filters")
20686
+ }
20687
+ ),
20688
+ /* @__PURE__ */ jsx119(
20689
+ FilterButton2,
20690
+ {
20691
+ "aria-controls": "search-and-filter-sortBy",
20692
+ "aria-label": "sort by options",
20693
+ "aria-haspopup": "true",
20694
+ text: sortByValueLabel,
20695
+ icon: sortByIcon,
20696
+ "aria-expanded": filterVisibility === "sort",
20697
+ hasSelectedValue: sortByValue !== "",
20698
+ onClick: () => handleFilterToggle("sort"),
20699
+ "data-testid": "sort-by-dropdown"
20639
20700
  }
20640
20701
  ),
20641
20702
  /* @__PURE__ */ jsx119(
@@ -20777,6 +20838,7 @@ var FilterMultiChoiceEditor = ({
20777
20838
  InputComboBox,
20778
20839
  {
20779
20840
  ...props,
20841
+ placeholder: "Type to search...",
20780
20842
  options,
20781
20843
  isMulti: true,
20782
20844
  isClearable: true,
@@ -20798,6 +20860,7 @@ var FilterSingleChoiceEditor = ({
20798
20860
  return /* @__PURE__ */ jsx121(
20799
20861
  InputComboBox,
20800
20862
  {
20863
+ placeholder: "Type to search...",
20801
20864
  options,
20802
20865
  isClearable: true,
20803
20866
  onChange: (e) => {
@@ -21047,7 +21110,8 @@ var ErrorContainer = ({ errorMessage }) => {
21047
21110
  };
21048
21111
 
21049
21112
  // src/components/SearchAndFilter/FilterMenu.tsx
21050
- import { Fragment as Fragment21, jsx as jsx122, jsxs as jsxs82 } from "@emotion/react/jsx-runtime";
21113
+ import React24, { useEffect as useEffect20 } from "react";
21114
+ import { jsx as jsx122, jsxs as jsxs82 } from "@emotion/react/jsx-runtime";
21051
21115
  var SearchAndFilterOptionsContainer2 = ({
21052
21116
  buttonRow,
21053
21117
  children
@@ -21066,65 +21130,33 @@ var SearchAndFilterOptionsContainer2 = ({
21066
21130
  ) : null
21067
21131
  ] });
21068
21132
  };
21069
- var FilterMenu = ({
21070
- id,
21071
- addButtonText = "add condition",
21072
- isAddDisabled,
21073
- resetButtonText = "reset filters",
21074
- filterTitle = "Show records",
21075
- children
21076
- }) => {
21077
- const { filterVisibility, handleAddFilter, handleResetFilters, setFilterVisibility, validFilterQuery } = useSearchAndFilter();
21078
- return /* @__PURE__ */ jsx122(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, children: filterVisibility ? /* @__PURE__ */ jsxs82(
21079
- SearchAndFilterOptionsContainer2,
21080
- {
21081
- buttonRow: /* @__PURE__ */ jsxs82(Fragment21, { children: [
21082
- /* @__PURE__ */ jsxs82(
21083
- "button",
21084
- {
21085
- type: "button",
21086
- css: AddConditionalBtn,
21087
- onClick: handleAddFilter,
21088
- disabled: isAddDisabled,
21089
- children: [
21090
- /* @__PURE__ */ jsx122(Icon, { icon: "math-plus", iconColor: "gray", size: "1rem" }),
21091
- addButtonText
21092
- ]
21093
- }
21094
- ),
21095
- (validFilterQuery == null ? void 0 : validFilterQuery.length) ? /* @__PURE__ */ jsx122(
21096
- "button",
21097
- {
21098
- type: "button",
21099
- css: ResetConditionsBtn,
21100
- onClick: () => {
21101
- handleResetFilters();
21102
- setFilterVisibility(false);
21103
- },
21104
- children: resetButtonText
21105
- }
21106
- ) : null
21107
- ] }),
21108
- children: [
21109
- /* @__PURE__ */ jsx122("span", { css: Title, children: filterTitle }),
21110
- /* @__PURE__ */ jsx122(
21111
- "button",
21112
- {
21113
- type: "button",
21114
- "aria-label": "close filters",
21115
- css: [CloseBtn],
21116
- onClick: () => setFilterVisibility(!filterVisibility),
21117
- children: /* @__PURE__ */ jsx122(Icon, { icon: "close", iconColor: "currentColor", size: "1.1rem" })
21118
- }
21119
- ),
21120
- children
21121
- ]
21133
+ var FilterMenu = ({ id, filterTitle = "Show records", menuControls, children }) => {
21134
+ const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
21135
+ const innerMenuRef = React24.useRef(null);
21136
+ useEffect20(() => {
21137
+ var _a;
21138
+ if (filterVisibility) {
21139
+ (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
21122
21140
  }
21123
- ) : null });
21141
+ }, [filterVisibility]);
21142
+ return /* @__PURE__ */ jsx122(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, children: filterVisibility ? /* @__PURE__ */ jsxs82(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
21143
+ /* @__PURE__ */ jsx122("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
21144
+ /* @__PURE__ */ jsx122(
21145
+ "button",
21146
+ {
21147
+ type: "button",
21148
+ "aria-label": "close filters",
21149
+ css: [CloseBtn],
21150
+ onClick: () => setFilterVisibility(void 0),
21151
+ children: /* @__PURE__ */ jsx122(Icon, { icon: "close", iconColor: "currentColor", size: "1.1rem" })
21152
+ }
21153
+ ),
21154
+ children
21155
+ ] }) : null });
21124
21156
  };
21125
21157
 
21126
21158
  // src/components/SearchAndFilter/FilterItem.tsx
21127
- import { jsx as jsx123, jsxs as jsxs83 } from "@emotion/react/jsx-runtime";
21159
+ import { Fragment as Fragment21, jsx as jsx123, jsxs as jsxs83 } from "@emotion/react/jsx-runtime";
21128
21160
  var FilterItem = ({
21129
21161
  index,
21130
21162
  paramOptions,
@@ -21216,8 +21248,19 @@ var FilterItem = ({
21216
21248
  ] })
21217
21249
  ] });
21218
21250
  };
21219
- var FilterItems = () => {
21220
- const { filterOptions, filters, setFilters } = useSearchAndFilter();
21251
+ var FilterItems = ({
21252
+ addButtonText = "add condition",
21253
+ resetButtonText = "reset filters"
21254
+ }) => {
21255
+ const {
21256
+ filterOptions,
21257
+ filters,
21258
+ setFilters,
21259
+ handleAddFilter,
21260
+ handleResetFilters,
21261
+ setFilterVisibility,
21262
+ validFilterQuery
21263
+ } = useSearchAndFilter();
21221
21264
  const handleUpdateFilter = (index, prop, value) => {
21222
21265
  const next = [...filters];
21223
21266
  next[index] = { ...next[index], [prop]: value };
@@ -21236,81 +21279,59 @@ var FilterItems = () => {
21236
21279
  }
21237
21280
  setFilters(next);
21238
21281
  };
21239
- return /* @__PURE__ */ jsx123(FilterMenu, { id: "search-and-filter-options", children: filters.map((item, i) => {
21240
- var _a, _b, _c, _d, _e, _f;
21241
- const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
21242
- var _a2;
21243
- return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
21244
- })) == null ? void 0 : _a.options) != null ? _b : [];
21245
- const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
21246
- const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
21247
- return /* @__PURE__ */ jsx123(
21248
- FilterItem,
21249
- {
21250
- index: i,
21251
- paramOptions: filterOptions,
21252
- onParamChange: (e) => handleUpdateFilter(i, "field", e),
21253
- operatorOptions: possibleOperators,
21254
- onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
21255
- onValueChange: (e) => handleUpdateFilter(i, "value", e),
21256
- valueOptions: possibleValueOptions
21257
- },
21258
- i
21259
- );
21260
- }) });
21261
- };
21262
-
21263
- // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
21264
- import { Fragment as Fragment22, jsx as jsx124, jsxs as jsxs84 } from "@emotion/react/jsx-runtime";
21265
- var SearchAndFilterResultContainer = ({
21266
- clearButtonLabel = "clear"
21267
- }) => {
21268
- const { searchTerm, setSearchTerm, totalResults } = useSearchAndFilter();
21269
- return searchTerm ? /* @__PURE__ */ jsxs84(Fragment22, { children: [
21270
- /* @__PURE__ */ jsxs84(HorizontalRhythm, { children: [
21271
- /* @__PURE__ */ jsxs84("span", { children: [
21272
- totalResults,
21273
- " results for ",
21274
- /* @__PURE__ */ jsxs84("strong", { children: [
21275
- '"',
21276
- searchTerm,
21277
- '"'
21278
- ] })
21279
- ] }),
21280
- /* @__PURE__ */ jsx124(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
21281
- ] }),
21282
- totalResults === 0 ? /* @__PURE__ */ jsx124(Callout, { title: "No search results found", type: "note", children: /* @__PURE__ */ jsx124(Button, { buttonType: "tertiaryOutline", size: "sm", onClick: () => setSearchTerm(""), children: "Clear search" }) }) : null
21283
- ] }) : null;
21284
- };
21285
-
21286
- // src/components/SearchAndFilter/SearchAndFilter.tsx
21287
- import { jsx as jsx125, jsxs as jsxs85 } from "@emotion/react/jsx-runtime";
21288
- var SearchAndFilter = ({
21289
- filters,
21290
- filterOptions,
21291
- filterControls = /* @__PURE__ */ jsx125(FilterControls, {}),
21292
- viewSwitchControls,
21293
- children = /* @__PURE__ */ jsx125(FilterItems, {}),
21294
- onChange,
21295
- onSearchChange,
21296
- totalResults
21297
- }) => {
21298
- return /* @__PURE__ */ jsx125(
21299
- SearchAndFilterProvider,
21282
+ return /* @__PURE__ */ jsx123(
21283
+ FilterMenu,
21300
21284
  {
21301
- filters,
21302
- filterOptions,
21303
- onChange,
21304
- onSearchChange,
21305
- totalResults,
21306
- children: /* @__PURE__ */ jsxs85(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
21307
- /* @__PURE__ */ jsxs85("div", { css: SearchAndFilterOutterControlWrapper, children: [
21308
- /* @__PURE__ */ jsx125("div", { css: SearchAndFilterControlsWrapper, children: filterControls }),
21309
- viewSwitchControls
21310
- ] }),
21311
- children,
21312
- /* @__PURE__ */ jsx125(SearchAndFilterResultContainer, {})
21313
- ] })
21285
+ id: "search-and-filter-options",
21286
+ menuControls: /* @__PURE__ */ jsxs83(Fragment21, { children: [
21287
+ /* @__PURE__ */ jsxs83(
21288
+ "button",
21289
+ {
21290
+ type: "button",
21291
+ css: AddConditionalBtn,
21292
+ onClick: handleAddFilter,
21293
+ disabled: !validFilterQuery,
21294
+ children: [
21295
+ /* @__PURE__ */ jsx123(Icon, { icon: "math-plus", iconColor: !validFilterQuery ? "currentColor" : "gray", size: "1rem" }),
21296
+ addButtonText
21297
+ ]
21298
+ }
21299
+ ),
21300
+ (validFilterQuery == null ? void 0 : validFilterQuery.length) ? /* @__PURE__ */ jsx123(
21301
+ "button",
21302
+ {
21303
+ type: "button",
21304
+ css: ResetConditionsBtn,
21305
+ onClick: () => {
21306
+ handleResetFilters();
21307
+ setFilterVisibility(void 0);
21308
+ },
21309
+ children: resetButtonText
21310
+ }
21311
+ ) : null
21312
+ ] }),
21313
+ children: filters.map((item, i) => {
21314
+ var _a, _b, _c, _d, _e, _f;
21315
+ const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
21316
+ var _a2;
21317
+ return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
21318
+ })) == null ? void 0 : _a.options) != null ? _b : [];
21319
+ const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
21320
+ const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
21321
+ return /* @__PURE__ */ jsx123(
21322
+ FilterItem,
21323
+ {
21324
+ index: i,
21325
+ paramOptions: filterOptions,
21326
+ onParamChange: (e) => handleUpdateFilter(i, "field", e),
21327
+ operatorOptions: possibleOperators,
21328
+ onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
21329
+ onValueChange: (e) => handleUpdateFilter(i, "value", e),
21330
+ valueOptions: possibleValueOptions
21331
+ },
21332
+ i
21333
+ );
21334
+ })
21314
21335
  }
21315
21336
  );
21316
21337
  };
@@ -21442,7 +21463,7 @@ var segmentedControlLabelContentStyles = css94`
21442
21463
  var segmentedControlLabelTextStyles = css94``;
21443
21464
 
21444
21465
  // src/components/SegmentedControl/SegmentedControl.tsx
21445
- import { jsx as jsx126, jsxs as jsxs86 } from "@emotion/react/jsx-runtime";
21466
+ import { jsx as jsx124, jsxs as jsxs84 } from "@emotion/react/jsx-runtime";
21446
21467
  var SegmentedControl = ({
21447
21468
  name,
21448
21469
  options,
@@ -21473,7 +21494,7 @@ var SegmentedControl = ({
21473
21494
  const isIconOnly = useMemo8(() => {
21474
21495
  return options.every((option) => option && option.icon && !option.label);
21475
21496
  }, [options]);
21476
- return /* @__PURE__ */ jsx126(
21497
+ return /* @__PURE__ */ jsx124(
21477
21498
  "div",
21478
21499
  {
21479
21500
  css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
@@ -21485,7 +21506,7 @@ var SegmentedControl = ({
21485
21506
  }
21486
21507
  const text = option.label ? option.label : option.icon ? null : String(option.value);
21487
21508
  const isDisabled = disabled2 || option.disabled;
21488
- return /* @__PURE__ */ jsx126(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx126("div", { css: segmentedControlItemStyles, "data-testid": "container-segmented-control", children: /* @__PURE__ */ jsxs86(
21509
+ return /* @__PURE__ */ jsx124(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx124("div", { css: segmentedControlItemStyles, "data-testid": "container-segmented-control", children: /* @__PURE__ */ jsxs84(
21489
21510
  "label",
21490
21511
  {
21491
21512
  css: [
@@ -21494,7 +21515,7 @@ var SegmentedControl = ({
21494
21515
  isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
21495
21516
  ],
21496
21517
  children: [
21497
- /* @__PURE__ */ jsx126(
21518
+ /* @__PURE__ */ jsx124(
21498
21519
  "input",
21499
21520
  {
21500
21521
  css: segmentedControlInputStyles,
@@ -21506,10 +21527,10 @@ var SegmentedControl = ({
21506
21527
  disabled: isDisabled
21507
21528
  }
21508
21529
  ),
21509
- option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx126(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
21510
- /* @__PURE__ */ jsxs86("span", { css: segmentedControlLabelContentStyles, children: [
21511
- !option.icon ? null : /* @__PURE__ */ jsx126(Icon, { icon: option.icon, size: "1.5em", iconColor: "currentColor" }),
21512
- !text ? null : /* @__PURE__ */ jsx126("span", { css: segmentedControlLabelTextStyles, children: text })
21530
+ option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx124(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
21531
+ /* @__PURE__ */ jsxs84("span", { css: segmentedControlLabelContentStyles, children: [
21532
+ !option.icon ? null : /* @__PURE__ */ jsx124(Icon, { icon: option.icon, size: "1.5em", iconColor: "currentColor" }),
21533
+ !text ? null : /* @__PURE__ */ jsx124("span", { css: segmentedControlLabelTextStyles, children: text })
21513
21534
  ] })
21514
21535
  ]
21515
21536
  }
@@ -21519,6 +21540,118 @@ var SegmentedControl = ({
21519
21540
  );
21520
21541
  };
21521
21542
 
21543
+ // src/components/SearchAndFilter/SortItems.tsx
21544
+ import { jsx as jsx125, jsxs as jsxs85 } from "@emotion/react/jsx-runtime";
21545
+ var SortItems = () => {
21546
+ var _a, _b;
21547
+ const { sortOptions, setSortBy, sortByValue } = useSearchAndFilter();
21548
+ const values = sortByValue.split("_");
21549
+ const sortDirection = values.pop();
21550
+ const sortField = values.join("_");
21551
+ const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
21552
+ var _a2;
21553
+ return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
21554
+ })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
21555
+ return /* @__PURE__ */ jsx125(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", children: /* @__PURE__ */ jsx125("div", { css: ConditionalFilterRow, children: /* @__PURE__ */ jsxs85("div", { css: ConditionalInputRow, children: [
21556
+ /* @__PURE__ */ jsx125(
21557
+ InputComboBox,
21558
+ {
21559
+ options: sortOptions,
21560
+ onChange: (e) => {
21561
+ const fieldName = e == null ? void 0 : e.value;
21562
+ setSortBy(`${fieldName}_${sortDirection}`);
21563
+ },
21564
+ value: currentSelectedOption
21565
+ }
21566
+ ),
21567
+ /* @__PURE__ */ jsx125(
21568
+ SegmentedControl,
21569
+ {
21570
+ noCheckmark: true,
21571
+ name: "sortBy",
21572
+ options: [
21573
+ { label: "Ascending", value: `ASC` },
21574
+ { label: "Descending", value: `DESC` }
21575
+ ],
21576
+ onChange: (e) => setSortBy(`${sortField}_${e}`),
21577
+ value: sortDirection
21578
+ }
21579
+ )
21580
+ ] }) }) });
21581
+ };
21582
+
21583
+ // src/components/SearchAndFilter/FilterModeView.tsx
21584
+ import { jsx as jsx126 } from "@emotion/react/jsx-runtime";
21585
+ var FilterModeView = () => {
21586
+ const { filterVisibility } = useSearchAndFilter();
21587
+ const modeView = {
21588
+ filters: /* @__PURE__ */ jsx126(FilterItems, {}),
21589
+ sort: /* @__PURE__ */ jsx126(SortItems, {})
21590
+ };
21591
+ return filterVisibility ? modeView[filterVisibility] : null;
21592
+ };
21593
+
21594
+ // src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
21595
+ import { Fragment as Fragment22, jsx as jsx127, jsxs as jsxs86 } from "@emotion/react/jsx-runtime";
21596
+ var SearchAndFilterResultContainer = ({
21597
+ clearButtonLabel = "clear"
21598
+ }) => {
21599
+ const { searchTerm, setSearchTerm, totalResults } = useSearchAndFilter();
21600
+ return searchTerm ? /* @__PURE__ */ jsxs86(Fragment22, { children: [
21601
+ /* @__PURE__ */ jsxs86(HorizontalRhythm, { children: [
21602
+ /* @__PURE__ */ jsxs86("span", { children: [
21603
+ totalResults,
21604
+ " results for ",
21605
+ /* @__PURE__ */ jsxs86("strong", { children: [
21606
+ '"',
21607
+ searchTerm,
21608
+ '"'
21609
+ ] })
21610
+ ] }),
21611
+ /* @__PURE__ */ jsx127(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
21612
+ ] }),
21613
+ totalResults === 0 ? /* @__PURE__ */ jsx127(Callout, { title: "No search results found", type: "note", children: /* @__PURE__ */ jsx127(Button, { buttonType: "tertiaryOutline", size: "sm", onClick: () => setSearchTerm(""), children: "Clear search" }) }) : null
21614
+ ] }) : null;
21615
+ };
21616
+
21617
+ // src/components/SearchAndFilter/SearchAndFilter.tsx
21618
+ import { jsx as jsx128, jsxs as jsxs87 } from "@emotion/react/jsx-runtime";
21619
+ var SearchAndFilter = ({
21620
+ filters,
21621
+ filterOptions,
21622
+ sortOptions,
21623
+ defaultSortByValue,
21624
+ filterControls = /* @__PURE__ */ jsx128(FilterControls, {}),
21625
+ viewSwitchControls,
21626
+ children = /* @__PURE__ */ jsx128(FilterModeView, {}),
21627
+ onChange,
21628
+ onSearchChange,
21629
+ onSortChange,
21630
+ totalResults
21631
+ }) => {
21632
+ return /* @__PURE__ */ jsx128(
21633
+ SearchAndFilterProvider,
21634
+ {
21635
+ filters,
21636
+ filterOptions,
21637
+ defaultSortByValue,
21638
+ sortOptions,
21639
+ onChange,
21640
+ onSearchChange,
21641
+ onSortChange,
21642
+ totalResults,
21643
+ children: /* @__PURE__ */ jsxs87(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
21644
+ /* @__PURE__ */ jsxs87("div", { css: SearchAndFilterOutterControlWrapper, children: [
21645
+ /* @__PURE__ */ jsx128("div", { css: SearchAndFilterControlsWrapper, children: filterControls }),
21646
+ viewSwitchControls
21647
+ ] }),
21648
+ children,
21649
+ /* @__PURE__ */ jsx128(SearchAndFilterResultContainer, {})
21650
+ ] })
21651
+ }
21652
+ );
21653
+ };
21654
+
21522
21655
  // src/components/Skeleton/Skeleton.styles.ts
21523
21656
  import { css as css96, keyframes as keyframes5 } from "@emotion/react";
21524
21657
  var lightFadingOut = keyframes5`
@@ -21531,7 +21664,7 @@ var skeletonStyles = css96`
21531
21664
  `;
21532
21665
 
21533
21666
  // src/components/Skeleton/Skeleton.tsx
21534
- import { jsx as jsx127 } from "@emotion/react/jsx-runtime";
21667
+ import { jsx as jsx129 } from "@emotion/react/jsx-runtime";
21535
21668
  var Skeleton = ({
21536
21669
  width = "100%",
21537
21670
  height = "1.25rem",
@@ -21539,7 +21672,7 @@ var Skeleton = ({
21539
21672
  circle = false,
21540
21673
  children,
21541
21674
  ...otherProps
21542
- }) => /* @__PURE__ */ jsx127(
21675
+ }) => /* @__PURE__ */ jsx129(
21543
21676
  "div",
21544
21677
  {
21545
21678
  css: [
@@ -21559,7 +21692,7 @@ var Skeleton = ({
21559
21692
  );
21560
21693
 
21561
21694
  // src/components/Switch/Switch.tsx
21562
- import * as React25 from "react";
21695
+ import * as React26 from "react";
21563
21696
 
21564
21697
  // src/components/Switch/Switch.styles.ts
21565
21698
  import { css as css97 } from "@emotion/react";
@@ -21646,26 +21779,26 @@ var SwitchText = css97`
21646
21779
  `;
21647
21780
 
21648
21781
  // src/components/Switch/Switch.tsx
21649
- import { Fragment as Fragment23, jsx as jsx128, jsxs as jsxs87 } from "@emotion/react/jsx-runtime";
21650
- var Switch = React25.forwardRef(
21782
+ import { Fragment as Fragment23, jsx as jsx130, jsxs as jsxs88 } from "@emotion/react/jsx-runtime";
21783
+ var Switch = React26.forwardRef(
21651
21784
  ({ label, infoText, toggleText, children, ...inputProps }, ref) => {
21652
21785
  let additionalText = infoText;
21653
21786
  if (infoText && toggleText) {
21654
21787
  additionalText = inputProps.checked ? toggleText : infoText;
21655
21788
  }
21656
- return /* @__PURE__ */ jsxs87(Fragment23, { children: [
21657
- /* @__PURE__ */ jsxs87("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
21658
- /* @__PURE__ */ jsx128("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
21659
- /* @__PURE__ */ jsx128("span", { css: SwitchInputLabel, children: label })
21789
+ return /* @__PURE__ */ jsxs88(Fragment23, { children: [
21790
+ /* @__PURE__ */ jsxs88("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
21791
+ /* @__PURE__ */ jsx130("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
21792
+ /* @__PURE__ */ jsx130("span", { css: SwitchInputLabel, children: label })
21660
21793
  ] }),
21661
- additionalText ? /* @__PURE__ */ jsx128("p", { css: SwitchText, children: additionalText }) : null,
21794
+ additionalText ? /* @__PURE__ */ jsx130("p", { css: SwitchText, children: additionalText }) : null,
21662
21795
  children
21663
21796
  ] });
21664
21797
  }
21665
21798
  );
21666
21799
 
21667
21800
  // src/components/Table/Table.tsx
21668
- import * as React26 from "react";
21801
+ import * as React27 from "react";
21669
21802
 
21670
21803
  // src/components/Table/Table.styles.ts
21671
21804
  import { css as css98 } from "@emotion/react";
@@ -21695,40 +21828,40 @@ var tableCellHead = css98`
21695
21828
  `;
21696
21829
 
21697
21830
  // src/components/Table/Table.tsx
21698
- import { jsx as jsx129 } from "@emotion/react/jsx-runtime";
21699
- var Table = React26.forwardRef(
21831
+ import { jsx as jsx131 } from "@emotion/react/jsx-runtime";
21832
+ var Table = React27.forwardRef(
21700
21833
  ({ children, cellPadding, ...otherProps }, ref) => {
21701
- return /* @__PURE__ */ jsx129("table", { ref, css: table({ cellPadding }), ...otherProps, children });
21834
+ return /* @__PURE__ */ jsx131("table", { ref, css: table({ cellPadding }), ...otherProps, children });
21702
21835
  }
21703
21836
  );
21704
- var TableHead = React26.forwardRef(
21837
+ var TableHead = React27.forwardRef(
21705
21838
  ({ children, ...otherProps }, ref) => {
21706
- return /* @__PURE__ */ jsx129("thead", { ref, css: tableHead, ...otherProps, children });
21839
+ return /* @__PURE__ */ jsx131("thead", { ref, css: tableHead, ...otherProps, children });
21707
21840
  }
21708
21841
  );
21709
- var TableBody = React26.forwardRef(
21842
+ var TableBody = React27.forwardRef(
21710
21843
  ({ children, ...otherProps }, ref) => {
21711
- return /* @__PURE__ */ jsx129("tbody", { ref, ...otherProps, children });
21844
+ return /* @__PURE__ */ jsx131("tbody", { ref, ...otherProps, children });
21712
21845
  }
21713
21846
  );
21714
- var TableFoot = React26.forwardRef(
21847
+ var TableFoot = React27.forwardRef(
21715
21848
  ({ children, ...otherProps }, ref) => {
21716
- return /* @__PURE__ */ jsx129("tfoot", { ref, ...otherProps, children });
21849
+ return /* @__PURE__ */ jsx131("tfoot", { ref, ...otherProps, children });
21717
21850
  }
21718
21851
  );
21719
- var TableRow = React26.forwardRef(
21852
+ var TableRow = React27.forwardRef(
21720
21853
  ({ children, ...otherProps }, ref) => {
21721
- return /* @__PURE__ */ jsx129("tr", { ref, css: tableRow, ...otherProps, children });
21854
+ return /* @__PURE__ */ jsx131("tr", { ref, css: tableRow, ...otherProps, children });
21722
21855
  }
21723
21856
  );
21724
- var TableCellHead = React26.forwardRef(
21857
+ var TableCellHead = React27.forwardRef(
21725
21858
  ({ children, ...otherProps }, ref) => {
21726
- return /* @__PURE__ */ jsx129("th", { ref, css: tableCellHead, ...otherProps, children });
21859
+ return /* @__PURE__ */ jsx131("th", { ref, css: tableCellHead, ...otherProps, children });
21727
21860
  }
21728
21861
  );
21729
- var TableCellData = React26.forwardRef(
21862
+ var TableCellData = React27.forwardRef(
21730
21863
  ({ children, ...otherProps }, ref) => {
21731
- return /* @__PURE__ */ jsx129("td", { ref, ...otherProps, children });
21864
+ return /* @__PURE__ */ jsx131("td", { ref, ...otherProps, children });
21732
21865
  }
21733
21866
  );
21734
21867
 
@@ -21740,7 +21873,7 @@ import {
21740
21873
  TabProvider as AriakitTabProvider,
21741
21874
  useTabStore as useAriakitTabStore
21742
21875
  } from "@ariakit/react";
21743
- import { useCallback as useCallback12, useEffect as useEffect20, useMemo as useMemo9 } from "react";
21876
+ import { useCallback as useCallback12, useEffect as useEffect21, useMemo as useMemo9 } from "react";
21744
21877
 
21745
21878
  // src/components/Tabs/Tabs.styles.ts
21746
21879
  import { css as css99 } from "@emotion/react";
@@ -21768,7 +21901,7 @@ var tabButtonGroupStyles = css99`
21768
21901
  `;
21769
21902
 
21770
21903
  // src/components/Tabs/Tabs.tsx
21771
- import { jsx as jsx130 } from "@emotion/react/jsx-runtime";
21904
+ import { jsx as jsx132 } from "@emotion/react/jsx-runtime";
21772
21905
  var useCurrentTab = () => {
21773
21906
  const context = useAriakitTabStore();
21774
21907
  if (!context) {
@@ -21801,28 +21934,28 @@ var Tabs = ({
21801
21934
  },
21802
21935
  [onSelectedIdChange, useHashForState]
21803
21936
  );
21804
- useEffect20(() => {
21937
+ useEffect21(() => {
21805
21938
  if (selected && selected !== tab.getState().activeId) {
21806
21939
  tab.setSelectedId(selected);
21807
21940
  }
21808
21941
  }, [selected, tab]);
21809
- return /* @__PURE__ */ jsx130(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
21942
+ return /* @__PURE__ */ jsx132(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
21810
21943
  };
21811
21944
  var TabButtonGroup = ({ children, ...props }) => {
21812
- return /* @__PURE__ */ jsx130(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
21945
+ return /* @__PURE__ */ jsx132(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
21813
21946
  };
21814
21947
  var TabButton = ({
21815
21948
  children,
21816
21949
  id,
21817
21950
  ...props
21818
21951
  }) => {
21819
- return /* @__PURE__ */ jsx130(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
21952
+ return /* @__PURE__ */ jsx132(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
21820
21953
  };
21821
21954
  var TabContent = ({
21822
21955
  children,
21823
21956
  ...props
21824
21957
  }) => {
21825
- return /* @__PURE__ */ jsx130(AriakitTabPanel, { ...props, children });
21958
+ return /* @__PURE__ */ jsx132(AriakitTabPanel, { ...props, children });
21826
21959
  };
21827
21960
 
21828
21961
  // src/components/Toast/Toast.tsx
@@ -22053,9 +22186,9 @@ var toastContainerStyles = css100`
22053
22186
  `;
22054
22187
 
22055
22188
  // src/components/Toast/Toast.tsx
22056
- import { jsx as jsx131 } from "@emotion/react/jsx-runtime";
22189
+ import { jsx as jsx133 } from "@emotion/react/jsx-runtime";
22057
22190
  var ToastContainer = ({ limit = 4 }) => {
22058
- return /* @__PURE__ */ jsx131(
22191
+ return /* @__PURE__ */ jsx133(
22059
22192
  ToastifyContainer,
22060
22193
  {
22061
22194
  css: toastContainerStyles,