@tui-cruises/mein-schiff-web-react-component-library 3.1.12 → 3.1.13
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.13](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/compare/v3.1.12...v3.1.13) (2026-04-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **PhoneNumberInput:** add disabled support and align muted look with InputField ([9b4ba3d](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/9b4ba3d4617eff7e382b32b18a15a97d7479f10d))
|
|
11
|
+
|
|
5
12
|
### [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
13
|
|
|
7
14
|
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from '../../../libs/phone-number/types';
|
|
16
16
|
import { CountryCode, parsePhoneNumber } from 'libphonenumber-js';
|
|
17
17
|
import { InputFieldError } from '../InputField/InputFieldError';
|
|
18
|
+
import { twMerge } from 'tailwind-merge';
|
|
18
19
|
|
|
19
20
|
type PhoneNumberInputProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
20
21
|
countries?: PhoneNumberCountry[];
|
|
@@ -87,6 +88,7 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
87
88
|
ariaLabelPhoneNumber = 'Phone number',
|
|
88
89
|
onValueChange,
|
|
89
90
|
readOnly,
|
|
91
|
+
disabled,
|
|
90
92
|
...attrs
|
|
91
93
|
} = props;
|
|
92
94
|
|
|
@@ -120,7 +122,10 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
120
122
|
|
|
121
123
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
122
124
|
const fullNumber = event.target.value;
|
|
123
|
-
const justNumber = fullNumber
|
|
125
|
+
const justNumber = fullNumber
|
|
126
|
+
.replace(selectedCountryDialCode, '')
|
|
127
|
+
.replace(/[^\d\s]/g, '')
|
|
128
|
+
.trim();
|
|
124
129
|
setTypedInNumber(justNumber);
|
|
125
130
|
onValueChange?.({
|
|
126
131
|
dialCode: selectedCountryDialCode,
|
|
@@ -142,15 +147,25 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
142
147
|
<div
|
|
143
148
|
ref={ref}
|
|
144
149
|
data-invalid={invalid || error ? 'true' : undefined}
|
|
145
|
-
className=
|
|
150
|
+
className={twMerge(
|
|
151
|
+
'flex w-full items-center overflow-hidden rounded-md border border-stroke-secondary-40 bg-surface-white p-1 text-marine-high-emphasis transition-all focus-within:border-stroke-primary-100 focus-within:shadow-[inset_0_0_0_2px_theme(colors.stroke.primary-100)] data-[invalid]:border-stroke-error-100',
|
|
152
|
+
!disabled &&
|
|
153
|
+
!readOnly &&
|
|
154
|
+
'hover:border-stroke-primary-100 hover:shadow-[inset_0_0_0_2px_theme(colors.stroke.primary-100)]',
|
|
155
|
+
(disabled || readOnly) &&
|
|
156
|
+
'border-transparent bg-surface-secondary-7 text-marine-medium-emphasis shadow-none',
|
|
157
|
+
)}
|
|
146
158
|
>
|
|
147
159
|
<SelectPrimitive.Root
|
|
148
160
|
value={selectedCountryCode}
|
|
149
161
|
onValueChange={handleCountryChange}
|
|
150
|
-
disabled={readOnly}
|
|
162
|
+
disabled={disabled || readOnly}
|
|
151
163
|
>
|
|
152
164
|
<SelectPrimitive.Trigger
|
|
153
|
-
className=
|
|
165
|
+
className={twMerge(
|
|
166
|
+
'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',
|
|
167
|
+
(disabled || readOnly) && 'bg-transparent',
|
|
168
|
+
)}
|
|
154
169
|
aria-label={ariaLabelCountryCode}
|
|
155
170
|
>
|
|
156
171
|
<CountryFlag
|
|
@@ -191,16 +206,22 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
|
|
|
191
206
|
<input
|
|
192
207
|
id={phoneInputId}
|
|
193
208
|
type="tel"
|
|
194
|
-
className="flex-1 p-3 focus:outline-none"
|
|
209
|
+
className="flex-1 bg-transparent p-3 text-inherit focus:outline-none"
|
|
195
210
|
value={inputValue}
|
|
196
211
|
onChange={handleChange}
|
|
197
212
|
readOnly={readOnly}
|
|
213
|
+
disabled={disabled}
|
|
198
214
|
aria-label={ariaLabelPhoneNumber}
|
|
199
215
|
aria-describedby={ariaDescribedBy}
|
|
200
216
|
/>
|
|
201
217
|
|
|
202
218
|
<Form.Control type="tel" asChild>
|
|
203
|
-
<input
|
|
219
|
+
<input
|
|
220
|
+
type="hidden"
|
|
221
|
+
{...attrs}
|
|
222
|
+
disabled={disabled}
|
|
223
|
+
defaultValue={inputValue}
|
|
224
|
+
/>
|
|
204
225
|
</Form.Control>
|
|
205
226
|
</div>
|
|
206
227
|
{error && <InputFieldError id={errorId}>{error}</InputFieldError>}
|