@geneui/components
Version:
The Gene UI components library designed for BI tools
58 lines (54 loc) • 1.55 kB
JavaScript
import React__default from 'react';
import PropTypes from 'prop-types';
import { c as classnames } from '../index-031ff73c.js';
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
var css_248z = "[data-gene-ui-version=\"2.16.5\"] .label{display:inline-block;font-weight:400;max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:top;white-space:nowrap}[data-gene-ui-version=\"2.16.5\"] .label.bold{font-weight:bolder}[data-gene-ui-version=\"2.16.5\"] .label.semiBold{font-weight:700}";
styleInject(css_248z);
const labels = {
headingExtraLarge: 'h1',
headingLarge: 'h1',
headingBig: 'h2',
heading: 'h3',
bodyBig: 'h4',
body: 'h5',
bodySmall: 'h6',
content: 'p'
};
function Label(_ref) {
let {
children,
className,
size,
font,
...restProps
} = _ref;
return /*#__PURE__*/React__default.createElement(labels[size], {
className: classnames('label', className, font, {
large: size === 'headingExtraLarge'
}),
...restProps
}, children);
}
Label.propTypes = {
/**
* Any valid React node.
*/
children: PropTypes.string.isRequired,
/**
* Label sizing
*/
size: PropTypes.oneOf(['headingExtraLarge', 'headingLarge', 'headingBig', 'heading', 'bodyBig', 'body', 'bodySmall', 'content']),
/**
* Label font to be used
*/
font: PropTypes.oneOf(['regular', 'semiBold', 'bold']),
/**
* Addional className
*/
className: PropTypes.string
};
Label.defaultProps = {
size: 'content',
font: 'regular'
};
export { Label as default };