UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

68 lines (60 loc) 2.23 kB
/** * MSKCC 2021, 2024 */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js'); var cx = require('classnames'); var PropTypes = require('prop-types'); var React = require('react'); var usePrefix = require('../../internal/usePrefix.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx); var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); var React__default = /*#__PURE__*/_interopDefaultLegacy(React); function Row(_ref) { let { as: BaseComponent = 'div', condensed = false, narrow = false, className: containerClassName, children, ...rest } = _ref; const prefix = usePrefix.usePrefix(); const className = cx__default["default"](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["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({ className: className }, rest), children); } Row.propTypes = { /** * Provide a custom element to render instead of the default <div> */ as: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].elementType]), /** * Pass in content that will be rendered within the `Row` */ children: PropTypes__default["default"].node, /** * Specify a custom className to be applied to the `Row` */ className: PropTypes__default["default"].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__default["default"].bool, /** * Specify a single row as narrow. The container will hang * 16px into the gutter. */ narrow: PropTypes__default["default"].bool }; exports["default"] = Row;