@widergy/mobile-ui 1.32.10 → 1.32.11
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 +7 -0
- package/lib/components/UTBaseInputField/README.md +26 -25
- package/lib/components/UTBaseInputField/index.js +3 -1
- package/lib/components/UTBaseInputField/utils.js +2 -2
- package/lib/components/UTTextInput/versions/V1/README.md +34 -33
- package/lib/components/UTTextInput/versions/V1/components/TextInputField/index.js +3 -0
- package/lib/components/UTTextInput/versions/V1/index.js +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.32.11](https://github.com/widergy/mobile-ui/compare/v1.32.10...v1.32.11) (2024-12-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* autoCapitalize for text input ([#396](https://github.com/widergy/mobile-ui/issues/396)) ([af0814c](https://github.com/widergy/mobile-ui/commit/af0814c77fba0cc34faa43ab813bf5325dba7fcf))
|
|
7
|
+
|
|
1
8
|
## [1.32.10](https://github.com/widergy/mobile-ui/compare/v1.32.9...v1.32.10) (2024-12-06)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -6,31 +6,32 @@
|
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
8
|
|
|
9
|
-
| Name | Type | Default
|
|
10
|
-
| --------------------- | --------------------------------------------------------- |
|
|
11
|
-
| alwaysShowPlaceholder | bool | false
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
9
|
+
| Name | Type | Default | Description |
|
|
10
|
+
| --------------------- | --------------------------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------- |
|
|
11
|
+
| alwaysShowPlaceholder | bool | false | Whether to always show the placeholder text, even when the field is focused. |
|
|
12
|
+
| autoCapitalize | oneOf('none','sentences','words','characters') | 'sentences' | Defines how to automatically capitalize certain characters. |
|
|
13
|
+
| blurOnSubmit | bool | | If true, the input will be blurred when the user submits the text. |
|
|
14
|
+
| disabled | bool | | Whether the input field is disabled. |
|
|
15
|
+
| editable | bool | true | Whether the input field is editable. If false, it behaves like a disabled field. |
|
|
16
|
+
| error | oneOfType([bool, string]) | | Error message to display, or `true` to indicate an error state without a message. |
|
|
17
|
+
| id | oneOfType([number, string]) | | Unique identifier for the input field. |
|
|
18
|
+
| value | oneOfType([string, number]) | null | The value of the input field. |
|
|
19
|
+
| onChange | func | () => {} | Callback function to handle change events. |
|
|
20
|
+
| inputSize | string | 'large' | Size of the input field. One of: `small`, `large`. |
|
|
21
|
+
| leftAdornments | arrayOf(shape({ name: string, props: object })) | [] | Elements to display on the left side of the input field (e.g., prefix, icons). |
|
|
22
|
+
| maxLength | number | | Maximum number of characters allowed in the input. |
|
|
23
|
+
| maxRows | number | 1 | Maximum number of rows for multiline input. |
|
|
24
|
+
| onBlur | func | | Callback function to handle blur events. |
|
|
25
|
+
| onFocus | func | | Callback function to handle focus events. |
|
|
26
|
+
| onSubmitEditing | func | | Callback function to handle submit events. |
|
|
27
|
+
| placeholder | string | | Placeholder text for the input field. |
|
|
28
|
+
| readOnly | bool | | Whether the input field is read-only. |
|
|
29
|
+
| returnKeyType | string | | Type of return key to display on the keyboard. |
|
|
30
|
+
| rightAdornments | arrayOf(shape({ name: string, props: object })) | [] | Elements to display on the right side of the input field (e.g., suffix, icons, action buttons). |
|
|
31
|
+
| showCharacterCount | bool | | Whether to display the character count. |
|
|
32
|
+
| style | shape({ container: object, input: object, root: object }) | {} | Custom styles to apply to the component. |
|
|
33
|
+
| type | string | | Type of the input field (e.g., text, email, numeric, password). |
|
|
34
|
+
| variant | string | 'white' | Variant of the input field. One of: `white`, `gray`. |
|
|
34
35
|
|
|
35
36
|
## Input Types
|
|
36
37
|
|
|
@@ -23,6 +23,7 @@ const UTBaseInputField = forwardRef(
|
|
|
23
23
|
(
|
|
24
24
|
{
|
|
25
25
|
alwaysShowPlaceholder = false,
|
|
26
|
+
autoCapitalize: autoCapitalize_,
|
|
26
27
|
blurOnSubmit,
|
|
27
28
|
disabled,
|
|
28
29
|
editable = true,
|
|
@@ -57,7 +58,7 @@ const UTBaseInputField = forwardRef(
|
|
|
57
58
|
const multiline = maxRows > 1;
|
|
58
59
|
const hasCharactersCount = showCharacterCount && maxLength && !disabled && !readOnly;
|
|
59
60
|
|
|
60
|
-
const { secureTextEntry, autoCapitalize, keyboardType } = getPropsByType(type);
|
|
61
|
+
const { secureTextEntry, autoCapitalize, keyboardType } = getPropsByType(type, autoCapitalize_);
|
|
61
62
|
|
|
62
63
|
const setNativeText = useMemo(
|
|
63
64
|
() => debounce(text => inputRef.current?.setNativeProps({ text }), DEBOUNCE_DELAY, DEBOUNCE_CONFIG),
|
|
@@ -223,6 +224,7 @@ UTBaseInputField.displayName = 'UTBaseInputField';
|
|
|
223
224
|
|
|
224
225
|
UTBaseInputField.propTypes = {
|
|
225
226
|
alwaysShowPlaceholder: bool,
|
|
227
|
+
autoCapitalize: string,
|
|
226
228
|
blurOnSubmit: bool,
|
|
227
229
|
disabled: bool,
|
|
228
230
|
editable: bool,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KEYBOARD_BY_TYPE, TYPES } from './constants';
|
|
2
2
|
|
|
3
|
-
export const getPropsByType = type => {
|
|
4
|
-
const autoCapitalize = type === TYPES.EMAIL ? 'none' : 'sentences';
|
|
3
|
+
export const getPropsByType = (type, autoCapitalize_) => {
|
|
4
|
+
const autoCapitalize = autoCapitalize_ ?? (type === TYPES.EMAIL ? 'none' : 'sentences');
|
|
5
5
|
const keyboardType = KEYBOARD_BY_TYPE[type] || 'default';
|
|
6
6
|
const secureTextEntry = [TYPES.PASSWORD, TYPES.PASSWORD_NUMERIC].includes(type);
|
|
7
7
|
|
|
@@ -6,39 +6,40 @@
|
|
|
6
6
|
|
|
7
7
|
## Props
|
|
8
8
|
|
|
9
|
-
| Name | Type | Default
|
|
10
|
-
| --------------------- | --------------------------------------------------------- |
|
|
11
|
-
| action | object |
|
|
12
|
-
| alwaysShowPlaceholder | bool | false
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
9
|
+
| Name | Type | Default | Description |
|
|
10
|
+
| --------------------- | --------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| action | object | | Action button configuration object. |
|
|
12
|
+
| alwaysShowPlaceholder | bool | false | Whether to always show the placeholder, even when the field is focused. |
|
|
13
|
+
| autoCapitalize | oneOf('none','sentences','words','characters') | 'sentences' | Defines how to automatically capitalize certain characters. |
|
|
14
|
+
| blurOnSubmit | bool | false | Whether the input should lose focus after submitting. |
|
|
15
|
+
| disabled | bool | false | Disables the input field. |
|
|
16
|
+
| error | string | | Error message to be displayed below the input field. |
|
|
17
|
+
| helpText | string | | Help text to be displayed below the input field. |
|
|
18
|
+
| id | oneOfType([number, string]) | | Unique identifier for the input field. |
|
|
19
|
+
| inputRef | oneOfType([func, instanceOf(Object)]) | | Reference to the input field to access methods like `focus`, `blur`, or `clear`. |
|
|
20
|
+
| inputSize | string | 'large' | Size of the input field. One of: `small`, `large`. |
|
|
21
|
+
| title | string | | Title text for the input field. |
|
|
22
|
+
| titleVariant | string | 'large' | Variant of the title. Either `small` or `large`. |
|
|
23
|
+
| LeftIcon | elementType | | Icon to be displayed on the left side of the input field. |
|
|
24
|
+
| maxLength | number | | Maximum number of characters allowed in the input field. |
|
|
25
|
+
| maxRows | number | 1 | Maximum number of rows allowed in the input field. |
|
|
26
|
+
| onBlur | func | | Function to call when the input field loses focus. |
|
|
27
|
+
| onChange | func | | Function to call when the input field value changes. |
|
|
28
|
+
| onFocus | func | | Function to call when the input field gains focus. |
|
|
29
|
+
| onSubmitEditing | func | | Function to call when the input field is submitted (e.g., pressing Enter on a keyboard). |
|
|
30
|
+
| placeholder | string | | Placeholder text for the input field. |
|
|
31
|
+
| prefix | string | | Prefix text to be displayed inside the input field before the entered value. |
|
|
32
|
+
| readOnly | bool | false | Makes the input field read-only. |
|
|
33
|
+
| required | bool | false | Marks the input field as required. |
|
|
34
|
+
| returnKeyType | string | 'done' | Determines the return key type on the keyboard (e.g., `done`, `next`). |
|
|
35
|
+
| RightIcon | elementType | | Icon to be displayed on the right side of the input field. |
|
|
36
|
+
| showCharacterCount | bool | false | Whether the character count should be displayed (if `maxLength` is defined). |
|
|
37
|
+
| style | shape({ container: object, input: object, root: object }) | | Style object to customize the input field. Can contain `root`, `container`, `input`, or `action` styles. |
|
|
38
|
+
| suffix | string | | Suffix text to be displayed inside the input field after the entered value. |
|
|
39
|
+
| tooltip | string | | Tooltip text to be displayed next to the input field. |
|
|
40
|
+
| type | string | 'default' | Type of input field (e.g., 'text', 'password', 'email', 'numeric'). |
|
|
41
|
+
| validations | validationDataProptypes | | Array of validation rules to be applied to the input field. |
|
|
42
|
+
| value | string | '' | The current value of the input field. |
|
|
42
43
|
|
|
43
44
|
### action
|
|
44
45
|
|
|
@@ -6,6 +6,7 @@ import { COMPONENT_KEYS } from '../../../../../UTBaseInputField/constants';
|
|
|
6
6
|
|
|
7
7
|
const TextInputField = ({
|
|
8
8
|
action,
|
|
9
|
+
autoCapitalize,
|
|
9
10
|
alwaysShowPlaceholder,
|
|
10
11
|
blurOnSubmit,
|
|
11
12
|
disabled,
|
|
@@ -47,6 +48,7 @@ const TextInputField = ({
|
|
|
47
48
|
return (
|
|
48
49
|
<UTBaseInputField
|
|
49
50
|
alwaysShowPlaceholder={alwaysShowPlaceholder}
|
|
51
|
+
autoCapitalize={autoCapitalize}
|
|
50
52
|
blurOnSubmit={blurOnSubmit}
|
|
51
53
|
disabled={disabled && !readOnly}
|
|
52
54
|
error={error}
|
|
@@ -77,6 +79,7 @@ TextInputField.displayName = 'TextInputField';
|
|
|
77
79
|
TextInputField.propTypes = {
|
|
78
80
|
action: shape({ icon: elementType, action: func, colorTheme: string, text: string }),
|
|
79
81
|
alwaysShowPlaceholder: bool,
|
|
82
|
+
autoCapitalize: string,
|
|
80
83
|
blurOnSubmit: bool,
|
|
81
84
|
disabled: bool,
|
|
82
85
|
error: string,
|
|
@@ -14,6 +14,7 @@ import TextInputField from './components/TextInputField';
|
|
|
14
14
|
const UTTextInput = ({
|
|
15
15
|
action,
|
|
16
16
|
alwaysShowPlaceholder,
|
|
17
|
+
autoCapitalize,
|
|
17
18
|
blurOnSubmit,
|
|
18
19
|
disabled,
|
|
19
20
|
error,
|
|
@@ -61,6 +62,7 @@ const UTTextInput = ({
|
|
|
61
62
|
<TextInputField
|
|
62
63
|
action={action}
|
|
63
64
|
alwaysShowPlaceholder={alwaysShowPlaceholder}
|
|
65
|
+
autoCapitalize={autoCapitalize}
|
|
64
66
|
blurOnSubmit={blurOnSubmit}
|
|
65
67
|
disabled={disabled}
|
|
66
68
|
error={error}
|
|
@@ -104,6 +106,7 @@ export const propTypes = {
|
|
|
104
106
|
text: string
|
|
105
107
|
}),
|
|
106
108
|
alwaysShowPlaceholder: bool,
|
|
109
|
+
autoCapitalize: string,
|
|
107
110
|
blurOnSubmit: bool,
|
|
108
111
|
disabled: bool,
|
|
109
112
|
error: string,
|
package/package.json
CHANGED