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

@include iro.props-namespace('form') {
    @include iro.props-store((
        --dims: (
            --item-spacing-y:  fn.global-dim(--spacing --y --md),
            --label-spacing-x: fn.global-dim(--spacing --x --md),
            --hint-font-size:  fn.global-dim(--font-size --sm),
        ),
    ), 'dims');

    @include iro.bem-layout(iro.props-namespace()) {
        display:        flex;
        flex-direction: column;
        align-items:    baseline;
        gap:            fn.dim(--item-spacing-y) fn.dim(--label-spacing-x);
    
        @include iro.bem-modifier('labels-left', 'labels-right') {
            display:               grid;
            grid-template-columns: auto 1fr;
            grid-template-rows:    auto;
    
            @include iro.bem-elem('item') {
                display: contents;
            }
        
            @include iro.bem-elem('item-label') {
                grid-column:   1;
                padding-right: 0;
            }
        
            @include iro.bem-elem('item-content') {
                grid-column: 2;
                margin-top:  0;
            }
        }
    
        @include iro.bem-modifier('labels-right') {
            @include iro.bem-elem('item-label') {
                text-align: right;
            }
        }
    }
}