UNPKG

@dnanpm/styleguide

Version:

DNA Styleguide repository provides the set of components and theme object used in various DNA projects.

36 lines (29 loc) 1.53 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = require('tslib'); var React = require('react'); var styledComponents = require('styled-components'); var theme = require('../../themes/theme.js'); var styledUtils = require('../../utils/styledUtils.js'); function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; } var React__default = /*#__PURE__*/_interopDefaultCompat(React); const Label = styledComponents.styled.label ` display: block; color: ${({ $status }) => $status === 'error' ? theme.default.color.notification.error : theme.default.color.text.gray}; font-weight: ${theme.default.fontWeight.medium}; font-size: ${theme.default.fontSize.default}; line-height: ${theme.default.lineHeight.default}; margin-bottom: ${styledUtils.getDividedSize(theme.default.base.baseWidth, 2)}; ${({ htmlFor }) => htmlFor && `cursor: pointer`}; `; const Mandatory = styledComponents.styled.span ` color: ${theme.default.color.text.pink}; `; /** @visibleName Label Text */ const LabelText = (_a) => { var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']); return (React__default.default.createElement(Label, { id: props.id, htmlFor: props.htmlFor, className: props.className, "data-testid": dataTestId, "$status": props.status }, props.children, props.isMandatory && React__default.default.createElement(Mandatory, null, "*"))); }; exports.default = LabelText;