"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HistoryActivitySelector = void 0;
var react_1 = __importDefault(require("react"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var ramda_1 = require("ramda");
var classnames_1 = __importDefault(require("classnames"));
var Typography_1 = __importDefault(require("@mui/material/Typography"));
var ReactSelectDropdownIndicatorWithIconButton_1 = require("../../../ReactSelectDropdownIndicatorWithIconButton");
var MultiSelect_1 = require("../../../MultiSelect");
var helpers_1 = require("./helpers");
var styles_1 = require("./styles");
var HistoryActivitySelector = function (_a) {
    var selectedHistoryActivityTypes = _a.selectedHistoryActivityTypes, onChange = _a.onChange, className = _a.className, disableUnderline = _a.disableUnderline;
    var styles = (0, styles_1.useStyles)();
    var valueToOption = function (value) { return ({ value: value, label: (0, helpers_1.getHistoryActivityLabel)(value) }); };
    var prepareValues = function (values) { return values.map(valueToOption); };
    var options = prepareValues(helpers_1.historyActivityOptions);
    return (react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.root, className), "data-reltio-id": "history-activity-selector" },
        react_1.default.createElement(Typography_1.default, { className: styles.title, variant: 'subtitle1' }, ui_i18n_1.default.text('Activity')),
        react_1.default.createElement(MultiSelect_1.MultiSelect, { value: prepareValues(selectedHistoryActivityTypes), onChange: (0, ramda_1.pipe)((0, ramda_1.pluck)('value'), onChange), options: options, TextFieldProps: {
                InputProps: { disableUnderline: disableUnderline },
                classes: { root: styles.dropDownInput }
            }, components: {
                DropdownIndicator: ReactSelectDropdownIndicatorWithIconButton_1.ReactSelectDropdownIndicatorWithIconButton
            }, styles: styles_1.customStyles, classes: styles, menuPlacement: "bottom", menuPortalTarget: document.body, menuShouldBlockScroll: true, captureMenuScroll: false })));
};
exports.HistoryActivitySelector = HistoryActivitySelector;
