gov-gui
Version:
Gov UI Component Library Typscript Build
140 lines (138 loc) • 5.73 kB
JavaScript
import { html } from "lit-html";
import "../../global/animate.min.css";
/**
* Contextual pop-up that appears when a user hovers over or focuses on an element, provides brief, informative text or guidance about the functionality or purpose of the element
*/
export default {
title: 'Components/Tooltip',
tags: ['autodocs'],
parameters: {
actions: {
handles: ['mouseenter', 'mouseleave'], // Track hover events
},
},
argTypes: {
text: {
control: 'text',
description: 'The content of the tooltip.',
table: {
type: { summary: 'string' },
defaultValue: { summary: '' },
category: 'Attributes',
},
},
position: {
control: 'select',
options: ['top', 'right', 'bottom', 'left'],
description: 'Position of the tooltip relative to the target element.',
table: {
type: { summary: 'string' },
defaultValue: { summary: 'top' },
category: 'Attributes',
},
},
size: {
control: 'select',
options: ['sm', 'lg'],
description: 'size of the tooltip.',
table: {
type: { summary: 'string' },
defaultValue: { summary: 'sm' },
category: 'Attributes',
},
},
color: {
control: 'select',
options: ['dark', 'light'],
description: 'Color scheme of the tooltip.',
table: {
type: { summary: 'string' },
defaultValue: { summary: 'dark' },
category: 'Attributes',
},
},
hoverDelay: {
control: { type: 'number' },
description: 'Delay in milliseconds before the tooltip is shown on hover.',
table: {
type: { summary: 'number' },
defaultValue: { summary: 300 },
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 `
<div style="padding: 50px; display: flex; align-items: center; justify-content:center; ">
<gov-tooltip
text="${args.text}"
position="${args.position}"
color="${args.color}"
hover-delay="${args.hoverDelay}"
size="${args.size}"
animation-delay="${args.animationDelay}"
animation="${args.animation}"
animation-speed="${args.animationSpeed}">
<gov-button label="Hover over me"></gov-button>
</gov-tooltip>
</div>
`;
export const Tooltip = Template.bind({});
Tooltip.args = {
text: 'This is a tooltip message',
position: 'top',
color: 'dark',
hoverDelay: 300,
size: 'sm',
animation: '',
animationDelay: '',
animationSpeed: '',
};
//# sourceMappingURL=gov-tooltip.stories.js.map