@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
64 lines (60 loc) • 1.38 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import PropTypes from 'prop-types';
import React__default from 'react';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix.js';
const SelectItem = _ref => {
let {
className,
value,
disabled,
hidden,
text,
...other
} = _ref;
const prefix = usePrefix();
const selectItemClasses = cx({
[`${prefix}--select-option`]: true,
...(className && {
[className]: className
})
});
return /*#__PURE__*/React__default.createElement("option", _extends({}, other, {
className: selectItemClasses,
value: value,
disabled: disabled,
hidden: hidden
}), text);
};
SelectItem.propTypes = {
/**
* Specify an optional className to be applied to the node
*/
className: PropTypes.string,
/**
* Specify whether the <SelectItem> should be disabled
*/
disabled: PropTypes.bool,
/**
* Specify whether the <SelectItem> is hidden
*/
hidden: PropTypes.bool,
/**
* Provide the contents of your <SelectItem>
*/
text: PropTypes.string.isRequired,
/**
* Specify the value of the <SelectItem>
*/
value: PropTypes.any.isRequired
};
SelectItem.defaultProps = {
disabled: false,
hidden: false,
value: '',
text: ''
};
export { SelectItem as default };