summaryrefslogtreecommitdiffstats
path: root/src/objects/_menu.scss
blob: 12e975502fd30fe331ea3d0a79bb224e0567ef80 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* stylelint-disable length-zero-no-unit */

@use 'iro-sass/src/iro-sass' as iro;
@use '../functions' as fn;

@use './icon';

@include iro.props-namespace('menu') {
    @include iro.props-store((
        --dims: (
            --spacing: 0em,
            --header: (
                --font-size: fn.global-dim(--font-size --50),
            ),
            --separator: fn.global-dim(--size --100),
            --item: (
                --pad-i:    fn.global-dim(--size --150),
                --pad-b:    fn.global-dim(--size --100),
                --rounding: 0em,
            
                --key-focus: (
                    --border:        fn.global-dim(--key-focus --border),
                    --border-offset: fn.global-dim(--key-focus --border-offset),
                    --outline:       fn.global-dim(--key-focus --outline),
                ),
            ),
        ),
        --colors: (
            --separator: fn.global-color(--border),
            --header: (
                --label:  fn.global-color(--heading),
            ),
            --item: (
                --hover: (
                    --bg:    fn.global-color(--border-mute),
                    --label: fn.global-color(--heading),
                ),
                --active: (
                    --bg:    fn.global-color(--border),
                    --label: fn.global-color(--heading),
                ),
                --disabled: (
                    --label: fn.global-color(--text-disabled),
                ),
                --key-focus: (
                    --border:  fn.global-color(--focus --border),
                    --outline: fn.global-color(--focus --outline),
                ),
            ),
        ),
    ));

    @include iro.bem-object(iro.props-namespace()) {
        display:        flex;
        flex-direction: column;
        gap:            fn.dim(--spacing);

        @include iro.bem-elem('header') {
            padding-block:  fn.dim(--item --pad-b);
            padding-inline: fn.dim(--item --pad-i);
            font-size:      fn.dim(--header --font-size);
            font-weight:    500;
            color:          fn.color(--header --label);
            text-transform: uppercase;
            letter-spacing: .5px;

            @include iro.bem-next-twin-elem {
                margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing));
            }
        }

        @include iro.bem-elem('item') {
            padding-block:   fn.dim(--item --pad-b);
            padding-inline:  fn.dim(--item --pad-i);
            margin:          calc(-1 * fn.dim(--item --key-focus --outline));
            color:           fn.color(--item --disabled --label);
            background-clip: padding-box;
            border:          fn.dim(--item --key-focus --outline) solid transparent;
            border-radius:   calc(fn.dim(--item --rounding) + fn.dim(--item --key-focus --outline));

            &:link,
            &:visited,
            &:enabled {
                color: currentColor;

                @include iro.bem-multi('&:hover, &:focus-visible', 'is' 'selected') {
                    color:            fn.color(--item --hover --label);
                    background-color: fn.color(--item --hover --bg);
                }

                &:active {
                    color:            fn.color(--item --active --label);
                    background-color: fn.color(--item --active --bg);
                }

                &:focus-visible {
                    outline:    fn.color(--item --key-focus --border) solid fn.dim(--item --key-focus --border);
                    box-shadow: 0 0 0 calc(fn.dim(--item --key-focus --border) + fn.dim(--item --key-focus --outline)) fn.color(--item --key-focus --outline);
                }
            }

            @include iro.bem-next-elem('header') {
                margin-block-start: calc(fn.dim(--separator) + fn.dim(--spacing));
            }
        }

        @include iro.bem-elem('header') {
            &:link,
            &:visited,
            &:enabled {
                color: fn.color(--header --label);
            }
        }

        @include iro.bem-elem('separator') {
            block-size:       1px;
            margin-block:     fn.dim(--separator);
            margin-inline:    fn.dim(--item --pad-i);
            background-color: fn.color(--separator);
        }

        @include iro.bem-elem('slot') {
            padding-block:  fn.dim(--item --pad-b);
            padding-inline: fn.dim(--item --pad-i);
        }

        @include iro.bem-elem('icon-slot') {
            display:         flex;
            justify-content: center;
            inline-size:     fn.foreign-dim(--icon, --size);
        }

        @include iro.bem-modifier('pull') {
            margin: calc(-1 * fn.dim(--item --pad-i));
        }
    }
}