@braineet/ui
Version:
Braineet design system
40 lines (39 loc) • 1.47 kB
JavaScript
var _excluded = ["children", "mandatory", "theme", "as"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import React from 'react';
import { withTheme } from 'styled-components';
import { fluid } from '../../utils';
import LabelText from '../label';
import Text from '../text';
/**
* The `Label` component.
*/
import { jsxs as _jsxs } from "react/jsx-runtime";
export var Label = function Label(_ref) {
var children = _ref.children,
text = _ref.mandatory,
theme = _ref.theme,
as = _ref.as,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
return /*#__PURE__*/_jsxs(LabelText, _extends({
display: "inline-block",
color: "black",
fontFamily: "display",
size: "xs",
marginBottom: fluid(4),
as: as
}, restProps, {
children: [children, " ", !!text && /*#__PURE__*/_jsxs(Text, {
size: "xxs",
children: ["(", text, ")"]
})]
}));
};
Label.defaultProps = {
children: 'Label Title',
as: 'label',
theme: {},
mandatory: ''
};
export default withTheme(Label);