summaryrefslogtreecommitdiffstats
path: root/src/layouts/_form.scss
blob: 5f0567b90beff7c068b71eb841df2a4c55ada501 (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
@use 'sass:meta';
@use 'iro-sass/src/bem';
@use 'iro-sass/src/props';
@use '../props' as *;

@forward 'form.vars';
@use 'form.vars' as vars;

@mixin styles {
    @include materialize-at-root(meta.module-variables('vars'));

    @include bem.layout('form') {
        display:        flex;
        flex-direction: column;
        gap:            props.get(vars.$item-spacing-b) props.get(vars.$label-spacing-i);

        @include bem.elem('item') {
            display: block;
        }
        
        @include bem.elem('item-content') {
            @include bem.modifier('align-start') {
                align-self: start;
            }
        }

        @include bem.modifier('row') {
            flex-direction: row;
            align-items:    flex-end;
        }

        @include bem.modifier('labels-start', 'labels-end') {
            display:               grid;
            grid-template-rows:    auto;
            grid-template-columns: auto 1fr;
            align-items:           baseline;

            @include bem.elem('item') {
                display: contents;
            }
        
            @include bem.elem('item-label') {
                grid-column:        1;
                padding-inline-end: 0;
            }
        
            @include bem.elem('item-content') {
                grid-column:        2;
                margin-block-start: 0;
            }
        }

        @include bem.modifier('labels-end') {
            @include bem.elem('item-label') {
                text-align: end;
            }
        }
    }
}