@carbon/react
Version:
React components for the Carbon Design System
60 lines (54 loc) • 1.64 kB
JavaScript
/**
* 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.
*/
;
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 OrderedList({
className,
nested = false,
native = false,
isExpressive = false,
...other
}) {
const prefix = usePrefix.usePrefix();
const classNames = cx({
[`${prefix}--list--ordered`]: !native,
[`${prefix}--list--ordered--native`]: native,
[`${prefix}--list--nested`]: nested,
[`${prefix}--list--expressive`]: isExpressive
}, className);
return /*#__PURE__*/React.createElement("ol", _rollupPluginBabelHelpers.extends({
className: classNames
}, other));
}
OrderedList.propTypes = {
/**
* Provide list items to be rendered in the ordered list
*/
children: PropTypes.node,
/**
* Provide an optional className to be applied to the containing <ol> node
*/
className: PropTypes.string,
/**
* Specify whether this ordered list expressive or not
*/
isExpressive: PropTypes.bool,
/**
* Specify whether this ordered list should use native list styles instead of custom counter
*/
native: PropTypes.bool,
/**
* Specify whether this ordered list is nested inside of another nested list
*/
nested: PropTypes.bool
};
exports.default = OrderedList;