UNPKG

gov-gui

Version:

Gov UI Component Library Typscript Build

128 lines (127 loc) 5.45 kB
import { html } from "lit-html"; import "../../global/animate.min.css"; /** * The Dropdown component allows users to select an option from a list. * It can display a heading, subtitle, and a list of options, and has * interactivity to toggle between opening and closing the dropdown. */ export default { title: 'Components/Dropdown', tags: ['autodocs'], argTypes: { heading: { control: 'text', description: 'The main heading of the dropdown.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Attributes', } }, subtitle: { control: 'text', description: 'The subtitle displayed under the heading.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Attributes', } }, options: { control: 'array', description: 'The options available in the dropdown. It accepts an array of strings or a JSON string.', table: { type: { summary: 'string | string[]' }, defaultValue: { summary: '[]' }, 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', }, }, selectedOption: { control: 'text', description: 'The currently selected option in the dropdown.', table: { type: { summary: 'string' }, defaultValue: { summary: 'Filter by type' }, category: 'State', } }, isOpen: { control: 'boolean', description: 'Indicates whether the dropdown is open.', table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, category: 'State', } }, } }; // Template for the Stencil dropdown component const Template = (args) => html ` <gov-drop heading="${args.heading}" subtitle="${args.subtitle}" animation-delay="${args.animationDelay}" animation="${args.animation}" animation-speed="${args.animationSpeed}" options='${JSON.stringify(args.options)}'> </gov-drop> `; // Default story for the dropdown export const Dropdown = Template.bind({}); Dropdown.args = { heading: 'Dropdown Heading', subtitle: 'Select an option from below', options: ['Option 1', 'Option 2', 'Option 3', 'Option 4'], animation: '', animationDelay: '', animationSpeed: '', }; //# sourceMappingURL=gov-drop.stories.js.map