@tui-cruises/mein-schiff-web-react-component-library 3.1.10 → 3.1.12
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,20 @@
|
|
|
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.12](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v3.1.11...v3.1.12) (2026-04-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **PhoneNumberInput:** add readOnly support ([8d97882](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/8d97882410dc2c27e7a7bacc605c21ad401d4b6a))
|
|
11
|
+
|
|
12
|
+
### [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)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **PhoneNumberInput:** expose an onValueChange prop for number change events ([72021b2](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/72021b20305eb1dd5ed21a7e346e39fef497afed))
|
|
18
|
+
|
|
5
19
|
### [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
20
|
|
|
7
21
|
|
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,8 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
83
85
|
error,
|
|
84
86
|
ariaLabelCountryCode = 'Country code',
|
|
85
87
|
ariaLabelPhoneNumber = 'Phone number',
|
|
88
|
+
onValueChange,
|
|
89
|
+
readOnly,
|
|
86
90
|
...attrs
|
|
87
91
|
} = props;
|
|
88
92
|
|
|
@@ -109,12 +113,19 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
109
113
|
const handleCountryChange = (value: string) => {
|
|
110
114
|
setSelectedCountryCode(value);
|
|
111
115
|
setTypedInNumber('');
|
|
116
|
+
const newDialCode =
|
|
117
|
+
countries.find(country => country.code === value)?.dialCode || '';
|
|
118
|
+
onValueChange?.({ dialCode: newDialCode, localNumber: '' });
|
|
112
119
|
};
|
|
113
120
|
|
|
114
121
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
115
122
|
const fullNumber = event.target.value;
|
|
116
123
|
const justNumber = fullNumber.replace(selectedCountryDialCode, '').trim();
|
|
117
124
|
setTypedInNumber(justNumber);
|
|
125
|
+
onValueChange?.({
|
|
126
|
+
dialCode: selectedCountryDialCode,
|
|
127
|
+
localNumber: justNumber,
|
|
128
|
+
});
|
|
118
129
|
};
|
|
119
130
|
|
|
120
131
|
const inputValue = `${selectedCountryDialCode} ${typedInNumber}`;
|
|
@@ -136,6 +147,7 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
136
147
|
<SelectPrimitive.Root
|
|
137
148
|
value={selectedCountryCode}
|
|
138
149
|
onValueChange={handleCountryChange}
|
|
150
|
+
disabled={readOnly}
|
|
139
151
|
>
|
|
140
152
|
<SelectPrimitive.Trigger
|
|
141
153
|
className="z-[1] flex items-center gap-2 rounded-md bg-surface-secondary-10 p-3 hover:!shadow-none focus:outline-none focus-visible:shadow-focus-state"
|
|
@@ -182,6 +194,7 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
182
194
|
className="flex-1 p-3 focus:outline-none"
|
|
183
195
|
value={inputValue}
|
|
184
196
|
onChange={handleChange}
|
|
197
|
+
readOnly={readOnly}
|
|
185
198
|
aria-label={ariaLabelPhoneNumber}
|
|
186
199
|
aria-describedby={ariaDescribedBy}
|
|
187
200
|
/>
|