generated from Tinkoff/angular-open-source-starter
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(demo): new documentation page
Supported <input /> types
(#1206)
- Loading branch information
1 parent
0c91cec
commit 08bb9b3
Showing
19 changed files
with
465 additions
and
4 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 |
---|---|---|
|
@@ -15,5 +15,5 @@ | |
"**/package.json", | ||
"**/tsconfig*.json" | ||
], | ||
"ignoreWords": ["Acpekt"] | ||
"ignoreWords": ["Acpekt", "WHATWG"] | ||
} |
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
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
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
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
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
39 changes: 39 additions & 0 deletions
39
projects/demo/src/pages/documentation/supported-input-types/examples/password/component.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,39 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {MaskitoDirective} from '@maskito/angular'; | ||
import {TuiHintModule, TuiTextfieldControllerModule} from '@taiga-ui/core'; | ||
import {TuiInputPasswordModule} from '@taiga-ui/kit'; | ||
|
||
import mask from './mask'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'input-type-password-example', | ||
imports: [ | ||
FormsModule, | ||
MaskitoDirective, | ||
TuiHintModule, | ||
TuiInputPasswordModule, | ||
TuiTextfieldControllerModule, | ||
], | ||
template: ` | ||
<tui-input-password | ||
tuiHintContent="Only 3 digits are allowed" | ||
[style.max-width.rem]="20" | ||
[tuiTextfieldLabelOutside]="true" | ||
[(ngModel)]="value" | ||
> | ||
Enter password | ||
<input | ||
tuiTextfield | ||
type="password" | ||
[maskito]="maskitoOptions" | ||
/> | ||
</tui-input-password> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class InputPasswordDocExample { | ||
protected readonly maskitoOptions = mask; | ||
protected value = ''; | ||
} |
5 changes: 5 additions & 0 deletions
5
projects/demo/src/pages/documentation/supported-input-types/examples/password/mask.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,5 @@ | ||
import type {MaskitoOptions} from '@maskito/core'; | ||
|
||
export default { | ||
mask: [/\d/, /\d/, /\d/], | ||
} as MaskitoOptions; |
38 changes: 38 additions & 0 deletions
38
projects/demo/src/pages/documentation/supported-input-types/examples/search/component.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,38 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {MaskitoDirective} from '@maskito/angular'; | ||
import {TuiTextfieldControllerModule} from '@taiga-ui/core'; | ||
import {TuiInputModule} from '@taiga-ui/kit'; | ||
|
||
import mask from './mask'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'input-type-search-example', | ||
imports: [ | ||
FormsModule, | ||
MaskitoDirective, | ||
TuiInputModule, | ||
TuiTextfieldControllerModule, | ||
], | ||
template: ` | ||
<tui-input | ||
tuiTextfieldIconLeft="tuiIconSearchLarge" | ||
[style.max-width.rem]="20" | ||
[tuiTextfieldLabelOutside]="true" | ||
[(ngModel)]="value" | ||
> | ||
Enter any english word | ||
<input | ||
tuiTextfield | ||
type="search" | ||
[maskito]="maskitoOptions" | ||
/> | ||
</tui-input> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class InputSearchDocExample { | ||
protected readonly maskitoOptions = mask; | ||
protected value = ''; | ||
} |
5 changes: 5 additions & 0 deletions
5
projects/demo/src/pages/documentation/supported-input-types/examples/search/mask.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,5 @@ | ||
import type {MaskitoOptions} from '@maskito/core'; | ||
|
||
export default { | ||
mask: /^[a-z]+$/i, | ||
} as MaskitoOptions; |
47 changes: 47 additions & 0 deletions
47
projects/demo/src/pages/documentation/supported-input-types/examples/tel/component.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,47 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {MaskitoDirective} from '@maskito/angular'; | ||
import {TuiFlagPipeModule, TuiTextfieldControllerModule} from '@taiga-ui/core'; | ||
import {TuiInputModule} from '@taiga-ui/kit'; | ||
|
||
import mask from './mask'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'input-type-tel-example', | ||
imports: [ | ||
FormsModule, | ||
MaskitoDirective, | ||
TuiInputModule, | ||
TuiTextfieldControllerModule, | ||
TuiFlagPipeModule, | ||
], | ||
template: ` | ||
<tui-input | ||
[style.max-width.rem]="20" | ||
[tuiTextfieldCustomContent]="usFlag" | ||
[tuiTextfieldLabelOutside]="true" | ||
[(ngModel)]="value" | ||
> | ||
Enter phone number | ||
<input | ||
tuiTextfield | ||
type="tel" | ||
[maskito]="maskitoOptions" | ||
/> | ||
</tui-input> | ||
<ng-template #usFlag> | ||
<img | ||
alt="Flag of the United States" | ||
width="28" | ||
[src]="'US' | tuiFlag" | ||
/> | ||
</ng-template> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class InputTelDocExample { | ||
protected readonly maskitoOptions = mask; | ||
protected value = ''; | ||
} |
7 changes: 7 additions & 0 deletions
7
projects/demo/src/pages/documentation/supported-input-types/examples/tel/mask.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,7 @@ | ||
import {maskitoPhoneOptionsGenerator} from '@maskito/phone'; | ||
import metadata from 'libphonenumber-js/metadata.min.json'; | ||
|
||
export default maskitoPhoneOptionsGenerator({ | ||
metadata, | ||
countryIsoCode: 'US', | ||
}); |
39 changes: 39 additions & 0 deletions
39
projects/demo/src/pages/documentation/supported-input-types/examples/text/component.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,39 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {MaskitoDirective} from '@maskito/angular'; | ||
import {TuiTextfieldControllerModule} from '@taiga-ui/core'; | ||
import {TuiInputModule} from '@taiga-ui/kit'; | ||
|
||
import mask from './mask'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'input-type-text-example', | ||
imports: [ | ||
FormsModule, | ||
MaskitoDirective, | ||
TuiInputModule, | ||
TuiTextfieldControllerModule, | ||
], | ||
template: ` | ||
<tui-input | ||
tuiTextfieldCustomContent="tuiIconClockLarge" | ||
[style.max-width.rem]="20" | ||
[tuiTextfieldLabelOutside]="true" | ||
[(ngModel)]="value" | ||
> | ||
Enter time | ||
<input | ||
inputmode="decimal" | ||
tuiTextfield | ||
type="text" | ||
[maskito]="maskitoOptions" | ||
/> | ||
</tui-input> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class InputTextDocExample { | ||
protected readonly maskitoOptions = mask; | ||
protected value = ''; | ||
} |
5 changes: 5 additions & 0 deletions
5
projects/demo/src/pages/documentation/supported-input-types/examples/text/mask.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,5 @@ | ||
import {maskitoTimeOptionsGenerator} from '@maskito/kit'; | ||
|
||
export default maskitoTimeOptionsGenerator({ | ||
mode: 'HH:MM', | ||
}); |
38 changes: 38 additions & 0 deletions
38
projects/demo/src/pages/documentation/supported-input-types/examples/url/component.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,38 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {MaskitoDirective} from '@maskito/angular'; | ||
import {TuiTextfieldControllerModule} from '@taiga-ui/core'; | ||
import {TuiInputModule} from '@taiga-ui/kit'; | ||
|
||
import mask from './mask'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'input-type-url-example', | ||
imports: [ | ||
FormsModule, | ||
MaskitoDirective, | ||
TuiInputModule, | ||
TuiTextfieldControllerModule, | ||
], | ||
template: ` | ||
<tui-input | ||
tuiTextfieldCustomContent="tuiIconGlobeLarge" | ||
[style.max-width.rem]="20" | ||
[tuiTextfieldLabelOutside]="true" | ||
[(ngModel)]="value" | ||
> | ||
Enter url | ||
<input | ||
tuiTextfield | ||
type="url" | ||
[maskito]="maskitoOptions" | ||
/> | ||
</tui-input> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class InputURLDocExample { | ||
protected readonly maskitoOptions = mask; | ||
protected value = ''; | ||
} |
6 changes: 6 additions & 0 deletions
6
projects/demo/src/pages/documentation/supported-input-types/examples/url/mask.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,6 @@ | ||
import type {MaskitoOptions} from '@maskito/core'; | ||
|
||
export default { | ||
// oversimplified version of url mask for demo purposes | ||
mask: /^[\w/:.@]+$/, | ||
} as MaskitoOptions; |
56 changes: 56 additions & 0 deletions
56
...cts/demo/src/pages/documentation/supported-input-types/supported-input-types.component.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,56 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {RouterLink} from '@angular/router'; | ||
import {DocExamplePrimaryTab} from '@demo/constants'; | ||
import type {TuiDocExample} from '@taiga-ui/addon-doc'; | ||
import {TuiAddonDocModule} from '@taiga-ui/addon-doc'; | ||
import {TuiLinkModule, TuiNotificationModule} from '@taiga-ui/core'; | ||
|
||
import {InputPasswordDocExample} from './examples/password/component'; | ||
import {InputSearchDocExample} from './examples/search/component'; | ||
import {InputTelDocExample} from './examples/tel/component'; | ||
import {InputTextDocExample} from './examples/text/component'; | ||
import {InputURLDocExample} from './examples/url/component'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'supported-input-types-doc-page', | ||
imports: [ | ||
RouterLink, | ||
TuiAddonDocModule, | ||
TuiLinkModule, | ||
TuiNotificationModule, | ||
InputTextDocExample, | ||
InputTelDocExample, | ||
InputPasswordDocExample, | ||
InputURLDocExample, | ||
InputSearchDocExample, | ||
], | ||
templateUrl: './supported-input-types.template.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export default class SupportedInputTypesDocPageComponent { | ||
protected readonly textTypeExample: TuiDocExample = { | ||
[DocExamplePrimaryTab.MaskitoOptions]: import('./examples/text/mask.ts?raw'), | ||
}; | ||
|
||
protected readonly telTypeExample: TuiDocExample = { | ||
[DocExamplePrimaryTab.MaskitoOptions]: import('./examples/tel/mask.ts?raw'), | ||
}; | ||
|
||
protected readonly passwordTypeExample: TuiDocExample = { | ||
[DocExamplePrimaryTab.MaskitoOptions]: import('./examples/password/mask.ts?raw'), | ||
}; | ||
|
||
protected readonly urlTypeExample: TuiDocExample = { | ||
[DocExamplePrimaryTab.MaskitoOptions]: import('./examples/url/mask.ts?raw'), | ||
}; | ||
|
||
protected readonly searchTypeExample: TuiDocExample = { | ||
[DocExamplePrimaryTab.MaskitoOptions]: import('./examples/search/mask.ts?raw'), | ||
}; | ||
|
||
protected getInput(type: HTMLInputElement['type']): string { | ||
// eslint-disable-next-line no-irregular-whitespace | ||
return `<input type="${type}" />`; | ||
} | ||
} |
Oops, something went wrong.