import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; var _excluded = ["as", "bsPrefix", "variant", "fill", "justify", "navbar", "navbarScroll", "className", "children", "activeKey"]; 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 = /*#__PURE__*/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, initialBsPrefix = _useUncontrolled.bsPrefix, variant = _useUncontrolled.variant, fill = _useUncontrolled.fill, justify = _useUncontrolled.justify, navbar = _useUncontrolled.navbar, navbarScroll = _useUncontrolled.navbarScroll, className = _useUncontrolled.className, children = _useUncontrolled.children, activeKey = _useUncontrolled.activeKey, props = _objectWithoutPropertiesLoose(_useUncontrolled, _excluded); var bsPrefix = useBootstrapPrefix(initialBsPrefix, 'nav'); var navbarBsPrefix; var cardHeaderBsPrefix; var isNavbar = false; var navbarContext = useContext(NavbarContext); var cardContext = useContext(CardContext); if (navbarContext) { navbarBsPrefix = navbarContext.bsPrefix; isNavbar = navbar == null ? true : navbar; } else if (cardContext) { cardHeaderBsPrefix = cardContext.cardHeaderBsPrefix; } return /*#__PURE__*/React.createElement(AbstractNav, _extends({ as: as, ref: ref, activeKey: activeKey, className: classNames(className, (_classNames = {}, _classNames[bsPrefix] = !isNavbar, _classNames[navbarBsPrefix + "-nav"] = isNavbar, _classNames[navbarBsPrefix + "-nav-scroll"] = isNavbar && navbarScroll, _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;