-----------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Miso.Native.X.Element.Textarea.Property
-- Copyright   :  (C) 2016-2026 David M. Johnson
-- License     :  BSD3-style (see the file LICENSE)
-- Maintainer  :  David M. Johnson <code@dmj.io>
-- Stability   :  experimental
-- Portability :  non-portable
----------------------------------------------------------------------------
module Miso.Native.X.Element.Textarea.Property
  ( -- *** Property
    androidFullscreenMode_
  , bounces_
  , confirmType_
  , disabled_
  , enableScrollBar_
  , inputFilter_
  , iosAutoCorrect_
  , iosSpellCheck_
  , lineSpacing_
  , maxlength_
  , maxlines_
  , placeholder_
  , readonly_
  , showSoftInputOnFocus_
  , type_
    -- *** Types
  , TextareaType (..)
  , ConfirmType (..)
  ) where
-----------------------------------------------------------------------------
import           Miso.JSON (ToJSON(..))
import           Miso.String (MisoString)
import           Miso.Types (Attribute)
import           Miso.Property
-----------------------------------------------------------------------------
-- | The content type of a \<textarea\>, used by 'type_'.
data TextareaType
  = TextareaNumber
  | TextareaText
  | TextareaDigit
  | TextareaTel
  | TextareaEmail
  deriving (Int -> TextareaType -> ShowS
[TextareaType] -> ShowS
TextareaType -> String
(Int -> TextareaType -> ShowS)
-> (TextareaType -> String)
-> ([TextareaType] -> ShowS)
-> Show TextareaType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextareaType -> ShowS
showsPrec :: Int -> TextareaType -> ShowS
$cshow :: TextareaType -> String
show :: TextareaType -> String
$cshowList :: [TextareaType] -> ShowS
showList :: [TextareaType] -> ShowS
Show, TextareaType -> TextareaType -> Bool
(TextareaType -> TextareaType -> Bool)
-> (TextareaType -> TextareaType -> Bool) -> Eq TextareaType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextareaType -> TextareaType -> Bool
== :: TextareaType -> TextareaType -> Bool
$c/= :: TextareaType -> TextareaType -> Bool
/= :: TextareaType -> TextareaType -> Bool
Eq)
-----------------------------------------------------------------------------
instance ToJSON TextareaType where
  toJSON :: TextareaType -> Value
toJSON TextareaType
TextareaNumber = Value
"number"
  toJSON TextareaType
TextareaText   = Value
"text"
  toJSON TextareaType
TextareaDigit  = Value
"digit"
  toJSON TextareaType
TextareaTel    = Value
"tel"
  toJSON TextareaType
TextareaEmail  = Value
"email"
-----------------------------------------------------------------------------
-- | The confirm button type of a \<textarea\>, used by 'confirmType_'.
data ConfirmType
  = ConfirmSearch
  | ConfirmSend
  | ConfirmGo
  | ConfirmDone
  | ConfirmNext
  deriving (Int -> ConfirmType -> ShowS
[ConfirmType] -> ShowS
ConfirmType -> String
(Int -> ConfirmType -> ShowS)
-> (ConfirmType -> String)
-> ([ConfirmType] -> ShowS)
-> Show ConfirmType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConfirmType -> ShowS
showsPrec :: Int -> ConfirmType -> ShowS
$cshow :: ConfirmType -> String
show :: ConfirmType -> String
$cshowList :: [ConfirmType] -> ShowS
showList :: [ConfirmType] -> ShowS
Show, ConfirmType -> ConfirmType -> Bool
(ConfirmType -> ConfirmType -> Bool)
-> (ConfirmType -> ConfirmType -> Bool) -> Eq ConfirmType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConfirmType -> ConfirmType -> Bool
== :: ConfirmType -> ConfirmType -> Bool
$c/= :: ConfirmType -> ConfirmType -> Bool
/= :: ConfirmType -> ConfirmType -> Bool
Eq)
-----------------------------------------------------------------------------
instance ToJSON ConfirmType where
  toJSON :: ConfirmType -> Value
toJSON ConfirmType
ConfirmSearch = Value
"search"
  toJSON ConfirmType
ConfirmSend   = Value
"send"
  toJSON ConfirmType
ConfirmGo     = Value
"go"
  toJSON ConfirmType
ConfirmDone   = Value
"done"
  toJSON ConfirmType
ConfirmNext   = Value
"next"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#android-fullscreen-mode
--
-- Whether to enter the full-screen input mode when in landscape screen.
--
-- Default Value: 'True'
--
androidFullscreenMode_ :: Bool -> Attribute model action
androidFullscreenMode_ :: forall model action. Bool -> Attribute model action
androidFullscreenMode_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"android-fullscreen-mode"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#bounces
--
-- *iOS* only. Bounce effect when scrolling past the boundary.
--
-- Default Value: 'True'
--
bounces_ :: Bool -> Attribute model action
bounces_ :: forall model action. Bool -> Attribute model action
bounces_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"bounces"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#confirm-type
--
-- Specifies the confirm button type.
--
-- Default Value: 'ConfirmDone'
--
confirmType_ :: ConfirmType -> Attribute model action
confirmType_ :: forall model action. ConfirmType -> Attribute model action
confirmType_ = MisoString -> ConfirmType -> Attribute model action
forall a model action.
ToJSON a =>
MisoString -> a -> Attribute model action
prop MisoString
"confirm-type"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#disabled
--
-- Controls whether interaction is enabled.
--
-- Default Value: 'False'
--
disabled_ :: Bool -> Attribute model action
disabled_ :: forall model action. Bool -> Attribute model action
disabled_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"disabled"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#enable-scroll-bar
--
-- Whether to show the scroll bar.
--
-- Default Value: 'False'
--
enableScrollBar_ :: Bool -> Attribute model action
enableScrollBar_ :: forall model action. Bool -> Attribute model action
enableScrollBar_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"enable-scroll-bar"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#input-filter
--
-- Filters the input content in the form of a regular expression.
--
inputFilter_ :: MisoString -> Attribute model action
inputFilter_ :: forall model action. MisoString -> Attribute model action
inputFilter_ = MisoString -> MisoString -> Attribute model action
forall model action.
MisoString -> MisoString -> Attribute model action
textProp MisoString
"input-filter"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#ios-auto-correct
--
-- Enables auto-correction on iOS.
--
-- Default Value: 'True'
--
iosAutoCorrect_ :: Bool -> Attribute model action
iosAutoCorrect_ :: forall model action. Bool -> Attribute model action
iosAutoCorrect_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"ios-auto-correct"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#ios-spell-check
--
-- Enables spell-checking on iOS.
--
-- Default Value: 'True'
--
iosSpellCheck_ :: Bool -> Attribute model action
iosSpellCheck_ :: forall model action. Bool -> Attribute model action
iosSpellCheck_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"ios-spell-check"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#line-spacing
--
-- Line spacing.
--
lineSpacing_ :: Double -> Attribute model action
lineSpacing_ :: forall model action. Double -> Attribute model action
lineSpacing_ = MisoString -> Double -> Attribute model action
forall model action. MisoString -> Double -> Attribute model action
doubleProp MisoString
"line-spacing"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#maxlength
--
-- Maximum input length allowed.
--
-- Default Value: 140
--
maxlength_ :: Int -> Attribute model action
maxlength_ :: forall model action. Int -> Attribute model action
maxlength_ = MisoString -> Int -> Attribute model action
forall model action. MisoString -> Int -> Attribute model action
intProp MisoString
"maxlength"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#maxlines
--
-- Maximum number of input lines.
--
maxlines_ :: Int -> Attribute model action
maxlines_ :: forall model action. Int -> Attribute model action
maxlines_ = MisoString -> Int -> Attribute model action
forall model action. MisoString -> Int -> Attribute model action
intProp MisoString
"maxlines"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#placeholder
--
-- Placeholder text display.
--
placeholder_ :: MisoString -> Attribute model action
placeholder_ :: forall model action. MisoString -> Attribute model action
placeholder_ = MisoString -> MisoString -> Attribute model action
forall model action.
MisoString -> MisoString -> Attribute model action
textProp MisoString
"placeholder"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#readonly
--
-- Makes the input read-only.
--
-- Default Value: 'False'
--
readonly_ :: Bool -> Attribute model action
readonly_ :: forall model action. Bool -> Attribute model action
readonly_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"readonly"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#show-soft-input-on-focus
--
-- Show soft input keyboard while focused.
--
-- Default Value: 'True'
--
showSoftInputOnFocus_ :: Bool -> Attribute model action
showSoftInputOnFocus_ :: forall model action. Bool -> Attribute model action
showSoftInputOnFocus_ = MisoString -> Bool -> Attribute model action
forall model action. MisoString -> Bool -> Attribute model action
boolProp MisoString
"show-soft-input-on-focus"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/textarea.html#type
--
-- Input content type.
--
-- Default Value: 'TextareaText'
--
type_ :: TextareaType -> Attribute model action
type_ :: forall model action. TextareaType -> Attribute model action
type_ = MisoString -> TextareaType -> Attribute model action
forall a model action.
ToJSON a =>
MisoString -> a -> Attribute model action
prop MisoString
"type"
-----------------------------------------------------------------------------