import React, { forwardRef, useMemo } from 'react';
import { SearchableList } from '../../list/SearchableList.js';
import { H1 } from '../../heading/index.js';
import { createTenantLabel } from '../createTenantLabel.js';

var TenantSelectionSelectList = forwardRef(function (_a, ref) {
    var managedSellers = _a.managedSellers, selectedTenantId = _a.selectedTenantId, onTenantSelect = _a.onTenantSelect, title = _a.title, searchFieldOptions = _a.searchFieldOptions;
    var listItems = useMemo(function () {
        return managedSellers.map(function (managedSeller) {
            return {
                value: managedSeller.id.toString(),
                label: createTenantLabel(managedSeller),
                onClick: function (event) {
                    return onTenantSelect(parseInt(event.currentTarget.value, 10));
                },
                showChevron: true,
                isSelected: managedSeller.id === selectedTenantId,
            };
        });
    }, [managedSellers, selectedTenantId, onTenantSelect]);
    return (React.createElement(React.Fragment, null,
        title ? React.createElement(H1, { textStyle: "heading3" }, title) : null,
        React.createElement(SearchableList, { listItems: listItems, ref: ref, searchFieldOptions: searchFieldOptions })));
});

export { TenantSelectionSelectList };
//# sourceMappingURL=List.js.map
