gov-gui
Version:
Gov UI Component Library Typscript Build
123 lines (122 loc) • 5.13 kB
JavaScript
import { fn } from "@storybook/test";
import { html } from "lit-html";
import "../../global/animate.min.css";
/**
* A tabs component that organizes content into separate views or sections,
* accessible by clicking on tab headers. Users can switch between tabs
* without leaving the current page. Tabs can be active, inactive, or deactivated.
*/
export default {
title: 'Components/Tabs', // Organizing under 'Components'
tags: ['autodocs'],
parameters: {
actions: {
handles: { onClick: fn() },
}
},
argTypes: {
tabList: {
control: 'array',
description: 'The list of tab names to be displayed.',
table: {
category: 'Attributes',
type: { summary: 'string[]' },
defaultValue: { summary: '[]' },
},
},
activeTab: {
control: 'text',
description: 'The initially active tab.',
table: {
category: 'Attributes',
type: { summary: 'string' },
defaultValue: { summary: 'Tab 1' },
},
},
disabledTabs: {
control: 'array',
description: 'The list of tabs that should be deactivated (grayed out and unclickable).',
table: {
category: 'Attributes',
type: { summary: 'string[]' },
defaultValue: { summary: '[]' },
},
},
animation: {
control: 'select',
options: ["",
"bounce", "flash", "pulse", "rubberBand", "shakeX", "shakeY", "headShake", "swing", "tada", "wobble", "jello", "heartBeat",
"backInDown", "backInLeft", "backInRight", "backInUp",
"backOutDown", "backOutLeft", "backOutRight", "backOutUp",
"bounceIn", "bounceInDown", "bounceInLeft", "bounceInRight", "bounceInUp",
"bounceOut", "bounceOutDown", "bounceOutLeft", "bounceOutRight", "bounceOutUp",
"fadeIn", "fadeInDown", "fadeInDownBig", "fadeInLeft", "fadeInLeftBig", "fadeInRight", "fadeInRightBig", "fadeInUp", "fadeInUpBig", "fadeInTopLeft", "fadeInTopRight", "fadeInBottomLeft", "fadeInBottomRight",
"fadeOut", "fadeOutDown", "fadeOutDownBig", "fadeOutLeft", "fadeOutLeftBig", "fadeOutRight", "fadeOutRightBig", "fadeOutUp", "fadeOutUpBig", "fadeOutTopLeft", "fadeOutTopRight", "fadeOutBottomRight", "fadeOutBottomLeft",
"flip", "flipInX", "flipInY", "flipOutX", "flipOutY",
"lightSpeedInRight", "lightSpeedInLeft", "lightSpeedOutRight", "lightSpeedOutLeft",
"rotateIn", "rotateInDownLeft", "rotateInDownRight", "rotateInUpLeft", "rotateInUpRight",
"rotateOut", "rotateOutDownLeft", "rotateOutDownRight", "rotateOutUpLeft", "rotateOutUpRight",
"hinge", "jackInTheBox", "rollIn", "rollOut",
"zoomIn", "zoomInDown", "zoomInLeft", "zoomInRight", "zoomInUp",
"zoomOut", "zoomOutDown", "zoomOutLeft", "zoomOutRight", "zoomOutUp",
"slideInDown", "slideInLeft", "slideInRight", "slideInUp",
"slideOutDown", "slideOutLeft", "slideOutRight", "slideOutUp"
],
description: 'Selects the animation effect to apply to the component.',
table: {
type: { summary: 'string' },
defaultValue: { summary: '' },
category: 'Animations',
},
},
animationDelay: {
control: 'select',
options: ["2s", "3s", "4s", "5s"],
description: 'Sets the delay before the animation begins (in seconds).',
table: {
type: { summary: 'string' },
defaultValue: { summary: '2s' },
category: 'Animations',
},
},
animationSpeed: {
control: 'select',
options: ["slow", "slower", "fast", "faster"],
description: 'Controls how quickly the animation plays.',
table: {
type: { summary: 'string' },
defaultValue: { summary: '' },
category: 'Animations',
},
},
},
};
const Template = (args) => html `
<gov-tabs
tab-list='${JSON.stringify(args.tabList)}'
active-tab="${args.activeTab}"
disabled-tabs='${JSON.stringify(args.disabledTabs)}'
animation-delay="${args.animationDelay}"
animation="${args.animation}"
animation-speed="${args.animationSpeed}">
<div slot="Tab 1">
<p>This is the content for Tab 1.</p>
</div>
<div slot="Tab 2">
<p>This is the content for Tab 2.</p>
</div>
<div slot="Tab 3">
<p>This is the content for Tab 3.</p>
</div>
</gov-tabs>
`;
export const Tabs = Template.bind({});
Tabs.args = {
tabList: ["Tab 1", "Tab 2", "Tab 3"],
activeTab: 'Tab 1',
disabledTabs: ["Tab 3"],
animation: '',
animationDelay: '',
animationSpeed: '',
};
//# sourceMappingURL=gov-tabs.stories.js.map