UNPKG

@carbon/react

Version:

React components for the Carbon Design System

72 lines (64 loc) 2.35 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 PropTypes = require('prop-types'); var React = require('react'); var cx = require('classnames'); var usePrefix = require('../../internal/usePrefix.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx); const Breadcrumb = /*#__PURE__*/React.forwardRef((props, ref) => { const { 'aria-label': ariaLabel, children, className: customClassNameNav, noTrailingSlash, size, ...rest } = props; const prefix = usePrefix.usePrefix(); const className = cx__default["default"]({ [`${prefix}--breadcrumb`]: true, [`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash, [`${prefix}--breadcrumb--sm`]: size === 'sm' }); return /*#__PURE__*/React__default["default"].createElement("nav", _rollupPluginBabelHelpers["extends"]({ className: customClassNameNav, "aria-label": ariaLabel ? ariaLabel : 'Breadcrumb', ref: ref }, rest), /*#__PURE__*/React__default["default"].createElement("ol", { className: className }, children)); }); Breadcrumb.displayName = 'Breadcrumb'; Breadcrumb.propTypes = { /** * Specify the label for the breadcrumb container */ 'aria-label': PropTypes__default["default"].string, /** * Pass in the BreadcrumbItem's for your Breadcrumb */ children: PropTypes__default["default"].node, /** * Specify an optional className to be applied to the container node */ className: PropTypes__default["default"].string, /** * Optional prop to omit the trailing slash for the breadcrumbs */ noTrailingSlash: PropTypes__default["default"].bool, /** * Specify the size of the Breadcrumb. Currently supports the following: */ size: PropTypes__default["default"].oneOf(['sm', 'md']) }; exports["default"] = Breadcrumb;