UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

57 lines (49 loc) 1.94 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); /** * Helper component for rendering content that hangs on the column. Useful when * trying to align content across different grid modes */ function ColumnHang(_ref) { let { as: BaseComponent = 'div', className: customClassName, children, ...rest } = _ref; const prefix = usePrefix.usePrefix(); const className = cx__default["default"](customClassName, `${prefix}--grid-column-hang`); // cast as any to let TypeScript allow passing in attributes to base component const BaseComponentAsAny = BaseComponent; return /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({}, rest, { className: className }), children); } ColumnHang.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 `Grid` */ children: PropTypes__default["default"].node, /** * Specify a custom className to be applied to the `Grid` */ className: PropTypes__default["default"].string }; const ColumnHangComponent = ColumnHang; exports.ColumnHang = ColumnHangComponent;