@rh-support/components 2.5.205 → 2.5.207
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAoB3B,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAoDD,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM;;;;;;;;;;CAmClD,CAAC;
|
|
1
|
+
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAoB3B,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtE,mBAAmB,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAoDD,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM;;;;;;;;;;CAmClD,CAAC;AAyCF,eAAO,MAAM,WAAW,GAAI,aAAa,MAAM;;;CAgB9C,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,qBA8RvC"}
|
|
@@ -107,7 +107,11 @@ const formatNumber = (fullPhoneNumber, localFormat) => {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
const isPatternWithPrefix = (_a = pattern === null || pattern === void 0 ? void 0 : pattern.replace(/\s+/g, '')) === null || _a === void 0 ? void 0 : _a.startsWith(PREFIX);
|
|
110
|
+
// TODO: Temporary — return pattern without forcing + prefix for portal phone without country code.
|
|
111
|
+
pattern = isPatternWithPrefix ? pattern : pattern;
|
|
112
|
+
/* TODO: Revert to previous logic after phone format handling is finalized.
|
|
110
113
|
pattern = isPatternWithPrefix ? pattern : !isEmpty(isPatternWithPrefix) ? PREFIX + pattern : '';
|
|
114
|
+
*/
|
|
111
115
|
return pattern;
|
|
112
116
|
};
|
|
113
117
|
// return phoneline and countrycode for any given phone
|
|
@@ -140,7 +144,11 @@ export function PhoneInput(props) {
|
|
|
140
144
|
const setLocalFormat = (phoneNumber) => {
|
|
141
145
|
const localPhone = removeAllChars(phoneNumber);
|
|
142
146
|
if (shouldNotSetCountryCode) {
|
|
147
|
+
// TODO: Temporary — portal phone without country code; use mask without + prefix.
|
|
148
|
+
return DEFAULT_MASK;
|
|
149
|
+
/* TODO: Revert to previous logic after phone format handling is finalized.
|
|
143
150
|
return DEFAULT_FORMAT; // default format for portal phone without country code
|
|
151
|
+
*/
|
|
144
152
|
}
|
|
145
153
|
let localFormat;
|
|
146
154
|
const exactCountry = getExactCountry(localPhone);
|
|
@@ -169,12 +177,23 @@ export function PhoneInput(props) {
|
|
|
169
177
|
const localFormat = setLocalFormat(phone);
|
|
170
178
|
const _formattedNumber = formatNumber(phone, localFormat);
|
|
171
179
|
setFormattedNumber(_formattedNumber);
|
|
172
|
-
|
|
180
|
+
// TODO: Temporary — do not prepend + when shouldNotSetCountryCode is true.
|
|
181
|
+
if (!shouldNotSetCountryCode &&
|
|
182
|
+
!(phone === null || phone === void 0 ? void 0 : phone.trim().startsWith(PREFIX)) &&
|
|
183
|
+
regex.test(phone) &&
|
|
184
|
+
!isEqual(phone, '-')) {
|
|
173
185
|
onPhoneValueChange(PREFIX + (phone === null || phone === void 0 ? void 0 : phone.trim()));
|
|
174
186
|
}
|
|
175
187
|
else {
|
|
176
188
|
onPhoneValueChange(phone === null || phone === void 0 ? void 0 : phone.slice(0, localFormat === null || localFormat === void 0 ? void 0 : localFormat.length));
|
|
177
189
|
}
|
|
190
|
+
/* TODO: Revert to previous logic after phone format handling is finalized.
|
|
191
|
+
if (!phone?.trim().startsWith(PREFIX) && regex.test(phone) && !isEqual(phone, '-')) {
|
|
192
|
+
onPhoneValueChange(PREFIX + phone?.trim());
|
|
193
|
+
} else {
|
|
194
|
+
onPhoneValueChange(phone?.slice(0, localFormat?.length));
|
|
195
|
+
}
|
|
196
|
+
*/
|
|
178
197
|
};
|
|
179
198
|
const onCountrySelect = (_event, itemId) => {
|
|
180
199
|
var _a, _b;
|
|
@@ -233,10 +252,18 @@ export function PhoneInput(props) {
|
|
|
233
252
|
onPhoneValueChange('');
|
|
234
253
|
}
|
|
235
254
|
else {
|
|
255
|
+
// TODO: Temporary — strip leading + when shouldNotSetCountryCode is true.
|
|
256
|
+
const normalizedPhone = shouldNotSetCountryCode ? (phoneValue === null || phoneValue === void 0 ? void 0 : phoneValue.replace(/^\++/, '')) || '' : phoneValue;
|
|
257
|
+
onPhoneValueChange(normalizedPhone);
|
|
258
|
+
const localFormat = setLocalFormat(normalizedPhone);
|
|
259
|
+
const _formattedNumber = formatNumber(normalizedPhone, localFormat);
|
|
260
|
+
setFormattedNumber(_formattedNumber);
|
|
261
|
+
/* TODO: Revert to previous logic after phone format handling is finalized.
|
|
236
262
|
onPhoneValueChange(phoneValue);
|
|
237
263
|
const localFormat = setLocalFormat(phoneValue);
|
|
238
264
|
const _formattedNumber = formatNumber(phoneValue, localFormat);
|
|
239
265
|
setFormattedNumber(_formattedNumber);
|
|
266
|
+
*/
|
|
240
267
|
}
|
|
241
268
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
242
269
|
}, [phoneValue]);
|
|
@@ -251,10 +278,20 @@ export function PhoneInput(props) {
|
|
|
251
278
|
else {
|
|
252
279
|
onCountryCodeChange && onCountryCodeChange(PREFIX + countryCode);
|
|
253
280
|
}
|
|
281
|
+
// TODO: Temporary — strip leading + when shouldNotSetCountryCode is true.
|
|
282
|
+
const normalizedPhone = shouldNotSetCountryCode
|
|
283
|
+
? removeAllSpaces((phoneValue === null || phoneValue === void 0 ? void 0 : phoneValue.replace(/^\++/, '')) || '')
|
|
284
|
+
: removeAllSpaces(phoneValue);
|
|
285
|
+
onPhoneValueChange && onPhoneValueChange(normalizedPhone);
|
|
286
|
+
const localFormat = setLocalFormat(normalizedPhone);
|
|
287
|
+
const _formattedNumber = formatNumber(normalizedPhone, localFormat);
|
|
288
|
+
setFormattedNumber(_formattedNumber);
|
|
289
|
+
/* TODO: Revert to previous logic after phone format handling is finalized.
|
|
254
290
|
onPhoneValueChange && onPhoneValueChange(removeAllSpaces(phoneValue)); // removing trailing and in between spaces
|
|
255
291
|
const localFormat = setLocalFormat(phoneValue);
|
|
256
292
|
const _formattedNumber = formatNumber(phoneValue, localFormat);
|
|
257
293
|
setFormattedNumber(_formattedNumber);
|
|
294
|
+
*/
|
|
258
295
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
259
296
|
}, [shouldNotSetCountryCode]);
|
|
260
297
|
const toggle = (React.createElement(MenuToggle, { ref: toggleRef, onClick: () => setIsOpen(!isOpen), isExpanded: isOpen, className: "phone-number-select", "data-tracking-id": "case-phone-number-country-code", isDisabled: props.isDisabled, "aria-label": "Country Code" }, iso2 && phoneValue !== '' ? placeholder : t('Country Code')));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.207",
|
|
4
4
|
"description": "Contains all reusabel components for support app",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@patternfly/react-icons": "6.2.1",
|
|
63
63
|
"@patternfly/react-table": "6.2.1",
|
|
64
64
|
"@rh-support/types": "2.0.26",
|
|
65
|
-
"@rh-support/user-permissions": "2.5.
|
|
66
|
-
"@rh-support/utils": "2.5.
|
|
65
|
+
"@rh-support/user-permissions": "2.5.154",
|
|
66
|
+
"@rh-support/utils": "2.5.135",
|
|
67
67
|
"dompurify": "^2.2.6",
|
|
68
68
|
"js-worker-search": "^1.4.1",
|
|
69
69
|
"lazysizes": "^5.3.2",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"defaults and supports es6-module",
|
|
104
104
|
"maintained node versions"
|
|
105
105
|
],
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "0ee7395e3f501d247910c0ac5f91a4f2e3195e07"
|
|
107
107
|
}
|