mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-27 13:02:42 +03:00
Merge pull request #1055 from NoRedInk/country-name-autocomplete
A11-1340 add `"country-name"` autocomplete to TextInput
This commit is contained in:
commit
f5cee17e86
@ -1,6 +1,6 @@
|
||||
module Nri.Ui.TextInput.V7 exposing
|
||||
( view, generateId
|
||||
, number, float, text, newPassword, currentPassword, email, search, addressLevel2, addressLine1, familyName, givenName, organization, organizationTitle, postalCode, sex, tel
|
||||
, number, float, text, newPassword, currentPassword, email, search, addressLevel2, addressLine1, countryName, familyName, givenName, organization, organizationTitle, postalCode, sex, tel
|
||||
, readOnlyText
|
||||
, value, map
|
||||
, onFocus, onBlur, onEnter
|
||||
@ -27,7 +27,7 @@ module Nri.Ui.TextInput.V7 exposing
|
||||
|
||||
### Input types
|
||||
|
||||
@docs number, float, text, newPassword, currentPassword, email, search, addressLevel2, addressLine1, familyName, givenName, organization, organizationTitle, postalCode, sex, tel
|
||||
@docs number, float, text, newPassword, currentPassword, email, search, addressLevel2, addressLine1, countryName, familyName, givenName, organization, organizationTitle, postalCode, sex, tel
|
||||
@docs readOnlyText
|
||||
|
||||
|
||||
@ -383,6 +383,25 @@ addressLevel2 onInput_ =
|
||||
)
|
||||
|
||||
|
||||
{-| An input that allows country-name entry
|
||||
-}
|
||||
countryName : (String -> msg) -> Attribute String msg
|
||||
countryName onInput_ =
|
||||
Attribute
|
||||
{ emptyEventsAndValues
|
||||
| toString = Just identity
|
||||
, fromString = Just identity
|
||||
, onInput = Just (identity >> onInput_)
|
||||
}
|
||||
(\config ->
|
||||
{ config
|
||||
| fieldType = Just "text"
|
||||
, inputMode = Nothing
|
||||
, autocomplete = Just "country-name"
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
{-| An input that allows postal-code entry
|
||||
-}
|
||||
postalCode : (String -> msg) -> Attribute String msg
|
||||
|
@ -282,6 +282,16 @@ customizableExamples state =
|
||||
, onBlur = "Blurred!!!"
|
||||
, onEnter = "Entered!!!"
|
||||
}
|
||||
, toExample
|
||||
{ name = "countryName"
|
||||
, toString = identity
|
||||
, inputType = TextInput.countryName
|
||||
, inputTypeCode = "TextInput.countryName"
|
||||
, inputTypeValueCode = \value -> Code.string (Maybe.withDefault "" value)
|
||||
, onFocus = "Focused!!!"
|
||||
, onBlur = "Blurred!!!"
|
||||
, onEnter = "Entered!!!"
|
||||
}
|
||||
, toExample
|
||||
{ name = "postalCode"
|
||||
, toString = identity
|
||||
|
Loading…
Reference in New Issue
Block a user