@carbon/ibm-security
Version:
Carbon for Cloud & Cognitive IBM Security UI components
42 lines (40 loc) • 2.15 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children"],
_excluded2 = ["className"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/**
* @file Description module.
* @copyright IBM Security 2020
*/
import classnames from 'classnames';
import { func } from 'prop-types';
import React from 'react';
import LayoutModule, { layoutModuleNamespace } from '../LayoutModule';
var namespace = 'description';
/**
* Description modules provide a means to orderly layout short-form content.
*/
var DescriptionModule = function DescriptionModule(_ref) {
var children = _ref.children,
other = _objectWithoutProperties(_ref, _excluded);
return /*#__PURE__*/React.createElement(LayoutModule, _extends({
namespace: namespace
}, other), children({
getLayoutProps: function getLayoutProps() {
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
className = _ref2.className,
rest = _objectWithoutProperties(_ref2, _excluded2);
return _objectSpread({
className: classnames("".concat(layoutModuleNamespace, "--").concat(namespace, "__content"), className)
}, rest);
}
}));
};
DescriptionModule.propTypes = {
/** Provide the content for the `DescriptionModule` */
children: func.isRequired
};
export default DescriptionModule;