import type { Meta, StoryObj } from '@storybook/vue3-vite' import { ref } from 'vue' import CpTransitionExpand from '@/components/CpTransitionExpand.vue' const meta = { title: 'Transitions/CpTransitionExpand', component: CpTransitionExpand, argTypes: { // No props to document as this is a utility component }, } satisfies Meta export default meta type Story = StoryObj const wrapperStyle = 'display: flex; flex-direction: column; align-items: center; gap: 12px;' /** * Animated height expansion. Wrap any element in `` * and toggle its rendering with `v-if` to smoothly expand/collapse. */ export const Default: Story = { render: () => ({ components: { CpTransitionExpand }, setup() { const isExpanded = ref(false) return { isExpanded } }, template: `
{{ isExpanded ? 'Collapse' : 'Expand' }}

Expanded Content

This content smoothly expands and collapses. The height transition is handled automatically by the CpTransitionExpand component.

`, }), } /** * The transition works with content of any height — no manual value * needed. */ export const WithLongContent: Story = { render: () => ({ components: { CpTransitionExpand }, setup() { const isExpanded = ref(false) return { isExpanded } }, template: `
{{ isExpanded ? 'Collapse' : 'Expand' }}

Long Content Example

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

`, }), }