1 | "use strict";
|
2 | "use client";
|
3 |
|
4 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5 | exports.__esModule = true;
|
6 | exports.default = void 0;
|
7 | var _classnames = _interopRequireDefault(require("classnames"));
|
8 | var _all = _interopRequireDefault(require("prop-types-extra/lib/all"));
|
9 | var React = _interopRequireWildcard(require("react"));
|
10 | var _uncontrollable = require("uncontrollable");
|
11 | var _Nav = _interopRequireDefault(require("@restart/ui/Nav"));
|
12 | var _ThemeProvider = require("./ThemeProvider");
|
13 | var _NavbarContext = _interopRequireDefault(require("./NavbarContext"));
|
14 | var _CardHeaderContext = _interopRequireDefault(require("./CardHeaderContext"));
|
15 | var _NavItem = _interopRequireDefault(require("./NavItem"));
|
16 | var _NavLink = _interopRequireDefault(require("./NavLink"));
|
17 | var _jsxRuntime = require("react/jsx-runtime");
|
18 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
19 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
20 | const Nav = React.forwardRef((uncontrolledProps, ref) => {
|
21 | const {
|
22 | as = 'div',
|
23 | bsPrefix: initialBsPrefix,
|
24 | variant,
|
25 | fill = false,
|
26 | justify = false,
|
27 | navbar,
|
28 | navbarScroll,
|
29 | className,
|
30 | activeKey,
|
31 | ...props
|
32 | } = (0, _uncontrollable.useUncontrolled)(uncontrolledProps, {
|
33 | activeKey: 'onSelect'
|
34 | });
|
35 | const bsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(initialBsPrefix, 'nav');
|
36 | let navbarBsPrefix;
|
37 | let cardHeaderBsPrefix;
|
38 | let isNavbar = false;
|
39 | const navbarContext = (0, React.useContext)(_NavbarContext.default);
|
40 | const cardHeaderContext = (0, React.useContext)(_CardHeaderContext.default);
|
41 | if (navbarContext) {
|
42 | navbarBsPrefix = navbarContext.bsPrefix;
|
43 | isNavbar = navbar == null ? true : navbar;
|
44 | } else if (cardHeaderContext) {
|
45 | ({
|
46 | cardHeaderBsPrefix
|
47 | } = cardHeaderContext);
|
48 | }
|
49 | return (0, _jsxRuntime.jsx)(_Nav.default, {
|
50 | as: as,
|
51 | ref: ref,
|
52 | activeKey: activeKey,
|
53 | className: (0, _classnames.default)(className, {
|
54 | [bsPrefix]: !isNavbar,
|
55 | [`${navbarBsPrefix}-nav`]: isNavbar,
|
56 | [`${navbarBsPrefix}-nav-scroll`]: isNavbar && navbarScroll,
|
57 | [`${cardHeaderBsPrefix}-${variant}`]: !!cardHeaderBsPrefix,
|
58 | [`${bsPrefix}-${variant}`]: !!variant,
|
59 | [`${bsPrefix}-fill`]: fill,
|
60 | [`${bsPrefix}-justified`]: justify
|
61 | }),
|
62 | ...props
|
63 | });
|
64 | });
|
65 | Nav.displayName = 'Nav';
|
66 | var _default = Object.assign(Nav, {
|
67 | Item: _NavItem.default,
|
68 | Link: _NavLink.default
|
69 | });
|
70 | exports.default = _default;
|
71 | module.exports = exports.default; |
\ | No newline at end of file |