@uniformdev/design-system 19.133.0 → 19.134.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -11754,7 +11754,6 @@ var activeMenuItem = css25`
11754
11754
  `;
11755
11755
  var menuItem = (textTheme, forceActive) => css25`
11756
11756
  align-items: center;
11757
- border: none;
11758
11757
  border-radius: var(--rounded-base);
11759
11758
  background: none;
11760
11759
  color: ${textTheme === "base" ? "var(--typography-base)" : "var(--brand-secondary-5)"};
@@ -11777,6 +11776,11 @@ var menuItem = (textTheme, forceActive) => css25`
11777
11776
  &[data-active-item] {
11778
11777
  ${typeof forceActive === "undefined" ? activeMenuItem : ""}
11779
11778
  }
11779
+
11780
+ // Remove border from input elements, this fixes UNI-4634
11781
+ &:not(input[type='radio'], input[type='checkbox']) {
11782
+ border: none;
11783
+ }
11780
11784
  `;
11781
11785
  var menuItemWithIcon = css25`
11782
11786
  align-items: center;
@@ -12141,6 +12145,7 @@ var ButtonWithMenu = ({
12141
12145
  placement,
12142
12146
  size = "lg",
12143
12147
  menuContainerCssClasses,
12148
+ withoutPortal = false,
12144
12149
  ...buttonProps
12145
12150
  }) => {
12146
12151
  const buttonTheme = {
@@ -12209,6 +12214,7 @@ var ButtonWithMenu = ({
12209
12214
  placement,
12210
12215
  menuTrigger: dropdownButton,
12211
12216
  menuItemsContainerCssClasses: menuContainerCssClasses,
12217
+ portal: withoutPortal,
12212
12218
  children
12213
12219
  }
12214
12220
  ) })
@@ -20483,11 +20489,8 @@ var ConditionalInputRow = css92`
20483
20489
  }
20484
20490
  `;
20485
20491
  var SearchInput = css92`
20486
- ${input("nowrap")}
20487
- border-radius: var(--rounded-full);
20488
- padding: var(--spacing-sm) var(--spacing-base);
20489
- font-size: var(--fs-sm);
20490
- padding-right: var(--spacing-2xl);
20492
+ max-height: 40px;
20493
+ min-height: unset;
20491
20494
  `;
20492
20495
  var FilterButton = css92`
20493
20496
  align-items: center;
@@ -20496,8 +20499,10 @@ var FilterButton = css92`
20496
20499
  border-radius: var(--rounded-full);
20497
20500
  color: var(--typography-base);
20498
20501
  display: flex;
20502
+ font-size: var(--fs-sm);
20499
20503
  gap: var(--spacing-sm);
20500
20504
  padding: var(--spacing-sm) var(--spacing-base);
20505
+ max-height: 40px;
20501
20506
  transition: color var(--duration-fast) var(--timing-ease-out),
20502
20507
  background-color var(--duration-fast) var(--timing-ease-out),
20503
20508
  border-color var(--duration-fast) var(--timing-ease-out),
@@ -20642,6 +20647,7 @@ var FilterButton2 = ({
20642
20647
  icon = "filter-add",
20643
20648
  filterCount,
20644
20649
  hasSelectedValue,
20650
+ dataTestId,
20645
20651
  ...props
20646
20652
  }) => {
20647
20653
  return /* @__PURE__ */ jsxs80(
@@ -20654,7 +20660,7 @@ var FilterButton2 = ({
20654
20660
  filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
20655
20661
  ],
20656
20662
  ...props,
20657
- "data-testid": "filters-button",
20663
+ "data-testid": dataTestId,
20658
20664
  children: [
20659
20665
  /* @__PURE__ */ jsx118(Icon, { icon, iconColor: "currentColor", size: "1rem" }),
20660
20666
  /* @__PURE__ */ jsx118("span", { css: FilterButtonText, children: text }),
@@ -20712,6 +20718,7 @@ var SearchAndFilterProvider = ({
20712
20718
  onSearchChange,
20713
20719
  onChange,
20714
20720
  onSortChange,
20721
+ resetFilterValues = [],
20715
20722
  totalResults,
20716
20723
  children
20717
20724
  }) => {
@@ -20741,8 +20748,8 @@ var SearchAndFilterProvider = ({
20741
20748
  onChange([...filters, { field: "", operator: "", value: "" }]);
20742
20749
  }, [filters, onChange]);
20743
20750
  const handleResetFilters = useCallback10(() => {
20744
- onChange([]);
20745
- }, [onChange]);
20751
+ onChange(resetFilterValues);
20752
+ }, [onChange, resetFilterValues]);
20746
20753
  const handleDeleteFilter = useCallback10(
20747
20754
  (index) => {
20748
20755
  const remainingFilters = filters.filter((_, i) => i !== index);
@@ -20859,7 +20866,8 @@ var FilterControls = ({
20859
20866
  "aria-haspopup": "true",
20860
20867
  "aria-expanded": filterVisibility === "filters",
20861
20868
  filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
20862
- onClick: () => handleFilterToggle("filters")
20869
+ onClick: () => handleFilterToggle("filters"),
20870
+ dataTestId: "filters-button"
20863
20871
  }
20864
20872
  ),
20865
20873
  /* @__PURE__ */ jsx120(
@@ -20873,7 +20881,7 @@ var FilterControls = ({
20873
20881
  "aria-expanded": filterVisibility === "sort",
20874
20882
  hasSelectedValue: sortByValue !== "",
20875
20883
  onClick: () => handleFilterToggle("sort"),
20876
- "data-testid": "sort-by-dropdown"
20884
+ dataTestId: "sort-by-button"
20877
20885
  }
20878
20886
  ),
20879
20887
  hideSearchInput ? null : /* @__PURE__ */ jsx120(
@@ -20883,7 +20891,8 @@ var FilterControls = ({
20883
20891
  onSearchTextChanged: (e) => setLocaleSearchTerm(e),
20884
20892
  value: localeSearchTerm,
20885
20893
  compact: true,
20886
- rounded: true
20894
+ rounded: true,
20895
+ css: SearchInput
20887
20896
  }
20888
20897
  ),
20889
20898
  children
@@ -21401,7 +21410,7 @@ var SearchAndFilterOptionsContainer2 = ({
21401
21410
  buttonRow,
21402
21411
  children
21403
21412
  }) => {
21404
- return /* @__PURE__ */ jsxs83("div", { css: SearchAndFilterOptionsContainer, "data-testid": "search-and-filter-options", children: [
21413
+ return /* @__PURE__ */ jsxs83("div", { css: SearchAndFilterOptionsContainer, children: [
21405
21414
  /* @__PURE__ */ jsx123("div", { css: SearchAndFilterOptionsInnerContainer, children }),
21406
21415
  buttonRow ? /* @__PURE__ */ jsx123(
21407
21416
  HorizontalRhythm,
@@ -21415,7 +21424,13 @@ var SearchAndFilterOptionsContainer2 = ({
21415
21424
  ) : null
21416
21425
  ] });
21417
21426
  };
21418
- var FilterMenu = ({ id, filterTitle = "Show results", menuControls, children }) => {
21427
+ var FilterMenu = ({
21428
+ id,
21429
+ filterTitle = "Show results",
21430
+ menuControls,
21431
+ children,
21432
+ dataTestId
21433
+ }) => {
21419
21434
  const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
21420
21435
  const innerMenuRef = React24.useRef(null);
21421
21436
  useEffect20(() => {
@@ -21424,7 +21439,7 @@ var FilterMenu = ({ id, filterTitle = "Show results", menuControls, children })
21424
21439
  (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
21425
21440
  }
21426
21441
  }, [filterVisibility]);
21427
- return /* @__PURE__ */ jsx123(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, children: filterVisibility ? /* @__PURE__ */ jsxs83(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
21442
+ return /* @__PURE__ */ jsx123(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs83(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
21428
21443
  /* @__PURE__ */ jsx123("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
21429
21444
  /* @__PURE__ */ jsx123(
21430
21445
  "button",
@@ -21433,6 +21448,7 @@ var FilterMenu = ({ id, filterTitle = "Show results", menuControls, children })
21433
21448
  "aria-label": "close filters",
21434
21449
  css: [CloseBtn],
21435
21450
  onClick: () => setFilterVisibility(void 0),
21451
+ "data-testid": "close-filters",
21436
21452
  children: /* @__PURE__ */ jsx123(Icon, { icon: "close", iconColor: "currentColor", size: "1.1rem" })
21437
21453
  }
21438
21454
  ),
@@ -21578,7 +21594,12 @@ var FilterItems = ({
21578
21594
  const next = [...filters];
21579
21595
  next[index] = { ...next[index], [prop]: value };
21580
21596
  if (prop === "operator") {
21581
- next[index].value = "";
21597
+ if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
21598
+ next[index].value = next[index].value[0];
21599
+ }
21600
+ if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
21601
+ next[index].value = [next[index].value, ""];
21602
+ }
21582
21603
  if (value === "def" || value === "true") {
21583
21604
  next[index].value = "true";
21584
21605
  }
@@ -21600,6 +21621,7 @@ var FilterItems = ({
21600
21621
  FilterMenu,
21601
21622
  {
21602
21623
  id: "search-and-filter-options",
21624
+ dataTestId: "search-and-filter-options",
21603
21625
  menuControls: /* @__PURE__ */ jsxs84(Fragment21, { children: [
21604
21626
  /* @__PURE__ */ jsxs84(
21605
21627
  "button",
@@ -21870,7 +21892,7 @@ var SortItems = () => {
21870
21892
  var _a2;
21871
21893
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
21872
21894
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
21873
- return /* @__PURE__ */ jsx126(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", children: /* @__PURE__ */ jsxs86("div", { css: SortFilterInputRow, children: [
21895
+ return /* @__PURE__ */ jsx126(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", dataTestId: "sorting-options", children: /* @__PURE__ */ jsxs86("div", { css: SortFilterInputRow, children: [
21874
21896
  /* @__PURE__ */ jsx126(
21875
21897
  InputComboBox,
21876
21898
  {
@@ -21887,7 +21909,8 @@ var SortItems = () => {
21887
21909
  };
21888
21910
  }
21889
21911
  },
21890
- value: currentSelectedOption
21912
+ value: currentSelectedOption,
21913
+ id: "sort-by-field"
21891
21914
  }
21892
21915
  ),
21893
21916
  /* @__PURE__ */ jsx126(
@@ -21900,7 +21923,8 @@ var SortItems = () => {
21900
21923
  { label: "Descending", value: `DESC` }
21901
21924
  ],
21902
21925
  onChange: (e) => setSortBy(`${sortField}_${e}`),
21903
- value: sortDirection
21926
+ value: sortDirection,
21927
+ "data-testid": "ordering-options"
21904
21928
  }
21905
21929
  )
21906
21930
  ] }) });
@@ -21983,7 +22007,8 @@ var SearchAndFilter = ({
21983
22007
  onChange,
21984
22008
  onSearchChange,
21985
22009
  onSortChange,
21986
- totalResults
22010
+ totalResults,
22011
+ resetFilterValues = []
21987
22012
  }) => {
21988
22013
  return /* @__PURE__ */ jsx129(
21989
22014
  SearchAndFilterProvider,
@@ -21997,6 +22022,7 @@ var SearchAndFilter = ({
21997
22022
  onSearchChange,
21998
22023
  onSortChange,
21999
22024
  totalResults,
22025
+ resetFilterValues,
22000
22026
  children: /* @__PURE__ */ jsxs88(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
22001
22027
  /* @__PURE__ */ jsxs88("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
22002
22028
  /* @__PURE__ */ jsx129(
package/dist/index.d.mts CHANGED
@@ -21103,6 +21103,10 @@ interface ActionButtonsProps {
21103
21103
  size?: ButtonSizeProps;
21104
21104
  /** sets additional Menu component styles */
21105
21105
  menuContainerCssClasses?: SerializedStyles;
21106
+ /** sets whether to use a React portal rendering or not.
21107
+ * @default false
21108
+ */
21109
+ withoutPortal?: boolean;
21106
21110
  }
21107
21111
  /** ButtonWithMenuProps combines the ActionButtonsProps with React HTMLButtonElement attributes */
21108
21112
  type ButtonWithMenuProps = ActionButtonsProps & React$1.ButtonHTMLAttributes<HTMLButtonElement>;
@@ -21128,7 +21132,7 @@ type ButtonWithMenuProps = ActionButtonsProps & React$1.ButtonHTMLAttributes<HTM
21128
21132
  </MenuItem>
21129
21133
  </ButtonWithMenu>
21130
21134
  */
21131
- declare const ButtonWithMenu: ({ onButtonClick, buttonType, buttonText, icon, disabled, children, placement, size, menuContainerCssClasses, ...buttonProps }: ButtonWithMenuProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
21135
+ declare const ButtonWithMenu: ({ onButtonClick, buttonType, buttonText, icon, disabled, children, placement, size, menuContainerCssClasses, withoutPortal, ...buttonProps }: ButtonWithMenuProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
21132
21136
 
21133
21137
  /**
21134
21138
  * A string in the ISO 8601 date format: YYYY-MM-DD
@@ -23086,12 +23090,14 @@ type FilterButtonProps = {
23086
23090
  filterCount?: number;
23087
23091
  /** sets the selected styles on the button */
23088
23092
  hasSelectedValue?: boolean;
23093
+ /** sets the data-testid attribute on the button */
23094
+ dataTestId?: string;
23089
23095
  } & HTMLAttributes<HTMLButtonElement>;
23090
23096
  /**
23091
23097
  * @deprecated beta - A filter button component used to display filter menu options
23092
23098
  * @example <FilterButton text="Filters" filterCount={3} />
23093
23099
  */
23094
- declare const FilterButton: ({ text, icon, filterCount, hasSelectedValue, ...props }: FilterButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23100
+ declare const FilterButton: ({ text, icon, filterCount, hasSelectedValue, dataTestId, ...props }: FilterButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23095
23101
 
23096
23102
  /**
23097
23103
  * @deprecated beta - Default filter controls for search and filter
@@ -23153,12 +23159,14 @@ type FiltersProps = {
23153
23159
  menuControls?: React__default.ReactNode;
23154
23160
  /** The children of the filter menu */
23155
23161
  children: React__default.ReactNode;
23162
+ /** Sets the data-test-id attribute for the filter menu */
23163
+ dataTestId?: string;
23156
23164
  };
23157
23165
  /**
23158
23166
  * @deprecated beta - A filter menu component used to display filter options
23159
23167
  * @example <FilterMenu id="search-and-filter-options">Children</FilterMenu>
23160
23168
  * */
23161
- declare const FilterMenu: ({ id, filterTitle, menuControls, children }: FiltersProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23169
+ declare const FilterMenu: ({ id, filterTitle, menuControls, children, dataTestId, }: FiltersProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23162
23170
 
23163
23171
  type SearchAndFilterProviderProps = {
23164
23172
  /** sets the filter values */
@@ -23171,6 +23179,10 @@ type SearchAndFilterProviderProps = {
23171
23179
  onChange: (filters: Filter[]) => void;
23172
23180
  /** function to trigger sort change events */
23173
23181
  onSortChange: (sort: string) => void;
23182
+ /** sets the reset filter values
23183
+ * @default []
23184
+ */
23185
+ resetFilterValues?: Filter[];
23174
23186
  /** sets the list of filter options for each filter row */
23175
23187
  filterOptions: FilterOption[];
23176
23188
  /** sets the list of sort options */
@@ -23201,7 +23213,7 @@ type SearchAndFilterContextProps = {
23201
23213
  /** function that adds a blank set of filter options */
23202
23214
  handleAddFilter: () => void;
23203
23215
  /** function to reset all filter values */
23204
- handleResetFilters: () => void;
23216
+ handleResetFilters: (filters?: Filter[]) => void;
23205
23217
  /** function that deletes a row and it's values visually and from state */
23206
23218
  handleDeleteFilter: (index: number) => void;
23207
23219
  /** sets the initial list of filter options */
@@ -23220,7 +23232,7 @@ declare const SearchAndFilterContext: React$1.Context<SearchAndFilterContextProp
23220
23232
  * @deprecated beta - Search and filter provider
23221
23233
  * @example <SearchAndFilterProvider filters={filters} filterOptions={filterOptions} onSearchChange={onSearchChange} onChange={onChange}>Children</SearchAndFilterProvider>
23222
23234
  * */
23223
- declare const SearchAndFilterProvider: ({ filters, filterOptions, sortOptions, defaultSortByValue, filterMode, onSearchChange, onChange, onSortChange, totalResults, children, }: SearchAndFilterProviderProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23235
+ declare const SearchAndFilterProvider: ({ filters, filterOptions, sortOptions, defaultSortByValue, filterMode, onSearchChange, onChange, onSortChange, resetFilterValues, totalResults, children, }: SearchAndFilterProviderProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23224
23236
  /** @deprecated beta - Search and filter hook
23225
23237
  * @example const { searchTerm, setSearchTerm, filterVisibility, setFilterVisibility, filters, setFilters, handleAddFilter, handleResetFilters, handleDeleteFilter, filterOptions, validFilterQuery } = useSearchAndFilter();
23226
23238
  */
@@ -23242,7 +23254,7 @@ declare const useSearchAndFilter: () => {
23242
23254
  /** function that adds a blank set of filter options */
23243
23255
  handleAddFilter: () => void;
23244
23256
  /** function to reset all filter values */
23245
- handleResetFilters: () => void;
23257
+ handleResetFilters: (filters?: Filter[]) => void;
23246
23258
  /** function that deletes a row and it's values visually and from state */
23247
23259
  handleDeleteFilter: (index: number) => void;
23248
23260
  /** sets the initial list of filter options */
@@ -23274,6 +23286,8 @@ type SearchAndFilterProps = Omit<SearchAndFilterProviderProps, 'children'> & {
23274
23286
  * @default '<SearchAndFilterResultContainer />'
23275
23287
  */
23276
23288
  resultsContainerView?: React$1.ReactNode;
23289
+ /** sets the reset filter values */
23290
+ resetFilterValues?: Filter[];
23277
23291
  /** The children of the search and filter component */
23278
23292
  children?: React$1.ReactNode;
23279
23293
  };
@@ -23281,7 +23295,7 @@ type SearchAndFilterProps = Omit<SearchAndFilterProviderProps, 'children'> & {
23281
23295
  * @deprecated beta - Search and filter component
23282
23296
  * @example <SearchAndFilter filters={filters} filterOptions={filterOptions} onChange={onChange} onSearchChange={onSearchChange} onSearchReset={onSearchReset} totalResults={totalResults} />
23283
23297
  * */
23284
- declare const SearchAndFilter: ({ filters, filterOptions, filterMode, sortOptions, defaultSortByValue, filterControls, viewSwitchControls, resultsContainerView, children, onChange, onSearchChange, onSortChange, totalResults, }: SearchAndFilterProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23298
+ declare const SearchAndFilter: ({ filters, filterOptions, filterMode, sortOptions, defaultSortByValue, filterControls, viewSwitchControls, resultsContainerView, children, onChange, onSearchChange, onSortChange, totalResults, resetFilterValues, }: SearchAndFilterProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23285
23299
 
23286
23300
  type SearchAndFilterResultContainerProps = {
23287
23301
  /** The label for the clear button
package/dist/index.d.ts CHANGED
@@ -21103,6 +21103,10 @@ interface ActionButtonsProps {
21103
21103
  size?: ButtonSizeProps;
21104
21104
  /** sets additional Menu component styles */
21105
21105
  menuContainerCssClasses?: SerializedStyles;
21106
+ /** sets whether to use a React portal rendering or not.
21107
+ * @default false
21108
+ */
21109
+ withoutPortal?: boolean;
21106
21110
  }
21107
21111
  /** ButtonWithMenuProps combines the ActionButtonsProps with React HTMLButtonElement attributes */
21108
21112
  type ButtonWithMenuProps = ActionButtonsProps & React$1.ButtonHTMLAttributes<HTMLButtonElement>;
@@ -21128,7 +21132,7 @@ type ButtonWithMenuProps = ActionButtonsProps & React$1.ButtonHTMLAttributes<HTM
21128
21132
  </MenuItem>
21129
21133
  </ButtonWithMenu>
21130
21134
  */
21131
- declare const ButtonWithMenu: ({ onButtonClick, buttonType, buttonText, icon, disabled, children, placement, size, menuContainerCssClasses, ...buttonProps }: ButtonWithMenuProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
21135
+ declare const ButtonWithMenu: ({ onButtonClick, buttonType, buttonText, icon, disabled, children, placement, size, menuContainerCssClasses, withoutPortal, ...buttonProps }: ButtonWithMenuProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
21132
21136
 
21133
21137
  /**
21134
21138
  * A string in the ISO 8601 date format: YYYY-MM-DD
@@ -23086,12 +23090,14 @@ type FilterButtonProps = {
23086
23090
  filterCount?: number;
23087
23091
  /** sets the selected styles on the button */
23088
23092
  hasSelectedValue?: boolean;
23093
+ /** sets the data-testid attribute on the button */
23094
+ dataTestId?: string;
23089
23095
  } & HTMLAttributes<HTMLButtonElement>;
23090
23096
  /**
23091
23097
  * @deprecated beta - A filter button component used to display filter menu options
23092
23098
  * @example <FilterButton text="Filters" filterCount={3} />
23093
23099
  */
23094
- declare const FilterButton: ({ text, icon, filterCount, hasSelectedValue, ...props }: FilterButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23100
+ declare const FilterButton: ({ text, icon, filterCount, hasSelectedValue, dataTestId, ...props }: FilterButtonProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23095
23101
 
23096
23102
  /**
23097
23103
  * @deprecated beta - Default filter controls for search and filter
@@ -23153,12 +23159,14 @@ type FiltersProps = {
23153
23159
  menuControls?: React__default.ReactNode;
23154
23160
  /** The children of the filter menu */
23155
23161
  children: React__default.ReactNode;
23162
+ /** Sets the data-test-id attribute for the filter menu */
23163
+ dataTestId?: string;
23156
23164
  };
23157
23165
  /**
23158
23166
  * @deprecated beta - A filter menu component used to display filter options
23159
23167
  * @example <FilterMenu id="search-and-filter-options">Children</FilterMenu>
23160
23168
  * */
23161
- declare const FilterMenu: ({ id, filterTitle, menuControls, children }: FiltersProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23169
+ declare const FilterMenu: ({ id, filterTitle, menuControls, children, dataTestId, }: FiltersProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23162
23170
 
23163
23171
  type SearchAndFilterProviderProps = {
23164
23172
  /** sets the filter values */
@@ -23171,6 +23179,10 @@ type SearchAndFilterProviderProps = {
23171
23179
  onChange: (filters: Filter[]) => void;
23172
23180
  /** function to trigger sort change events */
23173
23181
  onSortChange: (sort: string) => void;
23182
+ /** sets the reset filter values
23183
+ * @default []
23184
+ */
23185
+ resetFilterValues?: Filter[];
23174
23186
  /** sets the list of filter options for each filter row */
23175
23187
  filterOptions: FilterOption[];
23176
23188
  /** sets the list of sort options */
@@ -23201,7 +23213,7 @@ type SearchAndFilterContextProps = {
23201
23213
  /** function that adds a blank set of filter options */
23202
23214
  handleAddFilter: () => void;
23203
23215
  /** function to reset all filter values */
23204
- handleResetFilters: () => void;
23216
+ handleResetFilters: (filters?: Filter[]) => void;
23205
23217
  /** function that deletes a row and it's values visually and from state */
23206
23218
  handleDeleteFilter: (index: number) => void;
23207
23219
  /** sets the initial list of filter options */
@@ -23220,7 +23232,7 @@ declare const SearchAndFilterContext: React$1.Context<SearchAndFilterContextProp
23220
23232
  * @deprecated beta - Search and filter provider
23221
23233
  * @example <SearchAndFilterProvider filters={filters} filterOptions={filterOptions} onSearchChange={onSearchChange} onChange={onChange}>Children</SearchAndFilterProvider>
23222
23234
  * */
23223
- declare const SearchAndFilterProvider: ({ filters, filterOptions, sortOptions, defaultSortByValue, filterMode, onSearchChange, onChange, onSortChange, totalResults, children, }: SearchAndFilterProviderProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23235
+ declare const SearchAndFilterProvider: ({ filters, filterOptions, sortOptions, defaultSortByValue, filterMode, onSearchChange, onChange, onSortChange, resetFilterValues, totalResults, children, }: SearchAndFilterProviderProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23224
23236
  /** @deprecated beta - Search and filter hook
23225
23237
  * @example const { searchTerm, setSearchTerm, filterVisibility, setFilterVisibility, filters, setFilters, handleAddFilter, handleResetFilters, handleDeleteFilter, filterOptions, validFilterQuery } = useSearchAndFilter();
23226
23238
  */
@@ -23242,7 +23254,7 @@ declare const useSearchAndFilter: () => {
23242
23254
  /** function that adds a blank set of filter options */
23243
23255
  handleAddFilter: () => void;
23244
23256
  /** function to reset all filter values */
23245
- handleResetFilters: () => void;
23257
+ handleResetFilters: (filters?: Filter[]) => void;
23246
23258
  /** function that deletes a row and it's values visually and from state */
23247
23259
  handleDeleteFilter: (index: number) => void;
23248
23260
  /** sets the initial list of filter options */
@@ -23274,6 +23286,8 @@ type SearchAndFilterProps = Omit<SearchAndFilterProviderProps, 'children'> & {
23274
23286
  * @default '<SearchAndFilterResultContainer />'
23275
23287
  */
23276
23288
  resultsContainerView?: React$1.ReactNode;
23289
+ /** sets the reset filter values */
23290
+ resetFilterValues?: Filter[];
23277
23291
  /** The children of the search and filter component */
23278
23292
  children?: React$1.ReactNode;
23279
23293
  };
@@ -23281,7 +23295,7 @@ type SearchAndFilterProps = Omit<SearchAndFilterProviderProps, 'children'> & {
23281
23295
  * @deprecated beta - Search and filter component
23282
23296
  * @example <SearchAndFilter filters={filters} filterOptions={filterOptions} onChange={onChange} onSearchChange={onSearchChange} onSearchReset={onSearchReset} totalResults={totalResults} />
23283
23297
  * */
23284
- declare const SearchAndFilter: ({ filters, filterOptions, filterMode, sortOptions, defaultSortByValue, filterControls, viewSwitchControls, resultsContainerView, children, onChange, onSearchChange, onSortChange, totalResults, }: SearchAndFilterProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23298
+ declare const SearchAndFilter: ({ filters, filterOptions, filterMode, sortOptions, defaultSortByValue, filterControls, viewSwitchControls, resultsContainerView, children, onChange, onSearchChange, onSortChange, totalResults, resetFilterValues, }: SearchAndFilterProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
23285
23299
 
23286
23300
  type SearchAndFilterResultContainerProps = {
23287
23301
  /** The label for the clear button
package/dist/index.js CHANGED
@@ -13430,7 +13430,6 @@ var activeMenuItem = import_react33.css`
13430
13430
  `;
13431
13431
  var menuItem = (textTheme, forceActive) => import_react33.css`
13432
13432
  align-items: center;
13433
- border: none;
13434
13433
  border-radius: var(--rounded-base);
13435
13434
  background: none;
13436
13435
  color: ${textTheme === "base" ? "var(--typography-base)" : "var(--brand-secondary-5)"};
@@ -13453,6 +13452,11 @@ var menuItem = (textTheme, forceActive) => import_react33.css`
13453
13452
  &[data-active-item] {
13454
13453
  ${typeof forceActive === "undefined" ? activeMenuItem : ""}
13455
13454
  }
13455
+
13456
+ // Remove border from input elements, this fixes UNI-4634
13457
+ &:not(input[type='radio'], input[type='checkbox']) {
13458
+ border: none;
13459
+ }
13456
13460
  `;
13457
13461
  var menuItemWithIcon = import_react33.css`
13458
13462
  align-items: center;
@@ -13820,6 +13824,7 @@ var ButtonWithMenu = ({
13820
13824
  placement,
13821
13825
  size = "lg",
13822
13826
  menuContainerCssClasses,
13827
+ withoutPortal = false,
13823
13828
  ...buttonProps
13824
13829
  }) => {
13825
13830
  const buttonTheme = {
@@ -13888,6 +13893,7 @@ var ButtonWithMenu = ({
13888
13893
  placement,
13889
13894
  menuTrigger: dropdownButton,
13890
13895
  menuItemsContainerCssClasses: menuContainerCssClasses,
13896
+ portal: withoutPortal,
13891
13897
  children
13892
13898
  }
13893
13899
  ) })
@@ -22320,11 +22326,8 @@ var ConditionalInputRow = import_react139.css`
22320
22326
  }
22321
22327
  `;
22322
22328
  var SearchInput = import_react139.css`
22323
- ${input("nowrap")}
22324
- border-radius: var(--rounded-full);
22325
- padding: var(--spacing-sm) var(--spacing-base);
22326
- font-size: var(--fs-sm);
22327
- padding-right: var(--spacing-2xl);
22329
+ max-height: 40px;
22330
+ min-height: unset;
22328
22331
  `;
22329
22332
  var FilterButton = import_react139.css`
22330
22333
  align-items: center;
@@ -22333,8 +22336,10 @@ var FilterButton = import_react139.css`
22333
22336
  border-radius: var(--rounded-full);
22334
22337
  color: var(--typography-base);
22335
22338
  display: flex;
22339
+ font-size: var(--fs-sm);
22336
22340
  gap: var(--spacing-sm);
22337
22341
  padding: var(--spacing-sm) var(--spacing-base);
22342
+ max-height: 40px;
22338
22343
  transition: color var(--duration-fast) var(--timing-ease-out),
22339
22344
  background-color var(--duration-fast) var(--timing-ease-out),
22340
22345
  border-color var(--duration-fast) var(--timing-ease-out),
@@ -22479,6 +22484,7 @@ var FilterButton2 = ({
22479
22484
  icon = "filter-add",
22480
22485
  filterCount,
22481
22486
  hasSelectedValue,
22487
+ dataTestId,
22482
22488
  ...props
22483
22489
  }) => {
22484
22490
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(
@@ -22491,7 +22497,7 @@ var FilterButton2 = ({
22491
22497
  filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
22492
22498
  ],
22493
22499
  ...props,
22494
- "data-testid": "filters-button",
22500
+ "data-testid": dataTestId,
22495
22501
  children: [
22496
22502
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Icon, { icon, iconColor: "currentColor", size: "1rem" }),
22497
22503
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { css: FilterButtonText, children: text }),
@@ -22543,6 +22549,7 @@ var SearchAndFilterProvider = ({
22543
22549
  onSearchChange,
22544
22550
  onChange,
22545
22551
  onSortChange,
22552
+ resetFilterValues = [],
22546
22553
  totalResults,
22547
22554
  children
22548
22555
  }) => {
@@ -22572,8 +22579,8 @@ var SearchAndFilterProvider = ({
22572
22579
  onChange([...filters, { field: "", operator: "", value: "" }]);
22573
22580
  }, [filters, onChange]);
22574
22581
  const handleResetFilters = (0, import_react140.useCallback)(() => {
22575
- onChange([]);
22576
- }, [onChange]);
22582
+ onChange(resetFilterValues);
22583
+ }, [onChange, resetFilterValues]);
22577
22584
  const handleDeleteFilter = (0, import_react140.useCallback)(
22578
22585
  (index) => {
22579
22586
  const remainingFilters = filters.filter((_, i) => i !== index);
@@ -22690,7 +22697,8 @@ var FilterControls = ({
22690
22697
  "aria-haspopup": "true",
22691
22698
  "aria-expanded": filterVisibility === "filters",
22692
22699
  filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
22693
- onClick: () => handleFilterToggle("filters")
22700
+ onClick: () => handleFilterToggle("filters"),
22701
+ dataTestId: "filters-button"
22694
22702
  }
22695
22703
  ),
22696
22704
  /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
@@ -22704,7 +22712,7 @@ var FilterControls = ({
22704
22712
  "aria-expanded": filterVisibility === "sort",
22705
22713
  hasSelectedValue: sortByValue !== "",
22706
22714
  onClick: () => handleFilterToggle("sort"),
22707
- "data-testid": "sort-by-dropdown"
22715
+ dataTestId: "sort-by-button"
22708
22716
  }
22709
22717
  ),
22710
22718
  hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
@@ -22714,7 +22722,8 @@ var FilterControls = ({
22714
22722
  onSearchTextChanged: (e) => setLocaleSearchTerm(e),
22715
22723
  value: localeSearchTerm,
22716
22724
  compact: true,
22717
- rounded: true
22725
+ rounded: true,
22726
+ css: SearchInput
22718
22727
  }
22719
22728
  ),
22720
22729
  children
@@ -23239,7 +23248,7 @@ var SearchAndFilterOptionsContainer2 = ({
23239
23248
  buttonRow,
23240
23249
  children
23241
23250
  }) => {
23242
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: SearchAndFilterOptionsContainer, "data-testid": "search-and-filter-options", children: [
23251
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
23243
23252
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { css: SearchAndFilterOptionsInnerContainer, children }),
23244
23253
  buttonRow ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
23245
23254
  HorizontalRhythm,
@@ -23253,7 +23262,13 @@ var SearchAndFilterOptionsContainer2 = ({
23253
23262
  ) : null
23254
23263
  ] });
23255
23264
  };
23256
- var FilterMenu = ({ id, filterTitle = "Show results", menuControls, children }) => {
23265
+ var FilterMenu = ({
23266
+ id,
23267
+ filterTitle = "Show results",
23268
+ menuControls,
23269
+ children,
23270
+ dataTestId
23271
+ }) => {
23257
23272
  const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
23258
23273
  const innerMenuRef = import_react144.default.useRef(null);
23259
23274
  (0, import_react144.useEffect)(() => {
@@ -23262,7 +23277,7 @@ var FilterMenu = ({ id, filterTitle = "Show results", menuControls, children })
23262
23277
  (_a = innerMenuRef.current) == null ? void 0 : _a.focus();
23263
23278
  }
23264
23279
  }, [filterVisibility]);
23265
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
23280
+ 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: [
23266
23281
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
23267
23282
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
23268
23283
  "button",
@@ -23271,6 +23286,7 @@ var FilterMenu = ({ id, filterTitle = "Show results", menuControls, children })
23271
23286
  "aria-label": "close filters",
23272
23287
  css: [CloseBtn],
23273
23288
  onClick: () => setFilterVisibility(void 0),
23289
+ "data-testid": "close-filters",
23274
23290
  children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Icon, { icon: "close", iconColor: "currentColor", size: "1.1rem" })
23275
23291
  }
23276
23292
  ),
@@ -23416,7 +23432,12 @@ var FilterItems = ({
23416
23432
  const next = [...filters];
23417
23433
  next[index] = { ...next[index], [prop]: value };
23418
23434
  if (prop === "operator") {
23419
- next[index].value = "";
23435
+ if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
23436
+ next[index].value = next[index].value[0];
23437
+ }
23438
+ if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
23439
+ next[index].value = [next[index].value, ""];
23440
+ }
23420
23441
  if (value === "def" || value === "true") {
23421
23442
  next[index].value = "true";
23422
23443
  }
@@ -23438,6 +23459,7 @@ var FilterItems = ({
23438
23459
  FilterMenu,
23439
23460
  {
23440
23461
  id: "search-and-filter-options",
23462
+ dataTestId: "search-and-filter-options",
23441
23463
  menuControls: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
23442
23464
  /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
23443
23465
  "button",
@@ -23719,7 +23741,7 @@ var SortItems = () => {
23719
23741
  var _a2;
23720
23742
  return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
23721
23743
  })) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
23722
- return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { css: SortFilterInputRow, children: [
23744
+ 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: [
23723
23745
  /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
23724
23746
  InputComboBox,
23725
23747
  {
@@ -23736,7 +23758,8 @@ var SortItems = () => {
23736
23758
  };
23737
23759
  }
23738
23760
  },
23739
- value: currentSelectedOption
23761
+ value: currentSelectedOption,
23762
+ id: "sort-by-field"
23740
23763
  }
23741
23764
  ),
23742
23765
  /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
@@ -23749,7 +23772,8 @@ var SortItems = () => {
23749
23772
  { label: "Descending", value: `DESC` }
23750
23773
  ],
23751
23774
  onChange: (e) => setSortBy(`${sortField}_${e}`),
23752
- value: sortDirection
23775
+ value: sortDirection,
23776
+ "data-testid": "ordering-options"
23753
23777
  }
23754
23778
  )
23755
23779
  ] }) });
@@ -23833,7 +23857,8 @@ var SearchAndFilter = ({
23833
23857
  onChange,
23834
23858
  onSearchChange,
23835
23859
  onSortChange,
23836
- totalResults
23860
+ totalResults,
23861
+ resetFilterValues = []
23837
23862
  }) => {
23838
23863
  return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
23839
23864
  SearchAndFilterProvider,
@@ -23847,6 +23872,7 @@ var SearchAndFilter = ({
23847
23872
  onSearchChange,
23848
23873
  onSortChange,
23849
23874
  totalResults,
23875
+ resetFilterValues,
23850
23876
  children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
23851
23877
  /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
23852
23878
  /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/design-system",
3
- "version": "19.133.0",
3
+ "version": "19.134.0",
4
4
  "description": "Uniform design system components",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -23,8 +23,8 @@
23
23
  "@storybook/react": "6.5.16",
24
24
  "@types/react": "18.2.40",
25
25
  "@types/react-dom": "18.2.17",
26
- "@uniformdev/canvas": "^19.133.0",
27
- "@uniformdev/richtext": "^19.133.0",
26
+ "@uniformdev/canvas": "^19.134.0",
27
+ "@uniformdev/richtext": "^19.134.0",
28
28
  "autoprefixer": "10.4.16",
29
29
  "hygen": "6.2.11",
30
30
  "postcss": "8.4.32",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "405a628b0f592ca13bf65006ef5c92261468c144"
74
+ "gitHead": "4d3856ce53d66b4e69fd693dadc98292cfbc37d1"
75
75
  }