summaryrefslogtreecommitdiffstats
path: root/tpl/objects/text-field.pug
blob: cbdb8c4e031dc16574bcdac5a15a9659abd0f632 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
include icon.pug

mixin text-field
    - const slots = {}

    mixin slot(key)
        - slots[key] = block

    -
        block ? block() : undefined 

        let classes = {
            'o-text-field':      true,
            'o-text-field--ext': attributes.ext,
            'is-invalid':        attributes.invalid,
            'is-disabled':       attributes.disabled,
            'l-card':            !!block,
            'l-card--flush':     !!block,
            'l-card--gapless':   !!block
        }

    div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled))
        if !!block
            if slots.pre
                - slots.pre()
            input.o-text-field__native.l-card__block.l-card__block--main&attributes(attributes)
            if slots.post
                - slots.post()
            .o-text-field__bg
        else
            input.o-text-field__native&attributes(attributes)
            .o-text-field__bg