vpt-sebraeds 0.0.32 → 0.0.33
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/components/Select/index.jsx +28 -24
- package/components/Table/index.jsx +5 -1
- package/dist/components/Select/index.d.ts +3 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +5 -5
- package/dist/components/Table/index.d.ts +3 -1
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +2 -2
- package/package.json +1 -1
|
@@ -17,7 +17,9 @@ const Select = ({
|
|
|
17
17
|
supportText,
|
|
18
18
|
variant = "default",
|
|
19
19
|
displayMode,
|
|
20
|
-
innerTitle
|
|
20
|
+
innerTitle,
|
|
21
|
+
showCloseButton = false,
|
|
22
|
+
itemGap = 0
|
|
21
23
|
}) => {
|
|
22
24
|
const [isOpen, setIsOpen] = useState(false);
|
|
23
25
|
const [selectedOption, setSelectedOption] = useState(value || null);
|
|
@@ -40,7 +42,7 @@ const Select = ({
|
|
|
40
42
|
// setSelectedOption(option.map(option => option.value));
|
|
41
43
|
setSelectedOption(option.value);
|
|
42
44
|
setIsOpen(false);
|
|
43
|
-
|
|
45
|
+
|
|
44
46
|
// Compatibilidade com ambas as props
|
|
45
47
|
if (onSelect) {
|
|
46
48
|
onSelect(option);
|
|
@@ -52,7 +54,7 @@ const Select = ({
|
|
|
52
54
|
|
|
53
55
|
const getContainerStyle = () => {
|
|
54
56
|
const baseStyle = variant === "inverse" ? styles.containerInverse : styles.container;
|
|
55
|
-
|
|
57
|
+
|
|
56
58
|
if (disabled) return [baseStyle, variant === "inverse" ? styles.containerInverseDisabled : styles.containerDisabled];
|
|
57
59
|
if (error) return [baseStyle, variant === "inverse" ? styles.containerInverseError : styles.containerError];
|
|
58
60
|
if (success) return [baseStyle, variant === "inverse" ? styles.containerInverseSuccess : styles.containerSuccess];
|
|
@@ -62,7 +64,7 @@ const Select = ({
|
|
|
62
64
|
|
|
63
65
|
const getLabelStyle = () => {
|
|
64
66
|
const baseStyle = variant === "inverse" ? styles.labelInverse : styles.label;
|
|
65
|
-
|
|
67
|
+
|
|
66
68
|
if (disabled) return [baseStyle, variant === "inverse" ? styles.labelInverseDisabled : styles.labelDisabled];
|
|
67
69
|
if (error) return [baseStyle, variant === "inverse" ? styles.labelInverseError : styles.labelError];
|
|
68
70
|
if (success) return [baseStyle, variant === "inverse" ? styles.labelInverseSuccess : styles.labelSuccess];
|
|
@@ -71,7 +73,7 @@ const Select = ({
|
|
|
71
73
|
|
|
72
74
|
const getTextStyle = () => {
|
|
73
75
|
const baseStyle = variant === "inverse" ? styles.textInverse : styles.text;
|
|
74
|
-
|
|
76
|
+
|
|
75
77
|
if (disabled) return [baseStyle, variant === "inverse" ? styles.textInverseDisabled : styles.textDisabled];
|
|
76
78
|
if (error) return [baseStyle, variant === "inverse" ? styles.textInverseError : styles.textError];
|
|
77
79
|
if (success) return [baseStyle, variant === "inverse" ? styles.textInverseSuccess : styles.textSuccess];
|
|
@@ -80,7 +82,7 @@ const Select = ({
|
|
|
80
82
|
|
|
81
83
|
const getSupportTextStyle = () => {
|
|
82
84
|
const baseStyle = variant === "inverse" ? styles.supportTextInverse : styles.supportText;
|
|
83
|
-
|
|
85
|
+
|
|
84
86
|
if (error) return [baseStyle, variant === "inverse" ? styles.supportTextInverseError : styles.supportTextError];
|
|
85
87
|
if (success) return [baseStyle, variant === "inverse" ? styles.supportTextInverseSuccess : styles.supportTextSuccess];
|
|
86
88
|
return baseStyle;
|
|
@@ -93,7 +95,7 @@ const Select = ({
|
|
|
93
95
|
if (success) return '#52C41A';
|
|
94
96
|
return '#FFFFFF';
|
|
95
97
|
}
|
|
96
|
-
|
|
98
|
+
|
|
97
99
|
if (disabled) return '#BFBFBF';
|
|
98
100
|
if (error) return '#FF4D4F';
|
|
99
101
|
if (success) return '#52C41A';
|
|
@@ -105,7 +107,7 @@ const Select = ({
|
|
|
105
107
|
return (
|
|
106
108
|
<View style={wrapperStyle}>
|
|
107
109
|
{label && <SEText type="ns-sm-body" style={getLabelStyle()}>{label}</SEText>}
|
|
108
|
-
|
|
110
|
+
|
|
109
111
|
<View style={styles.selectContainer}>
|
|
110
112
|
<TouchableOpacity
|
|
111
113
|
style={getContainerStyle()}
|
|
@@ -122,30 +124,32 @@ const Select = ({
|
|
|
122
124
|
ellipsizeMode="tail"
|
|
123
125
|
>
|
|
124
126
|
{selectedOption ? (
|
|
125
|
-
selectedOption.label ||
|
|
127
|
+
selectedOption.label ||
|
|
126
128
|
selectedOption
|
|
127
129
|
) : placeholder}
|
|
128
130
|
</SEText>
|
|
129
|
-
|
|
131
|
+
|
|
130
132
|
<Icon
|
|
131
|
-
name={isOpen ? "arrow-up-s-line" : "arrow-down-s-line"}
|
|
133
|
+
name={isOpen ? "arrow-up-s-line" : "arrow-down-s-line"}
|
|
132
134
|
size={20}
|
|
133
|
-
color={getIconColor()}
|
|
135
|
+
color={getIconColor()}
|
|
134
136
|
/>
|
|
135
137
|
</TouchableOpacity>
|
|
136
138
|
|
|
137
|
-
<Dropdown
|
|
139
|
+
<Dropdown
|
|
138
140
|
title={innerTitle}
|
|
139
|
-
options={options}
|
|
140
|
-
isOpen={isOpen}
|
|
141
|
-
setIsOpen={setIsOpen}
|
|
141
|
+
options={options}
|
|
142
|
+
isOpen={isOpen}
|
|
143
|
+
setIsOpen={setIsOpen}
|
|
142
144
|
onSelect={handleSelect}
|
|
143
145
|
displayMode={displayMode}
|
|
144
146
|
selectedValue={selectedOption}
|
|
147
|
+
showCloseButton={showCloseButton}
|
|
148
|
+
itemGap={itemGap}
|
|
145
149
|
/>
|
|
146
150
|
</View>
|
|
147
151
|
|
|
148
|
-
|
|
152
|
+
{supportText && <SEText type="ns-xs-body" style={getSupportTextStyle()}>{supportText}</SEText>}
|
|
149
153
|
</View>
|
|
150
154
|
);
|
|
151
155
|
};
|
|
@@ -163,7 +167,7 @@ const styles = StyleSheet.create({
|
|
|
163
167
|
position: 'relative',
|
|
164
168
|
zIndex: 1000,
|
|
165
169
|
},
|
|
166
|
-
|
|
170
|
+
|
|
167
171
|
// DEFAULT VARIANT STYLES
|
|
168
172
|
container: {
|
|
169
173
|
flexDirection: 'row',
|
|
@@ -192,7 +196,7 @@ const styles = StyleSheet.create({
|
|
|
192
196
|
borderColor: '#E6EEFF',
|
|
193
197
|
backgroundColor: '#F5F5F5',
|
|
194
198
|
},
|
|
195
|
-
|
|
199
|
+
|
|
196
200
|
// INVERSE VARIANT STYLES
|
|
197
201
|
containerInverse: {
|
|
198
202
|
flexDirection: 'row',
|
|
@@ -222,7 +226,7 @@ const styles = StyleSheet.create({
|
|
|
222
226
|
borderColor: 'rgba(255, 255, 255, 0.1)',
|
|
223
227
|
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
224
228
|
},
|
|
225
|
-
|
|
229
|
+
|
|
226
230
|
// LABEL STYLES
|
|
227
231
|
label: {
|
|
228
232
|
fontSize: 18,
|
|
@@ -251,7 +255,7 @@ const styles = StyleSheet.create({
|
|
|
251
255
|
labelInverseDisabled: {
|
|
252
256
|
color: 'rgba(255, 255, 255, 0.4)',
|
|
253
257
|
},
|
|
254
|
-
|
|
258
|
+
|
|
255
259
|
// TEXT STYLES
|
|
256
260
|
text: {
|
|
257
261
|
flex: 1,
|
|
@@ -282,7 +286,7 @@ const styles = StyleSheet.create({
|
|
|
282
286
|
textInverseDisabled: {
|
|
283
287
|
color: 'rgba(255, 255, 255, 0.4)',
|
|
284
288
|
},
|
|
285
|
-
|
|
289
|
+
|
|
286
290
|
// PLACEHOLDER STYLES
|
|
287
291
|
placeholderText: {
|
|
288
292
|
color: '#BFBFBF',
|
|
@@ -290,12 +294,12 @@ const styles = StyleSheet.create({
|
|
|
290
294
|
placeholderTextInverse: {
|
|
291
295
|
color: 'rgba(255, 255, 255, 0.6)',
|
|
292
296
|
},
|
|
293
|
-
|
|
297
|
+
|
|
294
298
|
// SUPPORT TEXT STYLES
|
|
295
299
|
supportText: {
|
|
296
300
|
fontSize: 12,
|
|
297
301
|
color: '#4F7CFE',
|
|
298
|
-
|
|
302
|
+
|
|
299
303
|
},
|
|
300
304
|
supportTextError: {
|
|
301
305
|
color: '#FF4D4F',
|
|
@@ -12,7 +12,9 @@ const Table = ({
|
|
|
12
12
|
onFilterChange,
|
|
13
13
|
selectedRowIndex = null,
|
|
14
14
|
onRowPress,
|
|
15
|
-
hideUnavailableStatus = false
|
|
15
|
+
hideUnavailableStatus = false,
|
|
16
|
+
statusDropdownShowCloseButton = false,
|
|
17
|
+
statusDropdownItemGap = 0
|
|
16
18
|
}) => {
|
|
17
19
|
const [selectedYear, setSelectedYear] = useState(null);
|
|
18
20
|
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
@@ -249,6 +251,8 @@ const Table = ({
|
|
|
249
251
|
options={statusOptions}
|
|
250
252
|
placeholder="Selecione o status"
|
|
251
253
|
innerTitle="Escolha qual status exibir:"
|
|
254
|
+
showCloseButton={statusDropdownShowCloseButton}
|
|
255
|
+
itemGap={statusDropdownItemGap}
|
|
252
256
|
/>
|
|
253
257
|
</View>
|
|
254
258
|
</View>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default Select;
|
|
2
|
-
declare function Select({ label, placeholder, value, onSelect, onValueChange, options, error, success, disabled, supportText, variant, displayMode, innerTitle }: {
|
|
2
|
+
declare function Select({ label, placeholder, value, onSelect, onValueChange, options, error, success, disabled, supportText, variant, displayMode, innerTitle, showCloseButton, itemGap }: {
|
|
3
3
|
label: any;
|
|
4
4
|
placeholder?: string | undefined;
|
|
5
5
|
value: any;
|
|
@@ -13,6 +13,8 @@ declare function Select({ label, placeholder, value, onSelect, onValueChange, op
|
|
|
13
13
|
variant?: string | undefined;
|
|
14
14
|
displayMode: any;
|
|
15
15
|
innerTitle: any;
|
|
16
|
+
showCloseButton?: boolean | undefined;
|
|
17
|
+
itemGap?: number | undefined;
|
|
16
18
|
}): React.JSX.Element;
|
|
17
19
|
import React from 'react';
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Select/index.jsx"],"names":[],"mappings":";AAMA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Select/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;;;sBAoJC;kBA1J0C,OAAO"}
|
|
@@ -4,7 +4,7 @@ import { SEText } from 'vpt-sebraeds';
|
|
|
4
4
|
import Icon from '../Icon';
|
|
5
5
|
import Dropdown from '../Dropdown';
|
|
6
6
|
const Select = ({ label, placeholder = "Selecione uma opção", value, onSelect, onValueChange, // Manter compatibilidade
|
|
7
|
-
options = [], error, success, disabled, supportText, variant = "default", displayMode, innerTitle }) => {
|
|
7
|
+
options = [], error, success, disabled, supportText, variant = "default", displayMode, innerTitle, showCloseButton = false, itemGap = 0 }) => {
|
|
8
8
|
const [isOpen, setIsOpen] = useState(false);
|
|
9
9
|
const [selectedOption, setSelectedOption] = useState(value || null);
|
|
10
10
|
useEffect(() => {
|
|
@@ -91,7 +91,7 @@ options = [], error, success, disabled, supportText, variant = "default", displa
|
|
|
91
91
|
const wrapperStyle = variant === "inverse" ? styles.wrapperInverse : styles.wrapper;
|
|
92
92
|
return (<View style={wrapperStyle}>
|
|
93
93
|
{label && <SEText type="ns-sm-body" style={getLabelStyle()}>{label}</SEText>}
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
<View style={styles.selectContainer}>
|
|
96
96
|
<TouchableOpacity style={getContainerStyle()} onPress={toggleDropdown} activeOpacity={disabled ? 1 : 0.7}>
|
|
97
97
|
<SEText type="ns-sm-body" style={[
|
|
@@ -101,14 +101,14 @@ options = [], error, success, disabled, supportText, variant = "default", displa
|
|
|
101
101
|
{selectedOption ? (selectedOption.label ||
|
|
102
102
|
selectedOption) : placeholder}
|
|
103
103
|
</SEText>
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
<Icon name={isOpen ? "arrow-up-s-line" : "arrow-down-s-line"} size={20} color={getIconColor()}/>
|
|
106
106
|
</TouchableOpacity>
|
|
107
107
|
|
|
108
|
-
<Dropdown title={innerTitle} options={options} isOpen={isOpen} setIsOpen={setIsOpen} onSelect={handleSelect} displayMode={displayMode} selectedValue={selectedOption}/>
|
|
108
|
+
<Dropdown title={innerTitle} options={options} isOpen={isOpen} setIsOpen={setIsOpen} onSelect={handleSelect} displayMode={displayMode} selectedValue={selectedOption} showCloseButton={showCloseButton} itemGap={itemGap}/>
|
|
109
109
|
</View>
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
{supportText && <SEText type="ns-xs-body" style={getSupportTextStyle()}>{supportText}</SEText>}
|
|
112
112
|
</View>);
|
|
113
113
|
};
|
|
114
114
|
const styles = StyleSheet.create({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default Table;
|
|
2
|
-
declare function Table({ data, showMoreComponent, showFilters, onFilterChange, selectedRowIndex, onRowPress, hideUnavailableStatus }: {
|
|
2
|
+
declare function Table({ data, showMoreComponent, showFilters, onFilterChange, selectedRowIndex, onRowPress, hideUnavailableStatus, statusDropdownShowCloseButton, statusDropdownItemGap }: {
|
|
3
3
|
data?: never[] | undefined;
|
|
4
4
|
showMoreComponent: any;
|
|
5
5
|
showFilters?: boolean | undefined;
|
|
@@ -7,6 +7,8 @@ declare function Table({ data, showMoreComponent, showFilters, onFilterChange, s
|
|
|
7
7
|
selectedRowIndex?: null | undefined;
|
|
8
8
|
onRowPress: any;
|
|
9
9
|
hideUnavailableStatus?: boolean | undefined;
|
|
10
|
+
statusDropdownShowCloseButton?: boolean | undefined;
|
|
11
|
+
statusDropdownItemGap?: number | undefined;
|
|
10
12
|
}): React.JSX.Element;
|
|
11
13
|
import React from 'react';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Table/index.jsx"],"names":[],"mappings":";AAOA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Table/index.jsx"],"names":[],"mappings":";AAOA;;;;;;;;;;sBAwUC;kBA/UsE,OAAO"}
|
|
@@ -4,7 +4,7 @@ import moment from 'moment';
|
|
|
4
4
|
import Icon from '../Icon';
|
|
5
5
|
import Select from '../Select';
|
|
6
6
|
import { SEText } from 'vpt-sebraeds';
|
|
7
|
-
const Table = ({ data = [], showMoreComponent, showFilters = false, onFilterChange, selectedRowIndex = null, onRowPress, hideUnavailableStatus = false }) => {
|
|
7
|
+
const Table = ({ data = [], showMoreComponent, showFilters = false, onFilterChange, selectedRowIndex = null, onRowPress, hideUnavailableStatus = false, statusDropdownShowCloseButton = false, statusDropdownItemGap = 0 }) => {
|
|
8
8
|
const [selectedYear, setSelectedYear] = useState(null);
|
|
9
9
|
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
10
10
|
const [selectedFilter, setSelectedFilter] = useState({});
|
|
@@ -198,7 +198,7 @@ const Table = ({ data = [], showMoreComponent, showFilters = false, onFilterChan
|
|
|
198
198
|
.filter(option => selectedStatuses.includes(option.value))
|
|
199
199
|
.map(option => option.value)
|
|
200
200
|
.join(', ')
|
|
201
|
-
.toLowerCase()} onSelect={handleStatusChange} options={statusOptions} placeholder="Selecione o status" innerTitle="Escolha qual status exibir:"/>
|
|
201
|
+
.toLowerCase()} onSelect={handleStatusChange} options={statusOptions} placeholder="Selecione o status" innerTitle="Escolha qual status exibir:" showCloseButton={statusDropdownShowCloseButton} itemGap={statusDropdownItemGap}/>
|
|
202
202
|
</View>
|
|
203
203
|
</View>)}
|
|
204
204
|
|