"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SourceSelector = void 0;
var react_1 = __importDefault(require("react"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var classnames_1 = __importDefault(require("classnames"));
var ramda_1 = require("ramda");
var Typography_1 = __importDefault(require("@mui/material/Typography"));
var MultiSelect_1 = require("../../../../../MultiSelect");
var ReactSelectDropdownIndicatorWithIconButton_1 = require("../../../../../ReactSelectDropdownIndicatorWithIconButton");
var MdmModuleContext_1 = require("../../../../../contexts/MdmModuleContext");
var styles_1 = require("../../styles");
var SourceSelector = function (_a) {
    var selectedSources = _a.selectedSources, onChange = _a.onChange;
    var styles = (0, styles_1.useStyles)();
    var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
    var options = (0, ramda_1.sortBy)(function (option) { return option.label; })(metadata.sources);
    return (react_1.default.createElement("div", { className: styles.selectorWrapper, "data-reltio-id": "source-selector" },
        react_1.default.createElement(Typography_1.default, { className: (0, classnames_1.default)(styles.filterSubtitle, styles.labels), variant: 'subtitle1' }, ui_i18n_1.default.text('Source')),
        react_1.default.createElement(MultiSelect_1.MultiSelect, { value: selectedSources, onChange: onChange, options: options, TextFieldProps: {
                InputProps: { disableUnderline: true },
                classes: { root: styles.dropDownInput }
            }, components: {
                DropdownIndicator: ReactSelectDropdownIndicatorWithIconButton_1.ReactSelectDropdownIndicatorWithIconButton
            }, styles: styles_1.customStyles, classes: styles, getOptionValue: (0, ramda_1.prop)('abbreviation'), menuPlacement: "bottom", menuPortalTarget: document.body, menuShouldBlockScroll: true, captureMenuScroll: false })));
};
exports.SourceSelector = SourceSelector;
