import type { Meta, StoryObj } from '@storybook/nextjs-vite'; import { Field } from '../components/ui/field'; import { Input } from '../components/ui/input'; const meta = { title: 'UI/Field', component: Field, } satisfies Meta; export default meta; type Story = StoryObj; /** * The full contract in one field: label, required `*`, hover InfoHint, and a * `role="alert"` error. The render-prop spreads `id` / `aria-required` / * `aria-invalid` / `aria-describedby` onto the control so the label and error * are actually announced. */ export const Default: Story = { args: { label: 'Repository name', hint: 'The GitHub repository this rule set applies to. Owner/name format.', required: true, error: 'A repository with this name already exists.', children: () => null, }, render: args => (
{f => }
), }; /** * Clean state — no hint, no error, not required. */ export const Plain: Story = { args: { label: 'Display name', children: () => null, }, render: args => (
{f => }
), }; /** * Fields in a grid row top-align naturally because labels are a single line — * hints live in the hover icon, never in flow. */ export const GridRow: Story = { args: { label: 'Model', children: () => null, }, render: () => (
{f => } {f => }
), };