import React from "react"; import { styled } from "../theme"; import { InputSearchContext } from "./InputSearchRoot"; const StyledItemText = styled("span", {}); export type InputSearchItemTextProps = { children: React.ReactNode; } & React.ComponentPropsWithRef; export const InputSearchItemText = ({ children, ...rest }: InputSearchItemTextProps) => { const { state } = React.useContext(InputSearchContext); const highlighted = (children as string).replace( new RegExp(state.inputValue, "gi"), (match) => (match ? `${match}` : "") ); return ( ); }; InputSearchItemText.displayName = "InputSearchItemText";