react-elegant-ui
Version:
Elegant UI components, made by BEM best practices for react
52 lines (51 loc) • 1.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TabsMenuTab = void 0;
var _react = _interopRequireDefault(require("react"));
var _TabsMenu = require("../TabsMenu");
require("./TabsMenu-Tab.css");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var __assign = void 0 && (void 0).__assign || function () {
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = void 0 && (void 0).__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
var TabsMenuTab = function (_a) {
var active = _a.active,
disabled = _a.disabled,
first = _a.first,
innerRef = _a.innerRef,
className = _a.className,
children = _a.children,
props = __rest(_a, ["active", "disabled", "first", "innerRef", "className", "children"]);
return /*#__PURE__*/_react.default.createElement("li", __assign({}, props, {
"aria-selected": active,
"aria-disabled": disabled,
ref: innerRef,
className: (0, _TabsMenu.cnTabsMenu)('Tab', {
active: active,
disabled: disabled,
first: first
}, [className]),
role: "tab",
// For active tab set tabIndex 0 to allow focus on it by keyboard
// for other tabs set -1 for exclude it from navigation
tabIndex: disabled ? undefined : active ? 0 : -1
}), children);
};
exports.TabsMenuTab = TabsMenuTab;