UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

68 lines (60 loc) 1.85 kB
/** * MSKCC 2021, 2024 */ '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 SelectItem = _ref => { let { className, value, disabled, hidden, text, ...other } = _ref; const prefix = usePrefix.usePrefix(); const selectItemClasses = cx__default["default"]({ [`${prefix}--select-option`]: true, ...(className && { [className]: className }) }); return /*#__PURE__*/React__default["default"].createElement("option", _rollupPluginBabelHelpers["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__default["default"].string, /** * Specify whether the <SelectItem> should be disabled */ disabled: PropTypes__default["default"].bool, /** * Specify whether the <SelectItem> is hidden */ hidden: PropTypes__default["default"].bool, /** * Provide the contents of your <SelectItem> */ text: PropTypes__default["default"].string.isRequired, /** * Specify the value of the <SelectItem> */ value: PropTypes__default["default"].any.isRequired }; exports["default"] = SelectItem;