UNPKG

@up-group/react-controls

Version:

We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get

65 lines 3.01 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var 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 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 themedComponents_1 = require("../../../Common/theming/themedComponents"); var react_textarea_autosize_1 = require("react-textarea-autosize"); var styles_1 = require("../_Common/Styled/Input/styles"); var sizeMap = { xsmall: "100px", small: "150px", medium: "350px", large: "450px", xlarge: "600px", xxlarge: "700px", fill: "100%", }; var BaseTextArea = (function (_super) { __extends(BaseTextArea, _super); function BaseTextArea(p, c) { var _this = _super.call(this, p, c) || this; _this.setInput = function (input) { if (_this.textArea == undefined) { _this.textArea = input; } }; return _this; } BaseTextArea.prototype.componentDidMount = function () { var _props = this.props; if (_props.dataFor && this.textArea) { this.textArea._rootDOMNode.setAttribute('data-tip', 'tooltip'); this.textArea._rootDOMNode.setAttribute('data-for', _props.dataFor); } }; BaseTextArea.prototype.render = function () { var _a = this.props, className = _a.className, value = _a.value, onChange = _a.onChange; return React.createElement(react_textarea_autosize_1.default, { value: value, ref: this.setInput, className: className, onChange: onChange }); }; return BaseTextArea; }(React.Component)); exports.BaseTextArea = BaseTextArea; var base = function (props) { return (_a = ["\n min-height:80px;\n width: ", ";\n padding:10px;\n"], _a.raw = ["\n min-height:80px;\n width: ", ";\n padding:10px;\n"], themedComponents_1.css(_a, function (props) { return sizeMap[props.width] || "500px"; })); var _a; }; var error = function (props) { return (_a = ["\n border : 1px solid ", ";\n"], _a.raw = ["\n border : 1px solid ", ";\n"], themedComponents_1.css(_a, props.theme.danger)); var _a; }; exports.TexAreatStyled = (_a = ["\n", "\n", "\n", "\n"], _a.raw = ["\n", "\n", "\n", "\n"], themedComponents_1.default(BaseTextArea)(_a, function (props) { return styles_1.defaultStyles; }, function (props) { return base(props); }, function (props) { return props.hasError ? error(props) : (_a = [""], _a.raw = [""], themedComponents_1.css(_a)); var _a; })); exports.default = exports.TexAreatStyled; var _a; //# sourceMappingURL=styles.js.map