Debian Codegraph @

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

raw
1 import { __rest } from "tslib";
2 import { jsx as _jsx } from "react/jsx-runtime";
3 import { forwardRef } from 'react';
4 import styles from '@patternfly/react-styles/css/components/TabContent/tab-content.mjs';
5 import { css } from '@patternfly/react-styles';
6 import { getOUIAProps } from '../../helpers';
7 import { TabsContextConsumer } from './TabsContext';
8 const variantStyle = {
9 default: '',
10 secondary: styles.modifiers.secondary
11 };
12 const TabContentBase = (_a) => {
13 var { id, activeKey, 'aria-label': ariaLabel, child, children, className,
14 // eslint-disable-next-line @typescript-eslint/no-unused-vars
15 eventKey, innerRef, ouiaId, ouiaSafe } = _a, props = __rest(_a, ["id", "activeKey", 'aria-label', "child", "children", "className", "eventKey", "innerRef", "ouiaId", "ouiaSafe"]);
16 if (children || child) {
17 let labelledBy;
18 if (ariaLabel) {
19 labelledBy = null;
20 }
21 else {
22 labelledBy = children ? `${id}` : `pf-tab-${child.props.eventKey}-${id}`;
23 }
24 return (_jsx(TabsContextConsumer, { children: ({ variant }) => {
25 const variantClass = variantStyle[variant];
26 return (_jsx("section", Object.assign({ ref: innerRef, hidden: children ? null : child.props.eventKey !== activeKey, className: children
27 ? css(styles.tabContent, className, variantClass)
28 : css(styles.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 }, getOUIAProps('TabContent', ouiaId, ouiaSafe), props, { children: children || child.props.children })));
29 } }));
30 }
31 return null;
32 };
33 export const TabContent = forwardRef((props, ref) => (_jsx(TabContentBase, Object.assign({}, props, { innerRef: ref }))));
34 //# sourceMappingURL=TabContent.js.map