-
diff --git a/src/lib/tabs/tab-header.scss b/src/lib/tabs/tab-header.scss
index 801cd81c8..5cedf9c7b 100644
--- a/src/lib/tabs/tab-header.scss
+++ b/src/lib/tabs/tab-header.scss
@@ -2,7 +2,7 @@
display: flex;
}
-.mc-tab-header-pagination {
+.mc-tab-header__pagination {
position: relative;
display: none;
justify-content: center;
@@ -11,12 +11,12 @@
cursor: pointer;
z-index: 2;
- .mc-tab-header-pagination-controls-enabled & {
+ .mc-tab-header__pagination-controls_enabled & {
display: flex;
}
}
-.mc-tab-header-pagination-chevron {
+.mc-tab-header__pagination-chevron {
border-style: solid;
border-width: 2px 2px 0 0;
content: "";
@@ -25,31 +25,31 @@
}
// The pagination control that is displayed on the right side of the tab header.
-.mc-tab-header-pagination-after,
-.mc-tab-header-rtl .mc-tab-header-pagination-before {
+.mc-tab-header__pagination_after,
+.mc-tab-header_rtl .mc-tab-header__pagination_before {
padding-right: 4px;
- .mc-tab-header-pagination-chevron {
+ .mc-tab-header__pagination-chevron {
transform: rotate(45deg);
}
}
// The pagination control that is displayed on the left side of the tab header.
-.mc-tab-header-pagination-before,
-.mc-tab-header-rtl .mc-tab-header-pagination-after {
+.mc-tab-header__pagination_before,
+.mc-tab-header_rtl .mc-tab-header__pagination_after {
padding-left: 4px;
- .mc-tab-header-pagination-chevron {
+ .mc-tab-header__pagination-chevron {
transform: rotate(-135deg);
}
}
-.mc-tab-header-pagination-disabled {
+.mc-tab-header__pagination_disabled {
box-shadow: none;
cursor: default;
}
-.mc-tab-label-container {
+.mc-tab-header__content {
display: flex;
flex-grow: 1;
overflow: hidden;
@@ -62,7 +62,7 @@
transition: transform 500ms cubic-bezier(0.35, 0, 0.25, 1);
}
-.mc-tab-labels {
+.mc-tab-list__content {
display: flex;
.mc-tab-group_align-labels-center & {
diff --git a/src/lib/tabs/tab-header.ts b/src/lib/tabs/tab-header.ts
index b288ee6a8..77d04c78f 100644
--- a/src/lib/tabs/tab-header.ts
+++ b/src/lib/tabs/tab-header.ts
@@ -59,9 +59,9 @@ export class McTabHeaderBase {}
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'mc-tab-header',
- '[class.mc-tab-header-pagination-controls-enabled]':
+ '[class.mc-tab-header__pagination-controls_enabled]':
'showPaginationControls',
- '[class.mc-tab-header-rtl]': 'getLayoutDirection() == \'rtl\''
+ '[class.mc-tab-header_rtl]': 'getLayoutDirection() == \'rtl\''
}
})
export class McTabHeader extends McTabHeaderBase
diff --git a/src/lib/tabs/tab-label-wrapper.ts b/src/lib/tabs/tab-label-wrapper.ts
index d5381fa1c..0e01f8274 100644
--- a/src/lib/tabs/tab-label-wrapper.ts
+++ b/src/lib/tabs/tab-label-wrapper.ts
@@ -20,7 +20,7 @@ export const mcTabLabelWrapperMixinBase: CanDisableCtor &
selector: '[mcTabLabelWrapper]',
inputs: ['disabled'],
host: {
- '[class.mc-tab-disabled]': 'disabled',
+ '[class.mc-tab_disabled]': 'disabled',
'[attr.aria-disabled]': '!!disabled'
}
})
diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss b/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss
index 464fe46c5..a5352e079 100644
--- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss
+++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss
@@ -5,13 +5,13 @@
.mc-tab-nav-bar {
display: flex;
- &:not(.mc-tab-group-light) {
+ &:not(.mc-tab-group_light) {
.mc-tab-link {
@include tab-label;
}
}
- &.mc-tab-group-light {
+ &.mc-tab-group_light {
.mc-tab-link {
@include tab-label-light;
}
@@ -43,7 +43,7 @@
flex-grow: 1;
}
- &.mc-tab-disabled {
+ &.mc-tab_disabled {
// We use `pointer-events` to make the element unclickable when it's disabled, rather than
// preventing the default action through JS, because we can't prevent the action reliably
// due to other directives potentially registering their events earlier. This shouldn't cause
diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts
index 7ac74f996..1ae72ba8c 100644
--- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts
+++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts
@@ -69,19 +69,19 @@ describe('McTabNavBar', () => {
tabLink1.nativeElement.click();
fixture.detectChanges();
expect(
- tabLinkElements[0].classList.contains('mc-tab-label-active')
+ tabLinkElements[0].classList.contains('mc-tab-label_active')
).toBeTruthy();
expect(
- tabLinkElements[1].classList.contains('mc-tab-label-active')
+ tabLinkElements[1].classList.contains('mc-tab-label_active')
).toBeFalsy();
tabLink2.nativeElement.click();
fixture.detectChanges();
expect(
- tabLinkElements[0].classList.contains('mc-tab-label-active')
+ tabLinkElements[0].classList.contains('mc-tab-label_active')
).toBeFalsy();
expect(
- tabLinkElements[1].classList.contains('mc-tab-label-active')
+ tabLinkElements[1].classList.contains('mc-tab-label_active')
).toBeTruthy();
});
@@ -119,7 +119,7 @@ describe('McTabNavBar', () => {
expect(
tabLinkElements.every(
(tabLinkEl) =>
- !tabLinkEl.classList.contains('mc-tab-disabled')
+ !tabLinkEl.classList.contains('mc-tab_disabled')
)
).toBe(
true,
@@ -131,7 +131,7 @@ describe('McTabNavBar', () => {
expect(
tabLinkElements.every((tabLinkEl) =>
- tabLinkEl.classList.contains('mc-tab-disabled')
+ tabLinkEl.classList.contains('mc-tab_disabled')
)
).toBe(
true,
diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts
index d011d8a04..d00254585 100644
--- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts
+++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts
@@ -68,8 +68,8 @@ export const mcTabLinkMixinBase: HasTabIndexCtor &
'[attr.aria-current]': 'active',
'[attr.aria-disabled]': 'disabled.toString()',
'[attr.tabIndex]': 'tabIndex',
- '[class.mc-tab-disabled]': 'disabled',
- '[class.mc-tab-label-active]': 'active'
+ '[class.mc-tab_disabled]': 'disabled',
+ '[class.mc-tab-label_active]': 'active'
}
})
export class McTabLink extends mcTabLinkMixinBase
From 783e4a4d1d9dc80e3943a0e3976d4cd08dfcfd35 Mon Sep 17 00:00:00 2001
From: Stanislav Vladykov <112aden358@gmail.com>
Date: Wed, 12 Dec 2018 13:02:34 +0300
Subject: [PATCH 22/24] fix(tabs): fix after merge
---
src/lib/list/_list-theme.scss | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/lib/list/_list-theme.scss b/src/lib/list/_list-theme.scss
index ce742c3de..5424007f5 100644
--- a/src/lib/list/_list-theme.scss
+++ b/src/lib/list/_list-theme.scss
@@ -27,16 +27,10 @@
color: mc-color($foreground, text);
}
-<<<<<<< HEAD
- &.mc-focused {
- border-color: mc-color($primary, 500);
- }
-=======
.mc-list-option {
outline: none;
color: mc-color($foreground, text);
->>>>>>> master
&:hover,
&.mc-hovered {
From 4ff215dcabf4e1b422198cbf2857ab014b444424 Mon Sep 17 00:00:00 2001
From: Stanislav Vladykov <112aden358@gmail.com>
Date: Wed, 12 Dec 2018 13:09:23 +0300
Subject: [PATCH 23/24] fix(tabs): fix tslint
---
src/lib/tabs/tab-group.spec.ts | 2 ++
src/lib/tabs/tab-group.ts | 1 +
src/lib/tabs/tab-header.spec.ts | 1 +
src/lib/tabs/tab-header.ts | 14 +++++++++-----
src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts | 1 +
src/lib/tabs/tab-nav-bar/tab-nav-bar.ts | 1 +
6 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/lib/tabs/tab-group.spec.ts b/src/lib/tabs/tab-group.spec.ts
index 83f852b0c..21a111f56 100644
--- a/src/lib/tabs/tab-group.spec.ts
+++ b/src/lib/tabs/tab-group.spec.ts
@@ -1,3 +1,5 @@
+// tslint:disable:no-magic-numbers
+// tslint:disable:no-empty
import { CommonModule } from '@angular/common';
import { Component, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core';
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
diff --git a/src/lib/tabs/tab-group.ts b/src/lib/tabs/tab-group.ts
index af3271161..dc7f90d66 100644
--- a/src/lib/tabs/tab-group.ts
+++ b/src/lib/tabs/tab-group.ts
@@ -81,6 +81,7 @@ export const MC_TABS_CONFIG = new InjectionToken('MC_TABS_CONFIG');
// Boilerplate for applying mixins to McTabGroup.
/** @docs-private */
export class McTabGroupBase {
+ // tslint:disable-next-line:naming-convention
constructor(public _elementRef: ElementRef) { }
}
export const mcTabGroupMixinBase:
diff --git a/src/lib/tabs/tab-header.spec.ts b/src/lib/tabs/tab-header.spec.ts
index 5feb0b12c..80e21d679 100644
--- a/src/lib/tabs/tab-header.spec.ts
+++ b/src/lib/tabs/tab-header.spec.ts
@@ -1,3 +1,4 @@
+// tslint:disable:no-magic-numbers
import { CommonModule } from '@angular/common';
import { Component, ViewChild } from '@angular/core';
import {
diff --git a/src/lib/tabs/tab-header.ts b/src/lib/tabs/tab-header.ts
index 77d04c78f..0c7fd413a 100644
--- a/src/lib/tabs/tab-header.ts
+++ b/src/lib/tabs/tab-header.ts
@@ -27,6 +27,10 @@ import { takeUntil } from 'rxjs/operators';
import { McTabLabelWrapper } from './tab-label-wrapper';
+const VIEWPORT_THROTTLE_TIME = 150;
+const SCROLL_DISTANCE_DELIMITER = 3;
+
+
/**
* The directions that scrolling can go in when the header's tabs exceed the header width. 'After'
* will scroll the header towards the end of the tabs list and 'before' will scroll towards the
@@ -220,7 +224,7 @@ export class McTabHeader extends McTabHeaderBase
ngAfterContentInit() {
const dirChange = this.dir ? this.dir.change : observableOf(null);
- const resize = this.viewportRuler.change(150);
+ const resize = this.viewportRuler.change(VIEWPORT_THROTTLE_TIME);
const realign = () => {
this.updatePagination();
};
@@ -233,9 +237,9 @@ export class McTabHeader extends McTabHeaderBase
// Defer the first call in order to allow for slower browsers to lay out the elements.
// This helps in cases where the user lands directly on a page with paginated tabs.
- typeof requestAnimationFrame !== 'undefined'
- ? requestAnimationFrame(realign)
- : realign();
+ typeof requestAnimationFrame === undefined
+ ? realign()
+ : requestAnimationFrame(realign);
// On dir change or window resize, update the orientation of
// the key manager if the direction has changed.
@@ -362,7 +366,7 @@ export class McTabHeader extends McTabHeaderBase
// Move the scroll distance one-third the length of the tab list's viewport.
this.scrollDistance +=
- ((scrollDir === 'before' ? -1 : 1) * viewLength) / 3;
+ ((scrollDir === 'before' ? -1 : 1) * viewLength) / SCROLL_DISTANCE_DELIMITER;
}
/**
diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts
index 1ae72ba8c..d0970f4ca 100644
--- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts
+++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts
@@ -1,3 +1,4 @@
+// tslint:disable:no-magic-numbers
import { Component, ViewChild, ViewChildren, QueryList } from '@angular/core';
import {
async,
diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts
index d00254585..d8d8f4eeb 100644
--- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts
+++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts
@@ -25,6 +25,7 @@ import {
// Boilerplate for applying mixins to McTabNav.
/** @docs-private */
export class McTabNavBase {
+ // tslint:disable-next-line:naming-convention
constructor(public _elementRef: ElementRef) {}
}
export const mcTabNavMixinBase: CanColorCtor &
From 41e4bf0a7693a1f49c1100e40ccfc1c3d6035739 Mon Sep 17 00:00:00 2001
From: Stanislav Vladykov <112aden358@gmail.com>
Date: Wed, 12 Dec 2018 13:09:42 +0300
Subject: [PATCH 24/24] fix(tabs): fix stylelint
---
src/lib/tabs/_tabs-theme.scss | 34 ++++++++++----------
src/lib/tabs/tab-group.scss | 1 -
src/lib/tabs/tab-header.scss | 2 ++
src/lib/tabs/tab-nav-bar/tab-nav-bar.scss | 38 +++++++++++------------
4 files changed, 39 insertions(+), 36 deletions(-)
diff --git a/src/lib/tabs/_tabs-theme.scss b/src/lib/tabs/_tabs-theme.scss
index cec93d694..d37da7a01 100644
--- a/src/lib/tabs/_tabs-theme.scss
+++ b/src/lib/tabs/_tabs-theme.scss
@@ -35,22 +35,6 @@
.mc-tab-group,
.mc-tab-nav-bar {
- &:not(.mc-tab-group_light) {
- .mc-tab-label,
- .mc-tab-link {
- &.mc-tab-label_active {
- border: {
- color: $border-color;
- bottom-color: transparent;
- }
- }
-
- &:hover:not(.mc-tab-label_active) {
- background: mc-color($background, 'hover');
- }
- }
- }
-
&.mc-tab-group_light {
.mc-tab-label,
.mc-tab-link {
@@ -75,6 +59,24 @@
}
}
}
+
+ &:not(.mc-tab-group_light) {
+ /* stylelint-disable no-descending-specificity */
+ .mc-tab-label,
+ .mc-tab-link {
+ &.mc-tab-label_active {
+ border: {
+ color: $border-color;
+ bottom-color: transparent;
+ }
+ }
+
+ &:hover:not(.mc-tab-label_active) {
+ background: mc-color($background, 'hover');
+ }
+ }
+ /* stylelint-enable */
+ }
}
}
diff --git a/src/lib/tabs/tab-group.scss b/src/lib/tabs/tab-group.scss
index ed01d5aec..c0a184747 100644
--- a/src/lib/tabs/tab-group.scss
+++ b/src/lib/tabs/tab-group.scss
@@ -44,7 +44,6 @@
display: flex;
overflow: hidden;
position: relative;
- // transition: height $mc-tab-animation-duration $ease-in-out-curve-function;
}
// Wraps each tab body
diff --git a/src/lib/tabs/tab-header.scss b/src/lib/tabs/tab-header.scss
index 5cedf9c7b..62a9c4b6c 100644
--- a/src/lib/tabs/tab-header.scss
+++ b/src/lib/tabs/tab-header.scss
@@ -35,6 +35,7 @@
}
// The pagination control that is displayed on the left side of the tab header.
+/* stylelint-disable no-descending-specificity */
.mc-tab-header__pagination_before,
.mc-tab-header_rtl .mc-tab-header__pagination_after {
padding-left: 4px;
@@ -43,6 +44,7 @@
transform: rotate(-135deg);
}
}
+/* stylelint-enable */
.mc-tab-header__pagination_disabled {
box-shadow: none;
diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss b/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss
index a5352e079..89e64e701 100644
--- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss
+++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.scss
@@ -1,6 +1,25 @@
@import '../tabs-common';
@import '../tabs-theme';
+.mc-tab-link {
+ vertical-align: top;
+ text-decoration: none; // Removes anchor underline styling
+ -webkit-tap-highlight-color: transparent;
+
+ .mc-tab-group_stretch-labels & {
+ flex-basis: 0;
+ flex-grow: 1;
+ }
+
+ &.mc-tab_disabled {
+ // We use `pointer-events` to make the element unclickable when it's disabled, rather than
+ // preventing the default action through JS, because we can't prevent the action reliably
+ // due to other directives potentially registering their events earlier. This shouldn't cause
+ // the user to click through, because we always have a `.mc-tab-links` behind the link.
+ pointer-events: none;
+ }
+}
+
// Wraps the bar containing the anchors
.mc-tab-nav-bar {
display: flex;
@@ -32,22 +51,3 @@
justify-content: flex-end;
}
}
-
-.mc-tab-link {
- vertical-align: top;
- text-decoration: none; // Removes anchor underline styling
- -webkit-tap-highlight-color: transparent;
-
- .mc-tab-group_stretch-labels & {
- flex-basis: 0;
- flex-grow: 1;
- }
-
- &.mc-tab_disabled {
- // We use `pointer-events` to make the element unclickable when it's disabled, rather than
- // preventing the default action through JS, because we can't prevent the action reliably
- // due to other directives potentially registering their events earlier. This shouldn't cause
- // the user to click through, because we always have a `.mc-tab-links` behind the link.
- pointer-events: none;
- }
-}