summaryrefslogtreecommitdiffstats
path: root/src/objects/_action-button.scss
blob: 48ac2a6b9652b3d9c44781599ff7dfdbfb35a29a (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('action-button') {
    @include iro.props-store((
        --dims: (
            --line-height: 1.4,
            --pad-x:       fn.global-dim(--size --100),
            --pad-y:       fn.global-dim(--size --85),
            --rounding:    3px,
        ),
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --bg:     fn.global-color(--bg-hi),
            --label:  fn.global-color(--fg),
            --border: fn.global-color(--obj-lo),
    
            --hover: (
                --bg:     fn.global-color(--bg-hi2),
                --label:  fn.global-color(--fg-lo),
                --border: fn.global-color(--fg-hi2),
            ),
            --active: (
                --bg:     fn.global-color(--obj-hi),
                --label:  fn.global-color(--fg-lo),
                --border: fn.global-color(--fg-hi2),
            ),
            --selected: (
                --bg:     fn.global-color(--obj-hi),
                --label:  fn.global-color(--fg),
                --border: fn.global-color(--fg-hi3),

                --hover: (
                    --label:  fn.global-color(--fg-lo),
                    --border: fn.global-color(--fg-hi2),
                ),
            ),
            --disabled: (
                --bg:     fn.global-color(--obj-hi),
                --label:  fn.global-color(--fg-hi3),
                --border: fn.global-color(--obj-hi),
            ),
            --key-focus: (
                --border: fn.global-color(--focus --fill),
                --shadow: fn.global-color(--focus --shadow),
            ),
            --quiet: (
                --label: fn.global-color(--fg),
    
                --hover: (
                    --bg:    fn.global-color(--obj-hi),
                    --label: fn.global-color(--fg-lo),
                ),
                --active: (
                    --bg:    fn.global-color(--obj),
                    --label: fn.global-color(--fg-lo),
                ),
                --selected: (
                    --bg:    fn.global-color(--obj-hi),
                    --label: fn.global-color(--fg),
    
                    --hover: (
                        --bg:    fn.global-color(--obj),
                        --label: fn.global-color(--fg-lo),
                    ),
                ),
                --disabled: (
                    --label: fn.global-color(--fg-hi3),
                ),
            ),
        ),
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        display:          inline-block;
        padding:          fn.dim(--pad-y) fn.dim(--pad-x);
        overflow:         hidden;
        border:           1px solid fn.color(--disabled --border);
        border-radius:    fn.dim(--rounding);
        background-color: fn.color(--disabled --bg);
        color:            fn.color(--disabled --label);
        line-height:      fn.dim(--line-height);
        text-align:       center;
        text-decoration:  none;
        text-overflow:    ellipsis;
        vertical-align:   top;
        white-space:      nowrap;

        &:link,
        &:visited,
        &:enabled {
            border-color:     fn.color(--border);
            background-color: fn.color(--bg);
            color:            fn.color(--label);

            &:hover {
                border-color:     fn.color(--hover --border);
                background-color: fn.color(--hover --bg);
                color:            fn.color(--hover --label);
            }
    
            &:active {
                border-color:     fn.color(--active --border);
                background-color: fn.color(--active --bg);
                color:            fn.color(--active --label);
            }
    
            @include iro.bem-at-theme('keyboard') {
                &:focus {
                    background-color: fn.color(--hover --bg);
                    color:            fn.color(--hover --label);
                }
            }
        }
    
        @include iro.bem-is('selected') {
            &:link,
            &:visited,
            &:enabled {
                border-color:     fn.color(--selected --border);
                background-color: fn.color(--selected --bg);
                color:            fn.color(--selected --label);
        
                &:hover,
                &:active {
                    border-color:     fn.color(--selected --hover --border);
                    background-color: fn.color(--selected --bg);
                    color:            fn.color(--selected --hover --label);
                }
    
                @include iro.bem-at-theme('keyboard') {
                    &:focus {
                        background-color: fn.color(--selected --bg);
                        color:            fn.color(--selected --hover --label);
                    }
                }
            }
        }
    
        @include iro.bem-modifier('quiet') {
            border-color:     transparent;
            background-color: transparent;
            box-shadow:       none;
            color:            fn.color(--quiet --disabled --label);
    
            &:link,
            &:visited,
            &:enabled {
                border-color:     transparent;
                background-color: transparent;
                box-shadow:       none;
                color:            fn.color(--quiet --label);

                &:hover {
                    border-color:     transparent;
                    background-color: fn.color(--quiet --hover --bg);
                    box-shadow:       none;
                    color:            fn.color(--quiet --hover --label);
                }
    
                &:active {
                    border-color:     transparent;
                    background-color: fn.color(--quiet --active --bg);
                    box-shadow:       none;
                    color:            fn.color(--quiet --active --label);
                }
    
                @include iro.bem-at-theme('keyboard') {
                    &:focus {
                        background-color: fn.color(--quiet --hover --bg);
                        color:            fn.color(--quiet --hover --label);
                    }
                }
            }
    
            @include iro.bem-is('selected') {
                background-color: fn.color(--quiet --selected --bg);
                color:            fn.color(--quiet --disabled --label);

                &:link,
                &:visited,
                &:enabled {
                    border-color:     transparent;
                    background-color: fn.color(--quiet --selected --bg);
                    box-shadow:       none;
                    color:            fn.color(--quiet --selected --label);

                    &:hover,
                    &:active {
                        border-color:     transparent;
                        background-color: fn.color(--quiet --selected --hover --bg);
                        box-shadow:       none;
                        color:            fn.color(--quiet --selected --hover --label);
                    }
    
                    @include iro.bem-at-theme('keyboard') {
                        &:focus {
                            background-color: fn.color(--quiet --selected --bg);
                            color:            fn.color(--quiet --selected --hover --label);
                        }
                    }
                }
            }
        }
    
        @include iro.bem-at-theme('keyboard') {
            &:focus {
                border-color: fn.color(--key-focus --border);
                box-shadow:   inset 0 0 0 1px fn.color(--key-focus --border), fn.color(--key-focus --shadow);
            }
        }
    
        @include iro.bem-modifier('round') {
            width:         calc(1em * fn.dim(--line-height) + 2 * fn.dim(--pad-y));
            padding-right: 0;
            padding-left:  0;
            border-radius: 100em;
        }
    }
}