Gazebo_simulation-Frontend/node_modules/react-bootstrap/esm/Nav.js
2020-12-21 10:29:31 -05:00

58 lines
2.4 KiB
JavaScript

import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import classNames from 'classnames';
import all from 'prop-types-extra/lib/all';
import React, { useContext } from 'react';
import { useUncontrolled } from 'uncontrollable';
import { useBootstrapPrefix } from './ThemeProvider';
import NavbarContext from './NavbarContext';
import CardContext from './CardContext';
import AbstractNav from './AbstractNav';
import NavItem from './NavItem';
import NavLink from './NavLink';
var defaultProps = {
justify: false,
fill: false
};
var Nav = React.forwardRef(function (uncontrolledProps, ref) {
var _classNames;
var _useUncontrolled = useUncontrolled(uncontrolledProps, {
activeKey: 'onSelect'
}),
_useUncontrolled$as = _useUncontrolled.as,
as = _useUncontrolled$as === void 0 ? 'div' : _useUncontrolled$as,
bsPrefix = _useUncontrolled.bsPrefix,
variant = _useUncontrolled.variant,
fill = _useUncontrolled.fill,
justify = _useUncontrolled.justify,
navbar = _useUncontrolled.navbar,
className = _useUncontrolled.className,
children = _useUncontrolled.children,
activeKey = _useUncontrolled.activeKey,
props = _objectWithoutPropertiesLoose(_useUncontrolled, ["as", "bsPrefix", "variant", "fill", "justify", "navbar", "className", "children", "activeKey"]);
bsPrefix = useBootstrapPrefix(bsPrefix, 'nav');
var navbarBsPrefix, cardHeaderBsPrefix;
var navbarContext = useContext(NavbarContext);
var cardContext = useContext(CardContext);
if (navbarContext) {
navbarBsPrefix = navbarContext.bsPrefix;
navbar = navbar == null ? true : navbar;
} else if (cardContext) {
cardHeaderBsPrefix = cardContext.cardHeaderBsPrefix;
}
return React.createElement(AbstractNav, _extends({
as: as,
ref: ref,
activeKey: activeKey,
className: classNames(className, (_classNames = {}, _classNames[bsPrefix] = !navbar, _classNames[navbarBsPrefix + "-nav"] = navbar, _classNames[cardHeaderBsPrefix + "-" + variant] = !!cardHeaderBsPrefix, _classNames[bsPrefix + "-" + variant] = !!variant, _classNames[bsPrefix + "-fill"] = fill, _classNames[bsPrefix + "-justified"] = justify, _classNames))
}, props), children);
});
Nav.displayName = 'Nav';
Nav.defaultProps = defaultProps;
Nav.Item = NavItem;
Nav.Link = NavLink;
export default Nav;