UNPKG

@carbon/react

Version:

React components for the Carbon Design System

53 lines (47 loc) 1.57 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js'); var cx = require('classnames'); var React = require('react'); var PropTypes = require('prop-types'); var AriaPropTypes = require('../../prop-types/AriaPropTypes.js'); var usePrefix = require('../../internal/usePrefix.js'); function HeaderNavigation({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, children, className: customClassName, ...rest }) { const prefix = usePrefix.usePrefix(); const className = cx(`${prefix}--header__nav`, customClassName); return /*#__PURE__*/React.createElement("nav", _rollupPluginBabelHelpers.extends({}, rest, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: className }), /*#__PURE__*/React.createElement("ul", { className: `${prefix}--header__menu-bar` }, children)); } HeaderNavigation.propTypes = { /** * Required props for accessibility label on the underlying menu */ ...AriaPropTypes.AriaLabelPropType, /** * Provide valid children of HeaderNavigation, for example `HeaderMenuItem` * or `HeaderMenu` */ children: PropTypes.node, /** * Optionally provide a custom class to apply to the underlying <nav> node */ className: PropTypes.string }; exports.default = HeaderNavigation;