Skip to content

Commit cb9340c

Browse files
Merge pull request #33 from juanjotorres90/develop
develop to main
2 parents f44155c + 13937e6 commit cb9340c

File tree

15 files changed

+4094
-1959
lines changed

15 files changed

+4094
-1959
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node-version: [20.x]
15+
node-version: [22.x]
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Use Node.js ${{ matrix.node-version }}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [19.1.0] - 2024-12-21
9+
10+
### Added
11+
12+
- Add 'currentCountryCode' output event to retrieve the current country code number selected ([#30](https://github.com/juanjotorres90/ngx-material-intl-tel-input/issues/30)).
13+
- Add 'currentCountryISO' output event to retrieve the current country ISO code selected ([#31](https://github.com/juanjotorres90/ngx-material-intl-tel-input/issues/31)).
14+
815
## [19.0.0] - 2024-12-07
916

1017
### Added

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Validation with [google-libphonenumber](https://github.com/google/libphonenumber
2020

2121
| ngx-material-intl-tel-input | Angular |
2222
| --------------------------- | --------- |
23-
| 19.0.0 | >= 19.0.0 |
23+
| 19.0.0 - 19.1.0 | >= 19.0.0 |
2424
| 18.0.0 - 18.2.1 | >= 18.0.0 |
2525
| 0.0.1 - 17.3.0 | >= 17.2.0 |
2626

@@ -74,15 +74,17 @@ imports: [NgxMaterialIntlTelInputComponent];
7474
| iconMakeCall | `boolean` | `true` | Click on phone icon to trigger call action. |
7575
| initialValue | `string` | `''` | Sets initial telephone number value |
7676
| useMask | `boolean` | `false` | Use mask for phone number input. |
77-
| forceSelectedCountryCode | `string` | `false` | If useMask is active it forces the selected country code to be displayed |
78-
| showMaskPlaceholder | `string` | `false` | If useMask is active it shows the placeholder for the mask |
77+
| forceSelectedCountryCode | `boolean` | `false` | If useMask is active it forces the selected country code to be displayed |
78+
| showMaskPlaceholder | `boolean` | `false` | If useMask is active it shows the placeholder for the mask |
7979
| textLabels | `TextLabels` | {mainLabel: 'Phone number', codePlaceholder: 'Code', searchPlaceholderLabel: 'Search', noEntriesFoundLabel: 'No countries found', nationalNumberLabel: 'Number', hintLabel: 'Select country and type your phone number', invalidNumberError: 'Number is not valid', requiredError: 'This field is required'} | Overrides all component text labels |
8080

8181
## Events
8282

83-
| Event | Type | Default | Description |
84-
| ------------ | -------- | ------- | -------------------------------------------- |
85-
| currentValue | `string` | `''` | Emitted when the value of the input changes. |
83+
| Event | Type | Default | Description |
84+
| ------------------ | -------- | ------- | -------------------------------------------------------------------- |
85+
| currentValue | `string` | `''` | Full phone number value emitted when the value of the input changes. |
86+
| currentCountryCode | `string` | `''` | Country code value emitted when the value of the input changes. |
87+
| currentCountryISO | `string` | `''` | Country ISO value emitted when the value of the input changes. |
8688

8789
## Contribute and develop locally
8890

apps/ngx-material-intl-tel-input/src/app/app.component.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<form [formGroup]="formTestGroup" (ngSubmit)="onSubmit()">
33
<ngx-material-intl-tel-input
44
(currentValue)="getValue($event)"
5+
(currentCountryCode)="getCountryCode($event)"
6+
(currentCountryISO)="getCountryISO($event)"
57
fieldControlName="phone"
68
[emojiFlags]="false"
79
[includeDialCode]="false"
@@ -30,6 +32,18 @@
3032
<div>
3133
Returned value: <br /><mat-chip>{{ currentPhoneValue() }}</mat-chip>
3234
</div>
35+
<div class="current-country-code-container">
36+
@if (currentCountryCode()) {
37+
<div>
38+
Country code: <br /><mat-chip>{{ currentCountryCode() }}</mat-chip>
39+
</div>
40+
}
41+
@if (currentCountryISO()) {
42+
<div>
43+
Country ISO: <br /><mat-chip>{{ currentCountryISO() }}</mat-chip>
44+
</div>
45+
}
46+
</div>
3347
} @else {
3448
<div>No value returned</div>
3549
}

apps/ngx-material-intl-tel-input/src/app/app.component.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@
2525
margin: 0 auto;
2626
}
2727
}
28+
.current-country-code-container {
29+
display: flex;
30+
flex-direction: row;
31+
gap: 8px;
32+
div {
33+
display: flex;
34+
gap: 8px;
35+
align-items: center;
36+
flex: 1;
37+
width: auto;
38+
}
39+
}
2840
ngx-material-intl-tel-input,
2941
div {
3042
max-width: 400px;

apps/ngx-material-intl-tel-input/src/app/app.component.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import { NgxMaterialIntlTelInputComponent } from 'ngx-material-intl-tel-input';
3232
export class AppComponent {
3333
title = 'ngx-material-intl-tel-input';
3434
currentPhoneValue = signal<string>('');
35+
currentCountryCode = signal<string>('');
36+
currentCountryISO = signal<string>('');
3537
submittedPhoneValue = signal<string>('');
3638
formTestGroup: FormGroup;
3739
showSetPhoneInput = signal<boolean>(false);
@@ -74,4 +76,22 @@ export class AppComponent {
7476
toggleShowSetPhoneInput(): void {
7577
this.showSetPhoneInput.set(!this.showSetPhoneInput());
7678
}
79+
80+
/**
81+
* Sets the current country code to the provided value.
82+
*
83+
* @param value - The new country code to set.
84+
*/
85+
getCountryCode(value: string): void {
86+
this.currentCountryCode.set(value);
87+
}
88+
89+
/**
90+
* Sets the current country ISO code to the provided value.
91+
*
92+
* @param value - The new ISO code to set.
93+
*/
94+
getCountryISO(value: string): void {
95+
this.currentCountryISO.set(value);
96+
}
7797
}

eslint.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = [
3434
})
3535
.map((config) => ({
3636
...config,
37-
files: ['**/*.ts', '**/*.tsx'],
37+
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
3838
rules: {
3939
...config.rules,
4040
'@stylistic/no-extra-semi': 'error'
@@ -46,7 +46,7 @@ module.exports = [
4646
})
4747
.map((config) => ({
4848
...config,
49-
files: ['**/*.js', '**/*.jsx'],
49+
files: ['**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
5050
rules: {
5151
...config.rules,
5252
'@stylistic/no-extra-semi': 'error'

jest.preset.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
const nxPreset = require('@nx/jest/preset').default;
22

3-
module.exports = { ...nxPreset };
3+
module.exports = {
4+
...nxPreset,
5+
passWithNoTests: true,
6+
coverageReporters: ['html', 'lcov', 'text-summary'],
7+
collectCoverage: true,
8+
collectCoverageFrom: [
9+
'**/*.{ts,js,jsx}',
10+
'!**/node_modules/**',
11+
'!**/vendor/**'
12+
],
13+
testTimeout: 60000
14+
};

libs/ngx-material-intl-tel-input-lib/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Validation with [google-libphonenumber](https://github.com/google/libphonenumber
2020

2121
| ngx-material-intl-tel-input | Angular |
2222
| --------------------------- | --------- |
23-
| 19.0.0 | >= 19.0.0 |
23+
| 19.0.0 - 19.1.0 | >= 19.0.0 |
2424
| 18.0.0 - 18.2.1 | >= 18.0.0 |
2525
| 0.0.1 - 17.3.0 | >= 17.2.0 |
2626

@@ -74,15 +74,17 @@ imports: [NgxMaterialIntlTelInputComponent];
7474
| iconMakeCall | `boolean` | `true` | Click on phone icon to trigger call action. |
7575
| initialValue | `string` | `''` | Sets initial telephone number value |
7676
| useMask | `boolean` | `false` | Use mask for phone number input. |
77-
| forceSelectedCountryCode | `string` | `false` | If useMask is active it forces the selected country code to be displayed |
78-
| showMaskPlaceholder | `string` | `false` | If useMask is active it shows the placeholder for the mask |
77+
| forceSelectedCountryCode | `boolean` | `false` | If useMask is active it forces the selected country code to be displayed |
78+
| showMaskPlaceholder | `boolean` | `false` | If useMask is active it shows the placeholder for the mask |
7979
| textLabels | `TextLabels` | {mainLabel: 'Phone number', codePlaceholder: 'Code', searchPlaceholderLabel: 'Search', noEntriesFoundLabel: 'No countries found', nationalNumberLabel: 'Number', hintLabel: 'Select country and type your phone number', invalidNumberError: 'Number is not valid', requiredError: 'This field is required'} | Overrides all component text labels |
8080

8181
## Events
8282

83-
| Event | Type | Default | Description |
84-
| ------------ | -------- | ------- | -------------------------------------------- |
85-
| currentValue | `string` | `''` | Emitted when the value of the input changes. |
83+
| Event | Type | Default | Description |
84+
| ------------------ | -------- | ------- | -------------------------------------------------------------------- |
85+
| currentValue | `string` | `''` | Full phone number value emitted when the value of the input changes. |
86+
| currentCountryCode | `string` | `''` | Country code value emitted when the value of the input changes. |
87+
| currentCountryISO | `string` | `''` | Country ISO value emitted when the value of the input changes. |
8688

8789
## Contributors
8890

libs/ngx-material-intl-tel-input-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-material-intl-tel-input",
3-
"version": "19.0.0",
3+
"version": "19.1.0",
44
"license": "MIT",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)