'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var React = require('react');
var classnames = require('classnames');
var reactRouterDom = require('react-router-dom');
var jsxRuntime = require('react/jsx-runtime');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);
var React__default = /*#__PURE__*/_interopDefault(React);
var classnames__default = /*#__PURE__*/_interopDefault(classnames);

var _excluded$1 = ["active", "className", "children", "icon", "onClick", "activeClassName"];
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Item = function Item(_ref) {
  var active = _ref.active,
    _ref$className = _ref.className,
    className = _ref$className === void 0 ? "" : _ref$className,
    children = _ref.children,
    _ref$icon = _ref.icon,
    icon = _ref$icon === void 0 ? null : _ref$icon,
    _ref$onClick = _ref.onClick,
    onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
    _ref$activeClassName = _ref.activeClassName,
    activeClassName = _ref$activeClassName === void 0 ? "" : _ref$activeClassName,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded$1);
  var Icon = typeof icon === "string" ? function () {
    return /*#__PURE__*/jsxRuntime.jsx("i", {
      className: icon,
      "data-testid": "tab-item-icon"
    });
  } : icon || React__default.default.Fragment;
  var Parent = activeClassName ? reactRouterDom.NavLink : "button";
  var buttonAttributes = activeClassName ? {} : {
    type: "button"
  };
  return /*#__PURE__*/jsxRuntime.jsxs(Parent, _objectSpread$1(_objectSpread$1({
    "aria-selected": active,
    "data-testid": "tab-item",
    role: "tab",
    className: classnames__default.default(["neeto-ui-tab neeto-ui-flex neeto-ui-items-center neeto-ui-justify-center neeto-ui-select-none", className], {
      active: active
    })
  }, _objectSpread$1(_objectSpread$1({
    onClick: onClick
  }, otherProps), buttonAttributes)), {}, {
    children: [icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
      className: "neeto-ui-tab__icon"
    }), children]
  }));
};
Item.displayName = "Tab.Item";

var _excluded = ["size", "noUnderline", "children", "className"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var SIZES = {
  large: "large",
  small: "small"
};
var Tab = function Tab(_ref) {
  var _ref$size = _ref.size,
    size = _ref$size === void 0 ? SIZES.small : _ref$size,
    _ref$noUnderline = _ref.noUnderline,
    noUnderline = _ref$noUnderline === void 0 ? false : _ref$noUnderline,
    children = _ref.children,
    _ref$className = _ref.className,
    className = _ref$className === void 0 ? "" : _ref$className,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded);
  return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
    "data-testid": "tab-container",
    role: "tablist",
    className: classnames__default.default({
      "neeto-ui-tab__wrapper neeto-ui-flex": true,
      "neeto-ui-tab__wrapper--size-large": size === SIZES.large,
      "neeto-ui-tab__wrapper--size-small": size === SIZES.small,
      "neeto-ui-tab__wrapper--underline-none": noUnderline
    }, [className])
  }, otherProps), {}, {
    children: children
  }));
};
Tab.Item = Item;

module.exports = Tab;
//# sourceMappingURL=Tab.js.map
