UNPKG

@roo-ui/components

Version:

43 lines (29 loc) 2.49 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || 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; }; var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _styledComponents = require('styled-components'); var _styledComponents2 = _interopRequireDefault(_styledComponents); var _styledSystem = require('styled-system'); var _cleanTag = require('clean-tag'); var _cleanTag2 = _interopRequireDefault(_cleanTag); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Input = (0, _styledComponents2.default)(_cleanTag2.default).withConfig({ displayName: 'Input' })(['display:block;width:100%;margin:0;margin-bottom:', ';padding:', ' ', ';font-size:', ';line-height:', ';color:', ';background-color:', ';border:', ';border-color:', ';outline:0;transition:border-color ', ';appearance:none;&:focus{border-color:', ';}&[readonly]{border-color:transparent;background:transparent;padding-left:0;}::placeholder{color:', ';}::-ms-clear{display:none;}', ' ', ' ', ';'], (0, _styledSystem.themeGet)('space.3'), (0, _styledSystem.themeGet)('space.3'), (0, _styledSystem.themeGet)('space.4'), (0, _styledSystem.themeGet)('fontSizes.base'), (0, _styledSystem.themeGet)('lineHeights.normal'), (0, _styledSystem.themeGet)('colors.grey.0'), (0, _styledSystem.themeGet)('colors.white'), (0, _styledSystem.themeGet)('borders.2'), (0, _styledSystem.themeGet)('colors.grey.2'), (0, _styledSystem.themeGet)('transitions.default'), (0, _styledSystem.themeGet)('colors.brand.secondary'), (0, _styledSystem.themeGet)('colors.grey.1'), function (props) { return props.underline && (0, _styledComponents.css)(['border:none;border-bottom:', ';border-color:', ';'], (0, _styledSystem.themeGet)('borders.2'), (0, _styledSystem.themeGet)('colors.grey.2')); }, function (props) { return props.error && (0, _styledComponents.css)(['border-color:', ';'], (0, _styledSystem.themeGet)('colors.ui.error')); }, _styledSystem.space); Input.propTypes = _extends({}, _styledSystem.space.propTypes, { error: _propTypes2.default.bool, underline: _propTypes2.default.bool }); Input.defaultProps = { is: 'input', blacklist: Object.keys(Input.propTypes) }; exports.default = Input;