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