@widergy/mobile-ui 2.9.6 → 2.10.0

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
@@ -1,3 +1,17 @@
1
+ # [2.10.0](https://github.com/widergy/mobile-ui/compare/v2.9.7...v2.10.0) (2026-04-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * [PROMI-221] UTPhoneInput soporta valor string u objeto con prefix editable ([#496](https://github.com/widergy/mobile-ui/issues/496)) ([07a8a8b](https://github.com/widergy/mobile-ui/commit/07a8a8bf4101efcd89176119de7a8aa62252f79e))
7
+
8
+ ## [2.9.7](https://github.com/widergy/mobile-ui/compare/v2.9.6...v2.9.7) (2026-04-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * [UGGC-99] replace deprecated defaultProps with default parameter in UTModal ([#495](https://github.com/widergy/mobile-ui/issues/495)) ([b2c095f](https://github.com/widergy/mobile-ui/commit/b2c095f57a962e14029ddac9eb80cff07bd6b011))
14
+
1
15
  ## [2.9.6](https://github.com/widergy/mobile-ui/compare/v2.9.5...v2.9.6) (2026-04-09)
2
16
 
3
17
 
@@ -48,7 +48,7 @@ const UTModal = ({
48
48
  loadingText,
49
49
  modalBackgroundColor,
50
50
  modalStyles,
51
- onRequestClose,
51
+ onRequestClose = () => {},
52
52
  subtitle,
53
53
  subtitleProps = {},
54
54
  title,
@@ -184,10 +184,6 @@ const UTModal = ({
184
184
  );
185
185
  };
186
186
 
187
- UTModal.defaultProps = {
188
- onRequestClose: () => {}
189
- };
190
-
191
187
  UTModal.propTypes = ModalTypes;
192
188
 
193
189
  export default UTModal;
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent, createRef } from 'react';
2
2
  import { View } from 'react-native';
3
- import { bool, elementType, func, number, shape, string } from 'prop-types';
3
+ import { bool, elementType, func, number, oneOfType, shape, string } from 'prop-types';
4
4
 
5
5
  import { COMPONENT_KEYS } from '../UTBaseInputField/constants';
6
6
  import { formatErrorToValidation } from '../UTValidation/utils';
@@ -53,9 +53,11 @@ class UTPhoneInput extends PureComponent {
53
53
 
54
54
  changeText = updateFunction => {
55
55
  const { areaCode, phoneNumber } = this.state;
56
- const { withAreaCode } = this.props;
56
+ const { withAreaCode, prefix, editablePrefix } = this.props;
57
57
 
58
- if (withAreaCode && (areaCode || phoneNumber)) {
58
+ if (prefix !== undefined && editablePrefix) {
59
+ updateFunction({ number: phoneNumber, prefix });
60
+ } else if (withAreaCode && (areaCode || phoneNumber)) {
59
61
  updateFunction(`${areaCode}-${phoneNumber}`);
60
62
  } else if (!withAreaCode) {
61
63
  updateFunction(phoneNumber);
@@ -137,10 +139,14 @@ class UTPhoneInput extends PureComponent {
137
139
  };
138
140
 
139
141
  updateValue = () => {
140
- const { value, withAreaCode } = this.props;
142
+ const { value, withAreaCode, prefix, editablePrefix, onChange } = this.props;
141
143
  if (value) {
142
- if (withAreaCode) {
143
- const phone = value.split('-');
144
+ const valueNumber = typeof value === 'object' ? value.number : value;
145
+ if (prefix !== undefined && editablePrefix) {
146
+ this.setState({ phoneNumber: valueNumber });
147
+ if (typeof value !== 'object') onChange({ number: valueNumber, prefix });
148
+ } else if (withAreaCode) {
149
+ const phone = valueNumber.split('-');
144
150
  if (phone.length === 2) {
145
151
  const newAreaCodeState = this.getAreaCodeState(phone[0]);
146
152
  this.setState({
@@ -149,7 +155,7 @@ class UTPhoneInput extends PureComponent {
149
155
  });
150
156
  }
151
157
  } else {
152
- this.setState({ phoneNumber: value });
158
+ this.setState({ phoneNumber: valueNumber });
153
159
  }
154
160
  } else {
155
161
  this.setState({
@@ -164,7 +170,7 @@ class UTPhoneInput extends PureComponent {
164
170
  render() {
165
171
  const {
166
172
  areaCodePlaceholder,
167
- countryCode,
173
+ prefix,
168
174
  dataTestId,
169
175
  disabled,
170
176
  error,
@@ -235,9 +241,7 @@ class UTPhoneInput extends PureComponent {
235
241
  disabled={(withAreaCode && !isValidCode) || disabled || readOnly}
236
242
  error={hasError && !areaCodeError}
237
243
  leftAdornments={
238
- countryCode && !withAreaCode
239
- ? [{ name: COMPONENT_KEYS.PREFIX, props: { text: countryCode } }]
240
- : []
244
+ prefix && !withAreaCode ? [{ name: COMPONENT_KEYS.PREFIX, props: { text: prefix } }] : []
241
245
  }
242
246
  maxLength={withAreaCode ? maxLength - (areaCode?.length || 0) : maxLength}
243
247
  onBlur={this.handleSecondBlur}
@@ -288,7 +292,6 @@ UTPhoneInput.defaultProps = {
288
292
 
289
293
  UTPhoneInput.propTypes = {
290
294
  areaCodePlaceholder: string,
291
- countryCode: string,
292
295
  dataTestId: string,
293
296
  disabled: bool,
294
297
  error: string,
@@ -300,6 +303,8 @@ UTPhoneInput.propTypes = {
300
303
  onFocus: func,
301
304
  onSubmitEditing: func,
302
305
  placeholder: string,
306
+ prefix: string,
307
+ editablePrefix: bool,
303
308
  readOnly: bool,
304
309
  required: bool,
305
310
  RightIcon: elementType,
@@ -310,7 +315,7 @@ UTPhoneInput.propTypes = {
310
315
  invalidAreaCodeError: string
311
316
  }),
312
317
  validations: validationDataProptypes,
313
- value: string,
318
+ value: oneOfType([string, shape({ number: string, prefix: string })]),
314
319
  withAreaCode: bool
315
320
  };
316
321
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "2.9.6",
5
+ "version": "2.10.0",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [