Skip to content

Commit 68b0f15

Browse files
committed
docs(material/legacy-form-field): restore docs examples
Restores the docs examples for the legacy `mat-form-field` which were deleted in #25374.
1 parent 76f4f3c commit 68b0f15

File tree

36 files changed

+628
-115
lines changed

36 files changed

+628
-115
lines changed

src/components-examples/config.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ALL_EXAMPLES = [
4040
"//src/components-examples/material-experimental/column-resize",
4141
"//src/components-examples/material-experimental/popover-edit",
4242
"//src/components-examples/material-experimental/mdc-card",
43-
"//src/components-examples/material-experimental/mdc-form-field",
43+
"//src/components-examples/material/legacy-form-field",
4444
"//src/components-examples/material-experimental/selection",
4545
"//src/components-examples/cdk/tree",
4646
"//src/components-examples/cdk/text-field",

src/components-examples/material-experimental/mdc-form-field/BUILD.bazel

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/components-examples/material-experimental/mdc-form-field/index.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/components-examples/material-experimental/mdc-form-field/mdc-form-field-custom-control/example-tel-input-example.html

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/components-examples/material-experimental/mdc-form-field/mdc-form-field-custom-control/form-field-custom-control-example.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/components-examples/material/form-field/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ const EXAMPLES = [
5959
ReactiveFormsModule,
6060
],
6161
declarations: [...EXAMPLES, MyTelInput],
62-
exports: EXAMPLES,
62+
exports: [...EXAMPLES, MyTelInput],
6363
})
6464
export class FormFieldExamplesModule {}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
ng_module(
6+
name = "legacy-form-field",
7+
srcs = glob(
8+
["**/*.ts"],
9+
exclude = ["**/*.spec.ts"],
10+
),
11+
assets = glob([
12+
"**/*.html",
13+
"**/*.css",
14+
]),
15+
deps = [
16+
"//src/cdk/testing",
17+
"//src/cdk/testing/testbed",
18+
"//src/material/icon",
19+
"//src/material/legacy-button",
20+
"//src/material/legacy-checkbox",
21+
"//src/material/legacy-form-field",
22+
"//src/material/legacy-form-field/testing",
23+
"//src/material/legacy-input",
24+
"//src/material/legacy-input/testing",
25+
"//src/material/legacy-radio",
26+
"//src/material/legacy-select",
27+
"@npm//@angular/forms",
28+
"@npm//@angular/platform-browser",
29+
"@npm//@angular/platform-browser-dynamic",
30+
"@npm//@types/jasmine",
31+
],
32+
)
33+
34+
filegroup(
35+
name = "source-files",
36+
srcs = glob([
37+
"**/*.html",
38+
"**/*.css",
39+
"**/*.ts",
40+
]),
41+
)
42+
43+
ng_test_library(
44+
name = "unit_tests_lib",
45+
srcs = glob(["**/*.spec.ts"]),
46+
deps = [
47+
":legacy-form-field",
48+
"//src/cdk/testing",
49+
"//src/cdk/testing/testbed",
50+
"//src/material/legacy-form-field",
51+
"//src/material/legacy-form-field/testing",
52+
"//src/material/legacy-input",
53+
"//src/material/legacy-input/testing",
54+
"@npm//@angular/forms",
55+
"@npm//@angular/platform-browser",
56+
"@npm//@angular/platform-browser-dynamic",
57+
],
58+
)
59+
60+
ng_web_test_suite(
61+
name = "unit_tests",
62+
deps = [":unit_tests_lib"],
63+
)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import {CommonModule} from '@angular/common';
2+
import {NgModule} from '@angular/core';
3+
import {ReactiveFormsModule} from '@angular/forms';
4+
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
5+
import {MatLegacyCheckboxModule} from '@angular/material/legacy-checkbox';
6+
import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
7+
import {MatIconModule} from '@angular/material/icon';
8+
import {MatLegacyInputModule} from '@angular/material/legacy-input';
9+
import {MatLegacyRadioModule} from '@angular/material/legacy-radio';
10+
import {MatLegacySelectModule} from '@angular/material/legacy-select';
11+
import {LegacyFormFieldAppearanceExample} from './legacy-form-field-appearance/legacy-form-field-appearance-example';
12+
import {
13+
LegacyFormFieldCustomControlExample,
14+
MyLegacyTelInput,
15+
} from './legacy-form-field-custom-control/legacy-form-field-custom-control-example';
16+
import {LegacyFormFieldErrorExample} from './legacy-form-field-error/legacy-form-field-error-example';
17+
import {LegacyFormFieldHintExample} from './legacy-form-field-hint/legacy-form-field-hint-example';
18+
import {LegacyFormFieldLabelExample} from './legacy-form-field-label/legacy-form-field-label-example';
19+
import {LegacyFormFieldOverviewExample} from './legacy-form-field-overview/legacy-form-field-overview-example';
20+
import {LegacyFormFieldPrefixSuffixExample} from './legacy-form-field-prefix-suffix/legacy-form-field-prefix-suffix-example';
21+
import {LegacyFormFieldThemingExample} from './legacy-form-field-theming/legacy-legacy-form-field-theming-example';
22+
import {LegacyFormFieldHarnessExample} from './legacy-form-field-harness/legacy-form-field-harness-example';
23+
24+
export {
25+
LegacyFormFieldAppearanceExample,
26+
LegacyFormFieldCustomControlExample,
27+
LegacyFormFieldErrorExample,
28+
LegacyFormFieldHarnessExample,
29+
LegacyFormFieldHintExample,
30+
LegacyFormFieldLabelExample,
31+
LegacyFormFieldOverviewExample,
32+
LegacyFormFieldPrefixSuffixExample,
33+
LegacyFormFieldThemingExample,
34+
MyLegacyTelInput,
35+
};
36+
37+
const EXAMPLES = [
38+
LegacyFormFieldAppearanceExample,
39+
LegacyFormFieldCustomControlExample,
40+
LegacyFormFieldErrorExample,
41+
LegacyFormFieldHarnessExample,
42+
LegacyFormFieldHintExample,
43+
LegacyFormFieldLabelExample,
44+
LegacyFormFieldOverviewExample,
45+
LegacyFormFieldPrefixSuffixExample,
46+
LegacyFormFieldThemingExample,
47+
];
48+
49+
@NgModule({
50+
imports: [
51+
CommonModule,
52+
MatLegacyButtonModule,
53+
MatLegacyCheckboxModule,
54+
MatLegacyFormFieldModule,
55+
MatIconModule,
56+
MatLegacyInputModule,
57+
MatLegacyRadioModule,
58+
MatLegacySelectModule,
59+
ReactiveFormsModule,
60+
],
61+
declarations: [...EXAMPLES, MyLegacyTelInput],
62+
exports: EXAMPLES,
63+
})
64+
export class LegacyFormFieldExamplesModule {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<p>
2+
<mat-form-field appearance="legacy">
3+
<mat-label>Legacy form field</mat-label>
4+
<input matInput placeholder="Placeholder">
5+
<mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
6+
<mat-hint>Hint</mat-hint>
7+
</mat-form-field>
8+
</p>
9+
<p>
10+
<mat-form-field appearance="standard">
11+
<mat-label>Standard form field</mat-label>
12+
<input matInput placeholder="Placeholder">
13+
<mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
14+
<mat-hint>Hint</mat-hint>
15+
</mat-form-field>
16+
</p>
17+
<p>
18+
<mat-form-field appearance="fill">
19+
<mat-label>Fill form field</mat-label>
20+
<input matInput placeholder="Placeholder">
21+
<mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
22+
<mat-hint>Hint</mat-hint>
23+
</mat-form-field>
24+
</p>
25+
<p>
26+
<mat-form-field appearance="outline">
27+
<mat-label>Outline form field</mat-label>
28+
<input matInput placeholder="Placeholder">
29+
<mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
30+
<mat-hint>Hint</mat-hint>
31+
</mat-form-field>
32+
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Component} from '@angular/core';
2+
3+
/** @title Form field appearance variants */
4+
@Component({
5+
selector: 'legacy-form-field-appearance-example',
6+
templateUrl: 'legacy-form-field-appearance-example.html',
7+
})
8+
export class LegacyFormFieldAppearanceExample {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<div role="group" class="example-tel-input-container"
2+
[formGroup]="parts"
3+
[attr.aria-labelledby]="_formField?.getLabelId()"
4+
(focusin)="onFocusIn($event)"
5+
(focusout)="onFocusOut($event)">
6+
<input class="example-tel-input-element"
7+
formControlName="area" size="3"
8+
maxLength="3"
9+
aria-label="Area code"
10+
(input)="_handleInput(parts.controls.area, exchange)"
11+
#area>
12+
<span class="example-tel-input-spacer">&ndash;</span>
13+
<input class="example-tel-input-element"
14+
formControlName="exchange"
15+
maxLength="3"
16+
size="3"
17+
aria-label="Exchange code"
18+
(input)="_handleInput(parts.controls.exchange, subscriber)"
19+
(keyup.backspace)="autoFocusPrev(parts.controls.exchange, area)"
20+
#exchange>
21+
<span class="example-tel-input-spacer">&ndash;</span>
22+
<input class="example-tel-input-element"
23+
formControlName="subscriber"
24+
maxLength="4"
25+
size="4"
26+
aria-label="Subscriber number"
27+
(input)="_handleInput(parts.controls.subscriber)"
28+
(keyup.backspace)="autoFocusPrev(parts.controls.subscriber, exchange)"
29+
#subscriber>
30+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div [formGroup]="form">
2+
<mat-form-field appearance="fill">
3+
<mat-label>Phone number</mat-label>
4+
<example-tel-input formControlName="tel" required></example-tel-input>
5+
<mat-icon matSuffix>phone</mat-icon>
6+
<mat-hint>Include area code</mat-hint>
7+
</mat-form-field>
8+
</div>

0 commit comments

Comments
 (0)