import { Meta, StoryObj } from "@storybook/react"; import { getCssProps } from "@sb/cssprops"; import { fn } from "@storybook/test"; import { RenderPropsArgTypes } from "@sb/helpers"; import { Tabs } from "."; const meta: Meta = { title: "Content/Tabs", component: Tabs, parameters: { cssprops: getCssProps("Tab"), }, argTypes: { ...RenderPropsArgTypes, selectedKey: { control: "select", options: ["tab1", "tab2"], description: "The key of the selected tab in a controlled component.", }, defaultSelectedKey: { control: "select", options: ["tab1", "tab2"], description: "The key of the selected tab in an uncontrolled component.", }, children: { control: false, }, disabledKeys: { control: "select", options: ["None", "Tab 1", "Tab 2"], mapping: { None: [], "Tab 1": ["tab1"], "Tab 2": ["tab2"], "All Tabs": ["tab1", "tab2", "tab3"], }, description: "An array of keys to disable.", }, onSelectionChange: { table: { category: "Events", }, }, // @ts-expect-error - It's discovering these props from the internal // component for some reason, disabling them here so they don't show up tabsRef: { table: { disable: true, }, }, collection: { table: { disable: true, }, }, }, }; export default meta; type Story = StoryObj; export const Primary: Story = { args: { onSelectionChange: fn(), children: [ Tab One Tab Two Tab Three ,

Tab One Content

,

Tab Two Content

,

Tab Three Content

, ], }, }; export const Cards: Story = { args: { ...Primary.args, variant: "card", }, }; export const Toggle: Story = { args: { ...Primary.args, variant: "toggle", }, }; // TODO: figure out why tab nesting isn't working // export const NestedTabs: Story = { // args: { // variant: "card", // children: [ // // Users // Courses // Assignments // , // // // Licensed Users: 1000/1000 // // } // > // // Total // Active // // //

Total Users

//
// //

Active Users

//
//
//
, // // // Total Courses: 123/1231 // // } // > // // Total // Active // // //

Total Courses

//
// //

Active Courses

//
//
//
, // // // Total Assignments: 123414 // // } // > // // Total // Active // // //

Total Assignments

//
// //

Active Assignments

//
//
//
, // ], // }, // };