import type { Meta, StoryObj } from '@storybook/react' import { Checkbox } from '../Checkbox/Checkbox' import { LabeledCheckbox } from '../Checkbox/LabeledCheckbox' import { Input } from '../Input' import { SimpleSelect } from '../Select' import { FIELD_SIZE_OPTIONS, Field, FieldError, FieldHelper, FieldLabel, FieldControl, } from './Field' const meta: Meta = { title: 'Form/Field', component: Field, argTypes: { size: { control: { type: 'select', }, options: FIELD_SIZE_OPTIONS, table: { type: { summary: FIELD_SIZE_OPTIONS.map((value) => value).join(' | '), }, }, }, children: { control: false, }, }, parameters: { layout: 'centered', }, } export default meta type Story = StoryObj export const WithLabel: Story = { render: (_args) => ( Network ), } export const SmallWithLabel: Story = { render: (_args) => ( Email address ), } export const WithHelperAndLabel: Story = { render: (_args) => ( Risk threshold Choose when the subscription should trigger an alert. ), parameters: { docs: { description: { story: 'Use helper text to explain why a field is needed or how the selected value is used.', }, }, }, } export const WithErrorMessage: Story = { args: { children: [ , This field has an error., ], }, parameters: { docs: { description: { story: 'Use FieldError with FieldControl error state so assistive technology can associate the message with the control.', }, }, }, } export const WithEverything: Story = { args: { children: [ Complete Field, This is some helpful text., , This field has an error., ], }, } export const WithCheckbox: Story = { args: { children: [ I agree to the terms , You must agree to the terms to continue. , , This field is required., ], }, } export const WithLabeledCheckbox: Story = { render: (_args) => (
Unchecked Checked Indeterminate Disabled
), } export const WithEverythingSmall: Story = { args: { size: 'sm', children: [ Complete Field (Small), This is some helpful text., , This field has an error., ], }, }