summaryrefslogtreecommitdiffstats
path: root/src/objects/_action-menu.scss
blob: 5675ac4f5127c0ff3403d6dfcf023c9c8e8aaa13 (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
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('action-menu') {
    @include iro.props-store((
        --dims: (
            --pad-x:     0,
            --pad-y:     fn.global-dim(--size --85),
            --separator: fn.global-dim(--size --85),
            --rounding:  3px,
            --border:    1px,
            --item: (
                --pad-x: fn.global-dim(--size --150),
                --pad-y: fn.global-dim(--size --85),
            ),
        ),
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --shadow:    0 .2em .5em rgba(#000, .1),
            --border:    fn.global-color(--border --stable-lo),
            --separator: fn.global-color(--obj),
            --icon:      fn.global-color(--fg-hi),
            --item: (
                --hover: (
                    --bg:    fn.global-color(--obj-hi),
                    --label: fn.global-color(--fg-lo),
                ),
                --disabled: (
                    --label: fn.global-color(--fg-hi3),
                ),
                --key-focus: (
                    --bg:     fn.global-color(--obj-hi),
                    --label:  fn.global-color(--fg-lo),
                    --border: fn.global-color(--focus --fill),
                    --shadow: fn.global-color(--focus --shadow),
                ),
            ),
        ),
    ), 'colors');

    @include iro.props-store((
        --colors: (
            --shadow: 0 .2em .5em rgba(#000, .5),
        ),
    ), 'colors-dark');

    @include iro.bem-object(iro.props-namespace()) {
        position:         absolute;
        z-index:          10000;
        top:              0;
        left:             0;
        padding:          fn.dim(--pad-y) fn.dim(--pad-x);
        transform:        translate(var(--x), var(--y));
        border:           fn.dim(--border) solid fn.color(--border);
        border-radius:    fn.dim(--rounding);
        background-clip:  padding-box;
        background-color: fn.global-color(--bg);
        box-shadow:       fn.color(--shadow);
        color:            fn.global-color(--fg);

        @include iro.bem-modifier('up-left') {
            transform: translate(var(--x), calc(var(--y) - 100%));
        }

        @include iro.bem-modifier('up-right') {
            transform: translate(calc(var(--x) - 100%), calc(var(--y) - 100%));
        }

        @include iro.bem-modifier('down-right') {
            transform: translate(calc(var(--x) - 100%), var(--y));
        }

        @include iro.bem-elem('item') {
            display:    block;
            box-sizing: border-box;
            width:      100%;
            padding:    calc(fn.dim(--item --pad-y) - 2px) calc(fn.dim(--item --pad-x) - 2px);
            border:     2px solid transparent;
            color:      fn.color(--item --disabled --label);

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

                &:hover,
                &:active {
                    background-color: fn.color(--item --hover --bg);
                    color:            fn.color(--item --hover --label);
                }
    
                @include iro.bem-at-theme('keyboard') {
                    &:focus {
                        border-radius:    2px;
                        border-color:     fn.color(--item --key-focus --border);
                        background-color: fn.color(--item --key-focus --bg);
                        box-shadow:       fn.color(--item --key-focus --shadow);
                        color:            fn.color(--item --key-focus --label);
                    }
                }
            }
        }

        @include iro.bem-elem('separator') {
            height:           1px;
            margin:           fn.dim(--separator) 0;
            background-color: fn.color(--separator);
        }

        @include iro.bem-elem('slot') {
            padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x);
        }

        @include iro.bem-elem('icon-slot') {
            display:         flex;
            justify-content: center;
            width:           1.2em;
        }
    }
}