import type { Meta, StoryObj } from '@storybook/react-vite'
import { Field } from './Field'
import { TextInput } from './TextInput'
import { Textarea } from './Textarea'
const meta = {
title: 'Inputs/Field',
component: Field,
parameters: { layout: 'padded' },
args: { label: 'Title', required: false },
argTypes: { children: { control: false } },
decorators: [(Story) =>
],
} satisfies Meta
export default meta
type Story = StoryObj
export const Default: Story = { args: { children: } }
export const Required: Story = { args: { label: 'Title', required: true, children: } }
export const WithTextarea: Story = {
args: { label: 'Resolution message (optional)', children: },
}
/** A hint under the control: what the format is, or what happens if it is left empty. */
export const WithHelper: Story = {
// axe color-contrast is off here until PLAN.md stage 0.10 is ruled:
// the helper is muted caption text, 3.93:1 on --bg-base in signal (AA 4.5:1).
parameters: { a11y: { config: { rules: [{ id: 'color-contrast', enabled: false }] } } },
args: {
label: 'Label',
helper: 'Leave this empty and one is made for you.',
children: ,
},
}
/** The error takes the helper's place rather than joining it, and marks the control invalid. */
export const WithError: Story = {
args: {
label: 'Label',
helper: 'Leave this empty and one is made for you.',
error: 'That is not a valid value.',
children: ,
},
}
/** Required, with a helper — the three parts of a field at once. */
export const RequiredWithHelper: Story = {
// axe color-contrast is off here until PLAN.md stage 0.10 is ruled:
// the helper is muted caption text, 3.93:1 on --bg-base in signal (AA 4.5:1).
parameters: { a11y: { config: { rules: [{ id: 'color-contrast', enabled: false }] } } },
args: {
label: 'Label',
required: true,
helper: 'One line, and it can be changed later.',
children: ,
},
}