-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14901 from primefaces/floatlabel
Floatlabel
- Loading branch information
Showing
13 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { ChangeDetectionStrategy, Component, NgModule, ViewEncapsulation } from '@angular/core'; | ||
import { SharedModule } from '../api/shared'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
/** | ||
* FloatLabel appears on top of the input field when focused. | ||
* @group Components | ||
*/ | ||
@Component({ | ||
selector: 'p-floatLabel', | ||
template: ` | ||
<span class="p-float-label"> | ||
<ng-content></ng-content> | ||
</span> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
encapsulation: ViewEncapsulation.None, | ||
}) | ||
export class FloatLabel {} | ||
|
||
@NgModule({ | ||
imports: [CommonModule, SharedModule, RouterModule], | ||
exports: [FloatLabel, SharedModule], | ||
declarations: [FloatLabel] | ||
}) | ||
export class FloatLabelModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "ng-packagr/ng-package.schema.json", | ||
"lib": { | ||
"entryFile": "public_api.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './floatlabel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'accessibility-doc', | ||
template: ` | ||
<app-docsectiontext> | ||
<h3>Screen Reader</h3> | ||
<p>FloatLabel does not require any roles and attributes.</p> | ||
<h3>Keyboard Support</h3> | ||
<p>Component does not include any interactive elements.</p> | ||
</app-docsectiontext> | ||
` | ||
}) | ||
export class AccessibilityDoc {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Component } from '@angular/core'; | ||
import { Code } from '../../domain/code'; | ||
|
||
@Component({ | ||
selector: 'basic-doc', | ||
template: ` | ||
<app-docsectiontext> | ||
<p>FloatLabel is used by wrapping the input and its label.</p> | ||
</app-docsectiontext> | ||
<div class="card flex justify-content-center"> | ||
<p-floatLabel> | ||
<input id="username" type="text" pInputText [(ngModel)]="value" /> | ||
<label for="username">Username</label> | ||
</p-floatLabel> | ||
</div> | ||
<app-code [code]="code" selector="float-label-basic-demo"></app-code> | ||
` | ||
}) | ||
export class BasicDoc { | ||
value: string | undefined; | ||
|
||
code: Code = { | ||
basic: `<p-floatLabel> | ||
<input id="username" type="text" pInputText [(ngModel)]="value" /> | ||
<label for="username">Username</label> | ||
</p-floatLabel>`, | ||
|
||
html: `<div class="card flex justify-content-center"> | ||
<p-floatLabel> | ||
<input id="username" type="text" pInputText [(ngModel)]="value" /> | ||
<label for="username">Username</label> | ||
</p-floatLabel> | ||
</div>`, | ||
|
||
typescript: ` | ||
import { Component } from '@angular/core'; | ||
@Component({ | ||
selector: 'float-label-basic-demo', | ||
templateUrl: './float-label-basic-demo.html' | ||
}) | ||
export class FloatLabelBasicDemo { | ||
value: string | undefined; | ||
}` | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { AppDocModule } from '../../layout/doc/app.doc.module'; | ||
import { AppCodeModule } from '../../layout/doc/app.code.component'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { BasicDoc } from './basicdoc'; | ||
import { ImportDoc } from './importdoc'; | ||
import { FloatLabelModule } from 'primeng/floatlabel'; | ||
import { InputTextModule } from 'primeng/inputtext'; | ||
import { AccessibilityDoc } from './accessibilitydoc'; | ||
|
||
@NgModule({ | ||
imports: [CommonModule, RouterModule, AppCodeModule, AppDocModule, FormsModule, FloatLabelModule, InputTextModule], | ||
declarations: [BasicDoc, ImportDoc, AccessibilityDoc], | ||
exports: [AppDocModule] | ||
}) | ||
export class FloatLabelDocModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component } from '@angular/core'; | ||
import { Code } from '../../domain/code'; | ||
|
||
@Component({ | ||
selector: 'import-doc', | ||
template: ` <app-code [code]="code" [hideToggleCode]="true"></app-code> ` | ||
}) | ||
export class ImportDoc { | ||
code: Code = { | ||
typescript: `import { FloatLabelModule } from 'primeng/floatlabel';` | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/app/showcase/pages/floatlabel/floatlabeldemo-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { FloatLabelDemo } from './floatlabeldemo'; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild([{ path: '', component: FloatLabelDemo }])], | ||
exports: [RouterModule] | ||
}) | ||
export class FloatLabelDemoRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<app-doc docTitle="Angular Float Label Component" header="FloatLabel" description="FloatLabel appears on top of the input field when focused." [docs]="docs"></app-doc> |
12 changes: 12 additions & 0 deletions
12
src/app/showcase/pages/floatlabel/floatlabeldemo.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { FloatLabelDemo } from './floatlabeldemo'; | ||
import { FloatLabelDemoRoutingModule } from './floatlabeldemo-routing.module'; | ||
import { FloatLabelDocModule } from '../../doc/floatlabel/floatlabeldoc.module'; | ||
|
||
@NgModule({ | ||
imports: [CommonModule, FloatLabelDemoRoutingModule, FormsModule, FloatLabelDocModule], | ||
declarations: [FloatLabelDemo] | ||
}) | ||
export class FloatLabelDemoModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Component } from '@angular/core'; | ||
import { BasicDoc } from '../../doc/floatlabel/basicdoc'; | ||
import { ImportDoc } from '../../doc/floatlabel/importdoc'; | ||
import { AccessibilityDoc } from '../../doc/floatlabel/accessibilitydoc'; | ||
@Component({ | ||
templateUrl: './floatlabeldemo.html' | ||
}) | ||
export class FloatLabelDemo { | ||
docs = [ | ||
{ | ||
id: 'import', | ||
label: 'Import', | ||
component: ImportDoc | ||
}, | ||
{ | ||
id: 'basic', | ||
label: 'Basic', | ||
component: BasicDoc | ||
}, | ||
{ | ||
id: 'accessibility', | ||
label: 'Accessibility', | ||
component: AccessibilityDoc | ||
} | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters