@intility/bifrost-react
Version:
React library for Intility's design system, Bifrost.
112 lines • 2.43 kB
JavaScript
import { c as _c } from "react-compiler-runtime";
import classNames from "classnames";
import { forwardRef } from "react";
import hasTruthyChildren from "../../utils/hasTruthyChildren.js";
import BoxArrow from "../Box/Box.Arrow.js";
import Icon from "../Icon/Icon.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const NavItem = /*#__PURE__*/forwardRef((t0, ref) => {
const $ = _c(25);
let children;
let className;
let external;
let icon;
let props;
if ($[0] !== t0) {
({
children,
icon,
external,
className,
...props
} = t0);
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = external;
$[4] = icon;
$[5] = props;
} else {
children = $[1];
className = $[2];
external = $[3];
icon = $[4];
props = $[5];
}
let t1;
if ($[6] !== children) {
t1 = hasTruthyChildren(children);
$[6] = children;
$[7] = t1;
} else {
t1 = $[7];
}
const hasChildren = t1;
const t2 = icon && !hasChildren;
let t3;
if ($[8] !== className || $[9] !== t2) {
t3 = classNames("bf-nav-item", className, {
"bf-nav-item-icon-only": t2
});
$[8] = className;
$[9] = t2;
$[10] = t3;
} else {
t3 = $[10];
}
let t4;
if ($[11] !== icon) {
t4 = icon && /*#__PURE__*/_jsx(Icon, {
icon: icon,
className: "bf-nav-item-icon"
});
$[11] = icon;
$[12] = t4;
} else {
t4 = $[12];
}
let t5;
if ($[13] !== children || $[14] !== hasChildren) {
t5 = hasChildren && /*#__PURE__*/_jsx("span", {
className: "bf-nav-item-text",
children: children
});
$[13] = children;
$[14] = hasChildren;
$[15] = t5;
} else {
t5 = $[15];
}
let t6;
if ($[16] !== external) {
t6 = external && /*#__PURE__*/_jsx(BoxArrow, {
external: true,
className: "bf-nav-item-arrow"
});
$[16] = external;
$[17] = t6;
} else {
t6 = $[17];
}
let t7;
if ($[18] !== props || $[19] !== ref || $[20] !== t3 || $[21] !== t4 || $[22] !== t5 || $[23] !== t6) {
t7 = /*#__PURE__*/_jsxs("div", {
...props,
className: t3,
ref: ref,
children: [t4, t5, t6]
});
$[18] = props;
$[19] = ref;
$[20] = t3;
$[21] = t4;
$[22] = t5;
$[23] = t6;
$[24] = t7;
} else {
t7 = $[24];
}
return t7;
});
NavItem.displayName = "Nav.Item";
export default NavItem;