InputErrorInternal -> InputErrorAndGuidanceInternal

This commit is contained in:
Tessa Kelly 2021-11-11 13:38:55 -08:00
parent 2ac1ca42cf
commit cc9aabd99a
4 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,4 @@
module InputErrorInternal exposing
module InputErrorAndGuidanceInternal exposing
( ErrorState, init
, setErrorIf, setErrorMessage
, getIsInError, getErrorMessage

View File

@ -10,7 +10,7 @@ import Accessibility.Styled as Html exposing (Html)
import Accessibility.Styled.Style as Accessibility
import Css
import Html.Styled.Attributes as Attributes
import InputErrorInternal exposing (ErrorState)
import InputErrorAndGuidanceInternal exposing (ErrorState)
import Nri.Ui.Colors.V1 as Colors
import Nri.Ui.InputStyles.V3 as InputStyles exposing (Theme)
@ -32,7 +32,7 @@ view { for, label, theme } config =
Html.label
([ Attributes.for for
, Attributes.css
[ InputStyles.label theme (InputErrorInternal.getIsInError config.error)
[ InputStyles.label theme (InputErrorAndGuidanceInternal.getIsInError config.error)
, if config.noMarginTop then
Css.top (Css.px -InputStyles.defaultMarginTop)

View File

@ -46,7 +46,7 @@ import Css
import Dict
import Html.Styled.Attributes as Attributes exposing (css)
import Html.Styled.Events as Events
import InputErrorInternal exposing (ErrorState)
import InputErrorAndGuidanceInternal exposing (ErrorState)
import InputLabelInternal
import Json.Decode exposing (Decoder)
import Nri.Ui
@ -81,7 +81,7 @@ If you have an error message to display, use `errorMessage` instead.
-}
errorIf : Bool -> Attribute value
errorIf =
Attribute << InputErrorInternal.setErrorIf
Attribute << InputErrorAndGuidanceInternal.setErrorIf
{-| If `Just`, the field will be highlighted as having a validation error,
@ -89,7 +89,7 @@ and the given error message will be shown.
-}
errorMessage : Maybe String -> Attribute value
errorMessage =
Attribute << InputErrorInternal.setErrorMessage
Attribute << InputErrorAndGuidanceInternal.setErrorMessage
{-| Hides the visible label. (There will still be an invisible label for screen readers.)
@ -207,7 +207,7 @@ defaultConfig =
, choices = []
, valueToString = Nothing
, defaultDisplayText = Nothing
, error = InputErrorInternal.init
, error = InputErrorAndGuidanceInternal.init
, hideLabel = False
, noMarginTop = False
, containerCss = []
@ -223,7 +223,7 @@ view label attributes =
applyConfig attributes
isInError_ =
InputErrorInternal.getIsInError config.error
InputErrorAndGuidanceInternal.getIsInError config.error
id_ =
Maybe.withDefault (generateId label) config.id
@ -264,7 +264,7 @@ view label attributes =
, Message.alertRole
]
)
(InputErrorInternal.getErrorMessage config.error)
(InputErrorAndGuidanceInternal.getErrorMessage config.error)
]

View File

@ -56,7 +56,7 @@ import Css.Global
import Html.Styled as Html exposing (..)
import Html.Styled.Attributes as Attributes exposing (..)
import Html.Styled.Events as Events
import InputErrorInternal exposing (ErrorState)
import InputErrorAndGuidanceInternal exposing (ErrorState)
import InputLabelInternal
import Keyboard.Event exposing (KeyboardEvent)
import Nri.Ui.ClickableSvg.V2 as ClickableSvg
@ -285,7 +285,7 @@ loading =
-}
errorIf : Bool -> Attribute value msg
errorIf =
Attribute emptyEventsAndValues << InputErrorInternal.setErrorIf
Attribute emptyEventsAndValues << InputErrorAndGuidanceInternal.setErrorIf
{-| If `Just`, the field will be highlighted as having a validation error,
@ -293,7 +293,7 @@ and the given error message will be shown.
-}
errorMessage : Maybe String -> Attribute value msg
errorMessage =
Attribute emptyEventsAndValues << InputErrorInternal.setErrorMessage
Attribute emptyEventsAndValues << InputErrorAndGuidanceInternal.setErrorMessage
{-| A guidance message shows below the input, unless an error message is showing instead.
@ -485,7 +485,7 @@ emptyConfig =
{ inputStyle = InputStyles.Standard
, inputCss = []
, guidance = Nothing
, error = InputErrorInternal.init
, error = InputErrorAndGuidanceInternal.init
, disabled = False
, loading = False
, hideLabel = False
@ -561,10 +561,10 @@ view label attributes =
|> Maybe.withDefault label
isInError =
InputErrorInternal.getIsInError config.error
InputErrorAndGuidanceInternal.getIsInError config.error
errorMessage_ =
InputErrorInternal.getErrorMessage config.error
InputErrorAndGuidanceInternal.getErrorMessage config.error
( opacity, disabled_ ) =
case ( config.disabled, config.loading ) of