Liking cljdoc? Tell your friends :D

reacl-c-basics.forms.types

Input types extend over the :type attribute of reacl-c-basics.forms.core/input items, giving more control over the data types of the state value, and to some extend over the ui controls to enter those values. The type system defined here is also extensible.

For example, you can ask the user for an integer via

(c/isolate-state 0
  (core/input {:type types/integer}))
Input types extend over the `:type` attribute
of [[reacl-c-basics.forms.core/input]] items, giving more control
over the data types of the state value, and to some extend over the
ui controls to enter those values. The type system defined here is
also extensible.

For example, you can ask the user for an integer via

```
(c/isolate-state 0
  (core/input {:type types/integer}))
```
raw docstring

add-attributescljs

(add-attributes type attrs)

Adds additional default attributes for the dom element used for the given type.

Adds additional default attributes for the dom element used for the given type.
sourceraw docstring

booleancljs

An input for a boolean value, represented as a checkbox.

An input for a boolean value, represented as a checkbox.
sourceraw docstring

decimalcljs

(decimal decimals)

A input type for an integer, but represented and entered as (/ v (^ 10 decimals). E.g. 234 with 2 decimals is shown and entered as "2.34".

A input type for an integer, but represented and entered as `(/ v (^ 10
decimals)`. E.g. 234 with 2 decimals is shown and entered as
"2.34".
sourceraw docstring

enumcljs

(enum values-labels)

An input type for one of a set of arbitrary values. The argument values-labels must be a a sequence of tuples [value text] specifying the value selected and a string that represents the value for the user.

An input type for one of a set of arbitrary values. The argument
`values-labels` must be a a sequence of tuples `[value text]`
specifying the value selected and a string that represents the value
for the user.
sourceraw docstring

extend-typecljs

(extend-type type parse unparse)

Creates an input type that can allow for more values than the given one. The function parse will be called with the parse function of the given type and the string entered by the user, and the function unparse alike.

Creates an input type that can allow for more values than the given
one. The function `parse` will be called with the parse function of
the given type and the string entered by the user, and the function
`unparse` alike.
sourceraw docstring

fixnumcljs

(fixnum decimals)

An input type for a float, but when entered and displayed, exactly the given number of decimal places are used or shown respectively.

An input type for a float, but when entered and displayed, exactly the given number of
decimal places are used or shown respectively.
sourceraw docstring

integercljs

An input type for a integer number.

An input type for a integer number.
sourceraw docstring

multiline-stringcljs

An input type for a string, represented in a multiline textbox element.

An input type for a string, represented in a multiline textbox element.
sourceraw docstring

native-typecljs

(native-type type)

Creates an input type for one of the native 'types' supported by a dom/input, i.e. "text", "number", "checkbox" etc. Note that not all types are supported by all browsers.

Creates an input type for one of the native 'types' supported by a
dom/input, i.e. "text", "number", "checkbox" etc. Note that
not all types are supported by all browsers.
sourceraw docstring

new-typecljs

(new-type base-fn default-attrs to-optional)

Creates a new input type, given a basic dom function (e.g. core/input), a map of default attributes (e.g. a string value for the :type attribute), and a function that takes this type and returns a type that also accepts nil as a value. The to-optional function may throw, if the type cannot be extended to accept nil.

Creates a new input type, given a basic dom
function (e.g. core/input), a map of default attributes (e.g. a
string value for the `:type` attribute), and a function that takes
this type and returns a type that also accepts `nil` as a value. The
`to-optional` function may throw, if the type cannot be extended to
accept `nil`.
sourceraw docstring

numbercljs

An input type for a number.

An input type for a number.
sourceraw docstring

opt-integercljs

An input type for an optional integer.

An input type for an optional [[integer]].
sourceraw docstring

opt-non-empty-stringcljs

An input type for an optional, but non-empty string, i.e. the value is never an empty string. This also trims the text entered, so only whitespace becomed nil as well.

An input type for an optional, but non-empty string,
i.e. the value is never an empty string. This also trims the text
entered, so only whitespace becomed `nil` as well.
sourceraw docstring

opt-numbercljs

An input type for an optional number.

An input type for an optional number.
sourceraw docstring

opt-strict-integercljs

An optional strict-integer.

An optional [[strict-integer]].
sourceraw docstring

opt-stringcljs

An input type for an optional string.

An input type for an optional [[string]].
sourceraw docstring

optionalcljs

(optional type)

Adds 'nil' as a possible value to the given input type. Note that this is may not possible for all types.

Adds 'nil' as a possible value to the given input type. Note that
this is may not possible for all types.
sourceraw docstring

parsed-typecljs

(parsed-type base-type parse unparse)

Creates an input that requires parsing and unparsing of the native value entered by the user (usually a string). See parsed/input-parsed for details on the parse and unparse functions.

Creates an input that requires parsing and unparsing of the native
value entered by the user (usually a
string). See [[parsed/input-parsed]] for details on the parse and
unparse functions.
sourceraw docstring

restrict-typecljs

(restrict-type type f)

Creates an input that allows to restrict the parsed value of the given type further, by threading it though the given function f, which may throw parsed/parse-error. Note that it can be more intuitive for the user to set the input element attribute :invalid in some cases.

Creates an input that allows to restrict the parsed value of the
given type further, by threading it though the given function `f`,
which may throw [[parsed/parse-error]]. Note that it can be more
intuitive for the user to set the input element attribute `:invalid`
in some cases.
sourceraw docstring

strict-integercljs

An input type that requires the user to enter an integer number. For an input type that for example just removes decimal places, use integer.

An input type that requires the user to enter an integer
number. For an input type that for example just removes decimal
places, use [[integer]].
sourceraw docstring

stringcljs

An input type for a string.

An input type for a string.
sourceraw docstring

string-enumcljs

(string-enum strings)

An input type for one of the given strings.

An input type for one of the given strings.
sourceraw docstring

update-to-optionalcljs

(update-to-optional type f)
source

update-type-basecljs

(update-type-base type f)

Calls f with the current base function and replaces it with the result.

Calls f with the current base function and replaces it with the result.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close