@carbon/react
Version:
React components for the Carbon Design System
44 lines (42 loc) • 1.61 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.
*/
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_usePrefix = require("../../internal/usePrefix.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/components/ListBox/ListBoxField.tsx
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* `ListBoxField` is responsible for creating the containing node for valid
* elements inside of a field. It also provides a11y-related attributes like
* `role` to make sure a user can focus the given field.
*/
function ListBoxField({ children, disabled, tabIndex, ...rest }) {
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
className: `${require_usePrefix.usePrefix()}--list-box__field`,
tabIndex: !disabled && tabIndex || -1,
...rest,
children
});
}
ListBoxField.propTypes = {
"aria-haspopup": prop_types.default.oneOfType([prop_types.default.string, prop_types.default.bool]),
children: prop_types.default.node,
disabled: prop_types.default.bool,
role: prop_types.default.string,
tabIndex: prop_types.default.oneOfType([prop_types.default.number, prop_types.default.string])
};
//#endregion
exports.default = ListBoxField;