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 !default;
20

    
21
$tab-item-padding-horizontal:             10px !default;
22
$tab-item-padding-vertical:               5px !default;
23
$tab-item-color:                          $global-muted-color !default;
24
$tab-item-hover-color:                    $global-color !default;
25
$tab-item-hover-text-decoration:          none !default;
26
$tab-item-active-color:                   $global-emphasis-color !default;
27
$tab-item-disabled-color:                 $global-muted-color !default;
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
    @if(mixin-exists(hook-tab)) {@include 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
    @if(mixin-exists(hook-tab-item)) {@include 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
    @if(mixin-exists(hook-tab-item-hover)) {@include hook-tab-item-hover();}
99
}
100

    
101
/* Active */
102
.uk-tab > .uk-active > a {
103
    color: $tab-item-active-color;
104
    @if(mixin-exists(hook-tab-item-active)) {@include hook-tab-item-active();}
105
}
106

    
107
/* Disabled */
108
.uk-tab > .uk-disabled > a {
109
    color: $tab-item-disabled-color;
110
    @if(mixin-exists(hook-tab-item-disabled)) {@include hook-tab-item-disabled();}
111
}
112

    
113

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

    
117
/*
118
 * Bottom
119
 */
120

    
121
.uk-tab-bottom {
122
    @if(mixin-exists(hook-tab-bottom)) {@include hook-tab-bottom();}
123
}
124

    
125
.uk-tab-bottom > * > a {
126
    @if(mixin-exists(hook-tab-bottom-item)) {@include 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
    @if(mixin-exists(hook-tab-left)) {@include hook-tab-left();}
149
}
150

    
151
.uk-tab-right {
152
    @if(mixin-exists(hook-tab-right)) {@include hook-tab-right();}
153
}
154

    
155
.uk-tab-left > * > a {
156
    text-align: right;
157
    @if(mixin-exists(hook-tab-left-item)) {@include hook-tab-left-item();}
158
}
159

    
160
.uk-tab-right > * > a {
161
    text-align: left;
162
    @if(mixin-exists(hook-tab-right-item)) {@include hook-tab-right-item();}
163
}
164

    
165

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

    
169
@if(mixin-exists(hook-tab-misc)) {@include hook-tab-misc();}
170

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

    
184

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

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

    
193

    
194

    
195
// @mixin hook-inverse-tab(){}
196
// @mixin hook-inverse-tab-item(){}
197
// @mixin hook-inverse-tab-item-hover(){}
198
// @mixin hook-inverse-tab-item-active(){}
199
// @mixin hook-inverse-tab-item-disabled(){}
(56-56/66)