@carbon/react
Version:
React components for the Carbon Design System
53 lines (47 loc) • 1.35 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');
const SelectItemGroup = ({
children,
className,
disabled = false,
label,
...other
}) => {
const prefix = usePrefix.usePrefix();
const classNames = cx(`${prefix}--select-optgroup`, className);
return /*#__PURE__*/React.createElement("optgroup", _rollupPluginBabelHelpers.extends({
className: classNames,
label: label,
disabled: disabled
}, other), children);
};
SelectItemGroup.propTypes = {
/**
* Provide the contents of your <SelectItemGroup>
*/
children: PropTypes.node,
/**
* Specify an optional className to be applied to the node
*/
className: PropTypes.string,
/**
* Specify whether the <SelectItemGroup> should be disabled
*/
disabled: PropTypes.bool,
/**
* Specify the label to be displayed
*/
label: PropTypes.string.isRequired
};
exports.default = SelectItemGroup;