import { expect, fn, userEvent, within } from "storybook/test"; import type { Meta, StoryObj } from "@storybook/react-vite"; import { CalendarBlankRegularIcon } from "alouette-icons/phosphor-icons/CalendarBlank"; import { MagnifyingGlassRegularIcon } from "alouette-icons/phosphor-icons/MagnifyingGlass"; import type { ReactNode } from "react"; import { IconButton } from "../actions/IconButton"; import { Icon } from "../primitives/Icon"; import { Story, neutralAndAccents } from "../story-components/Story"; import { StoryGrid } from "../story-components/StoryGrid"; import { InputText, type InputTextProps } from "./InputText"; import { TextArea } from "./TextArea"; type ThisStory = StoryObj; interface SearchGlyphProps { disabled?: boolean; } // A slot glyph carries its own ink: `Icon` reads only its `text-*` class on // native, so the field's disabled color never reaches it. function SearchGlyph({ disabled }: SearchGlyphProps): ReactNode { return ( } className={disabled ? "text-form-disabled-text" : "text-muted"} /> ); } type ForcedState = NonNullable; type InputState = ForcedState | "disabled" | "invalid"; function StateCol({ state, ...props }: Pick & { state: InputState | undefined; }): ReactNode { if (state === "disabled") { return ( ); } if (state === "invalid") { return ( ); } return ( ); } function StateRow( props: Pick, ): ReactNode { return ( ); } export default { title: "alouette/Inputs/InputText", component: InputText, parameters: { componentSubtitle: "Single-line text input with theme support, modes, and platform-aware keyboards.", }, argTypes: { placeholder: { control: "text" }, disabled: { control: "boolean" }, value: { control: "text" }, maxLength: { control: "number" }, }, } satisfies Meta; export const PreviewInputTextStory: ThisStory = { parameters: { layout: "padded", chromatic: { disableSnapshot: true }, }, args: { placeholder: "Enter text..." }, render: (args) => , }; export const Variants: ThisStory = { render: () => ( {neutralAndAccents.map((accent) => ( ))} } /> } aria-label="Pick a date" onPress={fn()} /> } /> } endSlot={ } aria-label="Pick a date" onPress={fn()} /> } /> } endSlot={ } aria-label="Pick a date" onPress={fn()} /> } />