-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
77 deletions.
There are no files selected for viewing
15 changes: 10 additions & 5 deletions
15
projects/demo/src/modules/components/input-phone-international/examples/3/index.html
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<tui-input-phone-international | ||
[countries]="countries" | ||
[(countryIsoCode)]="countryIsoCode" | ||
[(ngModel)]="value" | ||
/> | ||
<tui-textfield tuiDropdownMobile="Select country"> | ||
<label tuiLabel>Phone number</label> | ||
<input | ||
tuiInputPhoneInternational | ||
[countries]="(countries | tuiSortCountries | async) || []" | ||
[countrySearch]="true" | ||
[(countryIsoCode)]="countryIsoCode" | ||
[(ngModel)]="value" | ||
/> | ||
</tui-textfield> |
46 changes: 18 additions & 28 deletions
46
projects/demo/src/modules/components/input-phone-international/examples/3/index.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 |
---|---|---|
@@ -1,53 +1,43 @@ | ||
import {AsyncPipe} from '@angular/common'; | ||
import {Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiDropdownMobile} from '@taiga-ui/addon-mobile'; | ||
import {TuiButton, TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiInputPhoneInternational} from '@taiga-ui/experimental'; | ||
import type {TuiCountryIsoCode} from '@taiga-ui/i18n'; | ||
import { | ||
TuiInputPhoneInternational, | ||
tuiInputPhoneInternationalOptionsProvider, | ||
TuiSortCountriesPipe, | ||
} from '@taiga-ui/kit'; | ||
import {getCountries} from 'libphonenumber-js'; | ||
import {defer} from 'rxjs'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [FormsModule, TuiInputPhoneInternational, TuiTextfield], | ||
imports: [ | ||
AsyncPipe, | ||
FormsModule, | ||
TuiButton, | ||
TuiDropdownMobile, | ||
TuiInputPhoneInternational, | ||
TuiSortCountriesPipe, | ||
TuiTextfield, | ||
], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
providers: [ | ||
/** | ||
* You can choose: lazily load metadata or include it in your bundle. | ||
* Lazy loading: | ||
*/ | ||
tuiInputPhoneInternationalOptionsProvider({ | ||
metadata: defer(async () => | ||
import('libphonenumber-js/max/metadata').then((m) => m.default), | ||
), | ||
}), | ||
/** | ||
* Eager loading: | ||
* ```ts | ||
* import metadata from 'libphonenumber-js/mobile/metadata'; | ||
* import {of} from 'rxjs'; | ||
* // [...] | ||
* tuiInputPhoneInternationalOptionsProvider({ | ||
* metadata: of(metadata), | ||
* }), | ||
* ``` | ||
*/ | ||
], | ||
}) | ||
export default class Example { | ||
protected readonly countries: readonly TuiCountryIsoCode[] = [ | ||
'IN', | ||
'CN', | ||
'US', | ||
'ID', | ||
'PK', | ||
]; | ||
|
||
protected countryIsoCode: TuiCountryIsoCode = 'US'; | ||
protected value = '+12125552368'; | ||
protected readonly countries = getCountries(); | ||
protected countryIsoCode: TuiCountryIsoCode = 'CN'; | ||
protected value = ''; | ||
} |
15 changes: 5 additions & 10 deletions
15
projects/demo/src/modules/components/input-phone-international/examples/7/index.html
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 |
---|---|---|
@@ -1,10 +1,5 @@ | ||
<tui-textfield tuiDropdownMobile="Select country"> | ||
<label tuiLabel>Phone number</label> | ||
<input | ||
tuiInputPhoneInternational | ||
[countries]="(countries | tuiSortCountries | async) || []" | ||
[countrySearch]="true" | ||
[(countryIsoCode)]="countryIsoCode" | ||
[(ngModel)]="value" | ||
/> | ||
</tui-textfield> | ||
<tui-input-phone-international | ||
[countries]="countries" | ||
[(countryIsoCode)]="countryIsoCode" | ||
[(ngModel)]="value" | ||
/> |
46 changes: 28 additions & 18 deletions
46
projects/demo/src/modules/components/input-phone-international/examples/7/index.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 |
---|---|---|
@@ -1,43 +1,53 @@ | ||
import {AsyncPipe} from '@angular/common'; | ||
import {Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiDropdownMobile} from '@taiga-ui/addon-mobile'; | ||
import {TuiButton, TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiInputPhoneInternational} from '@taiga-ui/experimental'; | ||
import {TuiTextfield} from '@taiga-ui/core'; | ||
import type {TuiCountryIsoCode} from '@taiga-ui/i18n'; | ||
import { | ||
TuiInputPhoneInternational, | ||
tuiInputPhoneInternationalOptionsProvider, | ||
TuiSortCountriesPipe, | ||
} from '@taiga-ui/kit'; | ||
import {getCountries} from 'libphonenumber-js'; | ||
import {defer} from 'rxjs'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ | ||
AsyncPipe, | ||
FormsModule, | ||
TuiButton, | ||
TuiDropdownMobile, | ||
TuiInputPhoneInternational, | ||
TuiSortCountriesPipe, | ||
TuiTextfield, | ||
], | ||
imports: [FormsModule, TuiInputPhoneInternational, TuiTextfield], | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
providers: [ | ||
/** | ||
* You can choose: lazily load metadata or include it in your bundle. | ||
* Lazy loading: | ||
*/ | ||
tuiInputPhoneInternationalOptionsProvider({ | ||
metadata: defer(async () => | ||
import('libphonenumber-js/max/metadata').then((m) => m.default), | ||
), | ||
}), | ||
/** | ||
* Eager loading: | ||
* ```ts | ||
* import metadata from 'libphonenumber-js/mobile/metadata'; | ||
* import {of} from 'rxjs'; | ||
* // [...] | ||
* tuiInputPhoneInternationalOptionsProvider({ | ||
* metadata: of(metadata), | ||
* }), | ||
* ``` | ||
*/ | ||
], | ||
}) | ||
export default class Example { | ||
protected readonly countries = getCountries(); | ||
protected countryIsoCode: TuiCountryIsoCode = 'CN'; | ||
protected value = ''; | ||
protected readonly countries: readonly TuiCountryIsoCode[] = [ | ||
'IN', | ||
'CN', | ||
'US', | ||
'ID', | ||
'PK', | ||
]; | ||
|
||
protected countryIsoCode: TuiCountryIsoCode = 'US'; | ||
protected value = '+12125552368'; | ||
} |
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