UNPKG

gov-gui

Version:

Gov UI Component Library Typscript Build

135 lines (134 loc) 5.7 kB
import { html } from "lit-html"; import "../../global/animate.min.css"; /** * The ComboBox component is a searchable dropdown that allows users to filter options as they type. * It displays a list of predefined options and lets users select one. The dropdown can be opened manually or automatically when the input is clicked or typed in. */ export default { title: 'Components/ComboBox', tags: ['autodocs'], parameters: { actions: { handles: ['click', 'input'], // Track the input and click events }, }, argTypes: { options: { control: 'array', description: 'The list of available options in the dropdown. Accepts a JSON string or an array of strings.', table: { type: { summary: 'string | string[]' }, defaultValue: { summary: '[]' }, category: 'Attributes', }, }, label: { control: 'text', description: 'The label text displayed above the comboBox.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Attributes', }, }, description: { control: 'text', description: 'A description for the comboBox.', table: { type: { summary: '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', }, }, onSelect: { description: 'Event emitted when an item is selected from the dropdown.', table: { type: { summary: 'void' }, defaultValue: { summary: '() => {}' }, category: 'Events', }, }, }, }; const Template = (args) => html ` <gov-combo-box label=${args.label} description=${args.description} animation-delay="${args.animationDelay}" animation="${args.animation}" animation-speed="${args.animationSpeed}" options=${JSON.stringify(args.options)}> </gov-combo-box> `; export const ComboBox = Template.bind({}); ComboBox.args = { options: ['List entry #1', 'List entry #2', 'List entry #3', 'List entry #4', 'List entry #5'], label: 'Select an option', description: 'Choose from the options below"', animation: '', animationDelay: '', animationSpeed: '', }; // Custom Template for Display ComboBox.parameters = { docs: { source: { code: `<gov-combo-box label=${ComboBox.args.label} description=${ComboBox.args.description} animation-delay="${ComboBox.args.animationDelay}" animation="${ComboBox.args.animation}" animation-speed="${ComboBox.args.animationSpeed}" options='${JSON.stringify(ComboBox.args.options)}'> </gov-combo-box>`, }, }, }; //# sourceMappingURL=gov-combo-box.stories.js.map