secullum-react-native-ui 4.16.2-beta.9 → 4.17.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/lib/components/AppShell.d.ts +52 -0
- package/lib/components/AppShell.js +82 -0
- package/lib/components/Button.d.ts +49 -0
- package/lib/components/Button.js +70 -0
- package/lib/components/Card.d.ts +66 -0
- package/lib/components/Card.js +131 -0
- package/lib/components/CheckBox.d.ts +36 -0
- package/lib/components/CheckBox.js +50 -0
- package/lib/components/DatePicker.d.ts +67 -0
- package/lib/components/DatePicker.js +106 -0
- package/lib/components/DatePicker.web.d.ts +64 -0
- package/lib/components/DatePicker.web.js +106 -0
- package/lib/components/Delay.d.ts +12 -0
- package/lib/components/Delay.js +22 -0
- package/lib/components/Details.d.ts +67 -0
- package/lib/components/Details.js +96 -0
- package/lib/components/DetailsHeader.d.ts +41 -0
- package/lib/components/DetailsHeader.js +65 -0
- package/lib/components/DimensionsMonitor.d.ts +21 -0
- package/lib/components/DimensionsMonitor.js +37 -0
- package/lib/components/DropDown.d.ts +53 -0
- package/lib/components/DropDown.js +351 -0
- package/lib/components/ErrorMessage.d.ts +16 -0
- package/lib/components/ErrorMessage.js +31 -0
- package/lib/components/FilePicker.d.ts +29 -0
- package/lib/components/FilePicker.js +46 -0
- package/lib/components/Header.d.ts +58 -0
- package/lib/components/Header.js +94 -0
- package/lib/components/HeaderDesktop.d.ts +59 -0
- package/lib/components/HeaderDesktop.js +83 -0
- package/lib/components/ImageButton.d.ts +14 -0
- package/lib/components/ImageButton.js +34 -0
- package/lib/components/KeyboardAvoidingView.d.ts +34 -0
- package/lib/components/KeyboardAvoidingView.js +106 -0
- package/lib/components/Link.d.ts +18 -0
- package/lib/components/Link.js +30 -0
- package/lib/components/Loading.d.ts +13 -0
- package/lib/components/Loading.js +45 -0
- package/lib/components/Menu.d.ts +42 -0
- package/lib/components/Menu.js +114 -0
- package/lib/components/MenuDesktop.d.ts +24 -0
- package/lib/components/MenuDesktop.js +39 -0
- package/lib/components/MenuMobile.d.ts +49 -0
- package/lib/components/MenuMobile.js +94 -0
- package/lib/components/Message.d.ts +37 -0
- package/lib/components/Message.js +52 -0
- package/lib/components/Modal.d.ts +18 -0
- package/lib/components/Modal.js +35 -0
- package/lib/components/MultiSelect.d.ts +51 -0
- package/lib/components/MultiSelect.js +377 -0
- package/lib/components/NoRecordMessage.d.ts +23 -0
- package/lib/components/NoRecordMessage.js +36 -0
- package/lib/components/Question.d.ts +57 -0
- package/lib/components/Question.js +79 -0
- package/lib/components/RadioButton.d.ts +43 -0
- package/lib/components/RadioButton.js +55 -0
- package/lib/components/RadioGroup.d.ts +45 -0
- package/lib/components/RadioGroup.js +71 -0
- package/lib/components/RangeDatePicker.d.ts +57 -0
- package/lib/components/RangeDatePicker.js +127 -0
- package/lib/components/RangeDatePicker.web.d.ts +61 -0
- package/lib/components/RangeDatePicker.web.js +146 -0
- package/lib/components/Space.d.ts +11 -0
- package/lib/components/Space.js +15 -0
- package/lib/components/StatusBar.d.ts +18 -0
- package/lib/components/StatusBar.js +33 -0
- package/lib/components/Switch.d.ts +34 -0
- package/lib/components/Switch.js +50 -0
- package/lib/components/Table.d.ts +30 -0
- package/lib/components/Table.js +79 -0
- package/lib/components/Table.web.d.ts +18 -0
- package/lib/components/Table.web.js +111 -0
- package/lib/components/Text.d.ts +29 -0
- package/lib/components/Text.js +38 -0
- package/lib/components/TextBox.d.ts +84 -0
- package/lib/components/TextBox.js +126 -0
- package/lib/components/TextBoxMask.d.ts +12 -0
- package/lib/components/TextBoxMask.js +34 -0
- package/lib/components/TimePicker.d.ts +63 -0
- package/lib/components/TimePicker.js +112 -0
- package/lib/components/TimePicker.web.d.ts +48 -0
- package/lib/components/TimePicker.web.js +88 -0
- package/lib/index.d.ts +40 -0
- package/lib/index.js +56 -0
- package/lib/modules/browser.d.ts +2 -0
- package/lib/modules/browser.js +51 -0
- package/lib/modules/format.d.ts +6 -0
- package/lib/modules/format.js +127 -0
- package/lib/modules/layout.d.ts +1 -0
- package/lib/modules/layout.js +12 -0
- package/lib/modules/test.d.ts +2 -0
- package/lib/modules/test.js +18 -0
- package/lib/modules/theme.d.ts +41 -0
- package/lib/modules/theme.js +52 -0
- package/lib/modules/validation.d.ts +3 -0
- package/lib/modules/validation.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IconProps } from 'react-native-vector-icons/Icon';
|
|
3
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
|
+
declare type DropDownItemData = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: any;
|
|
7
|
+
icon?: string;
|
|
8
|
+
nativeID?: string;
|
|
9
|
+
};
|
|
10
|
+
export interface DropDownProperties {
|
|
11
|
+
label?: string;
|
|
12
|
+
items: DropDownItemData[];
|
|
13
|
+
value: any | null;
|
|
14
|
+
onChange: (value: any) => void;
|
|
15
|
+
onPress?: () => void | boolean | Promise<void> | Promise<boolean>;
|
|
16
|
+
emptyMessage: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
disabledStyle?: StyleProp<ViewStyle>;
|
|
20
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
21
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
22
|
+
iconComponent?: React.ComponentClass<IconProps>;
|
|
23
|
+
nativeID?: string;
|
|
24
|
+
icon?: string | undefined;
|
|
25
|
+
arrowColor?: string | undefined;
|
|
26
|
+
searchable?: SearchableProps;
|
|
27
|
+
virtualized?: true | VirtualizedProps;
|
|
28
|
+
useKeyboardAvoidingView?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface SearchableProps {
|
|
31
|
+
placeHolder: string;
|
|
32
|
+
minItemsToSearch?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface VirtualizedProps {
|
|
35
|
+
initialNumToRender?: number;
|
|
36
|
+
maxToRenderPerBatch?: number;
|
|
37
|
+
windowSize?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface DropDownState {
|
|
40
|
+
modalOpen: boolean;
|
|
41
|
+
searchText: string;
|
|
42
|
+
}
|
|
43
|
+
export declare class DropDown extends React.Component<DropDownProperties, DropDownState> {
|
|
44
|
+
state: DropDownState;
|
|
45
|
+
handleItemPress: (value: any) => void;
|
|
46
|
+
filterItems: () => DropDownItemData[];
|
|
47
|
+
shouldDisplaySearchField: () => boolean | undefined;
|
|
48
|
+
renderClosedDropDown: (item: any, inputStyle: any) => JSX.Element | null;
|
|
49
|
+
getStyles: () => any;
|
|
50
|
+
renderItemsList: (filteredItems: DropDownItemData[]) => JSX.Element;
|
|
51
|
+
render(): JSX.Element;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DropDown = void 0;
|
|
13
|
+
const React = require("react");
|
|
14
|
+
const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
|
|
15
|
+
const Modal_1 = require("./Modal");
|
|
16
|
+
const layout_1 = require("../modules/layout");
|
|
17
|
+
const theme_1 = require("../modules/theme");
|
|
18
|
+
const test_1 = require("../modules/test");
|
|
19
|
+
const react_native_1 = require("react-native");
|
|
20
|
+
class DropDownItem extends React.PureComponent {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.getStyles = () => {
|
|
24
|
+
const theme = (0, theme_1.getTheme)();
|
|
25
|
+
const styles = react_native_1.StyleSheet.create({
|
|
26
|
+
modalItem: {
|
|
27
|
+
paddingHorizontal: 16,
|
|
28
|
+
paddingVertical: 16,
|
|
29
|
+
fontFamily: theme.fontFamily1,
|
|
30
|
+
fontSize: 16,
|
|
31
|
+
color: theme.dropDownTextColor
|
|
32
|
+
},
|
|
33
|
+
icon: {
|
|
34
|
+
fontSize: 26
|
|
35
|
+
},
|
|
36
|
+
rowView: {
|
|
37
|
+
flexDirection: 'row'
|
|
38
|
+
},
|
|
39
|
+
iconView: {
|
|
40
|
+
width: 100,
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
justifyContent: 'center'
|
|
43
|
+
},
|
|
44
|
+
iconOnlyView: {
|
|
45
|
+
width: 200,
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'center'
|
|
48
|
+
},
|
|
49
|
+
iconOnly: {
|
|
50
|
+
paddingHorizontal: 16,
|
|
51
|
+
paddingVertical: 16,
|
|
52
|
+
fontSize: 60
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return styles;
|
|
56
|
+
};
|
|
57
|
+
this.renderOpenDropDownItem = () => {
|
|
58
|
+
const { label, icon, iconComponent, nativeID } = this.props;
|
|
59
|
+
const theme = (0, theme_1.getTheme)();
|
|
60
|
+
const styles = this.getStyles();
|
|
61
|
+
if (label && icon) {
|
|
62
|
+
return (React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.rowView },
|
|
63
|
+
React.createElement(react_native_1.View, { style: styles.iconView }, iconComponent ? (React.createElement(iconComponent, {
|
|
64
|
+
name: icon,
|
|
65
|
+
style: styles.icon,
|
|
66
|
+
color: theme.textColor1
|
|
67
|
+
})) : (React.createElement(FontAwesome_1.default, { name: icon, color: theme.textColor1, style: styles.icon }))),
|
|
68
|
+
React.createElement(react_native_1.View, null,
|
|
69
|
+
React.createElement(react_native_1.Text, { style: styles.modalItem }, label))));
|
|
70
|
+
}
|
|
71
|
+
else if (label && !icon) {
|
|
72
|
+
return (React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.rowView },
|
|
73
|
+
React.createElement(react_native_1.Text, { style: styles.modalItem }, label)));
|
|
74
|
+
}
|
|
75
|
+
else if (!label && icon) {
|
|
76
|
+
return (React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.iconOnlyView }, iconComponent ? (React.createElement(iconComponent, {
|
|
77
|
+
name: icon,
|
|
78
|
+
style: styles.iconOnly,
|
|
79
|
+
color: theme.textColor1
|
|
80
|
+
})) : (React.createElement(FontAwesome_1.default, { name: icon, color: theme.textColor1, style: styles.iconOnly }))));
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
const { first, last, value, onPress, nativeID } = this.props;
|
|
87
|
+
const theme = (0, theme_1.getTheme)();
|
|
88
|
+
return (React.createElement(react_native_1.TouchableHighlight, { onPress: () => onPress(value), testID: (0, test_1.getTestID)(nativeID), underlayColor: theme.backgroundColor2, style: {
|
|
89
|
+
borderTopLeftRadius: first ? 5 : 0,
|
|
90
|
+
borderTopRightRadius: first ? 5 : 0,
|
|
91
|
+
borderBottomLeftRadius: last ? 5 : 0,
|
|
92
|
+
borderBottomRightRadius: last ? 5 : 0
|
|
93
|
+
} }, this.renderOpenDropDownItem()));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const DEFAULT_VIRTUALIZED_PROPS = {
|
|
97
|
+
initialNumToRender: 20,
|
|
98
|
+
maxToRenderPerBatch: 30,
|
|
99
|
+
windowSize: 10
|
|
100
|
+
};
|
|
101
|
+
class DropDown extends React.Component {
|
|
102
|
+
constructor() {
|
|
103
|
+
super(...arguments);
|
|
104
|
+
this.state = {
|
|
105
|
+
modalOpen: false,
|
|
106
|
+
searchText: ''
|
|
107
|
+
};
|
|
108
|
+
this.handleItemPress = (value) => {
|
|
109
|
+
const { onChange } = this.props;
|
|
110
|
+
this.setState({ modalOpen: false });
|
|
111
|
+
onChange(value);
|
|
112
|
+
};
|
|
113
|
+
this.filterItems = () => {
|
|
114
|
+
const { items } = this.props;
|
|
115
|
+
const { searchText } = this.state;
|
|
116
|
+
return items.filter(item => item.label.toLowerCase().includes(searchText.toLowerCase()));
|
|
117
|
+
};
|
|
118
|
+
this.shouldDisplaySearchField = () => {
|
|
119
|
+
const { items, searchable } = this.props;
|
|
120
|
+
const defaultQuantityToSearch = 10;
|
|
121
|
+
return (searchable &&
|
|
122
|
+
items.length >= (searchable.minItemsToSearch || defaultQuantityToSearch));
|
|
123
|
+
};
|
|
124
|
+
this.renderClosedDropDown = (item, inputStyle) => {
|
|
125
|
+
const { iconComponent } = this.props;
|
|
126
|
+
const theme = (0, theme_1.getTheme)();
|
|
127
|
+
const styles = this.getStyles();
|
|
128
|
+
if (!item) {
|
|
129
|
+
return (React.createElement(React.Fragment, null,
|
|
130
|
+
React.createElement(react_native_1.Text, { style: [styles.text, inputStyle] }, "-"),
|
|
131
|
+
React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.seta })));
|
|
132
|
+
}
|
|
133
|
+
else if (item.label && item.icon) {
|
|
134
|
+
return (React.createElement(React.Fragment, null,
|
|
135
|
+
React.createElement(react_native_1.View, { style: styles.rowView },
|
|
136
|
+
React.createElement(react_native_1.View, { style: styles.iconView }, iconComponent ? (React.createElement(iconComponent, {
|
|
137
|
+
name: item.icon,
|
|
138
|
+
style: styles.icon,
|
|
139
|
+
color: theme.textColor1
|
|
140
|
+
})) : (React.createElement(FontAwesome_1.default, { name: item.icon, color: theme.textColor1, style: styles.icon }))),
|
|
141
|
+
React.createElement(react_native_1.Text, { style: [styles.textIcon, inputStyle] }, item.label)),
|
|
142
|
+
React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.seta })));
|
|
143
|
+
}
|
|
144
|
+
else if (item.label && !item.icon) {
|
|
145
|
+
return (React.createElement(React.Fragment, null,
|
|
146
|
+
React.createElement(react_native_1.Text, { style: [styles.text, inputStyle] }, item.label),
|
|
147
|
+
React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.seta })));
|
|
148
|
+
}
|
|
149
|
+
else if (!item.label && item.icon) {
|
|
150
|
+
return (React.createElement(React.Fragment, null,
|
|
151
|
+
iconComponent ? (React.createElement(iconComponent, {
|
|
152
|
+
name: item.icon,
|
|
153
|
+
style: styles.iconOnly,
|
|
154
|
+
color: theme.textColor1
|
|
155
|
+
})) : (React.createElement(FontAwesome_1.default, { name: item.icon, color: theme.textColor1, style: styles.iconOnly })),
|
|
156
|
+
React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.setaIcone })));
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
};
|
|
160
|
+
this.getStyles = () => {
|
|
161
|
+
const theme = (0, theme_1.getTheme)();
|
|
162
|
+
const { icon, arrowColor } = this.props;
|
|
163
|
+
const styles = react_native_1.StyleSheet.create({
|
|
164
|
+
container: Object.assign({ paddingHorizontal: 16, paddingVertical: 8, borderWidth: 1, borderColor: theme.borderColor1, borderRadius: 3 }, (icon
|
|
165
|
+
? {
|
|
166
|
+
flexDirection: 'row',
|
|
167
|
+
minHeight: react_native_1.Platform.OS === 'web' || react_native_1.Platform.OS === 'ios' ? 40 : 46
|
|
168
|
+
}
|
|
169
|
+
: {})),
|
|
170
|
+
label: {
|
|
171
|
+
color: theme.textColor2,
|
|
172
|
+
fontFamily: theme.fontFamily3,
|
|
173
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
174
|
+
lineHeight: 16
|
|
175
|
+
},
|
|
176
|
+
text: {
|
|
177
|
+
lineHeight: (0, layout_1.isTablet)() ? 28 : 22,
|
|
178
|
+
minHeight: (0, layout_1.isTablet)() ? 28 : 22,
|
|
179
|
+
textAlignVertical: 'center',
|
|
180
|
+
color: theme.textColor1,
|
|
181
|
+
fontFamily: theme.fontFamily1,
|
|
182
|
+
fontSize: 16
|
|
183
|
+
},
|
|
184
|
+
textIcon: {
|
|
185
|
+
height: 27,
|
|
186
|
+
alignSelf: 'center',
|
|
187
|
+
color: theme.textColor1,
|
|
188
|
+
fontFamily: theme.fontFamily1,
|
|
189
|
+
fontSize: 16
|
|
190
|
+
},
|
|
191
|
+
seta: {
|
|
192
|
+
color: arrowColor ? arrowColor : theme.textColor1,
|
|
193
|
+
fontSize: 16,
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
bottom: 10,
|
|
196
|
+
right: 16
|
|
197
|
+
},
|
|
198
|
+
setaIcone: {
|
|
199
|
+
color: arrowColor ? arrowColor : theme.textColor1,
|
|
200
|
+
fontSize: 16,
|
|
201
|
+
position: 'absolute',
|
|
202
|
+
bottom: 25,
|
|
203
|
+
right: 16
|
|
204
|
+
},
|
|
205
|
+
modalOverlay: {
|
|
206
|
+
justifyContent: this.shouldDisplaySearchField()
|
|
207
|
+
? 'flex-start'
|
|
208
|
+
: 'center',
|
|
209
|
+
paddingTop: this.shouldDisplaySearchField() && react_native_1.Platform.OS === 'ios' ? 44 : 0
|
|
210
|
+
},
|
|
211
|
+
modalContainer: {
|
|
212
|
+
maxHeight: '95%',
|
|
213
|
+
borderRadius: 5,
|
|
214
|
+
backgroundColor: theme.backgroundColor1,
|
|
215
|
+
margin: 16
|
|
216
|
+
},
|
|
217
|
+
modalItem: {
|
|
218
|
+
paddingHorizontal: 16,
|
|
219
|
+
paddingVertical: 16,
|
|
220
|
+
fontFamily: theme.fontFamily1,
|
|
221
|
+
fontSize: 16
|
|
222
|
+
},
|
|
223
|
+
emptyMessageContainer: {
|
|
224
|
+
flexDirection: 'row',
|
|
225
|
+
alignItems: 'center',
|
|
226
|
+
paddingHorizontal: 16
|
|
227
|
+
},
|
|
228
|
+
readonly: {
|
|
229
|
+
backgroundColor: theme.disabledColor
|
|
230
|
+
},
|
|
231
|
+
icon: {
|
|
232
|
+
fontSize: 26
|
|
233
|
+
},
|
|
234
|
+
rowView: {
|
|
235
|
+
flexDirection: 'row'
|
|
236
|
+
},
|
|
237
|
+
iconView: {
|
|
238
|
+
width: 50,
|
|
239
|
+
alignItems: 'center'
|
|
240
|
+
},
|
|
241
|
+
iconOnlyView: {
|
|
242
|
+
width: 200,
|
|
243
|
+
alignItems: 'center',
|
|
244
|
+
justifyContent: 'center'
|
|
245
|
+
},
|
|
246
|
+
iconOnly: {
|
|
247
|
+
paddingHorizontal: 16,
|
|
248
|
+
paddingVertical: 8,
|
|
249
|
+
fontSize: 26
|
|
250
|
+
},
|
|
251
|
+
iconOnLine: {
|
|
252
|
+
color: theme.textColor2,
|
|
253
|
+
fontSize: (0, layout_1.isTablet)() ? 21 : 19,
|
|
254
|
+
marginRight: 10,
|
|
255
|
+
minWidth: 25,
|
|
256
|
+
textAlignVertical: 'center',
|
|
257
|
+
flex: 0
|
|
258
|
+
},
|
|
259
|
+
searchContainer: {
|
|
260
|
+
flexDirection: 'row',
|
|
261
|
+
alignItems: 'center',
|
|
262
|
+
justifyContent: 'space-between',
|
|
263
|
+
marginBottom: 10,
|
|
264
|
+
marginTop: 8,
|
|
265
|
+
marginRight: 16
|
|
266
|
+
},
|
|
267
|
+
searchLabel: {
|
|
268
|
+
fontSize: 16,
|
|
269
|
+
marginLeft: 16,
|
|
270
|
+
fontFamily: theme.fontFamily1
|
|
271
|
+
},
|
|
272
|
+
inputWrapper: {
|
|
273
|
+
flexDirection: 'row',
|
|
274
|
+
alignItems: 'center',
|
|
275
|
+
borderWidth: 1,
|
|
276
|
+
borderColor: '#ccc',
|
|
277
|
+
paddingHorizontal: 10,
|
|
278
|
+
backgroundColor: 'white',
|
|
279
|
+
flex: 1,
|
|
280
|
+
maxWidth: '100%',
|
|
281
|
+
minWidth: 150,
|
|
282
|
+
overflow: 'hidden',
|
|
283
|
+
marginLeft: 16
|
|
284
|
+
},
|
|
285
|
+
searchInput: {
|
|
286
|
+
flex: 1,
|
|
287
|
+
height: 40
|
|
288
|
+
},
|
|
289
|
+
searchIcon: {
|
|
290
|
+
marginLeft: 10
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
return styles;
|
|
294
|
+
};
|
|
295
|
+
this.renderItemsList = (filteredItems) => {
|
|
296
|
+
const { iconComponent, virtualized } = this.props;
|
|
297
|
+
const renderItem = ({ item, index }) => (React.createElement(DropDownItem, { nativeID: item.nativeID, first: index === 0, last: index === filteredItems.length - 1, label: item.label, value: item.value, onPress: this.handleItemPress, icon: item.icon, iconComponent: iconComponent }));
|
|
298
|
+
if (virtualized == null) {
|
|
299
|
+
return (React.createElement(react_native_1.FlatList, { data: filteredItems, initialNumToRender: filteredItems.length, keyExtractor: item => item.value.toString(), renderItem: renderItem }));
|
|
300
|
+
}
|
|
301
|
+
const virtualizedProps = typeof virtualized === 'object'
|
|
302
|
+
? Object.assign(Object.assign({}, DEFAULT_VIRTUALIZED_PROPS), virtualized) : DEFAULT_VIRTUALIZED_PROPS;
|
|
303
|
+
return (React.createElement(react_native_1.VirtualizedList, { getItem: (_, index) => filteredItems[index], getItemCount: () => filteredItems.length, keyExtractor: item => item.value.toString(), renderItem: renderItem, initialNumToRender: virtualizedProps.initialNumToRender, maxToRenderPerBatch: virtualizedProps.maxToRenderPerBatch, windowSize: virtualizedProps.windowSize }));
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
render() {
|
|
307
|
+
const { modalOpen, searchText } = this.state;
|
|
308
|
+
const { label, items, value, emptyMessage, style, disabledStyle, disabled, labelStyle, inputStyle, nativeID, onPress, icon, searchable, useKeyboardAvoidingView } = this.props;
|
|
309
|
+
const selectedItem = items.find(x => x.value === value);
|
|
310
|
+
const styles = this.getStyles();
|
|
311
|
+
const theme = (0, theme_1.getTheme)();
|
|
312
|
+
const filteredItems = searchable ? this.filterItems() : items;
|
|
313
|
+
const conteudoModal = (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: react_native_1.Keyboard.dismiss },
|
|
314
|
+
React.createElement(react_native_1.View, { style: [
|
|
315
|
+
styles.modalContainer,
|
|
316
|
+
react_native_1.Platform.OS === 'web' && {
|
|
317
|
+
marginVertical: '10px',
|
|
318
|
+
marginHorizontal: 'auto',
|
|
319
|
+
width: '90%',
|
|
320
|
+
maxWidth: 450,
|
|
321
|
+
maxHeight: 300,
|
|
322
|
+
justifyContent: 'center'
|
|
323
|
+
}
|
|
324
|
+
] },
|
|
325
|
+
this.shouldDisplaySearchField() && (React.createElement(react_native_1.View, { style: styles.searchContainer },
|
|
326
|
+
React.createElement(react_native_1.View, { style: styles.inputWrapper },
|
|
327
|
+
React.createElement(react_native_1.TextInput, { nativeID: nativeID + '-text-search', style: styles.searchInput, value: searchText, placeholder: searchable && searchable.placeHolder, onChangeText: text => this.setState({ searchText: text }) }),
|
|
328
|
+
React.createElement(FontAwesome_1.default, { name: "search", size: 16, color: "gray", style: styles.searchIcon })))),
|
|
329
|
+
filteredItems.length > 0 ? (this.renderItemsList(filteredItems)) : (React.createElement(react_native_1.View, { style: styles.emptyMessageContainer },
|
|
330
|
+
React.createElement(FontAwesome_1.default, { name: "warning", color: theme.warningColor, size: 24 }),
|
|
331
|
+
React.createElement(react_native_1.Text, { style: styles.modalItem }, emptyMessage))))));
|
|
332
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => __awaiter(this, void 0, void 0, function* () {
|
|
333
|
+
if (onPress) {
|
|
334
|
+
const result = yield onPress();
|
|
335
|
+
if (result === false) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
this.setState({ modalOpen: true, searchText: '' });
|
|
340
|
+
}), disabled: disabled },
|
|
341
|
+
React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [
|
|
342
|
+
styles.container,
|
|
343
|
+
style,
|
|
344
|
+
disabled ? [styles.readonly, disabledStyle] : null
|
|
345
|
+
] },
|
|
346
|
+
icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.iconOnLine })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
|
|
347
|
+
this.renderClosedDropDown(selectedItem, inputStyle),
|
|
348
|
+
React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay }, useKeyboardAvoidingView ? (React.createElement(react_native_1.KeyboardAvoidingView, { behavior: react_native_1.Platform.OS === 'ios' ? 'padding' : 'height' }, conteudoModal)) : (conteudoModal)))));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
exports.DropDown = DropDown;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
export interface Props {
|
|
4
|
+
message?: string | null;
|
|
5
|
+
style?: StyleProp<TextStyle>;
|
|
6
|
+
nativeID?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class ErrorMessage extends React.Component<Props> {
|
|
9
|
+
getStyles: () => {
|
|
10
|
+
errorMessage: {
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
render(): JSX.Element | null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorMessage = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const theme_1 = require("../modules/theme");
|
|
7
|
+
const test_1 = require("../modules/test");
|
|
8
|
+
class ErrorMessage extends React.Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.getStyles = () => {
|
|
12
|
+
const theme = (0, theme_1.getTheme)();
|
|
13
|
+
const styles = react_native_1.StyleSheet.create({
|
|
14
|
+
errorMessage: {
|
|
15
|
+
fontFamily: theme.fontFamily3,
|
|
16
|
+
color: theme.errorColor
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return styles;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
const { message, style, nativeID } = this.props;
|
|
24
|
+
const styles = this.getStyles();
|
|
25
|
+
if (!message) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return (React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.errorMessage, style] }, message));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ErrorMessage = ErrorMessage;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface FilePickerProperties {
|
|
3
|
+
label: string;
|
|
4
|
+
onPress: () => void;
|
|
5
|
+
icon: string;
|
|
6
|
+
nativeID?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class FilePicker extends React.Component<FilePickerProperties> {
|
|
9
|
+
static defaultProps: {
|
|
10
|
+
icon: string;
|
|
11
|
+
};
|
|
12
|
+
getStyles: () => {
|
|
13
|
+
container: {
|
|
14
|
+
borderRadius: number;
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
height: number;
|
|
17
|
+
alignItems: "center";
|
|
18
|
+
justifyContent: "center";
|
|
19
|
+
};
|
|
20
|
+
text: {
|
|
21
|
+
fontFamily: string;
|
|
22
|
+
fontSize: number;
|
|
23
|
+
color: string;
|
|
24
|
+
width: number;
|
|
25
|
+
textAlign: "center";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
render(): JSX.Element;
|
|
29
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilePicker = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
|
|
7
|
+
const theme_1 = require("../modules/theme");
|
|
8
|
+
const layout_1 = require("../modules/layout");
|
|
9
|
+
const test_1 = require("../modules/test");
|
|
10
|
+
class FilePicker extends React.Component {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.getStyles = () => {
|
|
14
|
+
const theme = (0, theme_1.getTheme)();
|
|
15
|
+
const styles = react_native_1.StyleSheet.create({
|
|
16
|
+
container: {
|
|
17
|
+
borderRadius: 3,
|
|
18
|
+
backgroundColor: theme.backgroundColor2,
|
|
19
|
+
height: 100,
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center'
|
|
22
|
+
},
|
|
23
|
+
text: {
|
|
24
|
+
fontFamily: theme.fontFamily1,
|
|
25
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
26
|
+
color: theme.textColor3,
|
|
27
|
+
width: 200,
|
|
28
|
+
textAlign: 'center'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return styles;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
const { label, onPress, icon, nativeID } = this.props;
|
|
36
|
+
const theme = (0, theme_1.getTheme)();
|
|
37
|
+
const styles = this.getStyles();
|
|
38
|
+
return (React.createElement(react_native_1.TouchableOpacity, { activeOpacity: 0.5, style: styles.container, onPress: onPress },
|
|
39
|
+
React.createElement(FontAwesome_1.default, { name: icon, color: theme.textColor3, size: 30 }),
|
|
40
|
+
React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: styles.text }, label)));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.FilePicker = FilePicker;
|
|
44
|
+
FilePicker.defaultProps = {
|
|
45
|
+
icon: 'cloud-upload'
|
|
46
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
export interface HeaderButton {
|
|
4
|
+
icon: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
counter?: number;
|
|
7
|
+
onPress: () => void;
|
|
8
|
+
nativeID?: string;
|
|
9
|
+
buttonStyle?: StyleProp<TextStyle>;
|
|
10
|
+
}
|
|
11
|
+
export interface HeaderProperties {
|
|
12
|
+
title: string;
|
|
13
|
+
leftButton?: HeaderButton;
|
|
14
|
+
rightButton?: HeaderButton;
|
|
15
|
+
nativeID?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class Header extends React.Component<HeaderProperties> {
|
|
18
|
+
static defaultProps: {
|
|
19
|
+
leftButtonType: string;
|
|
20
|
+
};
|
|
21
|
+
static height: number;
|
|
22
|
+
getStyles: () => {
|
|
23
|
+
header: {
|
|
24
|
+
backgroundColor: string;
|
|
25
|
+
height: number;
|
|
26
|
+
flexDirection: "row";
|
|
27
|
+
alignItems: "center";
|
|
28
|
+
justifyContent: "center";
|
|
29
|
+
};
|
|
30
|
+
title: {
|
|
31
|
+
color: string;
|
|
32
|
+
fontFamily: string;
|
|
33
|
+
fontSize: number;
|
|
34
|
+
marginHorizontal: number;
|
|
35
|
+
flexShrink: number;
|
|
36
|
+
};
|
|
37
|
+
button: {
|
|
38
|
+
padding: number;
|
|
39
|
+
};
|
|
40
|
+
counterContainer: {
|
|
41
|
+
position: "absolute";
|
|
42
|
+
backgroundColor: string;
|
|
43
|
+
height: number;
|
|
44
|
+
width: number;
|
|
45
|
+
top: number;
|
|
46
|
+
left: number;
|
|
47
|
+
borderRadius: number;
|
|
48
|
+
};
|
|
49
|
+
counterText: {
|
|
50
|
+
textAlign: "center";
|
|
51
|
+
color: string;
|
|
52
|
+
fontSize: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
renderButton: (button: HeaderButton, type: 'left' | 'right') => JSX.Element;
|
|
56
|
+
renderButtonInvisible: (type: 'left' | 'right') => JSX.Element;
|
|
57
|
+
render(): JSX.Element;
|
|
58
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
|
|
7
|
+
const theme_1 = require("../modules/theme");
|
|
8
|
+
const layout_1 = require("../modules/layout");
|
|
9
|
+
const test_1 = require("../modules/test");
|
|
10
|
+
class Header extends React.Component {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.getStyles = () => {
|
|
14
|
+
const theme = (0, theme_1.getTheme)();
|
|
15
|
+
const styles = react_native_1.StyleSheet.create({
|
|
16
|
+
header: {
|
|
17
|
+
backgroundColor: theme.backgroundColor3,
|
|
18
|
+
height: (0, layout_1.isTablet)() ? 65 : 50,
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center'
|
|
22
|
+
},
|
|
23
|
+
title: {
|
|
24
|
+
color: theme.textColor4,
|
|
25
|
+
fontFamily: theme.fontFamily1,
|
|
26
|
+
fontSize: (0, layout_1.isTablet)() ? 22 : 18,
|
|
27
|
+
marginHorizontal: 10,
|
|
28
|
+
flexShrink: 1
|
|
29
|
+
},
|
|
30
|
+
button: {
|
|
31
|
+
padding: (0, layout_1.isTablet)() ? 14 : 10
|
|
32
|
+
},
|
|
33
|
+
counterContainer: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
backgroundColor: theme.counterBackgroundColor,
|
|
36
|
+
height: (0, layout_1.isTablet)() ? 20 : 15,
|
|
37
|
+
width: (0, layout_1.isTablet)() ? 20 : 15,
|
|
38
|
+
top: 5,
|
|
39
|
+
left: 18,
|
|
40
|
+
borderRadius: 50
|
|
41
|
+
},
|
|
42
|
+
counterText: {
|
|
43
|
+
textAlign: 'center',
|
|
44
|
+
color: theme.counterTextColor,
|
|
45
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 10
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return styles;
|
|
49
|
+
};
|
|
50
|
+
this.renderButton = (button, type) => {
|
|
51
|
+
const styles = this.getStyles();
|
|
52
|
+
const theme = (0, theme_1.getTheme)();
|
|
53
|
+
const icon = (React.createElement(React.Fragment, null,
|
|
54
|
+
React.createElement(FontAwesome_1.default, { nativeID: button.nativeID, testID: (0, test_1.getTestID)(button.nativeID), name: button.icon, size: (0, layout_1.isTablet)() ? 30 : 20, color: button.disabled ? theme.textColor1 : theme.textColor4,
|
|
55
|
+
// @ts-ignore : The component uses a different version of typing
|
|
56
|
+
style: button.buttonStyle }),
|
|
57
|
+
button.counter ? (React.createElement(react_native_1.View, { style: styles.counterContainer },
|
|
58
|
+
React.createElement(react_native_1.Text, { style: styles.counterText }, button.counter))) : null));
|
|
59
|
+
const style = [
|
|
60
|
+
styles.button,
|
|
61
|
+
type === 'left' ? { marginRight: 'auto' } : { marginLeft: 'auto' }
|
|
62
|
+
];
|
|
63
|
+
if (button.disabled) {
|
|
64
|
+
return React.createElement(react_native_1.View, { style: style }, icon);
|
|
65
|
+
}
|
|
66
|
+
return (React.createElement(react_native_1.TouchableOpacity, { onPress: button.onPress, style: style }, icon));
|
|
67
|
+
};
|
|
68
|
+
this.renderButtonInvisible = (type) => {
|
|
69
|
+
const styles = this.getStyles();
|
|
70
|
+
const style = [
|
|
71
|
+
styles.button,
|
|
72
|
+
type === 'left' ? { marginRight: 'auto' } : { marginLeft: 'auto' }
|
|
73
|
+
];
|
|
74
|
+
return React.createElement(react_native_1.View, { style: style });
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
const { title, leftButton, rightButton, nativeID } = this.props;
|
|
79
|
+
const styles = this.getStyles();
|
|
80
|
+
return (React.createElement(react_native_1.View, { style: styles.header },
|
|
81
|
+
leftButton
|
|
82
|
+
? this.renderButton(leftButton, 'left')
|
|
83
|
+
: this.renderButtonInvisible('left'),
|
|
84
|
+
React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: styles.title }, title),
|
|
85
|
+
rightButton
|
|
86
|
+
? this.renderButton(rightButton, 'right')
|
|
87
|
+
: this.renderButtonInvisible('right')));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Header = Header;
|
|
91
|
+
Header.defaultProps = {
|
|
92
|
+
leftButtonType: 'menu'
|
|
93
|
+
};
|
|
94
|
+
Header.height = (0, layout_1.isTablet)() ? 65 : 50;
|