Skip to content

Commit cfc3373

Browse files
crisbetommalerba
authored andcommitted
chore: add scaffolding for mdc-based tabs (#16270)
Adds all of the scaffolding for the MDC-based tabs implementation. Relates to #16250.
1 parent c3eac17 commit cfc3373

32 files changed

+244
-0
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
# Note to implementer: please repossess
9494
/src/material-experimental/mdc-radio/** @mmalerba
9595
/src/material-experimental/mdc-slide-toggle/** @crisbeto
96+
/src/material-experimental/mdc-tabs/** @crisbeto
9697
/src/material-experimental/popover-edit/** @kseamon @andrewseguin
9798

9899
# CDK experimental package
@@ -146,6 +147,7 @@
146147
# Note to implementer: please repossess
147148
/src/dev-app/mdc-radio/** @mmalerba
148149
/src/dev-app/mdc-slide-toggle/** @crisbeto
150+
/src/dev-app/mdc-tabs/** @crisbeto
149151
/src/dev-app/menu/** @crisbeto
150152
/src/dev-app/overlay/** @jelbourn @crisbeto
151153
/src/dev-app/paginator/** @andrewseguin
@@ -196,6 +198,7 @@
196198
# Note to implementer: please repossess
197199
/src/e2e-app/mdc-radio/** @mmalerba
198200
/src/e2e-app/mdc-slide-toggle/** @crisbeto
201+
/src/e2e-app/mdc-tabs/** @crisbeto
199202
/src/e2e-app/menu/** @crisbeto
200203
/src/e2e-app/progress-bar/** @jelbourn @crisbeto @josephperrott
201204
/src/e2e-app/progress-spinner/** @jelbourn @crisbeto @josephperrott

packages.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ MATERIAL_EXPERIMENTAL_PACKAGES = [
8585
"mdc-card",
8686
"mdc-checkbox",
8787
"mdc-chips",
88+
"mdc-tabs",
8889
"mdc-helpers",
8990
"mdc-menu",
9091
"mdc-radio",

src/dev-app/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ ng_module(
4848
"//src/material-experimental/mdc-menu",
4949
"//src/material-experimental/mdc-radio",
5050
"//src/material-experimental/mdc-slide-toggle",
51+
"//src/material-experimental/mdc-tabs",
5152
"//src/material-examples:examples",
5253
] + CDK_TARGETS + CDK_EXPERIMENTAL_TARGETS + MATERIAL_TARGETS + MATERIAL_EXPERIMENTAL_TARGETS,
5354
)

src/dev-app/dev-app/dev-app-layout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export class DevAppLayout {
7575
{name: 'MDC Chips', route: '/mdc-chips'},
7676
{name: 'MDC Menu', route: '/mdc-menu'},
7777
{name: 'MDC Radio', route: '/mdc-radio'},
78+
{name: 'MDC Tabs', route: '/mdc-tabs'},
7879
{name: 'MDC Slide Toggle', route: '/mdc-slide-toggle'},
7980

8081
];

src/dev-app/dev-app/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const DEV_APP_ROUTES: Routes = [
6161
path: 'mdc-slide-toggle',
6262
loadChildren: 'mdc-slide-toggle/mdc-slide-toggle-demo-module#MdcSlideToggleDemoModule'
6363
},
64+
{path: 'mdc-tabs', loadChildren: 'mdc-tabs/mdc-tabs-demo-module#MdcTabsDemoModule'},
6465
{path: 'menu', loadChildren: 'menu/menu-demo-module#MenuDemoModule'},
6566
{path: 'paginator', loadChildren: 'paginator/paginator-demo-module#PaginatorDemoModule'},
6667
{path: 'platform', loadChildren: 'platform/platform-demo-module#PlatformDemoModule'},
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {NgModule} from '@angular/core';
10+
import {MatTabsModule} from '@angular/material-experimental/mdc-tabs';
11+
import {RouterModule} from '@angular/router';
12+
import {MdcTabsDemo} from './mdc-tabs-demo';
13+
14+
@NgModule({
15+
imports: [
16+
MatTabsModule,
17+
RouterModule.forChild([{path: '', component: MdcTabsDemo}]),
18+
],
19+
declarations: [MdcTabsDemo],
20+
})
21+
export class MdcTabsDemoModule {
22+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- TODO: copy in demo template from existing tabs demo. -->
2+
Not yet implemented.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// TODO: copy in demo styles from existing tabs demo.

src/dev-app/mdc-tabs/mdc-tabs-demo.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {Component} from '@angular/core';
10+
11+
@Component({
12+
moduleId: module.id,
13+
selector: 'mdc-tabs-demo',
14+
templateUrl: 'mdc-tabs-demo.html',
15+
styleUrls: ['mdc-tabs-demo.css'],
16+
})
17+
export class MdcTabsDemo {
18+
}

src/dev-app/system-config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ System.config({
148148
'dist/packages/material-experimental/mdc-radio/index.js',
149149
'@angular/material-experimental/mdc-slide-toggle':
150150
'dist/packages/material-experimental/mdc-slide-toggle/index.js',
151+
'@angular/material-experimental/mdc-tabs':
152+
'dist/packages/material-experimental/mdc-tabs/index.js',
151153
'@angular/material-experimental/mdc-helpers':
152154
'dist/packages/material-experimental/mdc-helpers/index.js',
153155
'@angular/material-experimental/popover-edit':

src/dev-app/theme.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@import '../material-experimental/mdc-menu/mdc-menu';
88
@import '../material-experimental/mdc-radio/mdc-radio';
99
@import '../material-experimental/mdc-slide-toggle/mdc-slide-toggle';
10+
@import '../material-experimental/mdc-tabs/mdc-tabs';
1011
@import '../material-experimental/popover-edit/popover-edit';
1112

1213
// Plus imports for other components in your app.
@@ -24,6 +25,7 @@
2425
@include mat-menu-typography-mdc(mat-typography-config());
2526
@include mat-radio-typography-mdc(mat-typography-config());
2627
@include mat-slide-toggle-typography-mdc(mat-typography-config());
28+
@include mat-tabs-typography-mdc(mat-typography-config());
2729

2830
// Define the default theme (same as the example above).
2931
$candy-app-primary: mat-palette($mat-indigo);
@@ -41,6 +43,7 @@ $candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-accent);
4143
@include mat-menu-theme-mdc($candy-app-theme);
4244
@include mat-radio-theme-mdc($candy-app-theme);
4345
@include mat-slide-toggle-theme-mdc($candy-app-theme);
46+
@include mat-tabs-theme-mdc($candy-app-theme);
4447
@include mat-edit-theme($candy-app-theme);
4548
@include mat-edit-typography(mat-typography-config());
4649
// Define an alternate dark theme.
@@ -64,5 +67,6 @@ $dark-theme: mat-dark-theme($dark-primary, $dark-accent, $dark-warn);
6467
@include mat-menu-theme-mdc($dark-theme);
6568
@include mat-radio-theme-mdc($dark-theme);
6669
@include mat-slide-toggle-theme-mdc($dark-theme);
70+
@include mat-tabs-theme-mdc($dark-theme);
6771
@include mat-edit-theme($dark-theme);
6872
}

src/e2e-app/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ng_module(
3838
"//src/material-experimental/mdc-menu",
3939
"//src/material-experimental/mdc-radio",
4040
"//src/material-experimental/mdc-slide-toggle",
41+
"//src/material-experimental/mdc-tabs",
4142
"//src/material/button",
4243
"//src/material/checkbox",
4344
"//src/material/core",
@@ -78,6 +79,7 @@ sass_binary(
7879
"//src/material-experimental/mdc-menu:mdc_menu_scss_lib",
7980
"//src/material-experimental/mdc-radio:mdc_radio_scss_lib",
8081
"//src/material-experimental/mdc-slide-toggle:mdc_slide_toggle_scss_lib",
82+
"//src/material-experimental/mdc-tabs:mdc_tabs_scss_lib",
8183
"//src/material/core:all_themes",
8284
],
8385
)

src/e2e-app/e2e-app/e2e-app-layout.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<a mat-list-item [routerLink]="['mdc-menu']">MDC Menu</a>
3131
<a mat-list-item [routerLink]="['mdc-radio']">MDC Radio</a>
3232
<a mat-list-item [routerLink]="['mdc-slide-toggle']">MDC Slide Toggle</a>
33+
<a mat-list-item [routerLink]="['mdc-tabs']">MDC Tabs</a>
3334
</mat-nav-list>
3435

3536
<main>

src/e2e-app/e2e-app/routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {MdcChipsE2e} from '../mdc-chips/mdc-chips-e2e';
1818
import {MdcMenuE2e} from '../mdc-menu/mdc-menu-e2e';
1919
import {MdcRadioE2e} from '../mdc-radio/mdc-radio-e2e';
2020
import {MdcSlideToggleE2e} from '../mdc-slide-toggle/mdc-slide-toggle-e2e';
21+
import {MdcTabsE2e} from '../mdc-tabs/mdc-tabs-e2e';
2122
import {MenuE2E} from '../menu/menu-e2e';
2223
import {ProgressBarE2E} from '../progress-bar/progress-bar-e2e';
2324
import {ProgressSpinnerE2E} from '../progress-spinner/progress-spinner-e2e';
@@ -51,6 +52,7 @@ export const E2E_APP_ROUTES: Routes = [
5152
{path: 'mdc-menu', component: MdcMenuE2e},
5253
{path: 'mdc-radio', component: MdcRadioE2e},
5354
{path: 'mdc-slide-toggle', component: MdcSlideToggleE2e},
55+
{path: 'mdc-tabs', component: MdcTabsE2e},
5456
{path: 'menu', component: MenuE2E},
5557
{path: 'progress-bar', component: ProgressBarE2E},
5658
{path: 'progress-spinner', component: ProgressSpinnerE2E},

src/e2e-app/main-module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {MdcChipsE2eModule} from './mdc-chips/mdc-chips-e2e-module';
2626
import {MdcMenuE2eModule} from './mdc-menu/mdc-menu-e2e-module';
2727
import {MdcRadioE2eModule} from './mdc-radio/mdc-radio-e2e-module';
2828
import {MdcSlideToggleE2eModule} from './mdc-slide-toggle/mdc-slide-toggle-e2e-module';
29+
import {MdcTabsE2eModule} from './mdc-tabs/mdc-tabs-e2e-module';
2930
import {MenuE2eModule} from './menu/menu-e2e-module';
3031
import {ProgressBarE2eModule} from './progress-bar/progress-bar-e2e-module';
3132
import {ProgressSpinnerE2eModule} from './progress-spinner/progress-spinner-e2e-module';
@@ -64,6 +65,7 @@ import {VirtualScrollE2eModule} from './virtual-scroll/virtual-scroll-e2e-module
6465
MdcMenuE2eModule,
6566
MdcRadioE2eModule,
6667
MdcSlideToggleE2eModule,
68+
MdcTabsE2eModule,
6769
MenuE2eModule,
6870
ProgressBarE2eModule,
6971
ProgressSpinnerE2eModule,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {NgModule} from '@angular/core';
10+
import {MatTabsModule} from '@angular/material-experimental/mdc-tabs';
11+
import {MdcTabsE2e} from './mdc-tabs-e2e';
12+
13+
@NgModule({
14+
imports: [MatTabsModule],
15+
declarations: [MdcTabsE2e],
16+
})
17+
export class MdcTabsE2eModule {
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- TODO: copy implementation from existing tabs e2e page. -->

src/e2e-app/mdc-tabs/mdc-tabs-e2e.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {Component} from '@angular/core';
10+
11+
@Component({
12+
moduleId: module.id,
13+
selector: 'mdc-tabs-e2e',
14+
templateUrl: 'mdc-tabs-e2e.html',
15+
})
16+
export class MdcTabsE2e {
17+
// TODO: copy implementation from existing tabs e2e page.
18+
}

src/e2e-app/theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@import '../material-experimental/mdc-menu/mdc-menu';
88
@import '../material-experimental/mdc-radio/mdc-radio';
99
@import '../material-experimental/mdc-slide-toggle/mdc-slide-toggle';
10+
@import '../material-experimental/mdc-tabs/mdc-tabs';
1011

1112
// Plus imports for other components in your app.
1213

@@ -23,6 +24,7 @@
2324
@include mat-menu-typography-mdc(mat-typography-config());
2425
@include mat-radio-typography-mdc(mat-typography-config());
2526
@include mat-slide-toggle-typography-mdc(mat-typography-config());
27+
@include mat-tabs-typography-mdc(mat-typography-config());
2628

2729
// Define the default theme (same as the example above).
2830
$candy-app-primary: mat-palette($mat-indigo);
@@ -40,3 +42,4 @@ $candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-accent);
4042
@include mat-menu-theme-mdc($candy-app-theme);
4143
@include mat-radio-theme-mdc($candy-app-theme);
4244
@include mat-slide-toggle-theme-mdc($candy-app-theme);
45+
@include mat-tabs-theme-mdc($candy-app-theme);
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
4+
load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite")
5+
load("//tools:defaults.bzl", "ng_e2e_test_library", "ng_module")
6+
7+
ng_module(
8+
name = "mdc-tabs",
9+
srcs = glob(
10+
["**/*.ts"],
11+
exclude = ["**/*.spec.ts"],
12+
),
13+
assets = [":tabs_scss"] + glob(["**/*.html"]),
14+
module_name = "@angular/material-experimental/mdc-tabs",
15+
deps = [
16+
"//src/material/core",
17+
"@npm//@angular/common",
18+
"@npm//@angular/core",
19+
"@npm//material-components-web",
20+
],
21+
)
22+
23+
sass_library(
24+
name = "mdc_tabs_scss_lib",
25+
srcs = glob(["**/_*.scss"]),
26+
deps = [
27+
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
28+
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
29+
"//src/material/core:core_scss_lib",
30+
],
31+
)
32+
33+
sass_binary(
34+
name = "tabs_scss",
35+
src = "tabs.scss",
36+
include_paths = [
37+
"external/npm/node_modules",
38+
],
39+
deps = [
40+
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
41+
"//src/material/core:all_themes",
42+
],
43+
)
44+
45+
ng_e2e_test_library(
46+
name = "e2e_test_sources",
47+
srcs = glob(["**/*.e2e.spec.ts"]),
48+
deps = [
49+
"//src/cdk/testing/e2e",
50+
],
51+
)
52+
53+
protractor_web_test_suite(
54+
name = "e2e_tests",
55+
configuration = "//src/e2e-app:protractor.conf.js",
56+
data = [
57+
"//tools/axe-protractor",
58+
"@npm//@angular/bazel",
59+
],
60+
on_prepare = "//src/e2e-app:start-devserver.js",
61+
server = "//src/e2e-app:devserver",
62+
tags = ["e2e"],
63+
deps = [
64+
":e2e_test_sources",
65+
"//src/cdk/testing/e2e",
66+
],
67+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a placeholder for the MDC-based implementation of tabs.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@import '../mdc-helpers/mdc-helpers';
2+
3+
@mixin mat-tabs-theme-mdc($theme) {
4+
@include mat-using-mdc-theme($theme) {
5+
// TODO: MDC theme styles here.
6+
}
7+
}
8+
9+
@mixin mat-tabs-typography-mdc($config) {
10+
@include mat-using-mdc-typography($config) {
11+
// TODO: MDC typography styles here.
12+
}
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export * from './public-api';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {CommonModule} from '@angular/common';
10+
import {NgModule} from '@angular/core';
11+
import {MatCommonModule} from '@angular/material/core';
12+
13+
@NgModule({
14+
imports: [MatCommonModule, CommonModule],
15+
exports: [MatCommonModule],
16+
})
17+
export class MatTabsModule {
18+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export * from './module';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// TODO: copy tests from existing tabs, update as necessary to fix.

src/material-experimental/mdc-tabs/tabs.scss

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// TODO: copy tests from existing tabs, update as necessary to fix.

0 commit comments

Comments
 (0)