define(["require", "exports", "tslib", "react", "../../Utilities", "../../Styling", "../../FocusZone", "./OverflowSet.scss"], function (require, exports, tslib_1, React, Utilities_1, Styling_1, FocusZone_1, stylesImport) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var styles = stylesImport;
    var OverflowSet = /** @class */ (function (_super) {
        tslib_1.__extends(OverflowSet, _super);
        function OverflowSet(props) {
            var _this = _super.call(this, props) || this;
            _this._focusZone = Utilities_1.createRef();
            _this._divContainer = Utilities_1.createRef();
            _this._onRenderItems = function (items) {
                return items.map(function (item, i) {
                    var wrapperDivProps = { className: Utilities_1.css('ms-OverflowSet-item', styles.item) };
                    return (React.createElement("div", tslib_1.__assign({ key: item.key }, wrapperDivProps), _this.props.onRenderItem(item)));
                });
            };
            _this._onRenderOverflowButtonWrapper = function (items) {
                var wrapperDivProps = { className: Utilities_1.css('ms-OverflowSet-overflowButton', styles.item) };
                return (React.createElement("div", tslib_1.__assign({}, wrapperDivProps), _this.props.onRenderOverflowButton(items)));
            };
            if (props.doNotContainWithinFocusZone) {
                _this._warnMutuallyExclusive({
                    'doNotContainWithinFocusZone': 'focusZoneProps'
                });
            }
            return _this;
        }
        OverflowSet.prototype.render = function () {
            var _a = this.props, items = _a.items, overflowItems = _a.overflowItems, className = _a.className, focusZoneProps = _a.focusZoneProps, _b = _a.vertical, vertical = _b === void 0 ? false : _b, _c = _a.role, role = _c === void 0 ? 'menubar' : _c, doNotContainWithinFocusZone = _a.doNotContainWithinFocusZone;
            var Tag;
            var uniqueComponentProps;
            if (doNotContainWithinFocusZone) {
                Tag = 'div';
                uniqueComponentProps = tslib_1.__assign({}, Utilities_1.getNativeProps(this.props, Utilities_1.divProperties), { ref: this._divContainer });
            }
            else {
                Tag = FocusZone_1.FocusZone;
                uniqueComponentProps = tslib_1.__assign({}, focusZoneProps, { componentRef: this._focusZone, direction: vertical ? FocusZone_1.FocusZoneDirection.vertical : FocusZone_1.FocusZoneDirection.horizontal });
            }
            return (React.createElement(Tag, tslib_1.__assign({}, uniqueComponentProps, { className: Styling_1.mergeStyles('ms-OverflowSet', styles.root, vertical && styles.rootVertical, className), role: role }),
                items && this._onRenderItems(items),
                overflowItems && overflowItems.length > 0 && this._onRenderOverflowButtonWrapper(overflowItems)));
        };
        OverflowSet.prototype.focus = function () {
            if (this.props.doNotContainWithinFocusZone) {
                if (this._divContainer.value) {
                    Utilities_1.focusFirstChild(this._divContainer.value);
                }
                return;
            }
            if (this._focusZone.value) {
                this._focusZone.value.focus();
            }
        };
        return OverflowSet;
    }(Utilities_1.BaseComponent));
    exports.OverflowSet = OverflowSet;
});
//# sourceMappingURL=OverflowSet.js.map