react-sleek
Version:
React Sleek Component Library
68 lines (67 loc) • 2.6 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var typestyle_1 = require("typestyle");
var Colors_1 = require("../../Style/Colors");
var Radiuses_1 = require("../../Style/Radiuses");
var Spacings_1 = require("../../Style/Spacings");
var csx_1 = require("csx");
var Text = /** @class */ (function (_super) {
__extends(Text, _super);
function Text() {
return _super !== null && _super.apply(this, arguments) || this;
}
Text.prototype.render = function () {
var styleProps = {
backgroundColor: this.props.baseColor,
color: this.props.tintColor,
flex: this.props.full ? 1 : 0,
display: this.props.full ? 'flex' : 'inline-flex',
cursor: this.props.disabled ? 'not-allowed' : 'auto',
width: this.props.full ? csx_1.percent(100) : 'auto',
};
if (this.props.disabled) {
styleProps.opacity = 0.6;
}
var inputStyle = typestyle_1.style(styleProps);
return (React.createElement("input", { className: typestyle_1.classes(styles.inputBase, inputStyle), alt: this.props.alt, title: this.props.title, placeholder: this.props.placeholder, onChange: this.props.onChange }));
};
Text.defaultProps = {
alt: '',
title: '',
placeholder: '',
baseColor: Colors_1.default.White,
tintColor: Colors_1.default.DarkBlue,
full: false,
disabled: false,
};
return Text;
}(React.PureComponent));
exports.default = Text;
var styles = {
inputBase: typestyle_1.style({
height: csx_1.px(50),
fontSize: csx_1.px(18),
boxSizing: 'border-box',
padding: csx_1.px(Spacings_1.default.Tight) + " " + csx_1.px(Spacings_1.default.Compact),
justifyContent: 'center',
alignItems: 'center',
borderRadius: Radiuses_1.default.Medium,
border: 'none',
outline: 'none',
userSelect: 'none',
}),
};