From 59cf99b8f45e996dff39cf380871c14a71c0c0d4 Mon Sep 17 00:00:00 2001 From: Jean-Michel FRANCOIS Date: Mon, 23 Oct 2023 20:01:03 +0200 Subject: [PATCH] feat: restore design system Tabs api (#4949) --- .../components/Tabs/Primitive/TabPanel.tsx | 2 +- .../Tabs/Primitive/TabsProvider.tsx | 3 +- .../src/components/Tabs/Tabs.test.tsx | 56 +++++-- .../Tabs/__snapshots__/Tabs.test.tsx.snap | 4 +- .../src/components/Tabs/index.ts | 4 +- .../src/components/Tabs/variants/Tabs.tsx | 92 +++++++++++ .../src/stories/navigation/Tabs.stories.tsx | 146 +++++++++++------- 7 files changed, 230 insertions(+), 77 deletions(-) create mode 100644 packages/design-system/src/components/Tabs/variants/Tabs.tsx diff --git a/packages/design-system/src/components/Tabs/Primitive/TabPanel.tsx b/packages/design-system/src/components/Tabs/Primitive/TabPanel.tsx index b9e8ff73d2..fda169b4ca 100644 --- a/packages/design-system/src/components/Tabs/Primitive/TabPanel.tsx +++ b/packages/design-system/src/components/Tabs/Primitive/TabPanel.tsx @@ -1,7 +1,7 @@ import { useContext } from 'react'; import { TabsInternalContext } from './TabsProvider'; -type TabPanelPropTypes = { +export type TabPanelPropTypes = { id: string; children: React.ReactNode | React.ReactNode[]; renderIf?: boolean; diff --git a/packages/design-system/src/components/Tabs/Primitive/TabsProvider.tsx b/packages/design-system/src/components/Tabs/Primitive/TabsProvider.tsx index ff899fc2a4..868f635515 100644 --- a/packages/design-system/src/components/Tabs/Primitive/TabsProvider.tsx +++ b/packages/design-system/src/components/Tabs/Primitive/TabsProvider.tsx @@ -8,6 +8,7 @@ export type TabsProviderPropTypes = { activeKey?: string; onSelect?: (event: any, key: string) => void; size?: string; + id?: string; }; type WithChildren = { @@ -29,7 +30,7 @@ export function TabsProvider(props: TabsProviderPropTypes & WithChildren) { }, }); return ( -