@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
58 lines (54 loc) • 1.63 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import cx from 'classnames';
import PropTypes from 'prop-types';
import React__default from 'react';
import { usePrefix } from '../../internal/usePrefix.js';
function Row(_ref) {
let {
as: BaseComponent = 'div',
condensed = false,
narrow = false,
className: containerClassName,
children,
...rest
} = _ref;
const prefix = usePrefix();
const className = cx(containerClassName, {
[`${prefix}--row`]: true,
[`${prefix}--row--condensed`]: condensed,
[`${prefix}--row--narrow`]: narrow
});
// TypeScript type validation reports conflicts on different instances of keyof JSX.IntrinsicElements
const BaseComponentAsAny = BaseComponent;
return /*#__PURE__*/React__default.createElement(BaseComponentAsAny, _extends({
className: className
}, rest), children);
}
Row.propTypes = {
/**
* Provide a custom element to render instead of the default <div>
*/
as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
/**
* Pass in content that will be rendered within the `Row`
*/
children: PropTypes.node,
/**
* Specify a custom className to be applied to the `Row`
*/
className: PropTypes.string,
/**
* Specify a single row as condensed.Rows that are adjacent
* and are condensed will have 2px of margin between them to match gutter.
*/
condensed: PropTypes.bool,
/**
* Specify a single row as narrow. The container will hang
* 16px into the gutter.
*/
narrow: PropTypes.bool
};
export { Row as default };