web-rep-0.7.0: representations of a web page

Web.Rep.SharedReps

Description

Various SharedRep instances for common html input elements.

Synopsis

# Documentation

Arguments

 :: (Monad m, ToHtml a) => Parser a Parser -> (a -> Text) Printer -> Input a Input type -> a initial value -> SharedRep m a

Create a sharedRep from an Input.

repMessage :: (Monad m, ToHtml a) => Parser a -> (a -> Text) -> Input a -> a -> a -> SharedRep m a Source #

Like repInput, but does not put a value into the HashMap on instantiation, consumes the value when found in the HashMap, and substitutes a default on lookup failure

sliderI :: (Monad m, ToHtml a, Integral a, Show a) => Maybe Text -> a -> a -> a -> a -> SharedRep m a Source #

integral slider

For Example, a slider between 0 and 1000 with a step of 10 and a default value of 300 is:

>>> :t sliderI (Just "label") 0 1000 10 300
sliderI (Just "label") 0 1000 10 300
:: (Monad m, ToHtml a, P.Integral a, Show a) => SharedRep m a


slider :: Monad m => Maybe Text -> Double -> Double -> Double -> Double -> SharedRep m Double Source #

double slider

For Example, a slider between 0 and 1 with a step of 0.01 and a default value of 0.3 is:

>>> :t slider (Just "label") 0 1 0.01 0.3
slider (Just "label") 0 1 0.01 0.3 :: Monad m => SharedRep m Double


Arguments

 :: (Monad m, ToHtml a) => Parser a parse an a from Text -> (a -> Text) print an a to Text -> Maybe Text label suggestion -> [Text] list of dropbox elements (as text) -> a initial value -> SharedRep m a

dropdown box

Arguments

 :: (Monad m, ToHtml a) => Parser a parse an a from Text -> (a -> Text) print an a to Text -> Maybe Text label suggestion -> [Text] list of dropbox elements (as text) -> [a] initial value -> SharedRep m [a]

dropdown box with multiple selections

datalist :: Monad m => Maybe Text -> [Text] -> Text -> Text -> SharedRep m Text Source #

a datalist input

dropdownSum :: (Monad m, ToHtml a) => Parser a -> (a -> Text) -> Maybe Text -> [Text] -> a -> SharedRep m a Source #

A dropdown box designed to help represent a haskell sum type.

Non-typed hex color input

textbox classique

>>> :t textbox (Just "label") "some text"
textbox (Just "label") "some text" :: Monad m => SharedRep m Text


textarea :: Monad m => Int -> Maybe Text -> Text -> SharedRep m Text Source #

textarea input element, specifying number of rows.

A checkbox input.

toggle :: Monad m => Maybe Text -> Bool -> SharedRep m Bool Source #

a toggle button

a button

filename input

maybeRep :: Monad m => Maybe Text -> Bool -> SharedRep m a -> SharedRep m (Maybe a) Source #

Represent a Maybe using a checkbox.

Hides the underlying content on Nothing

Representation of web concerns (css, js & html).

viaFiddle :: Monad m => SharedRep m a -> SharedRep m (Bool, Concerns Text, a) Source #

turns a SharedRep into a fiddle

accordionList :: Monad m => Maybe Text -> Text -> Maybe Text -> (Text -> a -> SharedRep m a) -> [Text] -> [a] -> SharedRep m [a] Source #

A (fixed-size) list represented in html as an accordion card A major restriction of the library is that a SharedRepF does not have a Monad instance. In practice, this means that the external representation of lists cannot have a dynamic size.

listMaybeRep :: Monad m => Maybe Text -> Text -> (Text -> Maybe a -> SharedRep m (Maybe a)) -> Int -> [a] -> SharedRep m [Maybe a] Source #

A fixed-sized list of Maybe a's

Arguments

 :: Monad m => Maybe Text -> Text -> (Bool -> SharedRep m Bool) name prefix (should be unique) -> (a -> SharedRep m a) Bool Rep -> Int a Rep -> a maximum length of list -> [a] default value for new rows -> SharedRep m [a] initial values

A SharedRep of [a]. Due to the applicative nature of the bridge, the size of lists has to be fixed on construction. listRep is a workaround for this, to enable some form of dynamic sizing.

readTextbox :: (Monad m, Read a, Show a) => Maybe Text -> a -> SharedRep m (Either Text a) Source #

Parse from a textbox

Uses focusout so as not to spam the reader.

repChoice :: Monad m => Int -> [(Text, SharedRep m a)] -> SharedRep m a Source #

subtype :: With a => a -> Text -> Text -> a Source #

selectItems :: [Text] -> HashMap Text a -> [(Text, a)] Source #

select test keys from a Map

repItemsSelect :: Monad m => [Text] -> [Text] -> SharedRep m [Text] Source #

rep of multiple items list