summaryrefslogtreecommitdiffstats
path: root/src/.old/objects/_field-label.scss
blob: 2127a09215d097107a282e4ba2a7f8faeb3b5325 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('field-label') {
    @include iro.props-store((
        --dims: (
            --spacing-x:       fn.global-dim(--size --150),
            --spacing-y:       fn.global-dim(--size --85),
            --label-font-size: fn.global-dim(--font-size --75),
            --hint-font-size:  fn.global-dim(--font-size --75),
        ),
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --label:      fn.global-color(--fg-hi),
            --hint:       fn.global-color(--fg-hi),
            --error-hint: fn.global-color(--accent --error --quiet --fg),
            --disabled:   fn.global-color(--fg-hi3),
        ),
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        display: block;

        @include iro.bem-elem('label') {
            display:       block;
            flex:          0 0 auto;
            padding-right: fn.dim(--spacing-x);
            color:         fn.color(--label);
            font-size:     fn.dim(--label-font-size);
            font-weight:   400;
            line-height:   1.3;
    
            @include iro.bem-next-elem('content') {
                margin-top: fn.dim(--spacing-y);
            }
        }
    
        @include iro.bem-elem('content') {
            display: block;
            width:   100%;
        }
    
        @include iro.bem-elem('hint') {
            display:    block;
            margin-top: fn.dim(--spacing-y);
            color:      fn.color(--hint);
            font-size:  fn.dim(--hint-font-size);
        }
    
        @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('left', 'right') {
            display:     flex;
            align-items: baseline;
    
            @include iro.bem-elem('label') {
                display: inline-block;
    
                @include iro.bem-next-elem('content') {
                    margin-top: 0;
                }
            }
        }
    
        @include iro.bem-modifier('left') {
            @include iro.bem-elem('label') {
                text-align: left;
            }
        }
    
        @include iro.bem-modifier('right') {
            @include iro.bem-elem('label') {
                text-align: right;
            }
        }
    }
}