diff options
Diffstat (limited to 'tpl/objects')
| -rw-r--r-- | tpl/objects/text-field.pug | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/tpl/objects/text-field.pug b/tpl/objects/text-field.pug index c933b69..24f8e21 100644 --- a/tpl/objects/text-field.pug +++ b/tpl/objects/text-field.pug | |||
| @@ -1,13 +1,32 @@ | |||
| 1 | include icon.pug | 1 | include icon.pug |
| 2 | 2 | ||
| 3 | mixin text-field | 3 | mixin text-field |
| 4 | - const slots = {} | ||
| 5 | |||
| 6 | mixin slot(key) | ||
| 7 | - slots[key] = block | ||
| 8 | |||
| 4 | - | 9 | - |
| 10 | block ? block() : undefined | ||
| 11 | |||
| 5 | let classes = { | 12 | let classes = { |
| 6 | 'o-text-field': true, | 13 | 'o-text-field': true, |
| 7 | 'is-invalid': attributes.invalid, | 14 | 'o-text-field--ext': attributes.ext, |
| 8 | 'is-disabled': attributes.disabled, | 15 | 'is-invalid': attributes.invalid, |
| 16 | 'is-disabled': attributes.disabled, | ||
| 17 | 'l-card': !!block, | ||
| 18 | 'l-card--flush': !!block, | ||
| 19 | 'l-card--gapless': !!block | ||
| 9 | } | 20 | } |
| 10 | 21 | ||
| 11 | div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled)) | 22 | div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled)) |
| 12 | input(class='o-text-field__native')&attributes(attributes) | 23 | if !!block |
| 13 | .o-text-field__bg | 24 | if slots.pre |
| 25 | - slots.pre() | ||
| 26 | input.o-text-field__native.l-card__block.l-card__block--main&attributes(attributes) | ||
| 27 | if slots.post | ||
| 28 | - slots.post() | ||
| 29 | .o-text-field__bg | ||
| 30 | else | ||
| 31 | input.o-text-field__native&attributes(attributes) | ||
| 32 | .o-text-field__bg | ||
