import * as React from 'react' ; import * as Styles from './search.styles' ; export const SearchFieldSlot = function SearchFieldSlot ( props ) { return < > { props . children } < />; } ; export const SearchLegendSlot = function SearchFieldSlot ( props ) { return < > { props . children } < />; } ; export const SearchPassThroughSlot = function PassThroughSlot ( props ) { return < > { props . children } < />; } ; export const SearchResultListSlot = function SearchResultListSlot ( props ) { return < > { props . children } < />; } ; export const SearchResultPreviewSlot = function SearchResultPreviewSlot ( props ) { return < > { props . children } < />; } ; type SearchSlot = typeof SearchResultListSlot | typeof SearchResultPreviewSlot | typeof SearchFieldSlot | typeof SearchLegendSlot | typeof SearchPassThroughSlot ; export function withSlot ( children , { slot } ) { return React . Children . toArray ( children ) . filter ( ( child ) : child is React . ReactElement < unknown > => typeof child === 'object' && typeof child . type !== 'undefined' ) . filter ( child => child . type === slot ) ; }