gov-gui
Version:
Gov UI Component Library Typscript Build
150 lines (149 loc) • 5.97 kB
JavaScript
import { html } from "lit-html";
import "../../global/animate.min.css";
/** Icon varient of the gov-button.
*
* **NB:** Make sure the icon you enter is a recognised ICON.
* Visit the icon utility page to verify available icons.
*/
export default {
title: 'Components/Button/IconButton',
tags: ['autodocs'],
parameters: {
actions: {
handles: ['clicked'],
}
},
argTypes: {
iconSize: {
control: 'select',
options: ['sm', 'md', 'lg'],
description: 'Sets the size of the icon in the button: small (sm), large (lg), or medium(md).',
table: {
type: { summary: 'string' },
defaultValue: { summary: '' },
category: 'Attributes',
}
},
variantClass: {
control: 'select',
options: ['primary', 'secondary', 'info', 'success', 'warning', 'danger', 'white'],
description: 'Sets the button variant style: primary or secondary.',
table: {
type: { summary: 'string' },
defaultValue: { summary: '' },
category: 'Attributes',
}
},
icon: {
control: 'text',
description: 'The name of the icon you want to render in the gov-button.',
table: {
type: { summary: 'string' },
defaultValue: { summary: '' },
category: 'Attributes',
}
},
disabled: {
control: 'boolean',
description: 'When true, disables all interactions with button.',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
category: 'Attributes',
},
},
type: {
control: 'text',
description: 'the type of button.',
table: {
type: { summary: 'string' },
defaultValue: { summary: 'submit' },
category: 'Attributes',
},
},
clicked: {
control: 'event',
description: 'on click functionality.',
table: {
type: { summary: 'void' },
defaultValue: { summary: () => { } },
category: 'Events',
},
},
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',
},
},
}
};
// Template for the Stencil button component
const Template = (args) => html `
<gov-button
icon = "${args.icon}"
type="${args.type}"
icon-size="${args.iconSize}"
variant="${args.variantClass}"
?disabled="${args.disabled}"
type-variant="iconButton"
animation-delay="${args.animationDelay}"
animation="${args.animation}"
animation-speed="${args.animationSpeed}"
>
</gov-button>
`;
/** Icon button */
export const IconButton = Template.bind({});
IconButton.args = {
iconSize: 'md',
variantClass: 'primary',
icon: 'home', // Example icon
disabled: false,
type: 'submit',
animation: '',
animationDelay: '',
animationSpeed: '',
};
//# sourceMappingURL=gov-button.icon.stories.js.map