@arche-mc2/arche-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
49 lines • 2.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var styles_1 = require("./styles");
var UpInput_1 = require("../../Inputs/Input/UpInput");
var UpLabel = (function (_super) {
tslib_1.__extends(UpLabel, _super);
function UpLabel(props) {
var _this = _super.call(this, props) || this;
_this.onFocus = function (e) {
e.preventDefault();
return false;
};
_this.onClick = function (e) {
if (e.target) {
if ((e.target.tagName || '').toUpperCase() === 'INPUT' && (e.target.type || '').toUpperCase() === 'TIME') {
return;
}
}
e.preventDefault();
return false;
};
return _this;
}
UpLabel.prototype.render = function () {
var _a = this.props, children = _a.children, text = _a.text, required = _a.required, textAlign = _a.textAlign, inline = _a.inline, color = _a.color, className = _a.className, others = tslib_1.__rest(_a, ["children", "text", "required", "textAlign", "inline", "color", "className"]);
return (React.createElement("label", tslib_1.__assign({ className: styles_1.getStyles(this.props), onFocus: this.onFocus, onClick: this.onClick }, others),
React.createElement("span", { className: "up-label-text" },
text,
required &&
React.createElement(UpInput_1.RequiredMark, { markStyle: {
position: "absolute",
top: "4px",
marginLeft: "4px"
} })),
children));
};
UpLabel.defaultProps = {
text: '',
disabled: false,
required: false,
textAlign: 'left',
color: '#9590B9',
};
return UpLabel;
}(React.Component));
exports.default = UpLabel;
//# sourceMappingURL=UpLabel.js.map