Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
13542 anikendra 1
/**
2
 * Tabs
3
 * --------------------------------------------------
4
 * A navigation bar with any number of tab items supported.
5
 */
6
 
7
.tabs {
8
  @include display-flex();
9
  @include flex-direction(horizontal);
10
  @include justify-content(center);
11
  @include translate3d(0,0,0);
12
 
13
  @include tab-style($tabs-default-bg, $tabs-default-border, $tabs-default-text);
14
  @include tab-badge-style($tabs-default-text, $tabs-default-bg);
15
 
16
  position: absolute;
17
  bottom: 0;
18
 
19
  z-index: $z-index-tabs;
20
 
21
  width: 100%;
22
  height: $tabs-height;
23
 
24
  border-style: solid;
25
  border-top-width: 1px;
26
 
27
  background-size: 0;
28
  line-height: $tabs-height;
29
 
30
  @media (min--moz-device-pixel-ratio: 1.5),
31
         (-webkit-min-device-pixel-ratio: 1.5),
32
         (min-device-pixel-ratio: 1.5),
33
         (min-resolution: 144dpi),
34
         (min-resolution: 1.5dppx) {
35
    padding-top: 2px;
36
    border-top: none !important;
37
    border-bottom: none;
38
    background-position: top;
39
    background-size: 100% 1px;
40
    background-repeat: no-repeat;
41
  }
42
 
43
}
44
/* Allow parent element of tabs to define color, or just the tab itself */
45
.tabs-light > .tabs,
46
.tabs.tabs-light {
47
  @include tab-style($tabs-light-bg, $tabs-light-border, $tabs-light-text);
48
  @include tab-badge-style($tabs-light-text, $tabs-light-bg);
49
}
50
.tabs-stable > .tabs,
51
.tabs.tabs-stable {
52
  @include tab-style($tabs-stable-bg, $tabs-stable-border, $tabs-stable-text);
53
  @include tab-badge-style($tabs-stable-text, $tabs-stable-bg);
54
}
55
.tabs-positive > .tabs,
56
.tabs.tabs-positive {
57
  @include tab-style($tabs-positive-bg, $tabs-positive-border, $tabs-positive-text);
58
  @include tab-badge-style($tabs-positive-text, $tabs-positive-bg);
59
}
60
.tabs-calm > .tabs,
61
.tabs.tabs-calm {
62
  @include tab-style($tabs-calm-bg, $tabs-calm-border, $tabs-calm-text);
63
  @include tab-badge-style($tabs-calm-text, $tabs-calm-bg);
64
}
65
.tabs-assertive > .tabs,
66
.tabs.tabs-assertive {
67
  @include tab-style($tabs-assertive-bg, $tabs-assertive-border, $tabs-assertive-text);
68
  @include tab-badge-style($tabs-assertive-text, $tabs-assertive-bg);
69
}
70
.tabs-balanced > .tabs,
71
.tabs.tabs-balanced {
72
  @include tab-style($tabs-balanced-bg, $tabs-balanced-border, $tabs-balanced-text);
73
  @include tab-badge-style($tabs-balanced-text, $tabs-balanced-bg);
74
}
75
.tabs-energized > .tabs,
76
.tabs.tabs-energized {
77
  @include tab-style($tabs-energized-bg, $tabs-energized-border, $tabs-energized-text);
78
  @include tab-badge-style($tabs-energized-text, $tabs-energized-bg);
79
}
80
.tabs-royal > .tabs,
81
.tabs.tabs-royal {
82
  @include tab-style($tabs-royal-bg, $tabs-royal-border, $tabs-royal-text);
83
  @include tab-badge-style($tabs-royal-text, $tabs-royal-bg);
84
}
85
.tabs-dark > .tabs,
86
.tabs.tabs-dark {
87
  @include tab-style($tabs-dark-bg, $tabs-dark-border, $tabs-dark-text);
88
  @include tab-badge-style($tabs-dark-text, $tabs-dark-bg);
89
}
90
 
91
@mixin tabs-striped($style, $color, $background) {
92
  &.#{$style} {
93
    .tabs{
94
      background-color: $background;
95
    }
96
    .tab-item {
97
      color: rgba($color, $tabs-striped-off-opacity);
98
      opacity: 1;
99
      .badge{
100
        opacity:$tabs-striped-off-opacity;
101
      }
102
      &.tab-item-active,
103
      &.active,
104
      &.activated {
105
        margin-top: -$tabs-striped-border-width;
106
        color: $color;
107
        border-style: solid;
108
        border-width: $tabs-striped-border-width 0 0 0;
109
        border-color: $color;
110
      }
111
    }
112
  }
113
  &.tabs-top{
114
    .tab-item {
115
      &.tab-item-active,
116
      &.active,
117
      &.activated {
118
        .badge {
119
          top: 4%;
120
        }
121
      }
122
    }
123
  }
124
}
125
 
126
@mixin tabs-background($style, $color, $border-color) {
127
  .#{$style} {
128
    .tabs,
129
    &> .tabs{
130
      background-color: $color;
131
      background-image: linear-gradient(0deg, $border-color, $border-color 50%, transparent 50%);
132
      border-color: $border-color;
133
    }
134
  }
135
}
136
 
137
@mixin tabs-striped-background($style, $color) {
138
  &.#{$style} {
139
    .tabs {
140
      background-color: $color;
141
      background-image:none;
142
    }
143
  }
144
}
145
 
146
@mixin tabs-color($style, $color) {
147
  .#{$style} {
148
    .tab-item {
149
      color: rgba($color, $tabs-off-opacity);
150
      opacity: 1;
151
      .badge{
152
        opacity:$tabs-off-opacity;
153
      }
154
      &.tab-item-active,
155
      &.active,
156
      &.activated {
157
        color: $color;
158
        border: 0 solid $color;
159
        .badge{
160
          opacity: 1;
161
        }
162
      }
163
    }
164
  }
165
}
166
 
167
@mixin tabs-striped-color($style, $color) {
168
  &.#{$style} {
169
    .tab-item {
170
      color: rgba($color, $tabs-striped-off-opacity);
171
      opacity: 1;
172
      .badge{
173
        opacity:$tabs-striped-off-opacity;
174
      }
175
      &.tab-item-active,
176
      &.active,
177
      &.activated {
178
        margin-top: -$tabs-striped-border-width;
179
        color: $color;
180
        border: 0 solid $color;
181
        border-top-width: $tabs-striped-border-width;
182
        .badge{
183
          top:$tabs-striped-border-width;
184
          opacity: 1;
185
        }
186
      }
187
    }
188
  }
189
}
190
 
191
.tabs-striped {
192
  .tabs {
193
    background-color: white;
194
    background-image: none;
195
    border: none;
196
    border-bottom: 1px solid #ddd;
197
    padding-top: $tabs-striped-border-width;
198
  }
199
  .tab-item {
200
    // default android tab style
201
    &.tab-item-active,
202
    &.active,
203
    &.activated {
204
      margin-top: -$tabs-striped-border-width;
205
      border-style: solid;
206
      border-width: $tabs-striped-border-width 0 0 0;
207
      border-color: $dark;
208
      .badge{
209
        top:$tabs-striped-border-width;
210
        opacity: 1;
211
      }
212
    }
213
  }
214
  @include tabs-striped('tabs-light', $dark, $light);
215
  @include tabs-striped('tabs-stable', $dark, $stable);
216
  @include tabs-striped('tabs-positive', $light, $positive);
217
  @include tabs-striped('tabs-calm', $light, $calm);
218
  @include tabs-striped('tabs-assertive', $light, $assertive);
219
  @include tabs-striped('tabs-balanced', $light, $balanced);
220
  @include tabs-striped('tabs-energized', $light, $energized);
221
  @include tabs-striped('tabs-royal', $light, $royal);
222
  @include tabs-striped('tabs-dark', $light, $dark);
223
 
224
  // doing this twice so striped tabs styles don't override specific bg and color vals
225
  @include tabs-striped-background('tabs-background-light', $light);
226
  @include tabs-striped-background('tabs-background-stable', $stable);
227
  @include tabs-striped-background('tabs-background-positive', $positive);
228
  @include tabs-striped-background('tabs-background-calm', $calm);
229
  @include tabs-striped-background('tabs-background-assertive', $assertive);
230
  @include tabs-striped-background('tabs-background-balanced', $balanced);
231
  @include tabs-striped-background('tabs-background-energized',$energized);
232
  @include tabs-striped-background('tabs-background-royal', $royal);
233
  @include tabs-striped-background('tabs-background-dark', $dark);
234
 
235
  @include tabs-striped-color('tabs-color-light', $light);
236
  @include tabs-striped-color('tabs-color-stable', $stable);
237
  @include tabs-striped-color('tabs-color-positive', $positive);
238
  @include tabs-striped-color('tabs-color-calm', $calm);
239
  @include tabs-striped-color('tabs-color-assertive', $assertive);
240
  @include tabs-striped-color('tabs-color-balanced', $balanced);
241
  @include tabs-striped-color('tabs-color-energized',$energized);
242
  @include tabs-striped-color('tabs-color-royal', $royal);
243
  @include tabs-striped-color('tabs-color-dark', $dark);
244
 
245
}
246
 
247
@include tabs-background('tabs-background-light', $light, $bar-light-border);
248
@include tabs-background('tabs-background-stable', $stable, $bar-stable-border);
249
@include tabs-background('tabs-background-positive', $positive, $bar-positive-border);
250
@include tabs-background('tabs-background-calm', $calm, $bar-calm-border);
251
@include tabs-background('tabs-background-assertive', $assertive, $bar-assertive-border);
252
@include tabs-background('tabs-background-balanced', $balanced, $bar-balanced-border);
253
@include tabs-background('tabs-background-energized',$energized, $bar-energized-border);
254
@include tabs-background('tabs-background-royal', $royal, $bar-royal-border);
255
@include tabs-background('tabs-background-dark', $dark, $bar-dark-border);
256
 
257
@include tabs-color('tabs-color-light', $light);
258
@include tabs-color('tabs-color-stable', $stable);
259
@include tabs-color('tabs-color-positive', $positive);
260
@include tabs-color('tabs-color-calm', $calm);
261
@include tabs-color('tabs-color-assertive', $assertive);
262
@include tabs-color('tabs-color-balanced', $balanced);
263
@include tabs-color('tabs-color-energized',$energized);
264
@include tabs-color('tabs-color-royal', $royal);
265
@include tabs-color('tabs-color-dark', $dark);
266
 
267
@mixin tabs-standard-color($style, $color, $off-color:$dark) {
268
  &.#{$style} {
269
    .tab-item {
270
      color: $off-color;
271
      &.tab-item-active,
272
      &.active,
273
      &.activated {
274
        color: $color;
275
      }
276
    }
277
  }
278
}
279
 
280
ion-tabs {
281
  @include tabs-standard-color('tabs-color-active-light', $light, $dark);
282
  @include tabs-standard-color('tabs-color-active-stable', $stable, $dark);
283
  @include tabs-standard-color('tabs-color-active-positive', $positive, $dark);
284
  @include tabs-standard-color('tabs-color-active-calm', $calm, $dark);
285
  @include tabs-standard-color('tabs-color-active-assertive', $assertive, $dark);
286
  @include tabs-standard-color('tabs-color-active-balanced', $balanced, $dark);
287
  @include tabs-standard-color('tabs-color-active-energized',$energized, $dark);
288
  @include tabs-standard-color('tabs-color-active-royal', $royal, $dark);
289
  @include tabs-standard-color('tabs-color-active-dark', $dark, $light);
290
}
291
 
292
.tabs-top {
293
  &.tabs-striped {
294
    padding-bottom:0;
295
    .tab-item{
296
      background: transparent;
297
      // animate the top bar, leave bottom for platform consistency
298
      -webkit-transition: all .1s ease;
299
      -moz-transition: all .1s ease;
300
      -ms-transition: all .1s ease;
301
      -o-transition: all .1s ease;
302
      transition: all .1s ease;
303
      &.tab-item-active,
304
      &.active,
305
      &.activated {
306
        margin-top: 0;
307
        margin-bottom: -$tabs-striped-border-width;
308
        border-width: 0px 0px $tabs-striped-border-width 0px !important;
309
        border-style: solid;
310
      }
311
      .badge{
312
        -webkit-transition: all .2s ease;
313
        -moz-transition: all .2s ease;
314
        -ms-transition: all .2s ease;
315
        -o-transition: all .2s ease;
316
        transition: all .2s ease;
317
      }
318
    }
319
  }
320
}
321
 
322
/* Allow parent element to have tabs-top */
323
/* If you change this, change platform.scss as well */
324
.tabs-top > .tabs,
325
.tabs.tabs-top {
326
  top: $bar-height;
327
  padding-top: 0;
328
  background-position: bottom;
329
  border-top-width: 0;
330
  border-bottom-width: 1px;
331
  .tab-item {
332
    &.tab-item-active,
333
    &.active,
334
    &.activated {
335
      .badge {
336
        top: 4%;
337
      }
338
    }
339
  }
340
}
341
.tabs-top ~ .bar-header {
342
  border-bottom-width: 0;
343
}
344
 
345
.tab-item {
346
  @include flex(1);
347
  display: block;
348
  overflow: hidden;
349
 
350
  max-width: $tab-item-max-width;
351
  height: 100%;
352
 
353
  color: inherit;
354
  text-align: center;
355
  text-decoration: none;
356
  text-overflow: ellipsis;
357
  white-space: nowrap;
358
 
359
  font-weight: 400;
360
  font-size: $tabs-text-font-size;
361
  font-family: $font-family-sans-serif;
362
 
363
  opacity: 0.7;
364
 
365
  &:hover {
366
    cursor: pointer;
367
  }
368
  &.tab-hidden{
369
    display:none;
370
  }
371
}
372
 
373
.tabs-item-hide > .tabs,
374
.tabs.tabs-item-hide {
375
  display: none;
376
}
377
 
378
.tabs-icon-top > .tabs .tab-item,
379
.tabs-icon-top.tabs .tab-item,
380
.tabs-icon-bottom > .tabs .tab-item,
381
.tabs-icon-bottom.tabs .tab-item {
382
  font-size: $tabs-text-font-size-side-icon;
383
  line-height: $tabs-text-font-size;
384
}
385
 
386
.tab-item .icon {
387
  display: block;
388
  margin: 0 auto;
389
  height: $tabs-icon-size;
390
  font-size: $tabs-icon-size;
391
}
392
 
393
.tabs-icon-left.tabs .tab-item,
394
.tabs-icon-left > .tabs .tab-item,
395
.tabs-icon-right.tabs .tab-item,
396
.tabs-icon-right > .tabs .tab-item {
397
  font-size: $tabs-text-font-size-side-icon;
398
 
399
  .icon {
400
    display: inline-block;
401
    vertical-align: top;
402
    margin-top: -.1em;
403
 
404
    &:before {
405
    font-size: $tabs-icon-size - 8;
406
    line-height: $tabs-height;
407
    }
408
  }
409
}
410
 
411
.tabs-icon-left > .tabs .tab-item .icon,
412
.tabs-icon-left.tabs .tab-item .icon {
413
  padding-right: 3px;
414
}
415
 
416
.tabs-icon-right > .tabs .tab-item .icon,
417
.tabs-icon-right.tabs .tab-item .icon {
418
  padding-left: 3px;
419
}
420
 
421
.tabs-icon-only > .tabs .icon,
422
.tabs-icon-only.tabs .icon {
423
  line-height: inherit;
424
}
425
 
426
 
427
.tab-item.has-badge {
428
  position: relative;
429
}
430
 
431
.tab-item .badge {
432
  position: absolute;
433
  top: 4%;
434
  right: 33%; // fallback
435
  right: calc(50% - 26px);
436
  padding: $tabs-badge-padding;
437
  height: auto;
438
  font-size: $tabs-badge-font-size;
439
  line-height: $tabs-badge-font-size + 4;
440
}
441
 
442
 
443
/* Navigational tab */
444
 
445
/* Active state for tab */
446
.tab-item.tab-item-active,
447
.tab-item.active,
448
.tab-item.activated {
449
  opacity: 1;
450
 
451
  &.tab-item-light {
452
    color: $light;
453
  }
454
  &.tab-item-stable {
455
    color: $stable;
456
  }
457
  &.tab-item-positive {
458
    color: $positive;
459
  }
460
  &.tab-item-calm {
461
    color: $calm;
462
  }
463
  &.tab-item-assertive {
464
    color: $assertive;
465
  }
466
  &.tab-item-balanced {
467
    color: $balanced;
468
  }
469
  &.tab-item-energized {
470
    color: $energized;
471
  }
472
  &.tab-item-royal {
473
    color: $royal;
474
  }
475
  &.tab-item-dark {
476
    color: $dark;
477
  }
478
}
479
 
480
.item.tabs {
481
  @include display-flex();
482
  padding: 0;
483
 
484
  .icon:before {
485
    position: relative;
486
  }
487
}
488
 
489
.tab-item.disabled,
490
.tab-item[disabled] {
491
  opacity: .4;
492
  cursor: default;
493
  pointer-events: none;
494
}