import { html, ref, when } from '@microsoft/fast-element';
import { type Meta, renderComponent, type StoryArgs, type StoryObj } from '../helpers.stories.js';
import { getStorybookHelpers } from '../../.storybook/wc-toolkit-helpers.js';
import type { Tablist as FluentTablist } from './tablist.js';
import { TablistAppearance as TablistAppearanceValues, TablistOrientation, TablistSize } from './tablist.options.js';
type Story = StoryObj;
const { argTypes } = getStorybookHelpers('fluent-tablist');
const storyTemplate = html>`
story.disabled}"
size="${story => story.size}"
activeid="${story => story.activeid}"
@change="${(x, c) => {
x.panel.textContent = `Panel changed to ${(c.event.target as FluentTablist).activetab?.textContent}`;
}}"
${ref('tablist')}
>
First Tab
${when(
story => story.hasStartSlot,
html` `,
)}
Second Tab
Third TabFourth Tab
`;
export default {
title: 'Components/Tablist',
render: renderComponent(storyTemplate),
argTypes: {
...argTypes,
ids: { table: { disable: true } },
hasStartSlot: { table: { disable: true } },
},
} as Meta;
export const Default: Story = {};
export const HorizontalWithStartSlot: Story = {
args: {
hasStartSlot: true,
},
};
export const VerticalOrientation: Story = {
args: {
orientation: TablistOrientation.vertical,
},
decorators: [
Story => {
const story = Story() as HTMLDivElement;
story.style.flexDirection = 'row';
return story;
},
],
};
export const VerticalOrientationWithStartSlot: Story = {
args: {
orientation: TablistOrientation.vertical,
hasStartSlot: true,
},
decorators: [
Story => {
const story = Story() as HTMLDivElement;
story.style.flexDirection = 'row';
return story;
},
],
};
export const Disabled: Story = {
args: {
disabled: true,
},
};
export const ActiveId: Story = {
args: {
activeid: 'third-tab',
ids: ['first-tab', 'second-tab', 'third-tab', 'fourth-tab'],
},
};
export const SubtleAppearance: Story = {
args: {
appearance: 'subtle',
},
};
export const SmallSize: Story = {
args: {
size: 'small',
},
};
export const LargeSize: Story = {
args: {
size: 'large',
},
};
export const SmallSizeVerticalOrientation: Story = {
args: {
orientation: TablistOrientation.vertical,
size: 'small',
},
decorators: [
Story => {
const story = Story() as HTMLDivElement;
story.style.flexDirection = 'row';
return story;
},
],
};
export const LargeSizeVerticalOrientation: Story = {
args: {
orientation: TablistOrientation.vertical,
size: 'large',
},
decorators: [
Story => {
const story = Story() as HTMLDivElement;
story.style.flexDirection = 'row';
return story;
},
],
};
export const AutoPanelAssociation: Story = {
render: renderComponent(html>`