From 365c56edcc36b5b92902bac01ce44b43d01e8685 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 18 Oct 2024 18:08:24 +0200 Subject: Refactoring --- src/objects/_field-label.scss | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/objects/_field-label.scss (limited to 'src/objects/_field-label.scss') diff --git a/src/objects/_field-label.scss b/src/objects/_field-label.scss new file mode 100644 index 0000000..ba3841a --- /dev/null +++ b/src/objects/_field-label.scss @@ -0,0 +1,86 @@ +@use 'iro-sass/src/iro-sass' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('field-label') { + @include iro.props-store(( + --dims: ( + --spacing-i: fn.global-dim(--size --150), + --spacing-b: fn.global-dim(--size --85), + --label-font-size: fn.global-dim(--font-size --75), + --hint-font-size: fn.global-dim(--font-size --75), + ), + --colors: ( + --label: fn.global-color(--text-mute), + --hint: fn.global-color(--text-mute), + --error-hint: fn.global-color(--negative --900), + --disabled: fn.global-color(--text-disabled), + ), + )); + + @include iro.bem-object(iro.props-namespace()) { + display: block; + + @include iro.bem-elem('label') { + display: block; + flex: 0 0 auto; + padding-inline-end: fn.dim(--spacing-i); + font-size: fn.dim(--label-font-size); + font-weight: 400; + line-height: 1.3; + color: fn.color(--label); + + @include iro.bem-next-elem('content') { + margin-block-start: fn.dim(--spacing-b); + } + } + + @include iro.bem-elem('content') { + display: block; + flex: 1 1 auto; + } + + @include iro.bem-elem('hint') { + display: block; + margin-block-start: fn.dim(--spacing-b); + font-size: fn.dim(--hint-font-size); + color: fn.color(--hint); + } + + @include iro.bem-is('invalid') { + @include iro.bem-elem('hint') { + color: fn.color(--error-hint); + } + } + + @include iro.bem-is('disabled') { + @include iro.bem-elem('label', 'hint') { + color: fn.color(--disabled); + } + } + + @include iro.bem-modifier('align-start', 'align-end') { + display: flex; + align-items: baseline; + + @include iro.bem-elem('label') { + display: inline-block; + + @include iro.bem-next-elem('content') { + margin-block-start: 0; + } + } + } + + @include iro.bem-modifier('align-start') { + @include iro.bem-elem('label') { + text-align: start; + } + } + + @include iro.bem-modifier('align-end') { + @include iro.bem-elem('label') { + text-align: end; + } + } + } +} -- cgit v1.2.3-70-g09d2