Project

General

Profile

1
// Name:            Tab
2
// Description:     Component to create a tabbed navigation
3
//
4
// Component:       `uk-tab`
5
//
6
// Modifiers:       `uk-tab-bottom`
7
//                  `uk-tab-left`
8
//                  `uk-tab-right`
9
//
10
// States:          `uk-active`
11
//                  `uk-disabled`
12
//
13
// ========================================================================
14

    
15

    
16
// Variables
17
// ========================================================================
18

    
19
@tab-margin-horizontal:                  20px;
20

    
21
@tab-item-padding-horizontal:            10px;
22
@tab-item-padding-vertical:              5px;
23
@tab-item-color:                         @global-muted-color;
24
@tab-item-hover-color:                   @global-color;
25
@tab-item-hover-text-decoration:         none;
26
@tab-item-active-color:                  @global-emphasis-color;
27
@tab-item-disabled-color:                @global-muted-color;
28

    
29

    
30
/* ========================================================================
31
   Component: Tab
32
 ========================================================================== */
33

    
34
/*
35
 * 1. Allow items to wrap into the next line
36
 * 2. Gutter
37
 * 3. Reset lists
38
 */
39

    
40
.uk-tab {
41
    display: -ms-flexbox;
42
    display: -webkit-flex;
43
    display: flex;
44
    /* 1 */
45
    -ms-flex-wrap: wrap;
46
    -webkit-flex-wrap: wrap;
47
    flex-wrap: wrap;
48
    /* 2 */
49
    margin-left: -@tab-margin-horizontal;
50
    /* 3 */
51
    padding: 0;
52
    list-style: none;
53
    .hook-tab;
54
}
55

    
56
/*
57
 * 1. Space is allocated solely based on content dimensions: 0 0 auto
58
 * 2. Gutter
59
 * 3. Create position context for dropdowns
60
 */
61

    
62
.uk-tab > * {
63
    /* 1 */
64
    -ms-flex: none;
65
    -webkit-flex: none;
66
    flex: none;
67
    /* 2 */
68
    padding-left: @tab-margin-horizontal;
69
    /* 3 */
70
    position: relative;
71
}
72

    
73

    
74
/* Items
75
 ========================================================================== */
76

    
77
/*
78
 * Items must target `a` elements to exclude other elements (e.g. dropdowns)
79
 * 1. Center text if a width is set
80
 * 2. Style
81
 */
82

    
83
.uk-tab > * > a {
84
    /* 1 */
85
    display: block;
86
    text-align: center;
87
    /* 2 */
88
    padding: @tab-item-padding-vertical @tab-item-padding-horizontal;
89
    color: @tab-item-color;
90
    .hook-tab-item;
91
}
92

    
93
/* Hover + Focus */
94
.uk-tab > * > a:hover,
95
.uk-tab > * > a:focus {
96
    color: @tab-item-hover-color;
97
    text-decoration: @tab-item-hover-text-decoration;
98
    .hook-tab-item-hover;
99
}
100

    
101
/* Active */
102
.uk-tab > .uk-active > a {
103
    color: @tab-item-active-color;
104
    .hook-tab-item-active;
105
}
106

    
107
/* Disabled */
108
.uk-tab > .uk-disabled > a {
109
    color: @tab-item-disabled-color;
110
    .hook-tab-item-disabled;
111
}
112

    
113

    
114
/* Position modifier
115
 ========================================================================== */
116

    
117
/*
118
 * Bottom
119
 */
120

    
121
.uk-tab-bottom {
122
    .hook-tab-bottom;
123
}
124

    
125
.uk-tab-bottom > * > a {
126
    .hook-tab-bottom-item;
127
}
128

    
129
/*
130
 * Left + Right
131
 * 1. Reset Gutter
132
 */
133

    
134
.uk-tab-left,
135
.uk-tab-right {
136
    -ms-flex-direction: column;
137
    -webkit-flex-direction: column;
138
    flex-direction: column;
139
    /* 1 */
140
    margin-left: 0;
141
}
142

    
143
/* 1 */
144
.uk-tab-left > *,
145
.uk-tab-right > * { padding-left: 0; }
146

    
147
.uk-tab-left {
148
    .hook-tab-left;
149
}
150

    
151
.uk-tab-right {
152
    .hook-tab-right;
153
}
154

    
155
.uk-tab-left > * > a {
156
    text-align: right;
157
    .hook-tab-left-item;
158
}
159

    
160
.uk-tab-right > * > a {
161
    text-align: left;
162
    .hook-tab-right-item;
163
}
164

    
165

    
166
// Hooks
167
// ========================================================================
168

    
169
.hook-tab-misc;
170

    
171
.hook-tab() {}
172
.hook-tab-item() {}
173
.hook-tab-item-hover() {}
174
.hook-tab-item-active() {}
175
.hook-tab-item-disabled() {}
176
.hook-tab-bottom() {}
177
.hook-tab-bottom-item() {}
178
.hook-tab-left() {}
179
.hook-tab-left-item() {}
180
.hook-tab-right() {}
181
.hook-tab-right-item() {}
182
.hook-tab-misc() {}
183

    
184

    
185
// Inverse
186
// ========================================================================
187

    
188
@inverse-tab-item-color:                       @inverse-global-muted-color;
189
@inverse-tab-item-hover-color:                 @inverse-global-color;
190
@inverse-tab-item-active-color:                @inverse-global-emphasis-color;
191
@inverse-tab-item-disabled-color:              @inverse-global-muted-color;
192

    
193
.hook-inverse() {
194

    
195
    .uk-tab {
196
        .hook-inverse-tab;
197
    }
198

    
199
    .uk-tab > * > a {
200
        color: @inverse-tab-item-color;
201
        .hook-inverse-tab-item;
202
    }
203

    
204
    .uk-tab > * > a:hover,
205
    .uk-tab > * > a:focus{
206
        color: @inverse-tab-item-hover-color;
207
        .hook-inverse-tab-item-hover;
208
    }
209

    
210
    .uk-tab > .uk-active > a {
211
        color: @inverse-tab-item-active-color;
212
        .hook-inverse-tab-item-active;
213
    }
214

    
215
    .uk-tab > .uk-disabled > a {
216
        color: @inverse-tab-item-disabled-color;
217
        .hook-inverse-tab-item-disabled;
218
    }
219

    
220
}
221

    
222
.hook-inverse-tab() {}
223
.hook-inverse-tab-item() {}
224
.hook-inverse-tab-item-hover() {}
225
.hook-inverse-tab-item-active() {}
226
.hook-inverse-tab-item-disabled() {}
(56-56/66)