glazier-react-widget-1.0.0.0: Generic widget library using glazier-react

Safe HaskellNone
LanguageHaskell2010

Glazier.React.Widgets.Input

Contents

Synopsis

Text input

textInput :: (AsReactor cmd, AsJavascript cmd) => ReactId -> Widget cmd p JSString (InputChange ()) Source #

Text inputs dosn't interact well as a React controlled component. Eg. cursor jumps if user types quickly. I think there a timing issue with lazy event handlers setting the value, So this prototype uses the React uncontrolled component (using defaultValue instead of value).

For input, React uses controlled input if input.value is not null.

This widget attempts to set the cursor position at the correct place by using a diffing algorithm on the old and new value.

Warning: This widget listens to onChange and will update the model value with the DOM input value. potentially overridding any user changes. So when changing the model value, be sure that the onChange handler will not be called.

Checkbox input

checkboxInput :: AsReactor cmd => ReactId -> Widget cmd p Bool (InputChange ()) Source #

This is a 'React controlled' checkbox. For checkboxes, React uses controlled checkbox if input.checked is not null https://stackoverflow.com/questions/37427508/react-changing-an-uncontrolled-input

data IndeterminateCheckboxInput Source #

Instances
Eq IndeterminateCheckboxInput Source # 
Instance details

Defined in Glazier.React.Widgets.Input

Ord IndeterminateCheckboxInput Source # 
Instance details

Defined in Glazier.React.Widgets.Input

Show IndeterminateCheckboxInput Source # 
Instance details

Defined in Glazier.React.Widgets.Input

Generic IndeterminateCheckboxInput Source # 
Instance details

Defined in Glazier.React.Widgets.Input

Associated Types

type Rep IndeterminateCheckboxInput :: * -> * #

type Rep IndeterminateCheckboxInput Source # 
Instance details

Defined in Glazier.React.Widgets.Input

type Rep IndeterminateCheckboxInput = D1 (MetaData "IndeterminateCheckboxInput" "Glazier.React.Widgets.Input" "glazier-react-widget-1.0.0.0-6HV9uwI557lI53FjkcrH3T" False) (C1 (MetaCons "IndeterminateCheckboxInput" PrefixI True) (S1 (MetaSel (Just "checked") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool) :*: S1 (MetaSel (Just "indeterminate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))

indeterminateCheckboxInput :: (AsReactor cmd, AsJavascript cmd) => ReactId -> Widget cmd p IndeterminateCheckboxInput (InputChange ()) Source #

Variation of checkboxInput supporting indeterminate state.