@tui-cruises/mein-schiff-web-react-component-library 3.1.10 → 3.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.1.11](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v3.1.10...v3.1.11) (2026-04-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **PhoneNumberInput:** expose an onValueChange prop for number change events ([72021b2](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/72021b20305eb1dd5ed21a7e346e39fef497afed))
|
|
11
|
+
|
|
5
12
|
### [3.1.10](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v3.1.9...v3.1.10) (2026-02-23)
|
|
6
13
|
|
|
7
14
|
|
package/package.json
CHANGED
|
@@ -24,6 +24,8 @@ type PhoneNumberInputProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
|
24
24
|
error?: string;
|
|
25
25
|
ariaLabelCountryCode?: string;
|
|
26
26
|
ariaLabelPhoneNumber?: string;
|
|
27
|
+
/** Called whenever the value changes with the dial code and number separately. */
|
|
28
|
+
onValueChange?: (value: { dialCode: string; localNumber: string }) => void;
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
const getDefaultCountry = (
|
|
@@ -83,6 +85,7 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
83
85
|
error,
|
|
84
86
|
ariaLabelCountryCode = 'Country code',
|
|
85
87
|
ariaLabelPhoneNumber = 'Phone number',
|
|
88
|
+
onValueChange,
|
|
86
89
|
...attrs
|
|
87
90
|
} = props;
|
|
88
91
|
|
|
@@ -109,12 +112,19 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
109
112
|
const handleCountryChange = (value: string) => {
|
|
110
113
|
setSelectedCountryCode(value);
|
|
111
114
|
setTypedInNumber('');
|
|
115
|
+
const newDialCode =
|
|
116
|
+
countries.find(country => country.code === value)?.dialCode || '';
|
|
117
|
+
onValueChange?.({ dialCode: newDialCode, localNumber: '' });
|
|
112
118
|
};
|
|
113
119
|
|
|
114
120
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
115
121
|
const fullNumber = event.target.value;
|
|
116
122
|
const justNumber = fullNumber.replace(selectedCountryDialCode, '').trim();
|
|
117
123
|
setTypedInNumber(justNumber);
|
|
124
|
+
onValueChange?.({
|
|
125
|
+
dialCode: selectedCountryDialCode,
|
|
126
|
+
localNumber: justNumber,
|
|
127
|
+
});
|
|
118
128
|
};
|
|
119
129
|
|
|
120
130
|
const inputValue = `${selectedCountryDialCode} ${typedInNumber}`;
|