summaryrefslogtreecommitdiffstats
path: root/src/layouts/_form.scss
blob: f6b60ea3ba9724c3fa824005abde923629d4776e (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
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

// @use '../objects/field-label';

@include iro.props-namespace('form') {
    @include iro.props-store((
        --dims: (
            --item-spacing-b:  fn.global-dim(--size --325),
            --label-spacing-i: fn.global-dim(--size --325),
            --hint-font-size:  fn.global-dim(--font-size --75),
        ),
    ));

    @include iro.bem-layout(iro.props-namespace()) {
        display:        flex;
        flex-direction: column;
        gap:            fn.dim(--item-spacing-b) fn.dim(--label-spacing-i);
    
        @include iro.bem-elem('item') {
            display: block;
        }
        
        @include iro.bem-elem('item-content') {
            @include iro.bem-modifier('align-start') {
                align-self: start;
            }
        }
    
        @include iro.bem-modifier('row') {
            flex-direction: row;
            align-items:    flex-end;
        }
    
        @include iro.bem-modifier('labels-start', 'labels-end') {
            display:               grid;
            grid-template-columns: auto 1fr;
            grid-template-rows:    auto;
            align-items:           baseline;
    
            @include iro.bem-elem('item') {
                display: contents;
            }
        
            @include iro.bem-elem('item-label') {
                grid-column:        1;
                padding-inline-end: 0;
            }
        
            @include iro.bem-elem('item-content') {
                grid-column:        2;
                margin-block-start: 0;
            }
        }
    
        @include iro.bem-modifier('labels-end') {
            @include iro.bem-elem('item-label') {
                text-align: end;
            }
        }
    }
}