import type { Meta, StoryObj } from '@storybook/react-vite' import { useState } from 'react' import { fn } from 'storybook/test' import { SIZES } from '../lib/styles' import { FeaturedTextArea } from './FeaturedTextArea' import { TEXT_FIELD_VARIANTS } from './featuredinput.tokens' const meta = { title: 'Forms/FeaturedTextArea', component: FeaturedTextArea, tags: ['autodocs'], parameters: { docs: { description: { component: 'The floating-label version of `TextArea`, with the same props. The label rests where the first line of text goes and floats to the top of the box when the textarea is focused or filled (CSS only). The box reserves room for the floated label, so scrolled text never runs under it.', }, }, }, argTypes: { label: { control: 'text' }, description: { control: 'text' }, error: { control: 'text' }, placeholder: { control: 'text', description: 'Shown once the label has floated, while the textarea is focused and empty.' }, size: { control: 'inline-radio', options: SIZES, table: { defaultValue: { summary: 'md' } } }, variant: { control: 'inline-radio', options: TEXT_FIELD_VARIANTS, table: { defaultValue: { summary: 'outline' } }, }, rows: { control: { type: 'number', min: 1, max: 12 }, table: { defaultValue: { summary: '3' } } }, resize: { control: 'inline-radio', options: ['none', 'vertical', 'both'], table: { defaultValue: { summary: 'vertical' } }, }, autoResize: { control: 'boolean' }, maxRows: { control: { type: 'number', min: 1, max: 20 } }, maxLength: { control: { type: 'number', min: 1 } }, required: { control: 'boolean' }, disabled: { control: 'boolean' }, readOnly: { control: 'boolean' }, value: { control: 'text' }, defaultValue: { control: 'text' }, name: { control: 'text' }, className: { control: 'text' }, textareaClassName: { control: 'text' }, onValueChange: { control: false }, onChange: { control: false }, }, args: { label: 'Delivery instructions', placeholder: 'Gate code, where to leave the parcel…', size: 'md', variant: 'outline', rows: 3, resize: 'vertical', autoResize: false, required: false, disabled: false, readOnly: false, onValueChange: fn(), onChange: fn(), }, decorators: [ (Story) => (
Value: {value || '(empty)'}