import React, { Fragment } from 'react';
const softHighlight = (searchSubject, searchValue, isStrict = false) => {
    if (!searchValue) {
        return searchSubject;
    }
    const normalizedSearchSubject = isStrict ? searchSubject : searchSubject.toLowerCase();
    const normalizedSearchValue = isStrict ? searchValue : searchValue.toLowerCase();
    const indexOfMatch = normalizedSearchSubject.indexOf(normalizedSearchValue);
    if (indexOfMatch === -1) {
        return searchSubject;
    }
    const preMatch = searchSubject.substr(0, indexOfMatch);
    const match = searchSubject.substr(indexOfMatch, searchValue.length);
    const postMatch = searchSubject.substr(indexOfMatch + searchValue.length);
    return (React.createElement(Fragment, null,
        preMatch,
        React.createElement("strong", null, match),
        postMatch));
};
export const SoftHighlight = ({ children, className, search, strict, ...rest }) => {
    return (React.createElement("span", Object.assign({ className: className }, rest), softHighlight(children, search, strict)));
};
//# sourceMappingURL=SoftHighlight.js.map