1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | import { __decorate, __extends } from "tslib";
|
17 | import classNames from "classnames";
|
18 | import * as React from "react";
|
19 | import { polyfill } from "react-lifecycles-compat";
|
20 | import { AbstractPureComponent2, Classes } from "../../common";
|
21 | import { DISPLAYNAME_PREFIX } from "../../common/props";
|
22 | var FormGroup = (function (_super) {
|
23 | __extends(FormGroup, _super);
|
24 | function FormGroup() {
|
25 | return _super !== null && _super.apply(this, arguments) || this;
|
26 | }
|
27 | FormGroup.prototype.render = function () {
|
28 | var _a = this.props, children = _a.children, contentClassName = _a.contentClassName, helperText = _a.helperText, label = _a.label, labelFor = _a.labelFor, labelInfo = _a.labelInfo, style = _a.style;
|
29 | return (React.createElement("div", { className: this.getClassName(), style: style },
|
30 | label && (React.createElement("label", { className: Classes.LABEL, htmlFor: labelFor },
|
31 | label,
|
32 | " ",
|
33 | React.createElement("span", { className: Classes.TEXT_MUTED }, labelInfo))),
|
34 | React.createElement("div", { className: classNames(Classes.FORM_CONTENT, contentClassName) },
|
35 | children,
|
36 | helperText && React.createElement("div", { className: Classes.FORM_HELPER_TEXT }, helperText))));
|
37 | };
|
38 | FormGroup.prototype.getClassName = function () {
|
39 | var _a;
|
40 | var _b = this.props, className = _b.className, disabled = _b.disabled, inline = _b.inline, intent = _b.intent;
|
41 | return classNames(Classes.FORM_GROUP, Classes.intentClass(intent), (_a = {},
|
42 | _a[Classes.DISABLED] = disabled,
|
43 | _a[Classes.INLINE] = inline,
|
44 | _a), className);
|
45 | };
|
46 | FormGroup.displayName = DISPLAYNAME_PREFIX + ".FormGroup";
|
47 | FormGroup = __decorate([
|
48 | polyfill
|
49 | ], FormGroup);
|
50 | return FormGroup;
|
51 | }(AbstractPureComponent2));
|
52 | export { FormGroup };
|
53 |
|
\ | No newline at end of file |