diff --git a/src/app/components/floatlabel/floatlabel.ts b/src/app/components/floatlabel/floatlabel.ts new file mode 100755 index 00000000000..2da7630c8ad --- /dev/null +++ b/src/app/components/floatlabel/floatlabel.ts @@ -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: ` + + + + `, + changeDetection: ChangeDetectionStrategy.OnPush, + encapsulation: ViewEncapsulation.None, +}) +export class FloatLabel {} + +@NgModule({ + imports: [CommonModule, SharedModule, RouterModule], + exports: [FloatLabel, SharedModule], + declarations: [FloatLabel] +}) +export class FloatLabelModule {} diff --git a/src/app/components/floatlabel/ng-package.json b/src/app/components/floatlabel/ng-package.json new file mode 100644 index 00000000000..ab5467eb7e4 --- /dev/null +++ b/src/app/components/floatlabel/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "ng-packagr/ng-package.schema.json", + "lib": { + "entryFile": "public_api.ts" + } + } \ No newline at end of file diff --git a/src/app/components/floatlabel/public_api.ts b/src/app/components/floatlabel/public_api.ts new file mode 100644 index 00000000000..b05926f72c3 --- /dev/null +++ b/src/app/components/floatlabel/public_api.ts @@ -0,0 +1 @@ +export * from './floatlabel'; diff --git a/src/app/showcase/doc/floatlabel/accessibilitydoc.ts b/src/app/showcase/doc/floatlabel/accessibilitydoc.ts new file mode 100644 index 00000000000..57e8b338e42 --- /dev/null +++ b/src/app/showcase/doc/floatlabel/accessibilitydoc.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'accessibility-doc', + template: ` + +

Screen Reader

+

FloatLabel does not require any roles and attributes.

+ +

Keyboard Support

+

Component does not include any interactive elements.

+
+ ` +}) +export class AccessibilityDoc {} diff --git a/src/app/showcase/doc/floatlabel/basicdoc.ts b/src/app/showcase/doc/floatlabel/basicdoc.ts new file mode 100644 index 00000000000..fd1daa5e369 --- /dev/null +++ b/src/app/showcase/doc/floatlabel/basicdoc.ts @@ -0,0 +1,46 @@ +import { Component } from '@angular/core'; +import { Code } from '../../domain/code'; + +@Component({ + selector: 'basic-doc', + template: ` + +

FloatLabel is used by wrapping the input and its label.

+
+
+ + + + +
+ + ` +}) +export class BasicDoc { + value: string | undefined; + + code: Code = { + basic: ` + + +`, + + html: `
+ + + + +
`, + + typescript: ` +import { Component } from '@angular/core'; + +@Component({ + selector: 'float-label-basic-demo', + templateUrl: './float-label-basic-demo.html' +}) +export class FloatLabelBasicDemo { + value: string | undefined; +}` + }; +} diff --git a/src/app/showcase/doc/floatlabel/floatlabeldoc.module.ts b/src/app/showcase/doc/floatlabel/floatlabeldoc.module.ts new file mode 100644 index 00000000000..4e0c4749ab7 --- /dev/null +++ b/src/app/showcase/doc/floatlabel/floatlabeldoc.module.ts @@ -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 {} diff --git a/src/app/showcase/doc/floatlabel/importdoc.ts b/src/app/showcase/doc/floatlabel/importdoc.ts new file mode 100644 index 00000000000..2265f63ea93 --- /dev/null +++ b/src/app/showcase/doc/floatlabel/importdoc.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { Code } from '../../domain/code'; + +@Component({ + selector: 'import-doc', + template: ` ` +}) +export class ImportDoc { + code: Code = { + typescript: `import { FloatLabelModule } from 'primeng/floatlabel';` + }; +} + diff --git a/src/app/showcase/layout/app.routes.ts b/src/app/showcase/layout/app.routes.ts index 64a2550b1c9..d56bbb2861b 100644 --- a/src/app/showcase/layout/app.routes.ts +++ b/src/app/showcase/layout/app.routes.ts @@ -49,6 +49,7 @@ export const routes: Routes = [ { path: 'dropdown', loadChildren: () => import('../pages/dropdown/dropdowndemo.module').then((m) => m.DropdownDemoModule) }, { path: 'iconfield', loadChildren: () => import('../pages/iconfield/iconfielddemo.module').then((m) => m.IconFieldDemoModule) }, { path: 'editor', loadChildren: () => import('../pages/editor/editordemo.module').then((m) => m.EditorDemoModule) }, + { path: 'floatlabel', loadChildren: () => import('../pages/floatlabel/floatlabeldemo.module').then((m) => m.FloatLabelDemoModule) }, { path: 'fieldset', loadChildren: () => import('../pages/fieldset/fieldsetdemo.module').then((m) => m.FieldsetDemoModule) }, { path: 'fileupload', loadChildren: () => import('../pages/fileupload/fileuploaddemo.module').then((m) => m.FileUploadDemoModule) }, { path: 'filterservice', loadChildren: () => import('../pages/filterservice/filterservicedemo.module').then((m) => m.FilterServiceDemoModule) }, diff --git a/src/app/showcase/pages/floatlabel/floatlabeldemo-routing.module.ts b/src/app/showcase/pages/floatlabel/floatlabeldemo-routing.module.ts new file mode 100755 index 00000000000..633fe346743 --- /dev/null +++ b/src/app/showcase/pages/floatlabel/floatlabeldemo-routing.module.ts @@ -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 {} diff --git a/src/app/showcase/pages/floatlabel/floatlabeldemo.html b/src/app/showcase/pages/floatlabel/floatlabeldemo.html new file mode 100755 index 00000000000..2e5f230bcae --- /dev/null +++ b/src/app/showcase/pages/floatlabel/floatlabeldemo.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/showcase/pages/floatlabel/floatlabeldemo.module.ts b/src/app/showcase/pages/floatlabel/floatlabeldemo.module.ts new file mode 100755 index 00000000000..71a9722a796 --- /dev/null +++ b/src/app/showcase/pages/floatlabel/floatlabeldemo.module.ts @@ -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 {} diff --git a/src/app/showcase/pages/floatlabel/floatlabeldemo.ts b/src/app/showcase/pages/floatlabel/floatlabeldemo.ts new file mode 100755 index 00000000000..8bcbdd92a69 --- /dev/null +++ b/src/app/showcase/pages/floatlabel/floatlabeldemo.ts @@ -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 + } + ]; +} diff --git a/src/assets/showcase/data/menu.json b/src/assets/showcase/data/menu.json index 058a861d382..f6879f858e7 100644 --- a/src/assets/showcase/data/menu.json +++ b/src/assets/showcase/data/menu.json @@ -57,6 +57,10 @@ "name": "Editor", "routerLink": "/editor" }, + { + "name": "FloatLabel", + "routerLink": "/floatlabel" + }, { "name": "IconField", "routerLink": "/iconfield"