@widergy/mobile-ui 1.12.4 → 1.12.6

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/components/UTBadge/README.md +17 -26
  3. package/lib/components/UTBadge/index.js +6 -5
  4. package/lib/components/UTButton/README.md +78 -26
  5. package/lib/components/UTButton/index.js +4 -4
  6. package/lib/components/UTIcon/README.md +53 -51
  7. package/lib/components/UTIcon/index.js +5 -3
  8. package/lib/components/UTLabel/README.md +62 -39
  9. package/lib/components/UTLabel/index.js +14 -6
  10. package/lib/components/UTLabel/theme.js +24 -9
  11. package/lib/components/UTLoading/index.js +5 -1
  12. package/lib/components/UTPasswordField/index.js +9 -42
  13. package/lib/components/UTPasswordField/{components → versions/V0/components}/PasswordValidations/components/ErrorMessage/index.js +3 -3
  14. package/lib/components/UTPasswordField/{components → versions/V0/components}/PasswordValidations/components/Validation/index.js +3 -3
  15. package/lib/components/UTPasswordField/{components → versions/V0/components}/PasswordValidations/index.js +1 -1
  16. package/lib/components/UTPasswordField/{components → versions/V0/components}/PasswordValidations/styles.js +1 -2
  17. package/lib/components/UTPasswordField/versions/V0/index.js +49 -0
  18. package/lib/components/UTPasswordField/versions/V1/README.md +23 -0
  19. package/lib/components/UTPasswordField/versions/V1/constants.js +7 -0
  20. package/lib/components/UTPasswordField/versions/V1/index.js +32 -0
  21. package/lib/components/UTTextArea/README.md +32 -0
  22. package/lib/components/UTTextInput/versions/V0/components/BaseInput/index.js +1 -1
  23. package/lib/components/UTTextInput/versions/V1/README.md +236 -0
  24. package/lib/components/UTTextInput/versions/V1/components/TextInputField/index.js +179 -148
  25. package/lib/components/UTTextInput/versions/V1/components/TextInputField/theme.js +30 -27
  26. package/lib/components/UTTextInput/versions/V1/components/TextInputField/utils.js +7 -5
  27. package/lib/components/UTTextInput/versions/V1/index.js +13 -5
  28. package/lib/components/UTTextInput/versions/V1/proptypes.js +3 -0
  29. package/lib/components/UTValidation/README.md +33 -18
  30. package/lib/components/UTValidation/index.js +8 -6
  31. package/package.json +1 -1
  32. /package/lib/components/UTPasswordField/{components → versions/V0/components}/PasswordValidations/components/ErrorMessage/styles.js +0 -0
  33. /package/lib/components/UTPasswordField/{components → versions/V0/components}/PasswordValidations/components/Validation/styles.js +0 -0
  34. /package/lib/components/UTPasswordField/{proptypes.js → versions/V0/proptypes.js} +0 -0
@@ -1,87 +1,111 @@
1
- import React, { useState, useRef, useEffect, useCallback, useLayoutEffect } from 'react';
1
+ import React, {
2
+ useState,
3
+ useRef,
4
+ useEffect,
5
+ useCallback,
6
+ useLayoutEffect,
7
+ useImperativeHandle,
8
+ forwardRef
9
+ } from 'react';
2
10
  import { bool, elementType, func, number, string, shape } from 'prop-types';
3
11
  import { View, TextInput } from 'react-native';
4
12
  import { ViewPropTypes } from 'deprecated-react-native-prop-types';
5
13
 
6
- import { themeType, withTheme } from '../../../../../../theming';
14
+ import { useTheme } from '../../../../../../theming';
7
15
  import UTButton from '../../../../../UTButton';
8
16
  import UTIcon from '../../../../../UTIcon';
9
17
  import UTLabel from '../../../../../UTLabel';
10
18
  import UTTooltip from '../../../../../UTTooltip';
11
19
 
12
20
  import { ERROR_ICON, KEYBOARD_BY_TYPE, TYPES } from './constants';
13
- import { iconRenderer } from './utils';
21
+ import { renderLeftIcon, renderRightIcon } from './utils';
14
22
  import { retrieveStyle } from './theme';
15
23
 
16
- const TextInputField = ({
17
- action,
18
- alwaysShowPlaceholder,
19
- disabled,
20
- error,
21
- inputSize,
22
- LeftIcon,
23
- maxCount,
24
- maxRows,
25
- onBlur,
26
- onChange,
27
- onFocus,
28
- placeholder,
29
- prefix,
30
- readOnly,
31
- RightIcon,
32
- style,
33
- suffix,
34
- theme,
35
- tooltip,
36
- type,
37
- value
38
- }) => {
39
- const [displayValue, setDisplayValue] = useState(value);
40
- const [focused, setFocused] = useState(false);
41
- const [inputWidth, setInputWidth] = useState(null);
42
- const [internalValue, setInternalValue] = useState(value);
43
- const textInputRef = useRef(null);
44
-
45
- const multiline = maxRows > 1;
46
-
47
- const handleTextChange = useCallback(
48
- text => {
49
- setInternalValue(text);
50
- onChange?.(text);
51
- },
52
- [onChange]
53
- );
54
-
55
- const handleFocus = useCallback(
56
- event => {
57
- setFocused(true);
58
- if (!multiline) setDisplayValue(internalValue);
59
- onFocus?.(event);
60
- },
61
- [onFocus, internalValue, multiline]
62
- );
63
-
64
- const handleBlur = useCallback(
65
- event => {
66
- const truncateText = text => {
67
- if (!inputWidth || !text) return text;
68
-
69
- const charWidth = 8;
70
- const maxCharsPerLine = Math.floor(inputWidth / charWidth);
71
- const maxLength = maxCharsPerLine;
72
-
73
- return text.length > maxLength ? `${text.substring(0, maxLength - 3)}...` : text;
74
- };
75
-
76
- setFocused(false);
77
- if (!multiline) setDisplayValue(truncateText(internalValue));
78
- onBlur?.(event);
24
+ const TextInputField = forwardRef(
25
+ (
26
+ {
27
+ action,
28
+ alwaysShowPlaceholder,
29
+ disabled,
30
+ error,
31
+ inputSize,
32
+ LeftIcon,
33
+ maxCount,
34
+ maxRows,
35
+ onBlur,
36
+ onChange,
37
+ onFocus,
38
+ onSubmitEditing,
39
+ placeholder,
40
+ prefix,
41
+ readOnly,
42
+ returnKeyType,
43
+ RightIcon,
44
+ style,
45
+ suffix,
46
+ tooltip,
47
+ type,
48
+ value
79
49
  },
80
- [inputWidth, internalValue, multiline, onBlur]
81
- );
82
-
83
- const { actionStyle, containerStyle, inputRowStyle, inputStyle, textLengthRowStyle, placeholderColor } =
84
- retrieveStyle({
50
+ ref
51
+ ) => {
52
+ const [displayValue, setDisplayValue] = useState(value);
53
+ const [focused, setFocused] = useState(false);
54
+ const [inputWidth, setInputWidth] = useState(null);
55
+ const [internalValue, setInternalValue] = useState(value);
56
+ const textInputRef = useRef(null);
57
+
58
+ const theme = useTheme();
59
+ const multiline = maxRows > 1;
60
+
61
+ useImperativeHandle(
62
+ ref,
63
+ () => ({
64
+ focus: () => textInputRef.current?.focus(),
65
+ blur: () => textInputRef.current?.blur(),
66
+ setValue: text => textInputRef.current?.setNativeProps({ text }),
67
+ clear: () => textInputRef.current?.setNativeProps({ text: '' })
68
+ }),
69
+ []
70
+ );
71
+
72
+ const handleTextChange = useCallback(
73
+ text => {
74
+ setInternalValue(text);
75
+ onChange?.(text);
76
+ },
77
+ [onChange]
78
+ );
79
+
80
+ const handleFocus = useCallback(
81
+ event => {
82
+ setFocused(true);
83
+ if (!multiline) setDisplayValue(internalValue);
84
+ onFocus?.(event);
85
+ },
86
+ [onFocus, internalValue, multiline]
87
+ );
88
+
89
+ const handleBlur = useCallback(
90
+ event => {
91
+ const truncateText = text => {
92
+ if (!inputWidth || !text) return text;
93
+
94
+ const charWidth = 8;
95
+ const maxCharsPerLine = Math.floor(inputWidth / charWidth);
96
+ const maxLength = maxCharsPerLine;
97
+
98
+ return text.length > maxLength ? `${text.substring(0, maxLength - 3)}...` : text;
99
+ };
100
+
101
+ setFocused(false);
102
+ if (!multiline) setDisplayValue(truncateText(internalValue));
103
+ onBlur?.(event);
104
+ },
105
+ [inputWidth, internalValue, multiline, onBlur]
106
+ );
107
+
108
+ const { actionStyle, containerStyle, inputRowStyle, inputStyle, textLengthRowStyle } = retrieveStyle({
85
109
  disabled,
86
110
  error,
87
111
  focused,
@@ -93,83 +117,89 @@ const TextInputField = ({
93
117
  theme
94
118
  });
95
119
 
96
- useEffect(() => {
97
- setInternalValue(value);
98
- setDisplayValue(value);
99
- }, [value]);
100
-
101
- useLayoutEffect(() => {
102
- if (textInputRef.current) {
103
- textInputRef.current.measure((_x, _y, width) => {
104
- setInputWidth(width);
105
- });
106
- }
107
- }, [focused]);
108
-
109
- const secureTextEntry = type === TYPES.PASSWORD;
110
- const autoCapitalize = type === TYPES.EMAIL ? 'none' : 'sentences';
111
- const keyboardType = KEYBOARD_BY_TYPE[type] || 'default';
112
-
113
- const renderIcon = iconRenderer(error, inputStyle.color);
114
-
115
- return (
116
- <View style={containerStyle}>
117
- <View style={inputRowStyle}>
118
- {LeftIcon && renderIcon(LeftIcon)}
119
- {prefix && <UTLabel colorTheme="gray">{prefix}</UTLabel>}
120
- <TextInput
121
- autoCapitalize={autoCapitalize}
122
- autoCorrect={false}
123
- editable={!disabled && !readOnly}
124
- keyboardType={keyboardType}
125
- maxLength={maxCount}
126
- multiline={multiline}
127
- numberOfLines={maxRows}
128
- onChangeText={handleTextChange}
129
- onEndEditing={handleBlur}
130
- onFocus={handleFocus}
131
- placeholder={!focused && !alwaysShowPlaceholder ? '' : placeholder}
132
- placeholderTextColor={placeholderColor}
133
- ref={textInputRef}
134
- secureTextEntry={secureTextEntry}
135
- style={inputStyle}
136
- type={type}
137
- value={focused || multiline ? internalValue : displayValue}
138
- />
139
- {suffix && (
140
- <UTLabel colorTheme="gray" variant="small">
141
- {suffix}
142
- </UTLabel>
143
- )}
144
- {action && (
145
- <UTButton
146
- disabled={disabled}
147
- style={actionStyle}
148
- variant="text"
149
- colorTheme={action.colorTheme}
150
- Icon={action.icon}
151
- onPress={action.onPress}
152
- >
153
- {action.text}
154
- </UTButton>
155
- )}
156
- {error ? renderIcon(ERROR_ICON) : RightIcon && renderIcon(RightIcon)}
157
- {!!tooltip && (
158
- <UTTooltip content={<UTLabel>{tooltip}</UTLabel>}>
159
- <UTIcon name="IconInfoCircle" color="gray" />
160
- </UTTooltip>
120
+ useEffect(() => {
121
+ setInternalValue(value);
122
+ setDisplayValue(value);
123
+ }, [value]);
124
+
125
+ useLayoutEffect(() => {
126
+ if (textInputRef.current) {
127
+ textInputRef.current.measure((_x, _y, width) => {
128
+ setInputWidth(width);
129
+ });
130
+ }
131
+ }, [focused]);
132
+
133
+ const secureTextEntry = type === TYPES.PASSWORD;
134
+ const autoCapitalize = type === TYPES.EMAIL ? 'none' : 'sentences';
135
+ const keyboardType = KEYBOARD_BY_TYPE[type] || 'default';
136
+
137
+ const rightIcon = error ? ERROR_ICON : RightIcon;
138
+
139
+ return (
140
+ <View style={containerStyle}>
141
+ <View style={inputRowStyle}>
142
+ {LeftIcon && renderLeftIcon(inputStyle.root.color, LeftIcon)}
143
+ {prefix && <UTLabel colorTheme="gray">{prefix}</UTLabel>}
144
+ <TextInput
145
+ autoCapitalize={autoCapitalize}
146
+ autoCorrect={false}
147
+ editable={!disabled && !readOnly}
148
+ keyboardType={keyboardType}
149
+ maxLength={maxCount}
150
+ multiline={multiline}
151
+ numberOfLines={maxRows}
152
+ onChangeText={handleTextChange}
153
+ onEndEditing={handleBlur}
154
+ onFocus={handleFocus}
155
+ onSubmitEditing={onSubmitEditing}
156
+ placeholder={!focused && !alwaysShowPlaceholder ? '' : placeholder}
157
+ placeholderTextColor={inputStyle.placeholderTextColor}
158
+ ref={textInputRef}
159
+ returnKeyType={returnKeyType}
160
+ secureTextEntry={secureTextEntry}
161
+ selectionColor={inputStyle.selectionColor}
162
+ style={inputStyle.root}
163
+ type={type}
164
+ value={focused || multiline ? internalValue : displayValue}
165
+ />
166
+ {suffix && (
167
+ <UTLabel colorTheme="gray" weight="medium" variant="small">
168
+ {suffix}
169
+ </UTLabel>
170
+ )}
171
+ {action && (
172
+ <UTButton
173
+ disabled={disabled}
174
+ style={actionStyle}
175
+ variant="text"
176
+ colorTheme={action.colorTheme}
177
+ Icon={action.icon}
178
+ onPress={action.onPress}
179
+ >
180
+ {action.text}
181
+ </UTButton>
182
+ )}
183
+ {rightIcon && renderRightIcon(error, inputStyle.root.color, rightIcon)}
184
+ {!!tooltip && (
185
+ <UTTooltip content={<UTLabel>{tooltip}</UTLabel>}>
186
+ <UTIcon name="IconInfoCircle" color="gray" />
187
+ </UTTooltip>
188
+ )}
189
+ </View>
190
+ {maxCount && (
191
+ <View style={textLengthRowStyle}>
192
+ <UTLabel colorTheme="gray" variant="small">
193
+ {internalValue?.length || 0}/{maxCount}
194
+ </UTLabel>
195
+ </View>
161
196
  )}
162
197
  </View>
163
- {maxCount && (
164
- <View style={textLengthRowStyle}>
165
- <UTLabel colorTheme="gray" variant="small">
166
- {internalValue?.length || 0}/{maxCount}
167
- </UTLabel>
168
- </View>
169
- )}
170
- </View>
171
- );
172
- };
198
+ );
199
+ }
200
+ );
201
+
202
+ TextInputField.displayName = 'TextInputField';
173
203
 
174
204
  TextInputField.propTypes = {
175
205
  action: shape({ icon: elementType, action: func, colorTheme: string, text: string }),
@@ -183,9 +213,11 @@ TextInputField.propTypes = {
183
213
  onBlur: func,
184
214
  onChange: func,
185
215
  onFocus: func,
216
+ onSubmitEditing: func,
186
217
  placeholder: string,
187
218
  prefix: string,
188
219
  readOnly: bool,
220
+ returnKeyType: string,
189
221
  RightIcon: elementType,
190
222
  style: shape({
191
223
  container: ViewPropTypes.style,
@@ -193,10 +225,9 @@ TextInputField.propTypes = {
193
225
  root: ViewPropTypes.style
194
226
  }),
195
227
  suffix: string,
196
- theme: themeType,
197
228
  tooltip: string,
198
229
  type: string,
199
230
  value: string
200
231
  };
201
232
 
202
- export default withTheme(TextInputField);
233
+ export default TextInputField;
@@ -1,8 +1,11 @@
1
- import { Platform } from 'react-native';
2
-
1
+ import { getFontStyles } from '../../../../../UTLabel/theme';
3
2
  import { SMALL } from '../../constants';
4
3
 
5
4
  const LINE_HEIGHT = 22;
5
+ const CONTAINER_PADDING = {
6
+ HORIZONTAL: 16,
7
+ VERTICAL: 12
8
+ };
6
9
 
7
10
  const baseTextInputTheme = theme => ({
8
11
  action: {
@@ -19,25 +22,24 @@ const baseTextInputTheme = theme => ({
19
22
  borderWidth: 1,
20
23
  flex: 1,
21
24
  flexDirection: 'column',
22
- paddingHorizontal: 16,
23
- paddingVertical: 12,
25
+ paddingHorizontal: CONTAINER_PADDING.HORIZONTAL,
26
+ paddingVertical: CONTAINER_PADDING.VERTICAL,
24
27
  rowGap: 16,
25
28
  width: '100%'
26
29
  },
27
30
  input: {
28
- color: theme.Palette.dark['05'],
29
- flex: 1,
30
- fontFamily: theme.fonts.fontFamily, // TODO! Change when integration of font sizes
31
- fontSize: 16,
32
- lineHeight: LINE_HEIGHT,
33
- padding: 0,
34
- zIndex: 4,
35
- ...Platform.select({
36
- ios: {
37
- height: '100%',
38
- lineHeight: LINE_HEIGHT + 4
39
- }
40
- })
31
+ root: {
32
+ ...getFontStyles({ theme, variant: 'body', weight: 'regular' }),
33
+ color: theme.Palette.dark['05'],
34
+ flex: 1,
35
+ includeFontPadding: false,
36
+ padding: 0,
37
+ paddingVertical: 0,
38
+ textAlignVertical: 'center',
39
+ zIndex: 4
40
+ },
41
+ placeholderTextColor: theme.Palette.gray['02'],
42
+ selectionColor: theme.Palette.accent['04']
41
43
  },
42
44
  inputRow: {
43
45
  alignItems: 'center',
@@ -51,9 +53,6 @@ const baseTextInputTheme = theme => ({
51
53
  flexDirection: 'row',
52
54
  justifyContent: 'flex-start',
53
55
  width: '100%'
54
- },
55
- placeholder: {
56
- color: theme.Palette.gray['02']
57
56
  }
58
57
  });
59
58
 
@@ -61,7 +60,8 @@ const conditionalContainerStyle = (focused, error, theme, readOnly, disabled, in
61
60
  ...(focused && {
62
61
  borderColor: theme.Palette.accent['04'],
63
62
  borderWidth: 2,
64
- padding: -1
63
+ paddingHorizontal: CONTAINER_PADDING.HORIZONTAL - 1,
64
+ paddingVertical: CONTAINER_PADDING.VERTICAL - 1
65
65
  }),
66
66
  ...(error && {
67
67
  borderColor: theme.Palette.error['04']
@@ -108,17 +108,20 @@ export const retrieveStyle = ({
108
108
  };
109
109
 
110
110
  const inputStyle = {
111
- ...baseTheme.input,
112
- ...conditionalInputStyle(maxRows, multiline),
113
- ...style.input
111
+ root: {
112
+ ...baseTheme.input.root,
113
+ ...conditionalInputStyle(maxRows, multiline),
114
+ ...style.input
115
+ },
116
+ placeholderTextColor: baseTheme.input.placeholderTextColor,
117
+ selectionColor: baseTheme.input.selectionColor
114
118
  };
115
119
 
116
120
  return {
117
121
  actionStyle: { ...baseTheme.action, ...style.action },
118
- inputStyle,
119
122
  containerStyle,
120
123
  inputRowStyle: baseTheme.inputRow,
121
- textLengthRowStyle: baseTheme.textLengthRow,
122
- placeholderColor: baseTheme.placeholder.color
124
+ inputStyle,
125
+ textLengthRowStyle: baseTheme.textLengthRow
123
126
  };
124
127
  };
@@ -4,8 +4,10 @@ import UTIcon from '../../../../../UTIcon';
4
4
 
5
5
  const isUTIcon = icon => typeof icon === 'string';
6
6
 
7
- export const iconRenderer = (error, themeColor) => Icon => {
8
- const color = error ? 'error' : 'gray';
9
- const shade = error && '04';
10
- return isUTIcon(Icon) ? <UTIcon name={Icon} color={color} shade={shade} /> : <Icon fill={themeColor} />;
11
- };
7
+ const getIconColorProps = error => (error ? { color: 'error', shade: '04' } : { color: 'gray' });
8
+
9
+ export const renderLeftIcon = (themeColor, Icon) =>
10
+ isUTIcon(Icon) ? <UTIcon name={Icon} color="gray" /> : <Icon fill={themeColor} />;
11
+
12
+ export const renderRightIcon = (error, themeColor, Icon) =>
13
+ isUTIcon(Icon) ? <UTIcon name={Icon} {...getIconColorProps(error)} /> : <Icon fill={themeColor} />;
@@ -16,6 +16,7 @@ const UTTextInput = ({
16
16
  disabled,
17
17
  error,
18
18
  helpText,
19
+ InputRef,
19
20
  inputSize,
20
21
  label,
21
22
  labelVariant,
@@ -25,10 +26,12 @@ const UTTextInput = ({
25
26
  onBlur,
26
27
  onChange,
27
28
  onFocus,
29
+ onSubmitEditing,
28
30
  placeholder,
29
31
  prefix,
30
32
  readOnly,
31
33
  required,
34
+ returnKeyType,
32
35
  RightIcon,
33
36
  style,
34
37
  suffix,
@@ -37,15 +40,15 @@ const UTTextInput = ({
37
40
  validations,
38
41
  value
39
42
  }) => {
40
- const labelColorTheme = error ? 'error' : readOnly ? 'gray' : 'dark';
43
+ const labelColorTheme = readOnly ? 'gray' : 'dark';
41
44
  const labelComponentVariant = labelVariant === SMALL ? 'small' : 'body';
42
- const validationData = validations || formatErrorToValidation(error);
45
+ const validationData = validations || (error && formatErrorToValidation(error));
43
46
 
44
47
  return (
45
48
  <View style={[styles.container, style.root]}>
46
49
  {label && (
47
50
  <View style={styles.label}>
48
- <UTLabel colorTheme={labelColorTheme} shade={error && '04'} variant={labelComponentVariant}>
51
+ <UTLabel colorTheme={labelColorTheme} variant={labelComponentVariant}>
49
52
  {label}
50
53
  </UTLabel>
51
54
  {required && (
@@ -67,9 +70,12 @@ const UTTextInput = ({
67
70
  onBlur={onBlur}
68
71
  onChange={onChange}
69
72
  onFocus={onFocus}
73
+ onSubmitEditing={onSubmitEditing}
70
74
  placeholder={placeholder}
71
75
  prefix={prefix}
72
76
  readOnly={readOnly}
77
+ ref={InputRef}
78
+ returnKeyType={returnKeyType}
73
79
  RightIcon={RightIcon}
74
80
  style={style}
75
81
  suffix={suffix}
@@ -82,13 +88,15 @@ const UTTextInput = ({
82
88
  {helpText}
83
89
  </UTLabel>
84
90
  )}
85
- {error && <UTValidation validationData={validationData} />}
91
+ {validationData && <UTValidation validationData={validationData} />}
86
92
  </View>
87
93
  );
88
94
  };
89
95
 
90
96
  UTTextInput.defaultProps = DEFAULT_PROPS;
91
97
 
92
- UTTextInput.propTypes = propTypes;
98
+ UTTextInput.propTypes = {
99
+ ...propTypes
100
+ };
93
101
 
94
102
  export default UTTextInput;
@@ -9,6 +9,7 @@ export default {
9
9
  disabled: bool,
10
10
  error: string,
11
11
  helpText: string,
12
+ InputRef: func,
12
13
  inputSize: string,
13
14
  label: string,
14
15
  labelVariant: string,
@@ -18,10 +19,12 @@ export default {
18
19
  onBlur: func,
19
20
  onChange: func,
20
21
  onFocus: func,
22
+ onSubmitEditing: func,
21
23
  placeholder: string,
22
24
  prefix: string,
23
25
  readOnly: bool,
24
26
  required: bool,
27
+ returnKeyType: string,
25
28
  RightIcon: elementType,
26
29
  style: shape({
27
30
  container: ViewPropTypes.style,
@@ -1,22 +1,29 @@
1
1
  # UTValidation
2
2
 
3
- ### Description
3
+ ## Description
4
4
 
5
5
  `UTValidation` is a component designed to display input validation messages. The statuses of the messages can be information, error, or success, helping users understand the current state of their input.
6
6
 
7
- ### Validation Data
7
+ ## Props
8
+
9
+ | Name | Type | Default | Description |
10
+ | -------------- | ------ | ------- | ---------------------------------------- |
11
+ | style | object | | Custom styles to apply to the component. |
12
+ | validationData | array | {} | The data to display validation messages. |
13
+
14
+ ## Validation Data
8
15
 
9
16
  The `validationData` prop is an array of objects, each representing a validation message or group of messages. Each object can optionally have a `title` and must have a `status` and an `items` array. The `items` array contains objects, each with `text` and `status` properties.
10
17
 
11
- #### Structure of validationData
18
+ ### Structure of validationData
12
19
 
13
- - title (optional): A string that represents the title of the validation group.
14
- - status (required): A string indicating the status of the validation group. Possible values are success, error, and default.
15
- - items (required): An array of objects, each representing an individual validation item.
16
- - text (required): A string containing the validation message.
17
- - status (required): A string indicating the status of the validation item. Possible values are success, error, and default.
20
+ - **title** (optional): A string that represents the title of the validation group.
21
+ - **status** (required): A string indicating the status of the validation group. Possible values are `success`, `error`, and `default`.
22
+ - **items** (required): An array of objects, each representing an individual validation item.
23
+ - **text** (required): A string containing the validation message.
24
+ - **status** (required): A string indicating the status of the validation item. Possible values are `success`, `error`, and `default`.
18
25
 
19
- Here's an example of `validationData`:
26
+ ### Example
20
27
 
21
28
  ```javascript
22
29
  const validationData = [
@@ -29,16 +36,14 @@ const validationData = [
29
36
  ]
30
37
  },
31
38
  {
32
- title: 'Debe cumplir con al menos 1 de las siguientes condiciones:',
39
+ title: 'Debe cumplir con al menos 2 de las siguientes condiciones:',
33
40
  status: 'error',
34
41
  items: [
35
42
  {
36
- status: 'default',
37
- text: 'Al menos 1 letra minúscula.'
43
+ text: 'Al menos 1 letra minúscula.' // Defaults to "default"
38
44
  },
39
45
  {
40
- status: 'default',
41
- text: 'Al menos 1 letra mayúscula.'
46
+ text: 'Al menos 1 letra mayúscula.' // Defaults to "default"
42
47
  },
43
48
  {
44
49
  status: 'success',
@@ -49,8 +54,18 @@ const validationData = [
49
54
  ];
50
55
  ```
51
56
 
52
- ### Props
57
+ ## Statuses
58
+
59
+ The `status` prop can be one of these values:
60
+
61
+ - `success`
62
+ - `error`
63
+ - `default`
53
64
 
54
- | Name | Description | Default |
55
- | -------------- | ------------------- | ------- |
56
- | validationData | The data to display | {} |
65
+ If `status` is not provided, it defaults to `default`.
66
+
67
+ ## Usage
68
+
69
+ ```javascript
70
+ <UTValidation validationData={validationData} />
71
+ ```