vpt-sebraeds 0.0.88 → 0.0.90

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,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { View, Pressable, StyleSheet } from 'react-native';
3
+ import { View, Pressable, StyleSheet, TextInput } from 'react-native';
4
4
  import Icon from '../Icon';
5
5
  import SEText from '../SEText';
6
6
  import { fontFamily } from '../utils/fontFamily';
@@ -50,6 +50,15 @@ const Item = ({
50
50
  valuePaddingVertical = 8,
51
51
  valueStyle,
52
52
  valueContainerStyle,
53
+ valueEditable = false,
54
+ onChangeValue,
55
+ valuePlaceholder = '',
56
+ valueKeyboardType = 'numeric',
57
+ valuePlaceholderTextColor = '#687499',
58
+ valueMaxLength,
59
+ valueTestID,
60
+ onValueFocus,
61
+ onValueBlur,
53
62
  // Test
54
63
  testID,
55
64
  }) => {
@@ -118,9 +127,27 @@ const Item = ({
118
127
  valueContainerStyle,
119
128
  ]}
120
129
  >
121
- <SEText type="ns-sm-body" style={[styles.value, valueStyle]}>
122
- {value}
123
- </SEText>
130
+ {valueEditable ? (
131
+ <TextInput
132
+ value={String(value ?? '')}
133
+ onChangeText={onChangeValue}
134
+ onFocus={onValueFocus}
135
+ onBlur={onValueBlur}
136
+ keyboardType={valueKeyboardType}
137
+ placeholder={valuePlaceholder}
138
+ placeholderTextColor={valuePlaceholderTextColor}
139
+ maxLength={valueMaxLength}
140
+ editable={!disabled}
141
+ textAlign="center"
142
+ underlineColorAndroid="transparent"
143
+ style={[styles.valueInput, valueStyle]}
144
+ testID={valueTestID}
145
+ />
146
+ ) : (
147
+ <SEText type="ns-sm-body" style={[styles.value, valueStyle]}>
148
+ {value}
149
+ </SEText>
150
+ )}
124
151
  </View>
125
152
  )}
126
153
  </Pressable>
@@ -160,6 +187,15 @@ Item.propTypes = {
160
187
  valuePaddingVertical: PropTypes.number,
161
188
  valueStyle: PropTypes.object,
162
189
  valueContainerStyle: PropTypes.object,
190
+ valueEditable: PropTypes.bool,
191
+ onChangeValue: PropTypes.func,
192
+ valuePlaceholder: PropTypes.string,
193
+ valueKeyboardType: PropTypes.string,
194
+ valuePlaceholderTextColor: PropTypes.string,
195
+ valueMaxLength: PropTypes.number,
196
+ valueTestID: PropTypes.string,
197
+ onValueFocus: PropTypes.func,
198
+ onValueBlur: PropTypes.func,
163
199
  testID: PropTypes.string,
164
200
  };
165
201
 
@@ -209,6 +245,17 @@ const styles = StyleSheet.create({
209
245
  color: '#1B244B',
210
246
  textAlign: 'center',
211
247
  },
248
+ valueInput: {
249
+ width: '100%',
250
+ height: '100%',
251
+ fontSize: 18,
252
+ fontFamily: fontFamily.regular,
253
+ fontWeight: '400',
254
+ color: '#1B244B',
255
+ textAlign: 'center',
256
+ textAlignVertical: 'center',
257
+ padding: 0,
258
+ },
212
259
  });
213
260
 
214
261
  export default SelectableOption;
@@ -13,7 +13,7 @@ declare namespace SelectableOption {
13
13
  }
14
14
  }
15
15
  import React from 'react';
16
- declare function Item({ label, value, checked, disabled, onPress, backgroundColor, borderLeftColor, borderLeftWidth, height, borderRadius, padding, style, checkColor, checkIconSize, checkBoxSize, checkBorderRadius, checkIcon, checkBorderColor, checkBorderWidth, checkBackgroundColor, checkUncheckedBackgroundColor, labelStyle, valueBorderColor, valueBorderWidth, valueBorderRadius, valueBackgroundColor, valueWidth, valueHeight, valuePaddingHorizontal, valuePaddingVertical, valueStyle, valueContainerStyle, testID, }: {
16
+ declare function Item({ label, value, checked, disabled, onPress, backgroundColor, borderLeftColor, borderLeftWidth, height, borderRadius, padding, style, checkColor, checkIconSize, checkBoxSize, checkBorderRadius, checkIcon, checkBorderColor, checkBorderWidth, checkBackgroundColor, checkUncheckedBackgroundColor, labelStyle, valueBorderColor, valueBorderWidth, valueBorderRadius, valueBackgroundColor, valueWidth, valueHeight, valuePaddingHorizontal, valuePaddingVertical, valueStyle, valueContainerStyle, valueEditable, onChangeValue, valuePlaceholder, valueKeyboardType, valuePlaceholderTextColor, valueMaxLength, valueTestID, onValueFocus, onValueBlur, testID, }: {
17
17
  label: any;
18
18
  value: any;
19
19
  checked?: boolean | undefined;
@@ -46,6 +46,15 @@ declare function Item({ label, value, checked, disabled, onPress, backgroundColo
46
46
  valuePaddingVertical?: number | undefined;
47
47
  valueStyle: any;
48
48
  valueContainerStyle: any;
49
+ valueEditable?: boolean | undefined;
50
+ onChangeValue: any;
51
+ valuePlaceholder?: string | undefined;
52
+ valueKeyboardType?: string | undefined;
53
+ valuePlaceholderTextColor?: string | undefined;
54
+ valueMaxLength: any;
55
+ valueTestID: any;
56
+ onValueFocus: any;
57
+ onValueBlur: any;
49
58
  testID: any;
50
59
  }): React.JSX.Element;
51
60
  declare namespace Item {
@@ -83,6 +92,15 @@ declare namespace Item {
83
92
  export let valuePaddingVertical: any;
84
93
  export let valueStyle: any;
85
94
  export let valueContainerStyle: any;
95
+ export let valueEditable: any;
96
+ export let onChangeValue: any;
97
+ export let valuePlaceholder: any;
98
+ export let valueKeyboardType: any;
99
+ export let valuePlaceholderTextColor: any;
100
+ export let valueMaxLength: any;
101
+ export let valueTestID: any;
102
+ export let onValueFocus: any;
103
+ export let onValueBlur: any;
86
104
  export let testID: any;
87
105
  }
88
106
  export { propTypes_1 as propTypes };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/SelectableOption/index.jsx"],"names":[],"mappings":";AAOA;;;;sBAMC;;;;;;;;;kBAbiB,OAAO;AAezB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAgHC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/SelectableOption/index.jsx"],"names":[],"mappings":";AAOA;;;;sBAMC;;;;;;;;;kBAbiB,OAAO;AAezB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA2IC"}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { View, Pressable, StyleSheet } from 'react-native';
3
+ import { View, Pressable, StyleSheet, TextInput } from 'react-native';
4
4
  import Icon from '../Icon';
5
5
  import SEText from '../SEText';
6
6
  import { fontFamily } from '../utils/fontFamily';
@@ -17,7 +17,7 @@ checkColor = '#687499', checkIconSize = 10, checkBoxSize = 13, checkBorderRadius
17
17
  // Label
18
18
  labelStyle,
19
19
  // Value card
20
- valueBorderColor = '#E2E9FC', valueBorderWidth = 2, valueBorderRadius = 8, valueBackgroundColor = '#FFFFFF', valueWidth = 161, valueHeight = 48, valuePaddingHorizontal = 8, valuePaddingVertical = 8, valueStyle, valueContainerStyle,
20
+ valueBorderColor = '#E2E9FC', valueBorderWidth = 2, valueBorderRadius = 8, valueBackgroundColor = '#FFFFFF', valueWidth = 161, valueHeight = 48, valuePaddingHorizontal = 8, valuePaddingVertical = 8, valueStyle, valueContainerStyle, valueEditable = false, onChangeValue, valuePlaceholder = '', valueKeyboardType = 'numeric', valuePlaceholderTextColor = '#687499', valueMaxLength, valueTestID, onValueFocus, onValueBlur,
21
21
  // Test
22
22
  testID, }) => {
23
23
  const resolvedCheckBorderColor = checkBorderColor || checkColor;
@@ -71,9 +71,9 @@ testID, }) => {
71
71
  },
72
72
  valueContainerStyle,
73
73
  ]}>
74
- <SEText type="ns-sm-body" style={[styles.value, valueStyle]}>
75
- {value}
76
- </SEText>
74
+ {valueEditable ? (<TextInput value={String(value ?? '')} onChangeText={onChangeValue} onFocus={onValueFocus} onBlur={onValueBlur} keyboardType={valueKeyboardType} placeholder={valuePlaceholder} placeholderTextColor={valuePlaceholderTextColor} maxLength={valueMaxLength} editable={!disabled} textAlign="center" underlineColorAndroid="transparent" style={[styles.valueInput, valueStyle]} testID={valueTestID}/>) : (<SEText type="ns-sm-body" style={[styles.value, valueStyle]}>
75
+ {value}
76
+ </SEText>)}
77
77
  </View>)}
78
78
  </Pressable>);
79
79
  };
@@ -110,6 +110,15 @@ Item.propTypes = {
110
110
  valuePaddingVertical: PropTypes.number,
111
111
  valueStyle: PropTypes.object,
112
112
  valueContainerStyle: PropTypes.object,
113
+ valueEditable: PropTypes.bool,
114
+ onChangeValue: PropTypes.func,
115
+ valuePlaceholder: PropTypes.string,
116
+ valueKeyboardType: PropTypes.string,
117
+ valuePlaceholderTextColor: PropTypes.string,
118
+ valueMaxLength: PropTypes.number,
119
+ valueTestID: PropTypes.string,
120
+ onValueFocus: PropTypes.func,
121
+ onValueBlur: PropTypes.func,
113
122
  testID: PropTypes.string,
114
123
  };
115
124
  SelectableOption.Item = Item;
@@ -156,5 +165,16 @@ const styles = StyleSheet.create({
156
165
  color: '#1B244B',
157
166
  textAlign: 'center',
158
167
  },
168
+ valueInput: {
169
+ width: '100%',
170
+ height: '100%',
171
+ fontSize: 18,
172
+ fontFamily: fontFamily.regular,
173
+ fontWeight: '400',
174
+ color: '#1B244B',
175
+ textAlign: 'center',
176
+ textAlignVertical: 'center',
177
+ padding: 0,
178
+ },
159
179
  });
160
180
  export default SelectableOption;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vpt-sebraeds",
3
- "version": "0.0.88",
3
+ "version": "0.0.90",
4
4
  "description": "Biblioteca de componentes React Native do Sebrae",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",