blob: d5c4444189dc14d0f0349d5a93548ca62c8bddac (
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
33
34
35
36
37
38
39
40
41
42
|
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--extended': !!block,
'is-invalid': attributes.invalid,
'is-disabled': attributes.disabled,
'l-media': !!block,
'l-media--flush': !!block,
'l-media--gapless': !!block,
}
if (attributes.class) {
classes[attributes.class] = true;
}
const attr = {
placeholder: attributes.placeholder,
disabled: attributes.disabled
}
div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled))
if !!block
if slots.pre
.u-d-contents.t-hi
- slots.pre()
input.o-text-field__native.l-media__block.l-media__block--main&attributes(attr)
if slots.post
.u-d-contents.t-hi
- slots.post()
.o-text-field__bg
else
input.o-text-field__native&attributes(attr)
.o-text-field__bg
|