| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.NavGroup = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
const nav_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Nav/nav")); |
| 7 |
const react_styles_1 = require("@patternfly/react-styles"); |
| 8 |
const helpers_1 = require("../../helpers"); |
| 9 |
const NavGroup = (_a) => { |
| 10 |
var { title, children = null, className = '', id: idProp } = _a, props = tslib_1.__rest(_a, ["title", "children", "className", "id"]); |
| 11 |
const generatedId = (0, helpers_1.useSSRSafeId)(); |
| 12 |
const id = idProp !== null && idProp !== void 0 ? idProp : generatedId; |
| 13 |
if (!title && !props['aria-label']) { |
| 14 |
// eslint-disable-next-line no-console |
| 15 |
console.warn("For accessibility reasons an aria-label should be specified on nav groups if a title isn't"); |
| 16 |
} |
| 17 |
const labelledBy = title ? id : undefined; |
| 18 |
return ((0, jsx_runtime_1.jsxs)("section", Object.assign({ className: (0, react_styles_1.css)(nav_1.default.navSection, className), "aria-labelledby": labelledBy }, props, { children: [title && ((0, jsx_runtime_1.jsx)("h2", { className: (0, react_styles_1.css)(nav_1.default.navSectionTitle), id: id, children: title })), (0, jsx_runtime_1.jsx)("ul", { className: (0, react_styles_1.css)(nav_1.default.navList, className), role: "list", children: children })] }))); |
| 19 |
}; |
| 20 |
exports.NavGroup = NavGroup; |
| 21 |
exports.NavGroup.displayName = 'NavGroup'; |
| 22 |
//# sourceMappingURL=NavGroup.js.map |