import type { Meta, StoryObj } from '@storybook/vue3-vite' import { mdiArrowRight, mdiClose, mdiPlus } from '@mdi/js' import SyIcon from '@/components/Customs/SyIcon/SyIcon.vue' const variantOptions = ['elevated', 'flat', 'tonal', 'outlined', 'text', 'plain'] as const const densityOptions = ['default', 'comfortable', 'compact'] as const const sizeOptions = ['x-small', 'small', 'default', 'large', 'x-large'] as const const meta: Meta = { title: 'Composants/Composants Vuetify/VBtn', tags: ['!dev'], argTypes: { variant: { control: 'select', options: [...variantOptions], }, density: { control: 'select', options: [...densityOptions], }, color: { control: 'select', options: ['primary', 'secondary', 'success', 'warning', 'error'], }, }, render: args => ({ setup() { return { args } }, template: ` {{ args.label }} `, }), } export default meta type Story = StoryObj // --- Primary --- export const Primary: Story = { args: { label: 'Button primary', color: 'primary', variant: 'elevated', disabled: false }, parameters: { docs: { source: { code: `Button` } } }, } export const PrimaryLoading: Story = { args: { label: 'Button primary loading', color: 'primary', variant: 'elevated', disabled: false, loading: true }, parameters: { docs: { source: { code: `Button` } } }, } export const PrimaryDisabled: Story = { args: { label: 'Button primary disabled', color: 'primary', variant: 'elevated', disabled: true }, parameters: { docs: { source: { code: `Button` } } }, } // --- Secondary --- export const Secondary: Story = { args: { label: 'Button secondary ', color: 'primary', variant: 'outlined', disabled: false }, parameters: { docs: { source: { code: `Button` } } }, } export const SecondaryLoading: Story = { args: { label: 'Button secondary loading', color: 'primary', variant: 'outlined', disabled: false, loading: true }, parameters: { docs: { source: { code: `Button` } } }, } export const SecondaryDisabled: Story = { args: { label: 'Button secondary disabled', color: 'primary', variant: 'outlined', disabled: true }, parameters: { docs: { source: { code: `Button` } } }, } // --- Tertiary --- export const Tertiary: Story = { args: { label: 'Button tertiary', color: 'primary', variant: 'text', disabled: false }, parameters: { docs: { source: { code: `Button` } } }, } export const TertiaryLoading: Story = { args: { label: 'Button tertiary loading', color: 'primary', variant: 'text', disabled: false, loading: true }, parameters: { docs: { source: { code: `Button` } } }, } export const TertiaryDisabled: Story = { args: { label: 'Button tertiary disabled', color: 'primary', variant: 'text', disabled: true }, parameters: { docs: { source: { code: `Button` } } }, } // --- Primary --- export const PrimaryDestructive: Story = { args: { label: 'Button primary', color: 'error', variant: 'elevated', disabled: false }, parameters: { docs: { source: { code: `Button` } } }, } export const PrimaryDestructiveLoading: Story = { args: { label: 'Button primary loading', color: 'error', variant: 'elevated', disabled: false, loading: true }, parameters: { docs: { source: { code: `Button` } } }, } export const PrimaryDestructiveDisabled: Story = { args: { label: 'Button primary disabled', color: 'error', variant: 'elevated', disabled: true }, parameters: { docs: { source: { code: `Button` } } }, } // --- Secondary --- export const SecondaryDestructive: Story = { args: { label: 'Button secondary ', color: 'error', variant: 'outlined', disabled: false }, parameters: { docs: { source: { code: `Button` } } }, } export const SecondaryDestructiveLoading: Story = { args: { label: 'Button secondary loading', color: 'error', variant: 'outlined', disabled: false, loading: true }, parameters: { docs: { source: { code: `Button` } } }, } export const SecondaryDestructiveDisabled: Story = { args: { label: 'Button secondary disabled', color: 'error', variant: 'outlined', disabled: true }, parameters: { docs: { source: { code: `Button` } } }, } // --- Tertiary --- export const TertiaryDestructive: Story = { args: { label: 'Button tertiary', color: 'error', variant: 'text', disabled: false }, parameters: { docs: { source: { code: `Button` } } }, } export const TertiaryDestructiveLoading: Story = { args: { label: 'Button tertiary loading', color: 'error', variant: 'text', disabled: false, loading: true }, parameters: { docs: { source: { code: `Button` } } }, } export const TertiaryDestructiveDisabled: Story = { args: { label: 'Button tertiary disabled', color: 'error', variant: 'text', disabled: true }, parameters: { docs: { source: { code: `Button` } } }, } // --- Variants --- export const Variants: Story = { render: () => ({ setup() { return { variants: variantOptions } }, template: `
{{ variant }}
`, }), parameters: { docs: { source: { code: `Elevated Flat Tonal Outlined Text Plain`, }, }, }, } export const Densities: Story = { render: () => ({ setup() { return { variants: variantOptions, densities: densityOptions } }, template: `
{{ density }}
{{ variant }}
`, }), parameters: { docs: { source: { code: `Default Comfortable Compact`, }, }, }, } // --- Sizes --- export const Sizes: Story = { render: () => ({ template: `
X-Small Small Default Large X-Large
`, }), parameters: { docs: { source: { code: `X-Small Small Default Large X-Large`, }, }, }, } export const SizeDensityMatrix: Story = { render: () => ({ setup() { return { densities: densityOptions, sizes: sizeOptions } }, template: `
{{ density }}
`, }), parameters: { docs: { source: { code: `Action Action Action`, }, }, }, } // --- Icônes --- // `prepend-icon`/`append-icon` et `v-icon` nu laissent un `role="img"` sur le interne // (VSvgIcon de Vuetify) même avec aria-hidden sur le conteneur : on passe par SyIcon (decorative) // qui neutralise ce role via la directive v-rgaa-svg-fix. export const IconOnly: Story = { render: () => ({ components: { SyIcon }, setup() { return { mdiClose } }, template: ` `, }), parameters: { docs: { source: { code: ` `, }, }, }, } export const PrependIcon: Story = { render: () => ({ components: { SyIcon }, setup() { return { mdiPlus } }, template: ` Ajouter `, }), parameters: { docs: { source: { code: ` Ajouter `, }, }, }, } export const AppendIcon: Story = { render: () => ({ components: { SyIcon }, setup() { return { mdiArrowRight } }, template: ` Continuer `, }), parameters: { docs: { source: { code: ` Continuer `, }, }, }, }