@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
60 lines • 2.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var SvgIcon_1 = require("../../../Display/SvgIcon");
var Tooltip_1 = require("../../../Display/Tooltip");
var typestyle_1 = require("typestyle");
var theming_1 = require("../../../../Common/theming");
var getErrorDisplayStyle = function (props) { return typestyle_1.style({
position: "relative",
cursor: (props.displayMode === "tooltip" && props.hasError) ? "help" : "default",
height: "100%",
width: "100%",
display: 'flex',
flexDirection: 'column',
$nest: {
"& .up-wrapper-error-tooltip": {
display: "inline-block",
position: "absolute",
top: "8px",
left: "-20px"
},
"& .up-wrapper-error-inline": {
display: "inline-block",
color: props.theme.colorMap.error,
fontSize: '8pt',
}
}
}); };
var ErrorDisplay = (function (_super) {
tslib_1.__extends(ErrorDisplay, _super);
function ErrorDisplay(p, c) {
return _super.call(this, p, c) || this;
}
ErrorDisplay.prototype.render = function () {
var Error = ErrorTooltip;
if (this.props.displayMode === 'inline') {
Error = ErrorInline;
}
return (React.createElement("div", { className: getErrorDisplayStyle(this.props) },
this.props.children,
this.props.showError === true && this.props.hasError === true ?
(React.createElement(Error, tslib_1.__assign({}, this.props))) : null));
};
ErrorDisplay.defaultProps = {
displayMode: 'tooltip',
theme: theming_1.default,
};
return ErrorDisplay;
}(React.Component));
exports.default = ErrorDisplay;
var ErrorTooltip = function (props) {
return (React.createElement("div", { className: "up-wrapper-error-tooltip" },
React.createElement(Tooltip_1.default, { content: props.error },
React.createElement(SvgIcon_1.default, { width: 15, height: 15, iconName: "alert-octagon", color: "red" }))));
};
var ErrorInline = function (props) {
return (React.createElement("div", { className: "up-wrapper-error-inline" }, props.error));
};
//# sourceMappingURL=ErrorDisplay.js.map