UNPKG

gov-gui

Version:

Gov UI Component Library Typscript Build

145 lines (144 loc) 5.96 kB
import { html } from "lit-html"; import "../../global/animate.min.css"; /** * GovAlert is a flexible notification component that displays messages with different severity levels such as success, info, warning, and danger. * It includes an icon, customizable label, header, and a close button. */ export default { title: 'Components/Alerts', tags: ['autodocs'], parameters: { actions: { handles: ['handleClose'], // Track click actions for the close button }, }, argTypes: { header: { control: 'text', description: 'The title or header of the alert message.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Attributes', }, }, label: { control: 'text', description: 'The main text or body of the alert message.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Attributes', }, }, variant: { control: 'select', options: ['success', 'info', 'warning', 'danger'], description: 'The severity level of the alert, determining its color and icon.', table: { type: { summary: 'string' }, defaultValue: { summary: 'success' }, 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', }, }, handleClose: { action: 'click', description: 'Triggered when the close button is clicked.', table: { category: 'Events', }, }, isVisible: { control: 'boolean', description: 'Determines whether the alert is visible or not.', table: { type: { summary: 'boolean' }, defaultValue: { summary: true }, // default to visible category: 'Attributes', }, }, showIcons: { control: 'boolean', description: 'Determines whether the alert buttons are visible or not.', table: { type: { summary: 'boolean' }, defaultValue: { summary: true }, // default to visible category: 'Attributes', }, }, }, }; const Template = (args) => html ` ${args.isVisible ? html ` <gov-alert header="${args.header}" label="${args.label}" variant="${args.variant}" animation-delay="${args.animationDelay}" animation="${args.animation}" animation-speed="${args.animationSpeed}" show-icons ="${args.showIcons}" @click="${args.handleClose}" ></gov-alert>` : html ``} `; export const AlertCard = Template.bind({}); AlertCard.args = { header: 'Congratulations!', label: 'The requested feature happened.', variant: 'success', isVisible: true, showIcons: true, animation: '', animationDelay: '', animationSpeed: '', }; //# sourceMappingURL=gov-alert.stories.js.map