Debian Codegraph @

node/@patternfly/react-core/dist/js/components/Tabs/TabContent.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.TabContent = void 0;
4 const tslib_1 = require("tslib");
5 const jsx_runtime_1 = require("react/jsx-runtime");
6 const react_1 = require("react");
7 const tab_content_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/TabContent/tab-content"));
8 const react_styles_1 = require("@patternfly/react-styles");
9 const helpers_1 = require("../../helpers");
10 const TabsContext_1 = require("./TabsContext");
11 const variantStyle = {
12 default: '',
13 secondary: tab_content_1.default.modifiers.secondary
14 };
15 const TabContentBase = (_a) => {
16 var { id, activeKey, 'aria-label': ariaLabel, child, children, className,
17 // eslint-disable-next-line @typescript-eslint/no-unused-vars
18 eventKey, innerRef, ouiaId, ouiaSafe } = _a, props = tslib_1.__rest(_a, ["id", "activeKey", 'aria-label', "child", "children", "className", "eventKey", "innerRef", "ouiaId", "ouiaSafe"]);
19 if (children || child) {
20 let labelledBy;
21 if (ariaLabel) {
22 labelledBy = null;
23 }
24 else {
25 labelledBy = children ? `${id}` : `pf-tab-${child.props.eventKey}-${id}`;
26 }
27 return ((0, jsx_runtime_1.jsx)(TabsContext_1.TabsContextConsumer, { children: ({ variant }) => {
28 const variantClass = variantStyle[variant];
29 return ((0, jsx_runtime_1.jsx)("section", Object.assign({ ref: innerRef, hidden: children ? null : child.props.eventKey !== activeKey, className: children
30 ? (0, react_styles_1.css)(tab_content_1.default.tabContent, className, variantClass)
31 : (0, react_styles_1.css)(tab_content_1.default.tabContent, child.props.className, variantClass), id: children ? id : `pf-tab-section-${child.props.eventKey}-${id}`, "aria-label": ariaLabel, "aria-labelledby": labelledBy, role: "tabpanel", tabIndex: 0 }, (0, helpers_1.getOUIAProps)('TabContent', ouiaId, ouiaSafe), props, { children: children || child.props.children })));
32 } }));
33 }
34 return null;
35 };
36 exports.TabContent = (0, react_1.forwardRef)((props, ref) => ((0, jsx_runtime_1.jsx)(TabContentBase, Object.assign({}, props, { innerRef: ref }))));
37 //# sourceMappingURL=TabContent.js.map