UNPKG

@braineet/ui

Version:

Braineet design system

38 lines (37 loc) 1.62 kB
var _excluded = ["isInvalid", "children", "theme", "disabled"]; 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 Text from '../text'; /** * The `Helper` component. */ import { jsx as _jsx } from "react/jsx-runtime"; export var Helper = function Helper(_ref) { var isInvalid = _ref.isInvalid, children = _ref.children, theme = _ref.theme, disabled = _ref.disabled, restProps = _objectWithoutPropertiesLoose(_ref, _excluded); var colorText = isInvalid ? theme.colors.error90 : theme.colors.black; return /*#__PURE__*/_jsx(Text, _extends({ as: "p", fontFamily: "text", size: "xs", display: "block", marginLeft: fluid(8), color: colorText, opacity: disabled ? 0.24 : 1 }, restProps, { children: children })); }; Helper.defaultProps = { children: 'Helper', theme: {}, isInvalid: false, disabled: false }; export default withTheme(Helper);