@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
67 lines (63 loc) • 1.84 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import { ChevronDown } from '@carbon/icons-react';
import cx from 'classnames';
import PropTypes from 'prop-types';
import React__default from 'react';
import { usePrefix } from '../../internal/usePrefix.js';
const TimePickerSelect = /*#__PURE__*/React__default.forwardRef(function TimePickerSelect(_ref, ref) {
let {
['aria-label']: ariaLabel = 'open list of options',
children,
id,
disabled = false,
className,
...rest
} = _ref;
const prefix = usePrefix();
const selectClasses = cx({
[`${prefix}--select`]: true,
[`${prefix}--time-picker__select`]: true,
...(className && {
[className]: true
})
});
return /*#__PURE__*/React__default.createElement("div", {
className: selectClasses
}, /*#__PURE__*/React__default.createElement("select", _extends({
"aria-label": ariaLabel,
className: `${prefix}--select-input`,
disabled: disabled,
id: id,
ref: ref
}, rest), children), /*#__PURE__*/React__default.createElement(ChevronDown, {
className: `${prefix}--select__arrow`,
"aria-hidden": "true"
}));
});
TimePickerSelect.propTypes = {
/**
* Provide the contents of your TimePickerSelect
*/
children: PropTypes.node,
/**
* Specify an optional className to be applied to the node containing the label and the select box
*/
className: PropTypes.string,
/**
* Optionally provide the default value of the `<select>`
*/
defaultValue: PropTypes.any,
/**
* Specify whether the control is disabled
*/
disabled: PropTypes.bool,
/**
* Specify a custom `id` for the `<select>`
*/
id: PropTypes.string.isRequired
};
var TimePickerSelect$1 = TimePickerSelect;
export { TimePickerSelect$1 as default };