define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Button", "@fluentui/example-data", "@fluentui/react-experiments/lib/SelectedItemsList"], function (require, exports, tslib_1, React, Button_1, example_data_1, SelectedItemsList_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.SelectedPeopleListBasicExample = void 0;
    var SelectedPeopleListBasicExample = /** @class */ (function (_super) {
        tslib_1.__extends(SelectedPeopleListBasicExample, _super);
        function SelectedPeopleListBasicExample(props) {
            var _this = _super.call(this, props) || this;
            _this.addMultipleKey = 50;
            _this._onAddItemButtonClicked = function () {
                if (!_this.index) {
                    _this.index = 0;
                }
                _this.setState({ currentSelectedItems: tslib_1.__spreadArrays(_this.state.currentSelectedItems, [example_data_1.people[_this.index]]) });
                _this.index++;
            };
            _this._addMoreItems = function () {
                var moreItems = example_data_1.people.map(function (obj) {
                    return tslib_1.__assign(tslib_1.__assign({}, obj), { key: ++_this.addMultipleKey });
                });
                _this.setState({ currentSelectedItems: tslib_1.__spreadArrays(_this.state.currentSelectedItems, moreItems) });
            };
            _this._onItemsRemoved = function (items) {
                var currentSelectedItemsCopy = tslib_1.__spreadArrays(_this.state.currentSelectedItems);
                items.forEach(function (item) {
                    var indexToRemove = currentSelectedItemsCopy.indexOf(item);
                    currentSelectedItemsCopy.splice(indexToRemove, 1);
                    _this.setState({ currentSelectedItems: tslib_1.__spreadArrays(currentSelectedItemsCopy) });
                });
            };
            _this.state = {
                currentSelectedItems: [example_data_1.people[40]],
            };
            return _this;
        }
        SelectedPeopleListBasicExample.prototype.render = function () {
            return (React.createElement("div", { className: 'ms-BasePicker-text' },
                React.createElement(Button_1.PrimaryButton, { text: "Add another item", onClick: this._onAddItemButtonClicked }),
                React.createElement(Button_1.PrimaryButton, { text: "Add multiple items", onClick: this._addMoreItems }),
                this._renderExtendedPicker()));
        };
        SelectedPeopleListBasicExample.prototype._renderExtendedPicker = function () {
            return (React.createElement("div", null,
                React.createElement(SelectedItemsList_1.SelectedPeopleList, { key: 'normal', removeButtonAriaLabel: 'Remove', selectedItems: tslib_1.__spreadArrays(this.state.currentSelectedItems), onItemsRemoved: this._onItemsRemoved })));
        };
        return SelectedPeopleListBasicExample;
    }(React.Component));
    exports.SelectedPeopleListBasicExample = SelectedPeopleListBasicExample;
});
//# sourceMappingURL=SelectedPeopleList.Basic.Example.js.map