GoScrobble/web/node_modules/reactstrap/lib/Nav.js

77 lines
2.5 KiB
JavaScript

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _utils = require("./utils");
var propTypes = {
tabs: _propTypes.default.bool,
pills: _propTypes.default.bool,
vertical: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
horizontal: _propTypes.default.string,
justified: _propTypes.default.bool,
fill: _propTypes.default.bool,
navbar: _propTypes.default.bool,
card: _propTypes.default.bool,
tag: _utils.tagPropType,
className: _propTypes.default.string,
cssModule: _propTypes.default.object
};
var defaultProps = {
tag: 'ul',
vertical: false
};
var getVerticalClass = function getVerticalClass(vertical) {
if (vertical === false) {
return false;
} else if (vertical === true || vertical === 'xs') {
return 'flex-column';
}
return "flex-" + vertical + "-column";
};
var Nav = function Nav(props) {
var className = props.className,
cssModule = props.cssModule,
tabs = props.tabs,
pills = props.pills,
vertical = props.vertical,
horizontal = props.horizontal,
justified = props.justified,
fill = props.fill,
navbar = props.navbar,
card = props.card,
Tag = props.tag,
attributes = (0, _objectWithoutPropertiesLoose2.default)(props, ["className", "cssModule", "tabs", "pills", "vertical", "horizontal", "justified", "fill", "navbar", "card", "tag"]);
var classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, navbar ? 'navbar-nav' : 'nav', horizontal ? "justify-content-" + horizontal : false, getVerticalClass(vertical), {
'nav-tabs': tabs,
'card-header-tabs': card && tabs,
'nav-pills': pills,
'card-header-pills': card && pills,
'nav-justified': justified,
'nav-fill': fill
}), cssModule);
return /*#__PURE__*/_react.default.createElement(Tag, (0, _extends2.default)({}, attributes, {
className: classes
}));
};
Nav.propTypes = propTypes;
Nav.defaultProps = defaultProps;
var _default = Nav;
exports.default = _default;