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

38 lines 2.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var themedComponents_1 = require("../../../../../Common/theming/themedComponents"); var index_1 = require("../../../../Display/SvgIcon/index"); var styles_1 = require("./styles"); var theming_1 = require("../../../../../Common/theming"); var BaseInput = function (props) { var className = props.className, type = props.type, iconName = props.iconName, placeholder = props.placeholder, disabled = props.disabled, readonly = props.readonly, onChange = props.onChange; var icon = null; if (iconName) { icon = React.createElement("div", { className: "up-icon" }, React.createElement(index_1.default, { iconName: iconName, width: 20, height: 20, color: props.color })); } return (React.createElement("div", { className: className }, React.createElement("div", { className: "up-input-group" }, React.createElement("input", { onChange: onChange, className: "up-input", type: "text", placeholder: placeholder, dir: "auto", disabled: disabled, readOnly: readonly }), icon))); }; var sizeMap = { xsmall: "40px", small: "100px", medium: "150px", large: "250px", xlarge: "350px", xxlarge: "500px", fill: "100%", }; var error = (_a = ["\n.up-input {\n border-color:", ";\n border-width: 1px;\n border-style: solid;\n}\n"], _a.raw = ["\n.up-input {\n border-color:", ";\n border-width: 1px;\n border-style: solid;\n}\n"], themedComponents_1.css(_a, function (props) { return (props.theme) ? props.theme.colorMap.danger : theming_1.default.colorMap.danger; })); exports.InputStyled = (_b = ["\n ", "\n ", "\n color: ", ";\n .up-input {\n width: ", ";\n ", "\n }\n"], _b.raw = ["\n ", "\n ", "\n color: ", ";\n .up-input {\n width: ", ";\n ", "\n }\n"], themedComponents_1.default(BaseInput)(_b, styles_1.inputStyles, function (props) { return props.hasError ? error : (_a = [""], _a.raw = [""], themedComponents_1.css(_a)); var _a; }, function (props) { return props.color; }, function (props) { return sizeMap[props.width]; }, function (props) { return (props.height == "large" ? styles_1.HeightLarge : (_a = [""], _a.raw = [""], themedComponents_1.css(_a))); var _a; })); var _a, _b; //# sourceMappingURL=BaseInput.js.map