var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import React from 'react';
import PropTypes from 'prop-types';
import { highlight } from '../utils';
import { Highlighter, HIGHLIGHT_TYPE } from '../../Highlighter';
var CommonListHighlight = /** @class */ (function (_super) {
    __extends(CommonListHighlight, _super);
    function CommonListHighlight() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CommonListHighlight.prototype.render = function () {
        var _a = this.props, listHighlightType = _a.listHighlightType, containsRichText = _a.containsRichText, title = _a.title, textHighlightPattern = _a.textHighlightPattern, textFilterPattern = _a.textFilterPattern;
        if (containsRichText || listHighlightType === HIGHLIGHT_TYPE.BACKGROUND) {
            return (React.createElement(Highlighter, { title: title, listHighlightType: listHighlightType, highlightRegexp: textHighlightPattern, filterRegexp: textFilterPattern }, this.props.children));
        }
        return highlight(textFilterPattern, this.props.children, title);
    };
    CommonListHighlight.HIGHLIGHT_TYPE_BACKGROUND = HIGHLIGHT_TYPE.BACKGROUND;
    CommonListHighlight.HIGHLIGHT_TYPE_BOLD = HIGHLIGHT_TYPE.BOLD;
    CommonListHighlight.propTypes = {
        children: PropTypes.node,
        title: PropTypes.string,
        textHighlightPattern: PropTypes.object,
        textFilterPattern: PropTypes.object,
        listHighlightType: PropTypes.oneOf([HIGHLIGHT_TYPE.BACKGROUND, HIGHLIGHT_TYPE.BOLD]),
        containsRichText: PropTypes.bool
    };
    CommonListHighlight.defaultProps = {
        children: null,
        title: null,
        textHighlightPattern: null,
        textFilterPattern: null,
        listHighlightType: HIGHLIGHT_TYPE.BOLD,
        containsRichText: false
    };
    return CommonListHighlight;
}(React.Component));
export { CommonListHighlight };
//# sourceMappingURL=CommonListHighlight.js.map