secullum-react-native-ui 4.3.8-beta.2 → 4.3.10

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 (95) hide show
  1. package/lib/components/AppShell.d.ts +24 -0
  2. package/lib/components/AppShell.js +79 -0
  3. package/lib/components/Button.d.ts +47 -0
  4. package/lib/components/Button.js +65 -0
  5. package/lib/components/Card.d.ts +65 -0
  6. package/lib/components/Card.js +125 -0
  7. package/lib/components/CheckBox.d.ts +34 -0
  8. package/lib/components/CheckBox.js +46 -0
  9. package/lib/components/DatePicker.d.ts +67 -0
  10. package/lib/components/DatePicker.js +105 -0
  11. package/lib/components/DatePicker.web.d.ts +64 -0
  12. package/lib/components/DatePicker.web.js +105 -0
  13. package/lib/components/Delay.d.ts +12 -0
  14. package/lib/components/Delay.js +21 -0
  15. package/lib/components/Details.d.ts +66 -0
  16. package/lib/components/Details.js +94 -0
  17. package/lib/components/DetailsHeader.d.ts +37 -0
  18. package/lib/components/DetailsHeader.js +63 -0
  19. package/lib/components/DimensionsMonitor.d.ts +21 -0
  20. package/lib/components/DimensionsMonitor.js +35 -0
  21. package/lib/components/DropDown.d.ts +35 -0
  22. package/lib/components/DropDown.js +263 -0
  23. package/lib/components/ErrorMessage.d.ts +16 -0
  24. package/lib/components/ErrorMessage.js +29 -0
  25. package/lib/components/FilePicker.d.ts +28 -0
  26. package/lib/components/FilePicker.js +44 -0
  27. package/lib/components/Header.d.ts +56 -0
  28. package/lib/components/Header.js +89 -0
  29. package/lib/components/HeaderDesktop.d.ts +59 -0
  30. package/lib/components/HeaderDesktop.js +80 -0
  31. package/lib/components/ImageButton.d.ts +14 -0
  32. package/lib/components/ImageButton.js +32 -0
  33. package/lib/components/KeyboardAvoidingView.d.ts +34 -0
  34. package/lib/components/KeyboardAvoidingView.js +92 -0
  35. package/lib/components/Link.d.ts +17 -0
  36. package/lib/components/Link.js +28 -0
  37. package/lib/components/Loading.d.ts +4 -0
  38. package/lib/components/Loading.js +37 -0
  39. package/lib/components/Menu.d.ts +42 -0
  40. package/lib/components/Menu.js +112 -0
  41. package/lib/components/MenuDesktop.d.ts +24 -0
  42. package/lib/components/MenuDesktop.js +38 -0
  43. package/lib/components/MenuMobile.d.ts +47 -0
  44. package/lib/components/MenuMobile.js +85 -0
  45. package/lib/components/Message.d.ts +37 -0
  46. package/lib/components/Message.js +50 -0
  47. package/lib/components/Modal.d.ts +11 -0
  48. package/lib/components/Modal.js +20 -0
  49. package/lib/components/MultiSelect.d.ts +51 -0
  50. package/lib/components/MultiSelect.js +376 -0
  51. package/lib/components/NoRecordMessage.d.ts +23 -0
  52. package/lib/components/NoRecordMessage.js +35 -0
  53. package/lib/components/Question.d.ts +57 -0
  54. package/lib/components/Question.js +72 -0
  55. package/lib/components/RadioButton.d.ts +42 -0
  56. package/lib/components/RadioButton.js +53 -0
  57. package/lib/components/RadioGroup.d.ts +44 -0
  58. package/lib/components/RadioGroup.js +64 -0
  59. package/lib/components/RangeDatePicker.d.ts +57 -0
  60. package/lib/components/RangeDatePicker.js +126 -0
  61. package/lib/components/RangeDatePicker.web.d.ts +61 -0
  62. package/lib/components/RangeDatePicker.web.js +119 -0
  63. package/lib/components/Space.d.ts +11 -0
  64. package/lib/components/Space.js +14 -0
  65. package/lib/components/StatusBar.d.ts +11 -0
  66. package/lib/components/StatusBar.js +27 -0
  67. package/lib/components/Switch.d.ts +34 -0
  68. package/lib/components/Switch.js +49 -0
  69. package/lib/components/Table.d.ts +28 -0
  70. package/lib/components/Table.js +62 -0
  71. package/lib/components/Table.web.d.ts +18 -0
  72. package/lib/components/Table.web.js +108 -0
  73. package/lib/components/Text.d.ts +28 -0
  74. package/lib/components/Text.js +36 -0
  75. package/lib/components/TextBox.d.ts +115 -0
  76. package/lib/components/TextBox.js +103 -0
  77. package/lib/components/TextBoxMask.d.ts +12 -0
  78. package/lib/components/TextBoxMask.js +29 -0
  79. package/lib/components/TimePicker.d.ts +63 -0
  80. package/lib/components/TimePicker.js +111 -0
  81. package/lib/components/TimePicker.web.d.ts +48 -0
  82. package/lib/components/TimePicker.web.js +82 -0
  83. package/lib/index.d.ts +39 -0
  84. package/lib/index.js +44 -0
  85. package/lib/modules/browser.d.ts +2 -0
  86. package/lib/modules/browser.js +50 -0
  87. package/lib/modules/format.d.ts +6 -0
  88. package/lib/modules/format.js +99 -0
  89. package/lib/modules/layout.d.ts +1 -0
  90. package/lib/modules/layout.js +10 -0
  91. package/lib/modules/theme.d.ts +41 -0
  92. package/lib/modules/theme.js +49 -0
  93. package/lib/modules/validation.d.ts +3 -0
  94. package/lib/modules/validation.js +12 -0
  95. package/package.json +1 -1
@@ -0,0 +1,263 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
5
+ const Modal_1 = require("./Modal");
6
+ const layout_1 = require("../modules/layout");
7
+ const theme_1 = require("../modules/theme");
8
+ const react_native_1 = require("react-native");
9
+ class DropDownItem extends React.PureComponent {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.getStyles = () => {
13
+ const theme = theme_1.getTheme();
14
+ const styles = react_native_1.StyleSheet.create({
15
+ modalItem: {
16
+ paddingHorizontal: 16,
17
+ paddingVertical: 16,
18
+ fontFamily: theme.fontFamily1,
19
+ fontSize: 16,
20
+ color: theme.dropDownTextColor
21
+ },
22
+ icon: {
23
+ fontSize: 26
24
+ },
25
+ rowView: {
26
+ flexDirection: 'row'
27
+ },
28
+ iconView: {
29
+ width: 100,
30
+ alignItems: 'center',
31
+ justifyContent: 'center'
32
+ },
33
+ iconOnlyView: {
34
+ width: 200,
35
+ alignItems: 'center',
36
+ justifyContent: 'center'
37
+ },
38
+ iconOnly: {
39
+ paddingHorizontal: 16,
40
+ paddingVertical: 16,
41
+ fontSize: 60
42
+ }
43
+ });
44
+ return styles;
45
+ };
46
+ this.renderOpenDropDownItem = () => {
47
+ const { label, icon, iconComponent, nativeID } = this.props;
48
+ const theme = theme_1.getTheme();
49
+ const styles = this.getStyles();
50
+ if (label && icon) {
51
+ return (React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.rowView },
52
+ React.createElement(react_native_1.View, { style: styles.iconView }, iconComponent ? (React.createElement(iconComponent, {
53
+ name: icon,
54
+ style: styles.icon,
55
+ color: theme.textColor1
56
+ })) : (React.createElement(FontAwesome_1.default, { name: icon, color: theme.textColor1, style: styles.icon }))),
57
+ React.createElement(react_native_1.View, null,
58
+ React.createElement(react_native_1.Text, { style: styles.modalItem }, label))));
59
+ }
60
+ else if (label && !icon) {
61
+ return (React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.rowView },
62
+ React.createElement(react_native_1.Text, { style: styles.modalItem }, label)));
63
+ }
64
+ else if (!label && icon) {
65
+ return (React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.iconOnlyView }, iconComponent ? (React.createElement(iconComponent, {
66
+ name: icon,
67
+ style: styles.iconOnly,
68
+ color: theme.textColor1
69
+ })) : (React.createElement(FontAwesome_1.default, { name: icon, color: theme.textColor1, style: styles.iconOnly }))));
70
+ }
71
+ return null;
72
+ };
73
+ }
74
+ render() {
75
+ const { first, last, value, onPress } = this.props;
76
+ const theme = theme_1.getTheme();
77
+ return (React.createElement(react_native_1.TouchableHighlight, { onPress: () => onPress(value), underlayColor: theme.backgroundColor2, style: {
78
+ borderTopLeftRadius: first ? 5 : 0,
79
+ borderTopRightRadius: first ? 5 : 0,
80
+ borderBottomLeftRadius: last ? 5 : 0,
81
+ borderBottomRightRadius: last ? 5 : 0
82
+ } }, this.renderOpenDropDownItem()));
83
+ }
84
+ }
85
+ class DropDown extends React.Component {
86
+ constructor() {
87
+ super(...arguments);
88
+ this.state = {
89
+ modalOpen: false
90
+ };
91
+ this.handleItemPress = (value) => {
92
+ const { onChange } = this.props;
93
+ this.setState({ modalOpen: false });
94
+ onChange(value);
95
+ };
96
+ this.renderClosedDropDown = (item, inputStyle) => {
97
+ const { iconComponent } = this.props;
98
+ const theme = theme_1.getTheme();
99
+ const styles = this.getStyles();
100
+ if (!item) {
101
+ return (React.createElement(React.Fragment, null,
102
+ React.createElement(react_native_1.Text, { style: [styles.text, inputStyle] }, "-"),
103
+ React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.seta })));
104
+ }
105
+ else if (item.label && item.icon) {
106
+ return (React.createElement(React.Fragment, null,
107
+ React.createElement(react_native_1.View, { style: styles.rowView },
108
+ React.createElement(react_native_1.View, { style: styles.iconView }, iconComponent ? (React.createElement(iconComponent, {
109
+ name: item.icon,
110
+ style: styles.icon,
111
+ color: theme.textColor1
112
+ })) : (React.createElement(FontAwesome_1.default, { name: item.icon, color: theme.textColor1, style: styles.icon }))),
113
+ React.createElement(react_native_1.Text, { style: [styles.textIcon, inputStyle] }, item.label)),
114
+ React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.seta })));
115
+ }
116
+ else if (item.label && !item.icon) {
117
+ return (React.createElement(React.Fragment, null,
118
+ React.createElement(react_native_1.Text, { style: [styles.text, inputStyle] }, item.label),
119
+ React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.seta })));
120
+ }
121
+ else if (!item.label && item.icon) {
122
+ return (React.createElement(React.Fragment, null,
123
+ iconComponent ? (React.createElement(iconComponent, {
124
+ name: item.icon,
125
+ style: styles.iconOnly,
126
+ color: theme.textColor1
127
+ })) : (React.createElement(FontAwesome_1.default, { name: item.icon, color: theme.textColor1, style: styles.iconOnly })),
128
+ React.createElement(FontAwesome_1.default, { name: "caret-down", style: styles.setaIcone })));
129
+ }
130
+ return null;
131
+ };
132
+ this.getStyles = () => {
133
+ const theme = theme_1.getTheme();
134
+ const { icon } = this.props;
135
+ const styles = react_native_1.StyleSheet.create({
136
+ container: Object.assign({ paddingHorizontal: 16, paddingVertical: 8, borderWidth: 1, borderColor: theme.borderColor1, borderRadius: 3 }, (icon
137
+ ? {
138
+ flexDirection: 'row',
139
+ minHeight: react_native_1.Platform.OS === 'web' || react_native_1.Platform.OS === 'ios' ? 40 : 46
140
+ }
141
+ : {})),
142
+ label: {
143
+ color: theme.textColor2,
144
+ fontFamily: theme.fontFamily3,
145
+ fontSize: layout_1.isTablet() ? 15 : 12,
146
+ lineHeight: 16
147
+ },
148
+ text: {
149
+ lineHeight: 22,
150
+ minHeight: 22,
151
+ textAlignVertical: 'center',
152
+ color: theme.textColor1,
153
+ fontFamily: theme.fontFamily1,
154
+ fontSize: 16
155
+ },
156
+ textIcon: {
157
+ height: 27,
158
+ alignSelf: 'center',
159
+ color: theme.textColor1,
160
+ fontFamily: theme.fontFamily1,
161
+ fontSize: 16
162
+ },
163
+ seta: {
164
+ color: theme.textColor1,
165
+ fontSize: 16,
166
+ position: 'absolute',
167
+ bottom: 10,
168
+ right: 16
169
+ },
170
+ setaIcone: {
171
+ color: theme.textColor1,
172
+ fontSize: 16,
173
+ position: 'absolute',
174
+ bottom: 25,
175
+ right: 16
176
+ },
177
+ modalOverlay: {
178
+ justifyContent: 'center'
179
+ },
180
+ modalContainer: {
181
+ borderRadius: 5,
182
+ backgroundColor: theme.backgroundColor1,
183
+ margin: 16
184
+ },
185
+ modalItem: {
186
+ paddingHorizontal: 16,
187
+ paddingVertical: 16,
188
+ fontFamily: theme.fontFamily1,
189
+ fontSize: 16
190
+ },
191
+ emptyMessageContainer: {
192
+ flexDirection: 'row',
193
+ alignItems: 'center',
194
+ paddingHorizontal: 16
195
+ },
196
+ readonly: {
197
+ backgroundColor: theme.disabledColor
198
+ },
199
+ icon: {
200
+ fontSize: 26
201
+ },
202
+ rowView: {
203
+ flexDirection: 'row'
204
+ },
205
+ iconView: {
206
+ width: 50,
207
+ alignItems: 'center'
208
+ },
209
+ iconOnlyView: {
210
+ width: 200,
211
+ alignItems: 'center',
212
+ justifyContent: 'center'
213
+ },
214
+ iconOnly: {
215
+ paddingHorizontal: 16,
216
+ paddingVertical: 8,
217
+ fontSize: 26
218
+ },
219
+ iconOnLine: {
220
+ color: theme.textColor2,
221
+ fontSize: layout_1.isTablet() ? 21 : 19,
222
+ marginRight: 10,
223
+ minWidth: 25,
224
+ textAlignVertical: 'center',
225
+ flex: 0
226
+ }
227
+ });
228
+ return styles;
229
+ };
230
+ }
231
+ render() {
232
+ const { modalOpen } = this.state;
233
+ const { label, items, value, emptyMessage, style, disabled, labelStyle, inputStyle, iconComponent, nativeID, icon } = this.props;
234
+ const selectedItem = items.find(x => x.value === value);
235
+ const styles = this.getStyles();
236
+ const theme = theme_1.getTheme();
237
+ return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => this.setState({ modalOpen: true }), disabled: disabled },
238
+ React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
239
+ icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.iconOnLine })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
240
+ this.renderClosedDropDown(selectedItem, inputStyle),
241
+ React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay },
242
+ React.createElement(react_native_1.TouchableWithoutFeedback, null,
243
+ React.createElement(react_native_1.View, { style: [
244
+ styles.modalContainer,
245
+ react_native_1.Platform.OS === 'web' && {
246
+ marginVertical: '10px',
247
+ marginHorizontal: 'auto',
248
+ width: '90%',
249
+ maxWidth: 450,
250
+ maxHeight: 300,
251
+ justifyContent: 'center'
252
+ }
253
+ ] }, items.length > 0 ? (React.createElement(react_native_1.FlatList, { data: items, initialNumToRender: items.length, keyExtractor: item => item.value.toString(), renderItem: ({ item, index }) => {
254
+ return (React.createElement(DropDownItem, { nativeID: item.nativeID, first: index === 0, last: index === items.length - 1, label: item.label, value: item.value, onPress: this.handleItemPress, icon: item.icon, iconComponent: iconComponent }));
255
+ } })) : (React.createElement(react_native_1.View, { style: styles.emptyMessageContainer },
256
+ React.createElement(FontAwesome_1.default, { name: "warning", color: theme.warningColor, size: 24 }),
257
+ React.createElement(react_native_1.Text, { style: styles.modalItem }, emptyMessage)))))))));
258
+ }
259
+ }
260
+ DropDown.defaultProps = {
261
+ emptyMessage: 'Não há registros cadastrados'
262
+ };
263
+ 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,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const theme_1 = require("../modules/theme");
6
+ class ErrorMessage extends React.Component {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.getStyles = () => {
10
+ const theme = theme_1.getTheme();
11
+ const styles = react_native_1.StyleSheet.create({
12
+ errorMessage: {
13
+ fontFamily: theme.fontFamily3,
14
+ color: theme.errorColor
15
+ }
16
+ });
17
+ return styles;
18
+ };
19
+ }
20
+ render() {
21
+ const { message, style, nativeID } = this.props;
22
+ const styles = this.getStyles();
23
+ if (!message) {
24
+ return null;
25
+ }
26
+ return (React.createElement(react_native_1.Text, { nativeID: nativeID, style: [styles.errorMessage, style] }, message));
27
+ }
28
+ }
29
+ exports.ErrorMessage = ErrorMessage;
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ export interface FilePickerProperties {
3
+ label: string;
4
+ onPress: () => void;
5
+ icon: string;
6
+ }
7
+ export declare class FilePicker extends React.Component<FilePickerProperties> {
8
+ static defaultProps: {
9
+ icon: string;
10
+ };
11
+ getStyles: () => {
12
+ container: {
13
+ borderRadius: number;
14
+ backgroundColor: string;
15
+ height: number;
16
+ alignItems: "center";
17
+ justifyContent: "center";
18
+ };
19
+ text: {
20
+ fontFamily: string;
21
+ fontSize: number;
22
+ color: string;
23
+ width: number;
24
+ textAlign: "center";
25
+ };
26
+ };
27
+ render(): JSX.Element;
28
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
+ const theme_1 = require("../modules/theme");
7
+ const layout_1 = require("../modules/layout");
8
+ class FilePicker extends React.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.getStyles = () => {
12
+ const theme = theme_1.getTheme();
13
+ const styles = react_native_1.StyleSheet.create({
14
+ container: {
15
+ borderRadius: 3,
16
+ backgroundColor: theme.backgroundColor2,
17
+ height: 100,
18
+ alignItems: 'center',
19
+ justifyContent: 'center'
20
+ },
21
+ text: {
22
+ fontFamily: theme.fontFamily1,
23
+ fontSize: layout_1.isTablet() ? 15 : 12,
24
+ color: theme.textColor3,
25
+ width: 200,
26
+ textAlign: 'center'
27
+ }
28
+ });
29
+ return styles;
30
+ };
31
+ }
32
+ render() {
33
+ const { label, onPress, icon } = this.props;
34
+ const theme = theme_1.getTheme();
35
+ const styles = this.getStyles();
36
+ return (React.createElement(react_native_1.TouchableOpacity, { activeOpacity: 0.5, style: styles.container, onPress: onPress },
37
+ React.createElement(FontAwesome_1.default, { name: icon, color: theme.textColor3, size: 30 }),
38
+ React.createElement(react_native_1.Text, { style: styles.text }, label)));
39
+ }
40
+ }
41
+ FilePicker.defaultProps = {
42
+ icon: 'cloud-upload'
43
+ };
44
+ exports.FilePicker = FilePicker;
@@ -0,0 +1,56 @@
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
+ }
16
+ export declare class Header extends React.Component<HeaderProperties> {
17
+ static defaultProps: {
18
+ leftButtonType: string;
19
+ };
20
+ static height: number;
21
+ getStyles: () => {
22
+ header: {
23
+ backgroundColor: string;
24
+ height: number;
25
+ flexDirection: "row";
26
+ alignItems: "center";
27
+ justifyContent: "center";
28
+ };
29
+ title: {
30
+ color: string;
31
+ fontFamily: string;
32
+ fontSize: number;
33
+ marginHorizontal: number;
34
+ };
35
+ button: {
36
+ padding: number;
37
+ };
38
+ counterContainer: {
39
+ position: "absolute";
40
+ backgroundColor: string;
41
+ height: number;
42
+ width: number;
43
+ top: number;
44
+ left: number;
45
+ borderRadius: number;
46
+ };
47
+ counterText: {
48
+ textAlign: "center";
49
+ color: string;
50
+ fontSize: number;
51
+ };
52
+ };
53
+ renderButton: (button: HeaderButton, type: "left" | "right") => JSX.Element;
54
+ renderButtonInvisible: (type: "left" | "right") => JSX.Element;
55
+ render(): JSX.Element;
56
+ }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
+ const theme_1 = require("../modules/theme");
7
+ const layout_1 = require("../modules/layout");
8
+ class Header extends React.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.getStyles = () => {
12
+ const theme = theme_1.getTheme();
13
+ const styles = react_native_1.StyleSheet.create({
14
+ header: {
15
+ backgroundColor: theme.backgroundColor3,
16
+ height: layout_1.isTablet() ? 65 : 50,
17
+ flexDirection: 'row',
18
+ alignItems: 'center',
19
+ justifyContent: 'center'
20
+ },
21
+ title: {
22
+ color: theme.textColor4,
23
+ fontFamily: theme.fontFamily1,
24
+ fontSize: layout_1.isTablet() ? 25 : 18,
25
+ marginHorizontal: 35
26
+ },
27
+ button: {
28
+ padding: layout_1.isTablet() ? 14 : 10
29
+ },
30
+ counterContainer: {
31
+ position: 'absolute',
32
+ backgroundColor: theme.counterBackgroundColor,
33
+ height: layout_1.isTablet() ? 20 : 15,
34
+ width: layout_1.isTablet() ? 20 : 15,
35
+ top: 5,
36
+ left: 18,
37
+ borderRadius: 50
38
+ },
39
+ counterText: {
40
+ textAlign: 'center',
41
+ color: theme.counterTextColor,
42
+ fontSize: layout_1.isTablet() ? 15 : 10
43
+ }
44
+ });
45
+ return styles;
46
+ };
47
+ this.renderButton = (button, type) => {
48
+ const styles = this.getStyles();
49
+ const theme = theme_1.getTheme();
50
+ const icon = (React.createElement(React.Fragment, null,
51
+ React.createElement(FontAwesome_1.default, { nativeID: button.nativeID, name: button.icon, size: layout_1.isTablet() ? 30 : 20, color: button.disabled ? theme.textColor1 : theme.textColor4, style: button.buttonStyle }),
52
+ button.counter ? (React.createElement(react_native_1.View, { style: styles.counterContainer },
53
+ React.createElement(react_native_1.Text, { style: styles.counterText }, button.counter))) : null));
54
+ const style = [
55
+ styles.button,
56
+ type === 'left' ? { marginRight: 'auto' } : { marginLeft: 'auto' }
57
+ ];
58
+ if (button.disabled) {
59
+ return React.createElement(react_native_1.View, { style: style }, icon);
60
+ }
61
+ return (React.createElement(react_native_1.TouchableOpacity, { onPress: button.onPress, style: style }, icon));
62
+ };
63
+ this.renderButtonInvisible = (type) => {
64
+ const styles = this.getStyles();
65
+ const style = [
66
+ styles.button,
67
+ type === 'left' ? { marginRight: 'auto' } : { marginLeft: 'auto' }
68
+ ];
69
+ return React.createElement(react_native_1.View, { style: style });
70
+ };
71
+ }
72
+ render() {
73
+ const { title, leftButton, rightButton } = this.props;
74
+ const styles = this.getStyles();
75
+ return (React.createElement(react_native_1.View, { style: styles.header },
76
+ leftButton
77
+ ? this.renderButton(leftButton, 'left')
78
+ : this.renderButtonInvisible('left'),
79
+ React.createElement(react_native_1.Text, { style: styles.title }, title),
80
+ rightButton
81
+ ? this.renderButton(rightButton, 'right')
82
+ : this.renderButtonInvisible('right')));
83
+ }
84
+ }
85
+ Header.defaultProps = {
86
+ leftButtonType: 'menu'
87
+ };
88
+ Header.height = layout_1.isTablet() ? 65 : 50;
89
+ exports.Header = Header;
@@ -0,0 +1,59 @@
1
+ import * as React from 'react';
2
+ import { HeaderButton } from '../components/Header';
3
+ import { StyleProp, TextStyle } from 'react-native';
4
+ export interface GreetingMessage {
5
+ message: string;
6
+ style?: StyleProp<TextStyle>;
7
+ }
8
+ export interface HeaderDesktopProperties {
9
+ logo: () => React.ReactNode;
10
+ title?: string;
11
+ greeting?: GreetingMessage;
12
+ rightButton?: HeaderButton;
13
+ headerStyle?: StyleProp<TextStyle>;
14
+ }
15
+ export declare class HeaderDesktop extends React.Component<HeaderDesktopProperties> {
16
+ static height: number;
17
+ getStyles: () => {
18
+ container: {
19
+ backgroundColor: string;
20
+ height: number;
21
+ flexDirection: "row";
22
+ alignItems: "center";
23
+ shadowOpacity: number;
24
+ shadowRadius: number;
25
+ shadowColor: string;
26
+ };
27
+ title: {
28
+ color: string;
29
+ fontSize: number;
30
+ fontFamily: string;
31
+ };
32
+ greeting: {
33
+ color: string;
34
+ fontSize: number;
35
+ fontFamily: string;
36
+ marginLeft: string;
37
+ marginRight: number;
38
+ };
39
+ button: {
40
+ padding: number;
41
+ };
42
+ counterContainer: {
43
+ position: "absolute";
44
+ backgroundColor: string;
45
+ height: number;
46
+ width: number;
47
+ top: number;
48
+ left: number;
49
+ borderRadius: number;
50
+ };
51
+ counterText: {
52
+ textAlign: "center";
53
+ color: string;
54
+ fontSize: number;
55
+ };
56
+ };
57
+ renderRightButton: (button: HeaderButton) => JSX.Element;
58
+ render(): JSX.Element;
59
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const theme_1 = require("../modules/theme");
5
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
+ const react_native_1 = require("react-native");
7
+ const layout_1 = require("../modules/layout");
8
+ class HeaderDesktop extends React.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.getStyles = () => {
12
+ const theme = theme_1.getTheme();
13
+ const styles = react_native_1.StyleSheet.create({
14
+ container: {
15
+ backgroundColor: theme.backgroundColor3,
16
+ height: HeaderDesktop.height,
17
+ flexDirection: 'row',
18
+ alignItems: 'center',
19
+ shadowOpacity: 0.6,
20
+ shadowRadius: 20,
21
+ shadowColor: theme.shadowColor1
22
+ },
23
+ title: {
24
+ color: theme.textColor4,
25
+ fontSize: 24,
26
+ fontFamily: theme.fontFamily3
27
+ },
28
+ greeting: {
29
+ color: theme.textColor4,
30
+ fontSize: 18,
31
+ fontFamily: theme.fontFamily2,
32
+ marginLeft: 'auto',
33
+ marginRight: 20
34
+ },
35
+ button: {
36
+ padding: layout_1.isTablet() ? 14 : 10
37
+ },
38
+ counterContainer: {
39
+ position: 'absolute',
40
+ backgroundColor: theme.counterBackgroundColor,
41
+ height: layout_1.isTablet() ? 20 : 15,
42
+ width: layout_1.isTablet() ? 20 : 15,
43
+ top: 5,
44
+ left: 18,
45
+ borderRadius: 50
46
+ },
47
+ counterText: {
48
+ textAlign: 'center',
49
+ color: theme.counterTextColor,
50
+ fontSize: layout_1.isTablet() ? 15 : 10
51
+ }
52
+ });
53
+ return styles;
54
+ };
55
+ this.renderRightButton = (button) => {
56
+ const styles = this.getStyles();
57
+ const theme = theme_1.getTheme();
58
+ const icon = (React.createElement(React.Fragment, null,
59
+ React.createElement(FontAwesome_1.default, { nativeID: button.nativeID, name: button.icon, size: layout_1.isTablet() ? 30 : 20, color: button.disabled ? theme.textColor1 : theme.textColor4, style: button.buttonStyle }),
60
+ button.counter ? (React.createElement(react_native_1.View, { style: styles.counterContainer },
61
+ React.createElement(react_native_1.Text, { nativeID: `${button.nativeID}-counter`, style: styles.counterText }, button.counter))) : null));
62
+ const style = [styles.button];
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
+ }
69
+ render() {
70
+ const { logo, title, greeting, rightButton, headerStyle } = this.props;
71
+ const styles = this.getStyles();
72
+ return (React.createElement(react_native_1.View, { style: [styles.container, headerStyle] },
73
+ logo(),
74
+ title && React.createElement(react_native_1.Text, { style: styles.title }, title),
75
+ greeting && (React.createElement(react_native_1.Text, { nativeID: "app-greeting-message", style: [styles.greeting, greeting.style] }, greeting.message)),
76
+ rightButton && this.renderRightButton(rightButton)));
77
+ }
78
+ }
79
+ HeaderDesktop.height = 60;
80
+ exports.HeaderDesktop = HeaderDesktop;