@tui-cruises/mein-schiff-web-react-component-library 3.1.11 → 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,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.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
+
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)
13
+
14
+
15
+ ### Features
16
+
17
+ * **PhoneNumberInput:** add readOnly support ([8d97882](https://bitbucket.org/yours_truly/tuic-mein-schiff-web-react-component-library/commit/8d97882410dc2c27e7a7bacc605c21ad401d4b6a))
18
+
5
19
  ### [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
20
 
7
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tui-cruises/mein-schiff-web-react-component-library",
3
- "version": "3.1.11",
3
+ "version": "3.1.13",
4
4
  "main": "./index.tsx",
5
5
  "types": "./index.tsx",
6
6
  "type": "module",
@@ -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[];
@@ -86,6 +87,8 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
86
87
  ariaLabelCountryCode = 'Country code',
87
88
  ariaLabelPhoneNumber = 'Phone number',
88
89
  onValueChange,
90
+ readOnly,
91
+ disabled,
89
92
  ...attrs
90
93
  } = props;
91
94
 
@@ -119,7 +122,10 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
119
122
 
120
123
  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
121
124
  const fullNumber = event.target.value;
122
- const justNumber = fullNumber.replace(selectedCountryDialCode, '').trim();
125
+ const justNumber = fullNumber
126
+ .replace(selectedCountryDialCode, '')
127
+ .replace(/[^\d\s]/g, '')
128
+ .trim();
123
129
  setTypedInNumber(justNumber);
124
130
  onValueChange?.({
125
131
  dialCode: selectedCountryDialCode,
@@ -141,14 +147,25 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
141
147
  <div
142
148
  ref={ref}
143
149
  data-invalid={invalid || error ? 'true' : undefined}
144
- className="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)] hover:border-stroke-primary-100 hover:shadow-[inset_0_0_0_2px_theme(colors.stroke.primary-100)] data-[invalid]:border-stroke-error-100"
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
+ )}
145
158
  >
146
159
  <SelectPrimitive.Root
147
160
  value={selectedCountryCode}
148
161
  onValueChange={handleCountryChange}
162
+ disabled={disabled || readOnly}
149
163
  >
150
164
  <SelectPrimitive.Trigger
151
- 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"
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
+ )}
152
169
  aria-label={ariaLabelCountryCode}
153
170
  >
154
171
  <CountryFlag
@@ -189,15 +206,22 @@ const PhoneNumberInputRenderFunction: ForwardRefRenderFunction<
189
206
  <input
190
207
  id={phoneInputId}
191
208
  type="tel"
192
- className="flex-1 p-3 focus:outline-none"
209
+ className="flex-1 bg-transparent p-3 text-inherit focus:outline-none"
193
210
  value={inputValue}
194
211
  onChange={handleChange}
212
+ readOnly={readOnly}
213
+ disabled={disabled}
195
214
  aria-label={ariaLabelPhoneNumber}
196
215
  aria-describedby={ariaDescribedBy}
197
216
  />
198
217
 
199
218
  <Form.Control type="tel" asChild>
200
- <input type="hidden" {...attrs} defaultValue={inputValue} />
219
+ <input
220
+ type="hidden"
221
+ {...attrs}
222
+ disabled={disabled}
223
+ defaultValue={inputValue}
224
+ />
201
225
  </Form.Control>
202
226
  </div>
203
227
  {error && <InputFieldError id={errorId}>{error}</InputFieldError>}