import React from "react"; import { Tabs as BlueprintTabs, TabsProps as BlueprintTabsProps } from "@blueprintjs/core"; import { CLASSPREFIX as eccgui } from "../../configuration/constants"; import { TestableComponent } from "../interfaces"; import Tab, { TabProps, transformTabProperties } from "./Tab"; export interface TabsProps extends TestableComponent, Omit { children?: React.ReactNode; /** * Data structure containing all tabs, including their titles and content panels. * Currently it is not possible to add `Tab` elements direct as children elements to the `` container. */ tabs?: TabProps[]; /** * Allow scrollbars on the tabs header. * Otherwise they will be shrinked if not enough space. */ allowScrollbars?: boolean; /** * If set then a `div` element is used as wrapper. * It uses the attributes given via this property. */ wrapperProps?: React.HTMLAttributes; } export const Tabs = ({ tabs = [], children, className = "", allowScrollbars, "data-test-id": dataTestId, "data-testid": dataTestid, wrapperProps, ...restProps }: TabsProps) => { const tabsContent = ( {tabs ? tabs.map((tab) => { return ; }) : children} ); return wrapperProps || dataTestId || dataTestid ? (
{tabsContent}
) : ( <>{tabsContent} ); }; export default Tabs;