+) => {
+ const {
+ children,
+ label,
+ value,
+ setValue,
+ defaultValue,
+ searchValue,
+ setSearchValue,
+ defaultSearchValue,
+ messages,
+ disabled,
+ ...otherProps
+ } = props
+
+ return (
+
+
+ {label}
+
+ {children}
+
+
+
+ )
+}
+
/**
* Filters represent criteria that users can choose to narrow down a Collection. They can include single or multiple selection.
* @status stable
@@ -15,44 +52,15 @@ import { FilterTrigger, type FilterTriggerProps } from './filter-trigger'
* Option
*
*/
-export const Filter = forwardRef(
- function Filter(props, ref) {
- const {
- children,
- label,
- value,
- setValue,
- defaultValue,
- searchValue,
- setSearchValue,
- defaultSearchValue,
- messages,
- disabled,
- ...otherProps
- } = props
-
- return (
-
-
- {label}
-
- {children}
-
-
-
- )
- }
-)
+export const Filter = forwardRef(FilterComp) as <
+ Value extends string | string[] = string,
+>(
+ props: FilterProps,
+ ref: ForwardedRef
+) => JSX.Element
-type InheritedOptions = Pick<
- FilterProviderProps,
+type InheritedOptions = Pick<
+ FilterProviderProps,
| 'value'
| 'setValue'
| 'defaultValue'
@@ -63,11 +71,13 @@ type InheritedOptions = Pick<
Pick &
Pick
-export interface FilterOptions extends InheritedOptions {
+export interface FilterOptions
+ extends InheritedOptions {
/**
* Filter label
*/
label: string
}
-export type FilterProps = FilterOptions & ComponentPropsWithoutRef<'div'>
+export type FilterProps =
+ FilterOptions & ComponentPropsWithoutRef<'div'>