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 ( ErrorState, init
, setErrorIf, setErrorMessage , setErrorIf, setErrorMessage
, getIsInError, getErrorMessage , getIsInError, getErrorMessage

View File

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

View File

@ -46,7 +46,7 @@ import Css
import Dict import Dict
import Html.Styled.Attributes as Attributes exposing (css) import Html.Styled.Attributes as Attributes exposing (css)
import Html.Styled.Events as Events import Html.Styled.Events as Events
import InputErrorInternal exposing (ErrorState) import InputErrorAndGuidanceInternal exposing (ErrorState)
import InputLabelInternal import InputLabelInternal
import Json.Decode exposing (Decoder) import Json.Decode exposing (Decoder)
import Nri.Ui import Nri.Ui
@ -81,7 +81,7 @@ If you have an error message to display, use `errorMessage` instead.
-} -}
errorIf : Bool -> Attribute value errorIf : Bool -> Attribute value
errorIf = errorIf =
Attribute << InputErrorInternal.setErrorIf Attribute << InputErrorAndGuidanceInternal.setErrorIf
{-| If `Just`, the field will be highlighted as having a validation error, {-| 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 : Maybe String -> Attribute value
errorMessage = errorMessage =
Attribute << InputErrorInternal.setErrorMessage Attribute << InputErrorAndGuidanceInternal.setErrorMessage
{-| Hides the visible label. (There will still be an invisible label for screen readers.) {-| Hides the visible label. (There will still be an invisible label for screen readers.)
@ -207,7 +207,7 @@ defaultConfig =
, choices = [] , choices = []
, valueToString = Nothing , valueToString = Nothing
, defaultDisplayText = Nothing , defaultDisplayText = Nothing
, error = InputErrorInternal.init , error = InputErrorAndGuidanceInternal.init
, hideLabel = False , hideLabel = False
, noMarginTop = False , noMarginTop = False
, containerCss = [] , containerCss = []
@ -223,7 +223,7 @@ view label attributes =
applyConfig attributes applyConfig attributes
isInError_ = isInError_ =
InputErrorInternal.getIsInError config.error InputErrorAndGuidanceInternal.getIsInError config.error
id_ = id_ =
Maybe.withDefault (generateId label) config.id Maybe.withDefault (generateId label) config.id
@ -264,7 +264,7 @@ view label attributes =
, Message.alertRole , 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 as Html exposing (..)
import Html.Styled.Attributes as Attributes exposing (..) import Html.Styled.Attributes as Attributes exposing (..)
import Html.Styled.Events as Events import Html.Styled.Events as Events
import InputErrorInternal exposing (ErrorState) import InputErrorAndGuidanceInternal exposing (ErrorState)
import InputLabelInternal import InputLabelInternal
import Keyboard.Event exposing (KeyboardEvent) import Keyboard.Event exposing (KeyboardEvent)
import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.ClickableSvg.V2 as ClickableSvg
@ -285,7 +285,7 @@ loading =
-} -}
errorIf : Bool -> Attribute value msg errorIf : Bool -> Attribute value msg
errorIf = errorIf =
Attribute emptyEventsAndValues << InputErrorInternal.setErrorIf Attribute emptyEventsAndValues << InputErrorAndGuidanceInternal.setErrorIf
{-| If `Just`, the field will be highlighted as having a validation error, {-| 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 : Maybe String -> Attribute value msg
errorMessage = errorMessage =
Attribute emptyEventsAndValues << InputErrorInternal.setErrorMessage Attribute emptyEventsAndValues << InputErrorAndGuidanceInternal.setErrorMessage
{-| A guidance message shows below the input, unless an error message is showing instead. {-| A guidance message shows below the input, unless an error message is showing instead.
@ -485,7 +485,7 @@ emptyConfig =
{ inputStyle = InputStyles.Standard { inputStyle = InputStyles.Standard
, inputCss = [] , inputCss = []
, guidance = Nothing , guidance = Nothing
, error = InputErrorInternal.init , error = InputErrorAndGuidanceInternal.init
, disabled = False , disabled = False
, loading = False , loading = False
, hideLabel = False , hideLabel = False
@ -561,10 +561,10 @@ view label attributes =
|> Maybe.withDefault label |> Maybe.withDefault label
isInError = isInError =
InputErrorInternal.getIsInError config.error InputErrorAndGuidanceInternal.getIsInError config.error
errorMessage_ = errorMessage_ =
InputErrorInternal.getErrorMessage config.error InputErrorAndGuidanceInternal.getErrorMessage config.error
( opacity, disabled_ ) = ( opacity, disabled_ ) =
case ( config.disabled, config.loading ) of case ( config.disabled, config.loading ) of