Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15747 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: color .1s ease;
299
      -moz-transition: color .1s ease;
300
      -ms-transition: color .1s ease;
301
      -o-transition: color .1s ease;
302
      transition: color .1s ease;
303
      &.tab-item-active,
304
      &.active,
305
      &.activated {
306
        margin-top: $tabs-striped-border-width - 1px;
307
        border-width: 0px 0px $tabs-striped-border-width 0px !important;
308
        border-style: solid;
309
        > .badge, > i{
310
          margin-top: -$tabs-striped-border-width + 1px;
311
        }
312
      }
313
      .badge{
314
        -webkit-transition: color .2s ease;
315
        -moz-transition: color .2s ease;
316
        -ms-transition: color .2s ease;
317
        -o-transition: color .2s ease;
318
        transition: color .2s ease;
319
      }
320
    }
321
  }
322
}
323
 
324
/* Allow parent element to have tabs-top */
325
/* If you change this, change platform.scss as well */
326
.tabs-top > .tabs,
327
.tabs.tabs-top {
328
  top: $bar-height;
329
  padding-top: 0;
330
  background-position: bottom;
331
  border-top-width: 0;
332
  border-bottom-width: 1px;
333
  .tab-item {
334
    &.tab-item-active,
335
    &.active,
336
    &.activated {
337
      .badge {
338
        top: 4%;
339
      }
340
    }
341
  }
342
}
343
.tabs-top ~ .bar-header {
344
  border-bottom-width: 0;
345
}
346
 
347
.tab-item {
348
  @include flex(1);
349
  display: block;
350
  overflow: hidden;
351
 
352
  max-width: $tab-item-max-width;
353
  height: 100%;
354
 
355
  color: inherit;
356
  text-align: center;
357
  text-decoration: none;
358
  text-overflow: ellipsis;
359
  white-space: nowrap;
360
 
361
  font-weight: 400;
362
  font-size: $tabs-text-font-size;
363
  font-family: $font-family-sans-serif;
364
 
365
  opacity: 0.7;
366
 
367
  &:hover {
368
    cursor: pointer;
369
  }
370
  &.tab-hidden{
371
    display:none;
372
  }
373
}
374
 
375
.tabs-item-hide > .tabs,
376
.tabs.tabs-item-hide {
377
  display: none;
378
}
379
 
380
.tabs-icon-top > .tabs .tab-item,
381
.tabs-icon-top.tabs .tab-item,
382
.tabs-icon-bottom > .tabs .tab-item,
383
.tabs-icon-bottom.tabs .tab-item {
384
  font-size: $tabs-text-font-size-side-icon;
385
  line-height: $tabs-text-font-size;
386
}
387
 
388
.tab-item .icon {
389
  display: block;
390
  margin: 0 auto;
391
  height: $tabs-icon-size;
392
  font-size: $tabs-icon-size;
393
}
394
 
395
.tabs-icon-left.tabs .tab-item,
396
.tabs-icon-left > .tabs .tab-item,
397
.tabs-icon-right.tabs .tab-item,
398
.tabs-icon-right > .tabs .tab-item {
399
  font-size: $tabs-text-font-size-side-icon;
400
 
401
  .icon {
402
    display: inline-block;
403
    vertical-align: top;
404
    margin-top: -.1em;
405
 
406
    &:before {
407
    font-size: $tabs-icon-size - 8;
408
    line-height: $tabs-height;
409
    }
410
  }
411
}
412
 
413
.tabs-icon-left > .tabs .tab-item .icon,
414
.tabs-icon-left.tabs .tab-item .icon {
415
  padding-right: 3px;
416
}
417
 
418
.tabs-icon-right > .tabs .tab-item .icon,
419
.tabs-icon-right.tabs .tab-item .icon {
420
  padding-left: 3px;
421
}
422
 
423
.tabs-icon-only > .tabs .icon,
424
.tabs-icon-only.tabs .icon {
425
  line-height: inherit;
426
}
427
 
428
 
429
.tab-item.has-badge {
430
  position: relative;
431
}
432
 
433
.tab-item .badge {
434
  position: absolute;
435
  top: 4%;
436
  right: 33%; // fallback
437
  right: calc(50% - 26px);
438
  padding: $tabs-badge-padding;
439
  height: auto;
440
  font-size: $tabs-badge-font-size;
441
  line-height: $tabs-badge-font-size + 4;
442
}
443
 
444
 
445
/* Navigational tab */
446
 
447
/* Active state for tab */
448
.tab-item.tab-item-active,
449
.tab-item.active,
450
.tab-item.activated {
451
  opacity: 1;
452
 
453
  &.tab-item-light {
454
    color: $light;
455
  }
456
  &.tab-item-stable {
457
    color: $stable;
458
  }
459
  &.tab-item-positive {
460
    color: $positive;
461
  }
462
  &.tab-item-calm {
463
    color: $calm;
464
  }
465
  &.tab-item-assertive {
466
    color: $assertive;
467
  }
468
  &.tab-item-balanced {
469
    color: $balanced;
470
  }
471
  &.tab-item-energized {
472
    color: $energized;
473
  }
474
  &.tab-item-royal {
475
    color: $royal;
476
  }
477
  &.tab-item-dark {
478
    color: $dark;
479
  }
480
}
481
 
482
.item.tabs {
483
  @include display-flex();
484
  padding: 0;
485
 
486
  .icon:before {
487
    position: relative;
488
  }
489
}
490
 
491
.tab-item.disabled,
492
.tab-item[disabled] {
493
  opacity: .4;
494
  cursor: default;
495
  pointer-events: none;
496
}