gov-gui
Version:
Gov UI Component Library Typscript Build
124 lines (123 loc) • 5.21 kB
JavaScript
import { html } from "lit-html";
import "../../global/animate.min.css";
/** Chips are compact visual elements used to represent an input, attribute, or action.
* They can display information like tags or categories, enhancing user interactions
* by allowing selections or indicating states. */
export default {
title: 'Components/Chips/Single Chips',
tags: ['autodocs'],
argTypes: {
selected: {
control: "boolean",
description: 'Indicates whether the chip is selected.',
table: {
type: { summary: 'boolean' },
category: 'Attributes',
defaultValue: { summary: 'false' },
},
},
disabled: {
control: "boolean",
description: 'Determines if the chip is disabled and cannot be interacted with.',
table: {
type: { summary: 'boolean' },
category: 'Attributes',
defaultValue: { summary: 'false' },
},
},
label: {
control: "text",
description: 'The text displayed on the chip.',
table: {
type: { summary: 'string' },
category: 'Attributes',
defaultValue: { summary: '' },
},
},
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 chip component
const Template = (args) => html `
<gov-chip
label="${args.label}"
selected="${args.selected}"
disabled="${args.disabled}"
animation-delay="${args.animationDelay}"
animation="${args.animation}"
animation-speed="${args.animationSpeed}"
></gov-chip>
`;
// Default story for the chip
export const Default = Template.bind({});
Default.args = {
label: 'UI/UX Design',
selected: false,
disabled: false,
animation: '',
animationDelay: '',
animationSpeed: '',
};
/** A chip component with selected property set to true.
* This indicates that the chip is currently selected. */
export const Selected = Template.bind({});
Selected.args = {
label: 'UI/UX Design',
selected: true,
disabled: false,
};
/** A chip component with the disabled property set to true.
* This chip cannot be selected in this state. */
export const Disabled = Template.bind({});
Disabled.args = {
label: 'UI/UX Design',
selected: false,
disabled: true,
};
//# sourceMappingURL=gov-chip.stories.js.map