"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "EuiFlyout", {
  enumerable: true,
  get: function get() {
    return _flyout.EuiFlyout;
  }
});
exports.OuiFlyout = void 0;
var _react = _interopRequireDefault(require("react"));
var _flyout = require("../../eui_components/flyout/flyout");
/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

/*
 * Licensed to Elasticsearch B.V. under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch B.V. licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

var OuiFlyout = function OuiFlyout(_ref) {
  var _ref$as = _ref.as,
    as = _ref$as === void 0 ? 'div' : _ref$as,
    _ref$role = _ref.role,
    role = _ref$role === void 0 ? 'dialog' : _ref$role,
    children = _ref.children,
    closeButtonProps = _ref.closeButtonProps,
    hideCloseButton = _ref.hideCloseButton,
    onClose = _ref.onClose,
    dataTestSubj = _ref['data-test-subj'];
  var Element = as;
  return /*#__PURE__*/_react.default.createElement(Element, {
    "data-oui": "OuiFlyout",
    "data-test-subj": dataTestSubj,
    role: role
  }, !hideCloseButton && /*#__PURE__*/_react.default.createElement("button", {
    type: "button",
    "data-test-subj": "ouiFlyoutCloseButton",
    onClick: function onClick(e) {
      onClose();
      (closeButtonProps === null || closeButtonProps === void 0 ? void 0 : closeButtonProps.onClick) && closeButtonProps.onClick(e);
    }
  }), children);
};

/* OUI -> EUI Aliases: Build-Time */
exports.OuiFlyout = OuiFlyout;