1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | import { __assign, __decorate, __extends, __rest } 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, removeNonHTMLProps } from "../../common/props";
|
22 | var TabTitle = (function (_super) {
|
23 | __extends(TabTitle, _super);
|
24 | function TabTitle() {
|
25 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
26 | _this.handleClick = function (e) { return _this.props.onClick(_this.props.id, e); };
|
27 | return _this;
|
28 | }
|
29 | TabTitle.prototype.render = function () {
|
30 | var _a = this.props, className = _a.className, children = _a.children, disabled = _a.disabled, id = _a.id, parentId = _a.parentId, selected = _a.selected, title = _a.title, htmlProps = __rest(_a, ["className", "children", "disabled", "id", "parentId", "selected", "title"]);
|
31 | return (React.createElement("div", __assign({}, removeNonHTMLProps(htmlProps), { "aria-controls": generateTabPanelId(parentId, id), "aria-disabled": disabled, "aria-expanded": selected, "aria-selected": selected, className: classNames(Classes.TAB, className), "data-tab-id": id, id: generateTabTitleId(parentId, id), onClick: disabled ? undefined : this.handleClick, role: "tab", tabIndex: disabled ? undefined : 0 }),
|
32 | title,
|
33 | children));
|
34 | };
|
35 | TabTitle.displayName = DISPLAYNAME_PREFIX + ".TabTitle";
|
36 | TabTitle = __decorate([
|
37 | polyfill
|
38 | ], TabTitle);
|
39 | return TabTitle;
|
40 | }(AbstractPureComponent2));
|
41 | export { TabTitle };
|
42 | export function generateTabPanelId(parentId, tabId) {
|
43 | return Classes.TAB_PANEL + "_" + parentId + "_" + tabId;
|
44 | }
|
45 | export function generateTabTitleId(parentId, tabId) {
|
46 | return Classes.TAB + "-title_" + parentId + "_" + tabId;
|
47 | }
|
48 |
|
\ | No newline at end of file |