UNPKG

gov-gui

Version:

Gov UI Component Library Typscript Build

119 lines (118 loc) 5.03 kB
import { html } from "lit-html"; import "../../global/animate.min.css"; /** * Toaster notifications display brief messages to the user. * The `gov-toaster` component supports multiple variants such as success, error, warning, and info, * and is automatically hidden after a set duration or can be manually dismissed. */ export default { title: 'Components/Toaster', tags: ['autodocs'], parameters: { actions: { handles: ['click'], // Track click actions for the close button }, }, argTypes: { message: { control: 'text', description: 'The message displayed in the toaster.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Attributes', }, }, variant: { control: 'select', options: ['success', 'danger', 'warning', 'info', 'white'], description: 'The type of toaster to display.', table: { type: { summary: 'string' }, defaultValue: { summary: 'info' }, category: 'Attributes', }, }, duration: { control: { type: 'number' }, description: 'Duration (in milliseconds) for which the toaster will be visible.', table: { type: { summary: 'number' }, defaultValue: { summary: 6000 }, category: 'Attributes', }, }, 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-toaster message="${args.message}" variant="${args.variant}" icon="${args.icon}" duration="${args.duration}" animation-delay="${args.animationDelay}" animation="${args.animation}" animation-speed="${args.animationSpeed}"> </gov-toaster> <script> document.querySelector('gov-toaster').show(); </script> `; export const Toaster = Template.bind({}); Toaster.args = { message: 'This is a notification message.', variant: 'info', duration: 6000, icon: 'infoCircle', animation: '', animationDelay: '', animationSpeed: '', }; //# sourceMappingURL=gov-toast.stories.js.map