@carbon/react
Version:
React components for the Carbon Design System
53 lines (51 loc) • 1.6 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { usePrefix } from "../../internal/usePrefix.js";
import classNames from "classnames";
import { forwardRef } from "react";
import PropTypes from "prop-types";
import { jsx, jsxs } from "react/jsx-runtime";
import { ChevronDown } from "@carbon/icons-react";
//#region src/components/TimePickerSelect/TimePickerSelect.tsx
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const TimePickerSelect = forwardRef((props, ref) => {
const { ["aria-label"]: ariaLabel = "open list of options", children, id, disabled = false, className, ...rest } = props;
const prefix = usePrefix();
return /* @__PURE__ */ jsxs("div", {
className: classNames({
[`${prefix}--select`]: true,
[`${prefix}--time-picker__select`]: true,
...className && { [className]: true }
}),
children: [/* @__PURE__ */ jsx("select", {
"aria-label": ariaLabel,
className: `${prefix}--select-input`,
disabled,
id,
ref,
...rest,
children
}), /* @__PURE__ */ jsx(ChevronDown, {
className: `${prefix}--select__arrow`,
"aria-hidden": "true"
})]
});
});
TimePickerSelect.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
defaultValue: PropTypes.any,
disabled: PropTypes.bool,
id: PropTypes.string.isRequired
};
//#endregion
export { TimePickerSelect as default };