From b45574b83da655d9b5e48d5ef5ce7f2e147e3bbf Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 12 Feb 2022 12:13:52 +0100 Subject: Text field update --- tpl/objects/text-field.pug | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'tpl/objects') 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 @@ include icon.pug mixin text-field + - const slots = {} + + mixin slot(key) + - slots[key] = block + - + block ? block() : undefined + let classes = { - 'o-text-field': true, - 'is-invalid': attributes.invalid, - 'is-disabled': attributes.disabled, + '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)) - input(class='o-text-field__native')&attributes(attributes) - .o-text-field__bg + 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 -- cgit v1.2.3-54-g00ecf