@carbon/ibm-products
Version:
Carbon for IBM Products
66 lines (64 loc) • 2.37 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 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 { __toESM } from "../../_virtual/_rolldown/runtime.js";
import { require_classnames } from "../../node_modules/classnames/index.js";
import { pkg } from "../../settings.js";
import { getDevtoolsProps } from "../../global/js/utils/devtools.js";
import { DescriptionListSize } from "./constants.js";
import React from "react";
import PropTypes from "prop-types";
import { StructuredListWrapper } from "@carbon/react";
//#region src/components/DescriptionList/DescriptionList.jsx
/**
* Copyright IBM Corp. 2024, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--description-list`;
const componentName = "DescriptionList";
const defaults = {
border: false,
size: DescriptionListSize.Medium
};
/**
* Type layouts provide an orderly layout of terms and definitions.
* @deprecated This component is deprecated
*/
let DescriptionList = React.forwardRef(({ border = defaults.border, children, className, size = defaults.size, ...rest }, ref) => {
return /* @__PURE__ */ React.createElement("div", {
...rest,
className: (0, import_classnames.default)(blockClass, {
[`${blockClass}--bordered`]: border,
[`${blockClass}--${size}`]: size
}, className),
ref,
...getDevtoolsProps(componentName)
}, /* @__PURE__ */ React.createElement(StructuredListWrapper, {
role: "table",
selection: false
}, children));
});
DescriptionList.deprecated = {
level: "warn",
details: `This component is deprecated`
};
DescriptionList = pkg.checkComponentEnabled(DescriptionList, componentName);
DescriptionList.displayName = componentName;
DescriptionList.propTypes = {
/** Specify if the type layout has a border */
border: PropTypes.bool,
/** Provide the contents of the node */
children: PropTypes.node,
/** Provide an optional class to be applied to the containing node */
className: PropTypes.string,
/** Specify the size of the type layout, from a list of available sizes */
size: PropTypes.oneOf(Object.values(DescriptionListSize))
};
//#endregion
export { DescriptionList };