From 03bd2d3ad6c3da5532e31acb7cce80c2449365c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20I=C3=9Fbr=C3=BCcker?= Date: Fri, 15 Aug 2025 09:17:27 +0200 Subject: [PATCH] refactor!: remove TabSheet tab helper in v25 --- dev/kitchen-sink/Row10.tsx | 24 +++++++++---------- dev/kitchen-sink/index.html | 3 +++ packages/react-components/src/TabSheet.tsx | 27 ---------------------- test/TabSheet.spec.tsx | 10 +------- 4 files changed, 15 insertions(+), 49 deletions(-) diff --git a/dev/kitchen-sink/Row10.tsx b/dev/kitchen-sink/Row10.tsx index e34d4c31..39efb06f 100644 --- a/dev/kitchen-sink/Row10.tsx +++ b/dev/kitchen-sink/Row10.tsx @@ -1,7 +1,5 @@ import { BoardRow } from '../../packages/react-components-pro/src/BoardRow.js'; -import { Tab } from '../../packages/react-components/src/Tab.js'; -import { Tabs } from '../../packages/react-components/src/Tabs.js'; -import { tab, TabSheet } from '../../packages/react-components/src/TabSheet.js'; +import { TabSheet, TabSheetTab } from '../../packages/react-components/src/TabSheet.js'; export default function Row10() { return ( @@ -10,17 +8,17 @@ export default function Row10() {
Prefix
Suffix
- - Tab 1 - Tab 2 - Tab 3 - + +
Panel 1
+
-
Panel 1
- {/* @ts-expect-error TS2322: "tab" is not an HTML standard attribute */} -
Panel 2
- {/* @ts-expect-error TS2322: "tab" is not an HTML standard attribute */} -
Panel 3
+ +
Panel 2
+
+ + +
Panel 3
+
); diff --git a/dev/kitchen-sink/index.html b/dev/kitchen-sink/index.html index 0f930c2c..463696e8 100644 --- a/dev/kitchen-sink/index.html +++ b/dev/kitchen-sink/index.html @@ -5,6 +5,9 @@ Kitchen Sink App + diff --git a/packages/react-components/src/TabSheet.tsx b/packages/react-components/src/TabSheet.tsx index 1bfb73d4..21e351bf 100644 --- a/packages/react-components/src/TabSheet.tsx +++ b/packages/react-components/src/TabSheet.tsx @@ -99,30 +99,3 @@ function TabSheet(props: TabSheetProps, ref: ForwardedRef) { const ForwardedTabSheet = forwardRef(TabSheet); export { ForwardedTabSheet as TabSheet }; - -/** - * A helper function that allows declaring the tab identifier on the children - * of the `` component - * - * ### Usage - * - * ```tsx - * - * - * About - * Contact us - * - *
This tab is all about,..
- *
Our website: ...
- *
- * ``` - * - * @param tab The identifier of the correspoding tab. - * - * @returns object with HTML attribute values recognized on tab sheet children. - * @deprecated Use `` instead. - */ -export function tab(tab: string): Record { - console.warn('Using the `tab` helper function is deprecated. Use instead.'); - return { tab } as Record; -} diff --git a/test/TabSheet.spec.tsx b/test/TabSheet.spec.tsx index 22140b69..572c0e7c 100644 --- a/test/TabSheet.spec.tsx +++ b/test/TabSheet.spec.tsx @@ -1,8 +1,7 @@ import { describe, expect, it } from 'vitest'; import { render } from 'vitest-browser-react'; -import { TabSheet, TabSheetTab, tab } from '../packages/react-components/src/TabSheet.js'; +import { TabSheet, TabSheetTab } from '../packages/react-components/src/TabSheet.js'; import type { TabElement } from '../packages/react-components/src/Tab.js'; -import sinon from 'sinon'; import { useState } from 'react'; function getTabSheet() { @@ -143,13 +142,6 @@ describe('TabSheet', () => { expect(suffix).to.have.text('SUFFIX'); }); - it('should warn when using the tab helper', async () => { - const stub = sinon.stub(console, 'warn'); - tab('Tab 1'); - expect(stub.calledOnce).to.be.true; - stub.restore(); - }); - it('should expand content element to full size', async () => { render(