UNPKG

backpack-ui

Version:
106 lines (75 loc) 3.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = require("babel-runtime/helpers/extends"); var _extends3 = _interopRequireDefault(_extends2); var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties"); var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); var _react = require("react"); var _react2 = _interopRequireDefault(_react); var _propTypes = require("prop-types"); var _propTypes2 = _interopRequireDefault(_propTypes); var _radium = require("radium"); var _radium2 = _interopRequireDefault(_radium); var _colors = require("../../styles/colors"); var _colors2 = _interopRequireDefault(_colors); var _timing = require("../../styles/timing"); var _timing2 = _interopRequireDefault(_timing); var _typography = require("../../styles/typography"); var _propTypes3 = require("../../utils/propTypes"); var _propTypes4 = _interopRequireDefault(_propTypes3); var _createQAHook = require("../../utils/createQAHook"); var _createQAHook2 = _interopRequireDefault(_createQAHook); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var height = 56; var styles = { backgroundColor: _colors2.default.bgPrimary, display: "block", borderBottomColor: _colors2.default.borderPrimary, borderBottomStyle: "solid", borderWidth: "0 0 1px 0", color: _colors2.default.textPrimary, height: height / _typography.fontSizeHeading7 + "em", fontSize: _typography.fontSizeHeading7 + "px", fontWeight: _typography.fontWeightMedium, lineHeight: _typography.lineHeightHeading7, minHeight: height + "px", paddingBottom: 15 / _typography.fontSizeHeading7 + "em", paddingLeft: 0, paddingRight: 0, paddingTop: 17 / _typography.fontSizeHeading7 + "em", transition: "\n backgroundColor " + _timing2.default.fast + ",\n border-bottom-color " + _timing2.default.fast + ",\n color " + _timing2.default.fast, width: "100%", ":focus": { borderBottomColor: _colors2.default.linkPrimary, outline: "none" } }; var Input = function Input(props) { var innerRef = props.innerRef, style = props.style, qaHook = props.qaHook, attributes = (0, _objectWithoutProperties3.default)(props, ["innerRef", "style", "qaHook"]); return _react2.default.createElement("input", (0, _extends3.default)({}, attributes, { ref: innerRef, style: [styles, style], "data-testid": qaHook ? (0, _createQAHook2.default)(innerRef, "default", "input") : null })); }; Input.propTypes = { innerRef: _propTypes2.default.func, style: _propTypes4.default.style, qaHook: _propTypes2.default.bool }; Input.defaultProps = { type: "text", innerRef: null, style: null, qaHook: false }; Input.styles = styles; Input.fontSize = _typography.fontSizeHeading7; Input.lineHeight = _typography.lineHeightHeading7 * _typography.fontSizeHeading7; Input.height = height; exports.default = (0, _radium2.default)(Input);