diff --git a/packages/react-core/package.json b/packages/react-core/package.json index d116f697a0b..23329c9b0a0 100644 --- a/packages/react-core/package.json +++ b/packages/react-core/package.json @@ -54,7 +54,7 @@ "tslib": "^2.5.0" }, "devDependencies": { - "@patternfly/patternfly": "6.0.0-alpha.66", + "@patternfly/patternfly": "6.0.0-alpha.69", "@rollup/plugin-commonjs": "^25.0.0", "@rollup/plugin-node-resolve": "^15.0.2", "@rollup/plugin-replace": "^5.0.2", diff --git a/packages/react-core/src/components/Tabs/TabContent.tsx b/packages/react-core/src/components/Tabs/TabContent.tsx index ababc391f22..7645af08255 100644 --- a/packages/react-core/src/components/Tabs/TabContent.tsx +++ b/packages/react-core/src/components/Tabs/TabContent.tsx @@ -27,10 +27,10 @@ export interface TabContentProps extends Omit, 'ref ouiaSafe?: boolean; } -// TODO: Update with issue #9909 -// const variantStyle = { -// default: '' -// }; +const variantStyle = { + default: '', + secondary: styles.modifiers.secondary +}; const TabContentBase: React.FunctionComponent = ({ id, @@ -56,27 +56,30 @@ const TabContentBase: React.FunctionComponent = ({ return ( - {({ variant }: TabsContextProps) => ( - - )} + {({ variant }: TabsContextProps) => { + const variantClass = variantStyle[variant]; + + return ( + + ); + }} ); } diff --git a/packages/react-core/src/components/Tabs/TabTitleIcon.tsx b/packages/react-core/src/components/Tabs/TabTitleIcon.tsx index a7fe89656f3..d9f5503b5ad 100644 --- a/packages/react-core/src/components/Tabs/TabTitleIcon.tsx +++ b/packages/react-core/src/components/Tabs/TabTitleIcon.tsx @@ -14,7 +14,7 @@ export const TabTitleIcon: React.FunctionComponent = ({ className = '', ...props }: TabTitleIconProps) => ( - + {children} ); diff --git a/packages/react-core/src/components/Tabs/Tabs.tsx b/packages/react-core/src/components/Tabs/Tabs.tsx index 5858f8ee285..2ffc1018cc4 100644 --- a/packages/react-core/src/components/Tabs/Tabs.tsx +++ b/packages/react-core/src/components/Tabs/Tabs.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import styles from '@patternfly/react-styles/css/components/Tabs/tabs'; -import buttonStyles from '@patternfly/react-styles/css/components/Button/button'; import { css } from '@patternfly/react-styles'; import { PickOptional } from '../../helpers/typeUtils'; import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon'; @@ -38,7 +37,7 @@ export interface TabsProps extends Omit { activeKey: 0, onSelect: () => undefined as any, isFilled: false, - isSecondary: false, + isSubtab: false, isVertical: false, isBox: false, hasNoBorderBottom: false, @@ -247,7 +246,6 @@ class Tabs extends React.Component { if (container && !this.props.isVertical && !isOverflowHorizontal) { // get first element and check if it is in view const overflowOnLeft = !isElementInView(container, container.firstChild as HTMLElement, false); - // get last element and check if it is in view const overflowOnRight = !isElementInView(container, container.lastChild as HTMLElement, false); @@ -392,7 +390,7 @@ class Tabs extends React.Component { defaultActiveKey, id, isFilled, - isSecondary, + isSubtab, isVertical, isBox, hasNoBorderBottom, @@ -473,7 +471,7 @@ class Tabs extends React.Component { className={css( styles.tabs, isFilled && styles.modifiers.fill, - isSecondary && styles.modifiers.secondary, + isSubtab && styles.modifiers.subtab, isVertical && styles.modifiers.vertical, isVertical && expandable && formatBreakpointMods(expandable, styles), isVertical && expandable && isExpandedLocal && styles.modifiers.expanded, @@ -518,33 +516,35 @@ class Tabs extends React.Component { )} {renderScrollButtons && ( - +
+ +
)}
    {isOverflowHorizontal ? filteredChildrenWithoutOverflow : filteredChildren} {hasOverflowTab && }
{renderScrollButtons && ( - +
+ +
)} {onAdd !== undefined && ( diff --git a/packages/react-core/src/components/Tabs/TabsContext.ts b/packages/react-core/src/components/Tabs/TabsContext.ts index 5e0726da692..018af907620 100644 --- a/packages/react-core/src/components/Tabs/TabsContext.ts +++ b/packages/react-core/src/components/Tabs/TabsContext.ts @@ -1,7 +1,7 @@ import * as React from 'react'; export interface TabsContextProps { - variant: 'default' | 'light300'; + variant: 'default' | 'secondary'; mountOnEnter: boolean; unmountOnExit: boolean; localActiveKey: string | number; diff --git a/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/TabContent.test.tsx.snap b/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/TabContent.test.tsx.snap index 268ee9e5316..9c5f6b1a919 100644 --- a/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/TabContent.test.tsx.snap +++ b/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/TabContent.test.tsx.snap @@ -4,7 +4,7 @@ exports[`TabContent should match snapshot (auto-generated) 1`] = `
{ expect(asFragment()).toMatchSnapshot(); }); -test('should render secondary tabs', () => { +test('should render subtabs', () => { const { asFragment } = render( "Tab item 1"}> - - "Secondary Tab item 1"}> - Secondary Tab 1 section + + "Subtab item 1"}> + Subtab 1 section - "Secondary Tab item 2"}> - Secondary Tab 2 section + "Subtab item 2"}> + Subtab 2 section - "Secondary Tab item 3"}> - Secondary Tab 3 section + "Subtab item 3"}> + Subtab 3 section @@ -338,9 +338,9 @@ test('should render tabs with separate content', () => { expect(asFragment()).toMatchSnapshot(); }); -test('should render box tabs of light variant', () => { +test('should render box tabs of secondary variant', () => { const { asFragment } = render( - + "Tab item 1"}> Tab 1 section @@ -372,9 +372,9 @@ test('should render tabs with no bottom border', () => { expect(asFragment()).toMatchSnapshot(); }); -test('should render secondary tabs with no bottom border when passed hasNoBorderBottom', () => { +test('should render subtabs with no bottom border when passed hasNoBorderBottom', () => { render( - + "Tab item 1"}> Tab 1 section @@ -387,14 +387,14 @@ test('should render secondary tabs with no bottom border when passed hasNoBorder ); - const tabsContainer = screen.queryByLabelText('Secondary bottom border'); + const tabsContainer = screen.queryByLabelText('Subtab bottom border'); expect(tabsContainer).toHaveClass('pf-m-no-border-bottom'); }); -test('should render secondary tabs with border bottom', () => { +test('should render subtabs with border bottom', () => { render( - + "Tab item 1"}> Tab 1 section @@ -407,7 +407,7 @@ test('should render secondary tabs with border bottom', () => { ); - const tabsContainer = screen.queryByLabelText('Secondary bottom border'); + const tabsContainer = screen.queryByLabelText('Subtab bottom border'); expect(tabsContainer).not.toHaveClass('pf-m-no-border-bottom'); }); diff --git a/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap b/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap index 0a904e2f6df..40c9366efeb 100644 --- a/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +++ b/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap @@ -81,7 +81,7 @@ exports[`should render accessible tabs 1`] = `