1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.Callout = void 0;
|
19 | var tslib_1 = require("tslib");
|
20 | var classnames_1 = tslib_1.__importDefault(require("classnames"));
|
21 | var React = tslib_1.__importStar(require("react"));
|
22 | var common_1 = require("../../common");
|
23 | var html_1 = require("../html/html");
|
24 | var icon_1 = require("../icon/icon");
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | var Callout = (function (_super) {
|
31 | tslib_1.__extends(Callout, _super);
|
32 | function Callout() {
|
33 | return _super !== null && _super.apply(this, arguments) || this;
|
34 | }
|
35 | Callout.prototype.render = function () {
|
36 | var _a;
|
37 | var _b = this.props, className = _b.className, children = _b.children, icon = _b.icon, intent = _b.intent, title = _b.title, htmlProps = tslib_1.__rest(_b, ["className", "children", "icon", "intent", "title"]);
|
38 | var iconName = this.getIconName(icon, intent);
|
39 | var classes = (0, classnames_1.default)(common_1.Classes.CALLOUT, common_1.Classes.intentClass(intent), (_a = {}, _a[common_1.Classes.CALLOUT_ICON] = iconName != null, _a), className);
|
40 | return (React.createElement("div", tslib_1.__assign({ className: classes }, htmlProps),
|
41 | iconName && React.createElement(icon_1.Icon, { icon: iconName, size: icon_1.IconSize.LARGE, "aria-hidden": true, tabIndex: -1 }),
|
42 | title && React.createElement(html_1.H4, null, title),
|
43 | children));
|
44 | };
|
45 | Callout.prototype.getIconName = function (icon, intent) {
|
46 |
|
47 | if (icon === null) {
|
48 | return undefined;
|
49 | }
|
50 |
|
51 | if (icon !== undefined) {
|
52 | return icon;
|
53 | }
|
54 |
|
55 | switch (intent) {
|
56 | case common_1.Intent.DANGER:
|
57 | return "error";
|
58 | case common_1.Intent.PRIMARY:
|
59 | return "info-sign";
|
60 | case common_1.Intent.WARNING:
|
61 | return "warning-sign";
|
62 | case common_1.Intent.SUCCESS:
|
63 | return "tick";
|
64 | default:
|
65 | return undefined;
|
66 | }
|
67 | };
|
68 | Callout.displayName = "".concat(common_1.DISPLAYNAME_PREFIX, ".Callout");
|
69 | return Callout;
|
70 | }(common_1.AbstractPureComponent2));
|
71 | exports.Callout = Callout;
|
72 |
|
\ | No newline at end of file |