Debian Codegraph @

node/@patternfly/react-core/dist/esm/components/Nav/NavGroup.js

raw
1 import { __rest } from "tslib";
2 import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3 import styles from '@patternfly/react-styles/css/components/Nav/nav.mjs';
4 import { css } from '@patternfly/react-styles';
5 import { useSSRSafeId } from '../../helpers';
6 export const NavGroup = (_a) => {
7 var { title, children = null, className = '', id: idProp } = _a, props = __rest(_a, ["title", "children", "className", "id"]);
8 const generatedId = useSSRSafeId();
9 const id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
10 if (!title && !props['aria-label']) {
11 // eslint-disable-next-line no-console
12 console.warn("For accessibility reasons an aria-label should be specified on nav groups if a title isn't");
13 }
14 const labelledBy = title ? id : undefined;
15 return (_jsxs("section", Object.assign({ className: css(styles.navSection, className), "aria-labelledby": labelledBy }, props, { children: [title && (_jsx("h2", { className: css(styles.navSectionTitle), id: id, children: title })), _jsx("ul", { className: css(styles.navList, className), role: "list", children: children })] })));
16 };
17 NavGroup.displayName = 'NavGroup';
18 //# sourceMappingURL=NavGroup.js.map