[{"name":"Form","comment":" Build type-safe, declarative forms with validation and transformation support.\n\nThis module provides a simple way to create forms by composing inputs together.\nIt handles form state management, validation, and transformation of user input.\n\n\n# Types\n\n@docs Form, FormInput\n\n\n# Creating Forms\n\n@docs new, input\n\n\n# Configuring Inputs\n\n@docs withRequired, withType, withPlaceholder, withTransformer, withValidator, withAttributes\n\n\n# Rendering\n\n@docs build\n\n","unions":[{"name":"Form","comment":" An opaque type representing a form with multiple inputs.\n\nA `Form` contains form-level attributes and a collection of inputs that will be\nrendered together.\n\n","args":["msg"],"cases":[]}],"aliases":[{"name":"FormInput","comment":" Represents an input field within a form.\n\nEach input has a unique `key` that identifies it in the form's value dictionary,\nand configuration for how the input should behave and appear.\n\n**Note**: You should create `FormInput` values using the `input` function\nrather than constructing this record directly. The `input` function provides\na clean, type-safe way to create form inputs.\n\n","args":["msg"],"type":"{ key : String.String, input_ : Input.Input Input.Dumb msg }"}],"values":[{"name":"build","comment":" Render the form to HTML.\n\nTakes the current form values as a dictionary, a message constructor for handling\nvalue changes, a message for form submission, and the form configuration.\n\n    import Dict exposing (Dict)\n\n    type Msg\n        = FormChanged (Dict String String)\n        | FormSubmitted\n\n    view : Dict String String -> Html Msg\n    view formValues =\n        myForm\n            |> build formValues FormChanged FormSubmitted\n\n","type":"Dict.Dict String.String String.String -> (Dict.Dict String.String String.String -> msg) -> msg -> Form.Form msg -> Html.Html msg"},{"name":"input","comment":" Create a new form input with a key and label.\n\nThe key is used to identify the input's value in the form state dictionary.\n\n    input \"username\" \"Username\"\n\n    input \"bio\" \"Biography\"\n        |> withType \"textarea\"\n\n","type":"String.String -> String.String -> Form.FormInput msg"},{"name":"new","comment":" Create a new form with form-level attributes and inputs.\n\n    import Html.Attributes as Attr\n\n    myForm : Form Msg\n    myForm =\n        new [ Attr.class \"my-form\" ]\n            [ input \"email\" \"Email Address\"\n                |> withType \"email\"\n                |> withRequired True\n            , input \"name\" \"Full Name\"\n                |> withRequired True\n            ]\n\n","type":"List.List (Html.Attribute msg) -> List.List (Form.FormInput msg) -> Form.Form msg"},{"name":"withAttributes","comment":" Add custom HTML attributes to an input.\n\n    import Html.Attributes as Attr\n\n    input \"name\" \"Name\"\n        |> withAttributes\n            [ Attr.class \"form-control\"\n            , Attr.placeholder \"Enter your name\"\n            ]\n\n","type":"List.List (Html.Attribute msg) -> Form.FormInput msg -> Form.FormInput msg"},{"name":"withPlaceholder","comment":" Add placeholder text to an input.\n\n    input \"search\" \"Search\"\n        |> withPlaceholder \"Type to search...\"\n\n    input \"email\" \"Email Address\"\n        |> withType \"email\"\n        |> withPlaceholder \"you@example.com\"\n\n","type":"String.String -> Form.FormInput msg -> Form.FormInput msg"},{"name":"withRequired","comment":" Mark an input as required or optional.\n\n    input \"email\" \"Email\"\n        |> withRequired True\n\n","type":"Basics.Bool -> Form.FormInput msg -> Form.FormInput msg"},{"name":"withTransformer","comment":" Add a transformer function that processes the input value before it's stored.\n\nTransformers are useful for formatting input, such as removing whitespace or\nconverting to a specific case.\n\n    input \"username\" \"Username\"\n        |> withTransformer String.trim\n\n    input \"code\" \"Postal Code\"\n        |> withTransformer String.toUpper\n\n","type":"(String.String -> String.String) -> Form.FormInput msg -> Form.FormInput msg"},{"name":"withType","comment":" Set the input type (e.g., \"text\", \"email\", \"password\", \"number\").\n\n    input \"password\" \"Password\"\n        |> withType \"password\"\n        |> withRequired True\n\n    input \"age\" \"Age\"\n        |> withType \"number\"\n\n","type":"String.String -> Form.FormInput msg -> Form.FormInput msg"},{"name":"withValidator","comment":" Add a validator function that returns additional HTML attributes on validation failure.\n\nValidators can return attributes like CSS classes or ARIA attributes to provide\nvisual feedback when validation fails.\n\n    import Html.Attributes as Attr\n\n    emailValidator : String -> Result (List (Html.Attribute msg)) ()\n    emailValidator value =\n        if String.contains \"@\" value then\n            Ok ()\n        else\n            Err [ Attr.class \"error\", Attr.attribute \"aria-invalid\" \"true\" ]\n\n    input \"email\" \"Email\"\n        |> withType \"email\"\n        |> withValidator emailValidator\n\n","type":"(String.String -> Result.Result (List.List (Html.Attribute msg)) ()) -> Form.FormInput msg -> Form.FormInput msg"}],"binops":[]},{"name":"Input","comment":" Build type-safe HTML input elements with validation and state management.\n\nThis module uses phantom types to ensure inputs are properly configured before\nbeing rendered. An input must have interaction (via `withOnChange` or `withDisabled`)\nbefore it can be built into HTML.\n\n\n# Types\n\n@docs Input, Dumb, WithInteraction\n\n\n# Creating Inputs\n\n@docs new\n\n\n# Configuration\n\n@docs withRequired, withType, withPlaceholder, withTransformer, withValidator, withAttributes\n\n\n# Adding Interaction\n\n@docs withOnChange, withDisabled\n\n\n# Rendering\n\n@docs build\n\n","unions":[{"name":"Dumb","comment":" Phantom type representing an input without interaction.\n\nInputs with this type cannot be built yet - they need to be given interaction\nvia `withOnChange` or `withDisabled`.\n\n","args":[],"cases":[]},{"name":"Input","comment":" An input element with a phantom type parameter for compile-time state tracking.\n\nThe phantom type ensures that inputs have proper interaction handlers before\nthey can be rendered.\n\n","args":["interaction","msg"],"cases":[]},{"name":"WithInteraction","comment":" Phantom type representing an input with interaction.\n\nInputs with this type can be built into HTML.\n\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"build","comment":" Build an input into HTML.\n\nThe input must have interaction (via `withOnChange` or `withDisabled`) to be buildable.\nThe build function is optimized with lazy rendering for performance.\n\n    type Msg\n        = EmailChanged String\n\n    view : String -> Html Msg\n    view emailValue =\n        new \"Email\"\n            |> withType \"email\"\n            |> withRequired True\n            |> withOnChange EmailChanged\n            |> build emailValue\n\n","type":"String.String -> Input.Input Input.WithInteraction msg -> Html.Html msg"},{"name":"new","comment":" Create a new input with a label.\n\nThe input starts as `Dumb`, meaning it cannot be built yet. You must add\ninteraction via `withOnChange` or `withDisabled` before building.\n\n    new \"Email Address\"\n\n    new \"Password\"\n        |> withType \"password\"\n        |> withRequired True\n        |> withOnChange PasswordChanged\n\n","type":"String.String -> Input.Input Input.Dumb msg"},{"name":"withAttributes","comment":" Add custom HTML attributes to an input.\n\n    import Html.Attributes as Attr\n\n    new \"Email\"\n        |> withAttributes\n            [ Attr.class \"form-input\"\n            , Attr.autocomplete False\n            ]\n        |> withOnChange EmailChanged\n\n","type":"List.List (Html.Attribute msg) -> Input.Input any msg -> Input.Input any msg"},{"name":"withDisabled","comment":" Convert a `Dumb` input to a disabled input with interaction.\n\nThis allows you to build a disabled input without providing an onChange handler.\n\n    new \"Disabled Field\"\n        |> withDisabled\n        |> build \"\"\n\n","type":"Input.Input Input.Dumb msg -> Input.Input Input.WithInteraction msg"},{"name":"withOnChange","comment":" Add an onChange handler to make the input interactive.\n\nThis is required before an input can be built. The handler receives the transformed\nvalue after any transformer has been applied.\n\n    type Msg\n        = NameChanged String\n\n    new \"Name\"\n        |> withTransformer String.trim\n        |> withOnChange NameChanged\n        |> build currentValue\n\n","type":"(String.String -> msg) -> Input.Input Input.Dumb msg -> Input.Input Input.WithInteraction msg"},{"name":"withPlaceholder","comment":" Add placeholder text to an input.\n\n    new \"Search\"\n        |> withPlaceholder \"Type to search...\"\n        |> withOnChange SearchChanged\n\n","type":"String.String -> Input.Input any msg -> Input.Input any msg"},{"name":"withRequired","comment":" Mark an input as required or optional.\n\nThis sets the HTML `required` attribute.\n\n    new \"Email\"\n        |> withRequired True\n\n","type":"Basics.Bool -> Input.Input any msg -> Input.Input any msg"},{"name":"withTransformer","comment":" Add a transformer function that processes the input value.\n\nThe transformer is applied to the value before it's passed to the `onChange` handler.\nThis is useful for formatting, trimming, or normalizing input.\n\n    new \"Username\"\n        |> withTransformer String.trim\n        |> withOnChange UsernameChanged\n\n    new \"Code\"\n        |> withTransformer String.toUpper\n        |> withOnChange CodeChanged\n\n","type":"(String.String -> String.String) -> Input.Input any msg -> Input.Input any msg"},{"name":"withType","comment":" Set the input type (e.g., \"text\", \"email\", \"password\", \"number\").\n\n    new \"Password\"\n        |> withType \"password\"\n        |> withRequired True\n        |> withOnChange PasswordChanged\n\n","type":"String.String -> Input.Input any msg -> Input.Input any msg"},{"name":"withValidator","comment":" Add a validator function that returns additional HTML attributes on validation failure.\n\nThe validator receives the current value and can return error attributes that will\nbe applied to the input element. This is useful for providing visual feedback or\nARIA attributes for accessibility.\n\n    import Html.Attributes as Attr\n\n    lengthValidator : String -> Result (List (Html.Attribute msg)) ()\n    lengthValidator value =\n        if String.length value >= 3 then\n            Ok ()\n        else\n            Err\n                [ Attr.class \"invalid\"\n                , Attr.attribute \"aria-invalid\" \"true\"\n                ]\n\n    new \"Username\"\n        |> withValidator lengthValidator\n        |> withOnChange UsernameChanged\n\n","type":"(String.String -> Result.Result (List.List (Html.Attribute msg)) ()) -> Input.Input any msg -> Input.Input any msg"}],"binops":[]}]