@braineet/ui
Version:
Braineet design system
40 lines (39 loc) • 1.64 kB
JavaScript
var _excluded = ["children", "mandatory", "theme", "as"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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);