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