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,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatePicker = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_modal_datetime_picker_1 = require("react-native-modal-datetime-picker");
|
|
6
|
+
const format_1 = require("../modules/format");
|
|
7
|
+
const layout_1 = require("../modules/layout");
|
|
8
|
+
const theme_1 = require("../modules/theme");
|
|
9
|
+
const ImageButton_1 = require("./ImageButton");
|
|
10
|
+
const test_1 = require("../modules/test");
|
|
11
|
+
const react_native_1 = require("react-native");
|
|
12
|
+
class DatePicker extends React.Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.state = {
|
|
16
|
+
showModal: false,
|
|
17
|
+
isDarkModeEnabled: react_native_1.Appearance.getColorScheme() === 'dark'
|
|
18
|
+
};
|
|
19
|
+
this.handlePress = () => {
|
|
20
|
+
this.setState({ showModal: true });
|
|
21
|
+
};
|
|
22
|
+
this.handleConfirm = (value) => {
|
|
23
|
+
this.setState({ showModal: false }, () => {
|
|
24
|
+
this.props.onChange(value);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
this.handleCancel = () => {
|
|
28
|
+
this.setState({ showModal: false }, () => {
|
|
29
|
+
if (this.props.onCancel) {
|
|
30
|
+
this.props.onCancel();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
this.handleClear = () => {
|
|
35
|
+
this.props.onChange(undefined);
|
|
36
|
+
};
|
|
37
|
+
this.getStyles = () => {
|
|
38
|
+
const theme = (0, theme_1.getTheme)();
|
|
39
|
+
const styles = react_native_1.StyleSheet.create({
|
|
40
|
+
container: {
|
|
41
|
+
paddingLeft: 16,
|
|
42
|
+
paddingRight: 4,
|
|
43
|
+
paddingVertical: 8,
|
|
44
|
+
borderWidth: 1,
|
|
45
|
+
borderColor: theme.borderColor1,
|
|
46
|
+
borderRadius: 3,
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
alignItems: 'center'
|
|
49
|
+
},
|
|
50
|
+
label: {
|
|
51
|
+
color: theme.textColor2,
|
|
52
|
+
fontFamily: theme.fontFamily3,
|
|
53
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
54
|
+
lineHeight: 16
|
|
55
|
+
},
|
|
56
|
+
value: {
|
|
57
|
+
color: theme.textColor1,
|
|
58
|
+
fontFamily: theme.fontFamily1,
|
|
59
|
+
fontSize: 16,
|
|
60
|
+
lineHeight: 22,
|
|
61
|
+
minHeight: 22
|
|
62
|
+
},
|
|
63
|
+
calendarIcon: {
|
|
64
|
+
marginLeft: 'auto',
|
|
65
|
+
color: theme.textColor2,
|
|
66
|
+
fontSize: 22
|
|
67
|
+
},
|
|
68
|
+
clearIcon: {
|
|
69
|
+
borderWidth: 0,
|
|
70
|
+
marginLeft: 'auto'
|
|
71
|
+
},
|
|
72
|
+
readonly: {
|
|
73
|
+
backgroundColor: theme.disabledColor
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return styles;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
componentDidMount() {
|
|
80
|
+
this.appearanceSubscription = react_native_1.Appearance.addChangeListener(({ colorScheme }) => {
|
|
81
|
+
this.setState({ isDarkModeEnabled: colorScheme === 'dark' });
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
componentWillUnmount() {
|
|
85
|
+
this.appearanceSubscription.remove();
|
|
86
|
+
}
|
|
87
|
+
render() {
|
|
88
|
+
const { label, value, clearable, style, nativeID, disabled } = this.props;
|
|
89
|
+
const { showModal, isDarkModeEnabled } = this.state;
|
|
90
|
+
const styles = this.getStyles();
|
|
91
|
+
const theme = (0, theme_1.getTheme)();
|
|
92
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: this.handlePress },
|
|
93
|
+
React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.container, style, disabled ? styles.readonly : null] },
|
|
94
|
+
React.createElement(react_native_1.View, null,
|
|
95
|
+
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
96
|
+
React.createElement(react_native_1.Text, { style: styles.value }, value ? (0, format_1.formatDate)(value, 'cccc, dd/MM/yyyy') : '')),
|
|
97
|
+
!disabled && (React.createElement(ImageButton_1.ImageButton, { icon: value && clearable ? 'times' : 'calendar', style: styles.clearIcon, iconColor: value && clearable ? theme.textColor1 : theme.textColor2, onPress: value && clearable ? this.handleClear : this.handlePress, hitBoxSize: 30 })),
|
|
98
|
+
react_native_1.Platform.OS !== 'web' && (React.createElement(react_native_modal_datetime_picker_1.default, { date: value || undefined, isVisible: showModal, onConfirm: this.handleConfirm, onCancel: this.handleCancel, isDarkModeEnabled: isDarkModeEnabled,
|
|
99
|
+
//@ts-ignore
|
|
100
|
+
display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' })))));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.DatePicker = DatePicker;
|
|
104
|
+
DatePicker.defaultProps = {
|
|
105
|
+
clearable: true
|
|
106
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import 'react-date-range/dist/styles.css';
|
|
4
|
+
import '../../styles/RangeDatePicker.css';
|
|
5
|
+
export interface DatePickerProperties {
|
|
6
|
+
label: string;
|
|
7
|
+
value?: Date;
|
|
8
|
+
clearable?: boolean;
|
|
9
|
+
onChange: (value?: Date) => void;
|
|
10
|
+
style?: StyleProp<ViewStyle>;
|
|
11
|
+
dateFormat: string;
|
|
12
|
+
nativeID?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DatePickerState {
|
|
15
|
+
showModal: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class DatePicker extends React.Component<DatePickerProperties, DatePickerState> {
|
|
18
|
+
static defaultProps: {
|
|
19
|
+
clearable: boolean;
|
|
20
|
+
dateFormat: string;
|
|
21
|
+
};
|
|
22
|
+
state: DatePickerState;
|
|
23
|
+
private calendarRef;
|
|
24
|
+
componentWillMount(): void;
|
|
25
|
+
componentWillUnmount(): void;
|
|
26
|
+
handleClick: (event: MouseEvent) => void;
|
|
27
|
+
handlePress: () => void;
|
|
28
|
+
handleClear: () => void;
|
|
29
|
+
handleConfirm: (value: any) => void;
|
|
30
|
+
getStyles: () => {
|
|
31
|
+
container: {
|
|
32
|
+
paddingLeft: number;
|
|
33
|
+
paddingRight: number;
|
|
34
|
+
paddingVertical: number;
|
|
35
|
+
borderWidth: number;
|
|
36
|
+
borderColor: string;
|
|
37
|
+
borderRadius: number;
|
|
38
|
+
flexDirection: "row";
|
|
39
|
+
alignItems: "center";
|
|
40
|
+
};
|
|
41
|
+
modalOverlay: {
|
|
42
|
+
justifyContent: "center";
|
|
43
|
+
alignItems: "center";
|
|
44
|
+
};
|
|
45
|
+
label: {
|
|
46
|
+
color: string;
|
|
47
|
+
fontFamily: string;
|
|
48
|
+
fontSize: number;
|
|
49
|
+
lineHeight: number;
|
|
50
|
+
};
|
|
51
|
+
value: {
|
|
52
|
+
color: string;
|
|
53
|
+
fontFamily: string;
|
|
54
|
+
fontSize: number;
|
|
55
|
+
lineHeight: number;
|
|
56
|
+
minHeight: number;
|
|
57
|
+
};
|
|
58
|
+
clearIcon: {
|
|
59
|
+
borderWidth: number;
|
|
60
|
+
marginLeft: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
render(): JSX.Element;
|
|
64
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatePicker = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const theme_1 = require("../modules/theme");
|
|
6
|
+
const layout_1 = require("../modules/layout");
|
|
7
|
+
const format_1 = require("../modules/format");
|
|
8
|
+
const ImageButton_1 = require("./ImageButton");
|
|
9
|
+
const Modal_1 = require("./Modal");
|
|
10
|
+
const react_date_range_1 = require("react-date-range");
|
|
11
|
+
const react_native_1 = require("react-native");
|
|
12
|
+
require("react-date-range/dist/styles.css");
|
|
13
|
+
require("../../styles/RangeDatePicker.css");
|
|
14
|
+
class DatePicker extends React.Component {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.state = {
|
|
18
|
+
showModal: false
|
|
19
|
+
};
|
|
20
|
+
this.calendarRef = React.createRef();
|
|
21
|
+
this.handleClick = (event) => {
|
|
22
|
+
if (this.calendarRef.current &&
|
|
23
|
+
!this.calendarRef.current.contains(event.target)) {
|
|
24
|
+
this.setState({ showModal: false });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.handlePress = () => {
|
|
28
|
+
this.setState({ showModal: true });
|
|
29
|
+
};
|
|
30
|
+
this.handleClear = () => {
|
|
31
|
+
this.props.onChange(undefined);
|
|
32
|
+
};
|
|
33
|
+
this.handleConfirm = (value) => {
|
|
34
|
+
this.props.onChange(value);
|
|
35
|
+
this.setState({ showModal: false });
|
|
36
|
+
};
|
|
37
|
+
this.getStyles = () => {
|
|
38
|
+
const theme = (0, theme_1.getTheme)();
|
|
39
|
+
const styles = react_native_1.StyleSheet.create({
|
|
40
|
+
container: {
|
|
41
|
+
paddingLeft: 16,
|
|
42
|
+
paddingRight: 4,
|
|
43
|
+
paddingVertical: 8,
|
|
44
|
+
borderWidth: 1,
|
|
45
|
+
borderColor: theme.borderColor1,
|
|
46
|
+
borderRadius: 3,
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
alignItems: 'center'
|
|
49
|
+
},
|
|
50
|
+
modalOverlay: {
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
alignItems: 'center'
|
|
53
|
+
},
|
|
54
|
+
label: {
|
|
55
|
+
color: theme.textColor2,
|
|
56
|
+
fontFamily: theme.fontFamily3,
|
|
57
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
58
|
+
lineHeight: 16
|
|
59
|
+
},
|
|
60
|
+
value: {
|
|
61
|
+
color: theme.textColor1,
|
|
62
|
+
fontFamily: theme.fontFamily1,
|
|
63
|
+
fontSize: 16,
|
|
64
|
+
lineHeight: 22,
|
|
65
|
+
minHeight: 22
|
|
66
|
+
},
|
|
67
|
+
clearIcon: {
|
|
68
|
+
borderWidth: 0,
|
|
69
|
+
marginLeft: 'auto'
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return styles;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
componentWillMount() {
|
|
76
|
+
document.addEventListener('mousedown', this.handleClick, false);
|
|
77
|
+
}
|
|
78
|
+
componentWillUnmount() {
|
|
79
|
+
document.removeEventListener('mousedown', this.handleClick, false);
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
const { label, value, clearable, style, dateFormat, nativeID } = this.props;
|
|
83
|
+
const styles = this.getStyles();
|
|
84
|
+
const theme = (0, theme_1.getTheme)();
|
|
85
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handlePress },
|
|
86
|
+
React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style] },
|
|
87
|
+
React.createElement(react_native_1.View, null,
|
|
88
|
+
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
89
|
+
React.createElement(react_native_1.Text, { style: styles.value }, value != undefined ? (0, format_1.formatDate)(value, dateFormat) : '')),
|
|
90
|
+
React.createElement(ImageButton_1.ImageButton, { icon: value && clearable ? 'times' : 'calendar', style: styles.clearIcon, iconColor: value && clearable ? theme.textColor1 : theme.textColor2, onPress: value && clearable ? this.handleClear : this.handlePress, hitBoxSize: 30 }),
|
|
91
|
+
React.createElement(Modal_1.Modal, { visible: this.state.showModal, overlayStyle: styles.modalOverlay },
|
|
92
|
+
React.createElement("div", { ref: this.calendarRef, style: {
|
|
93
|
+
borderRadius: '5px',
|
|
94
|
+
position: 'absolute',
|
|
95
|
+
top: '50%',
|
|
96
|
+
marginTop: '-150px',
|
|
97
|
+
fontFamily: theme.fontFamily1
|
|
98
|
+
} },
|
|
99
|
+
React.createElement(react_date_range_1.Calendar, { locale: (0, format_1.getDateFnsLocale)(), date: value, onChange: this.handleConfirm, weekdayDisplayFormat: (0, format_1.getLocale)() === 'pt' ? 'EEEEEE' : 'E' }))))));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.DatePicker = DatePicker;
|
|
103
|
+
DatePicker.defaultProps = {
|
|
104
|
+
clearable: true,
|
|
105
|
+
dateFormat: 'cccc, dd/MM/yyyy'
|
|
106
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface DelayProperties {
|
|
3
|
+
wait: number;
|
|
4
|
+
}
|
|
5
|
+
export interface DelayState {
|
|
6
|
+
hidden: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class Delay extends React.Component<DelayProperties, DelayState> {
|
|
9
|
+
state: DelayState;
|
|
10
|
+
componentDidMount(): void;
|
|
11
|
+
render(): React.ReactNode;
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Delay = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
class Delay extends React.Component {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.state = {
|
|
9
|
+
hidden: true
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
componentDidMount() {
|
|
13
|
+
const { wait } = this.props;
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
this.setState({ hidden: false });
|
|
16
|
+
}, wait);
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return this.state.hidden ? null : this.props.children;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Delay = Delay;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
export interface DetailsIcon {
|
|
4
|
+
name: string;
|
|
5
|
+
color: string;
|
|
6
|
+
size: number;
|
|
7
|
+
onPress?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface DetailsLine {
|
|
10
|
+
title?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
icons?: Array<DetailsIcon>;
|
|
13
|
+
render?: () => React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface DetailsProperties {
|
|
16
|
+
title: string;
|
|
17
|
+
titleNativeId?: string;
|
|
18
|
+
lines: Array<DetailsLine>;
|
|
19
|
+
lineTitleStyle?: StyleProp<TextStyle>;
|
|
20
|
+
lineValueStyle?: StyleProp<TextStyle>;
|
|
21
|
+
}
|
|
22
|
+
export declare class Details extends React.Component<DetailsProperties> {
|
|
23
|
+
getStyles: () => {
|
|
24
|
+
title: {
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
fontSize: number;
|
|
27
|
+
color: string;
|
|
28
|
+
};
|
|
29
|
+
lineSection: {
|
|
30
|
+
paddingVertical: number;
|
|
31
|
+
flexDirection: "row";
|
|
32
|
+
justifyContent: "space-between";
|
|
33
|
+
alignItems: "center";
|
|
34
|
+
minHeight: number;
|
|
35
|
+
};
|
|
36
|
+
lineSectionCustomRender: {
|
|
37
|
+
padding: number;
|
|
38
|
+
};
|
|
39
|
+
lineText: {
|
|
40
|
+
fontFamily: string;
|
|
41
|
+
fontSize: number;
|
|
42
|
+
color: string;
|
|
43
|
+
minWidth: number;
|
|
44
|
+
};
|
|
45
|
+
lineValue: {
|
|
46
|
+
textAlign: "center";
|
|
47
|
+
};
|
|
48
|
+
lineTitle: {
|
|
49
|
+
textAlign: "left";
|
|
50
|
+
flexShrink: number;
|
|
51
|
+
};
|
|
52
|
+
lineValueContainer: {
|
|
53
|
+
flexDirection: "row";
|
|
54
|
+
flexGrow: number;
|
|
55
|
+
flexShrink: number;
|
|
56
|
+
alignItems: "center";
|
|
57
|
+
justifyContent: "flex-end";
|
|
58
|
+
};
|
|
59
|
+
lineValueIcon: {
|
|
60
|
+
width: number;
|
|
61
|
+
textAlign: "center";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
renderIcon: (icon: DetailsIcon, index: number) => JSX.Element;
|
|
65
|
+
renderLine: (line: DetailsLine, index: number) => JSX.Element;
|
|
66
|
+
render(): JSX.Element;
|
|
67
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Details = 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 Card_1 = require("./Card");
|
|
8
|
+
const Space_1 = require("./Space");
|
|
9
|
+
const theme_1 = require("../modules/theme");
|
|
10
|
+
const test_1 = require("../modules/test");
|
|
11
|
+
const layout_1 = require("../modules/layout");
|
|
12
|
+
class Details extends React.Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.getStyles = () => {
|
|
16
|
+
const theme = (0, theme_1.getTheme)();
|
|
17
|
+
const styles = react_native_1.StyleSheet.create({
|
|
18
|
+
title: {
|
|
19
|
+
fontFamily: theme.fontFamily1,
|
|
20
|
+
fontSize: (0, layout_1.isTablet)() ? 22 : 18,
|
|
21
|
+
color: theme.textColor1
|
|
22
|
+
},
|
|
23
|
+
lineSection: {
|
|
24
|
+
paddingVertical: 10,
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
justifyContent: 'space-between',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
minHeight: 45
|
|
29
|
+
},
|
|
30
|
+
lineSectionCustomRender: {
|
|
31
|
+
padding: 0
|
|
32
|
+
},
|
|
33
|
+
lineText: {
|
|
34
|
+
fontFamily: theme.fontFamily2,
|
|
35
|
+
fontSize: (0, layout_1.isTablet)() ? 18 : 14,
|
|
36
|
+
color: theme.textColor1,
|
|
37
|
+
minWidth: 40
|
|
38
|
+
},
|
|
39
|
+
lineValue: {
|
|
40
|
+
textAlign: 'center'
|
|
41
|
+
},
|
|
42
|
+
lineTitle: {
|
|
43
|
+
textAlign: 'left',
|
|
44
|
+
flexShrink: 0
|
|
45
|
+
},
|
|
46
|
+
lineValueContainer: {
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
flexShrink: 1,
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'flex-end'
|
|
52
|
+
},
|
|
53
|
+
lineValueIcon: {
|
|
54
|
+
width: 25,
|
|
55
|
+
textAlign: 'center'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return styles;
|
|
59
|
+
};
|
|
60
|
+
this.renderIcon = (icon, index) => {
|
|
61
|
+
const styles = this.getStyles();
|
|
62
|
+
const fa = (React.createElement(FontAwesome_1.default, { key: index, testID: (0, test_1.getTestID)(icon.name), name: icon.name, color: icon.color, size: icon.size, style: styles.lineValueIcon }));
|
|
63
|
+
if (icon.onPress) {
|
|
64
|
+
return (React.createElement(react_native_1.TouchableOpacity, { key: index, onPress: icon.onPress }, fa));
|
|
65
|
+
}
|
|
66
|
+
return fa;
|
|
67
|
+
};
|
|
68
|
+
this.renderLine = (line, index) => {
|
|
69
|
+
const styles = this.getStyles();
|
|
70
|
+
const { lineTitleStyle, lineValueStyle } = this.props;
|
|
71
|
+
const { title, value, icons, render } = line;
|
|
72
|
+
const sectionStyle = render
|
|
73
|
+
? styles.lineSectionCustomRender
|
|
74
|
+
: styles.lineSection;
|
|
75
|
+
const children = render ? (render()) : (React.createElement(React.Fragment, null,
|
|
76
|
+
React.createElement(react_native_1.Text, { style: [styles.lineText, styles.lineTitle, lineTitleStyle] }, title),
|
|
77
|
+
React.createElement(react_native_1.View, { style: styles.lineValueContainer },
|
|
78
|
+
icons && icons.map(this.renderIcon),
|
|
79
|
+
React.createElement(react_native_1.Text, { style: [styles.lineText, styles.lineValue, lineValueStyle] }, value))));
|
|
80
|
+
return (React.createElement(React.Fragment, { key: index },
|
|
81
|
+
React.createElement(Space_1.Space, { height: 3 }),
|
|
82
|
+
React.createElement(Card_1.Card, null,
|
|
83
|
+
React.createElement(Card_1.Card.Section, { style: sectionStyle }, children))));
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
|
+
const { title, lines, titleNativeId } = this.props;
|
|
88
|
+
const styles = this.getStyles();
|
|
89
|
+
return (React.createElement(React.Fragment, null,
|
|
90
|
+
React.createElement(Card_1.Card, null,
|
|
91
|
+
React.createElement(Card_1.Card.Section, null,
|
|
92
|
+
React.createElement(react_native_1.Text, { nativeID: titleNativeId, testID: (0, test_1.getTestID)(titleNativeId), style: styles.title }, title))),
|
|
93
|
+
lines.map(this.renderLine)));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.Details = Details;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
export interface DetailsHeaderProperties {
|
|
4
|
+
text: string;
|
|
5
|
+
textStyle?: StyleProp<TextStyle>;
|
|
6
|
+
onLeftPress?: () => void;
|
|
7
|
+
onRightPress?: () => void;
|
|
8
|
+
leftNativeID?: string;
|
|
9
|
+
rightNativeID?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class DetailsHeader extends React.Component<DetailsHeaderProperties> {
|
|
12
|
+
getStyles: () => {
|
|
13
|
+
container: {
|
|
14
|
+
flexDirection: "row";
|
|
15
|
+
alignItems: "center";
|
|
16
|
+
justifyContent: "space-between";
|
|
17
|
+
};
|
|
18
|
+
text: {
|
|
19
|
+
fontFamily: string;
|
|
20
|
+
fontSize: number;
|
|
21
|
+
color: string;
|
|
22
|
+
width: string;
|
|
23
|
+
textAlign: "center";
|
|
24
|
+
};
|
|
25
|
+
button: {
|
|
26
|
+
height: number;
|
|
27
|
+
width: number;
|
|
28
|
+
alignItems: "center";
|
|
29
|
+
justifyContent: "center";
|
|
30
|
+
borderColor: string;
|
|
31
|
+
borderWidth: number;
|
|
32
|
+
borderRadius: number;
|
|
33
|
+
};
|
|
34
|
+
buttonPlaceholder: {
|
|
35
|
+
height: number;
|
|
36
|
+
width: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
renderButton: (type: 'left' | 'right', onPress: (() => void) | undefined, nativeID?: string) => JSX.Element;
|
|
40
|
+
render(): JSX.Element;
|
|
41
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DetailsHeader = 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 Card_1 = require("./Card");
|
|
8
|
+
const theme_1 = require("../modules/theme");
|
|
9
|
+
const layout_1 = require("../modules/layout");
|
|
10
|
+
const test_1 = require("../modules/test");
|
|
11
|
+
class DetailsHeader extends React.Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.getStyles = () => {
|
|
15
|
+
const theme = (0, theme_1.getTheme)();
|
|
16
|
+
const styles = react_native_1.StyleSheet.create({
|
|
17
|
+
container: {
|
|
18
|
+
flexDirection: 'row',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'space-between'
|
|
21
|
+
},
|
|
22
|
+
text: {
|
|
23
|
+
fontFamily: theme.fontFamily1,
|
|
24
|
+
fontSize: (0, layout_1.isTablet)() ? 22 : 18,
|
|
25
|
+
color: theme.textColor1,
|
|
26
|
+
width: '80%',
|
|
27
|
+
textAlign: 'center'
|
|
28
|
+
},
|
|
29
|
+
button: {
|
|
30
|
+
height: (0, layout_1.isTablet)() ? 28 : 24,
|
|
31
|
+
width: (0, layout_1.isTablet)() ? 28 : 24,
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
borderColor: theme.borderColor1,
|
|
35
|
+
borderWidth: 1,
|
|
36
|
+
borderRadius: 24
|
|
37
|
+
},
|
|
38
|
+
buttonPlaceholder: {
|
|
39
|
+
height: (0, layout_1.isTablet)() ? 28 : 24,
|
|
40
|
+
width: (0, layout_1.isTablet)() ? 28 : 24
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return styles;
|
|
44
|
+
};
|
|
45
|
+
this.renderButton = (type, onPress, nativeID) => {
|
|
46
|
+
const styles = this.getStyles();
|
|
47
|
+
const theme = (0, theme_1.getTheme)();
|
|
48
|
+
if (onPress) {
|
|
49
|
+
return (React.createElement(react_native_1.TouchableOpacity, { testID: (0, test_1.getTestID)(nativeID), style: styles.button, onPress: onPress },
|
|
50
|
+
React.createElement(FontAwesome_1.default, { nativeID: nativeID, name: type === 'left' ? 'angle-left' : 'angle-right', color: theme.textColor3, size: 14 })));
|
|
51
|
+
}
|
|
52
|
+
return React.createElement(react_native_1.View, { style: styles.buttonPlaceholder });
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
const { text, textStyle, onLeftPress, onRightPress, leftNativeID, rightNativeID } = this.props;
|
|
57
|
+
const styles = this.getStyles();
|
|
58
|
+
return (React.createElement(Card_1.Card, null,
|
|
59
|
+
React.createElement(Card_1.Card.Section, { style: styles.container },
|
|
60
|
+
this.renderButton('left', onLeftPress, leftNativeID),
|
|
61
|
+
React.createElement(react_native_1.Text, { style: [styles.text, textStyle] }, text),
|
|
62
|
+
this.renderButton('right', onRightPress, rightNativeID))));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.DetailsHeader = DetailsHeader;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ScaledSize } from 'react-native';
|
|
3
|
+
export interface DimensionsMonitorProperties {
|
|
4
|
+
children?: (dimensionsInfo: {
|
|
5
|
+
isDesktop: boolean;
|
|
6
|
+
}) => React.ReactNode;
|
|
7
|
+
onDimensionChange?: (isDesktop: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface DimensionsMonitorState {
|
|
10
|
+
isDesktop: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class DimensionsMonitor extends React.Component<DimensionsMonitorProperties, DimensionsMonitorState> {
|
|
13
|
+
constructor(props: DimensionsMonitorProperties);
|
|
14
|
+
componentDidMount(): void;
|
|
15
|
+
componentWillUnmount(): void;
|
|
16
|
+
handleDimensionsChange: ({ window }: {
|
|
17
|
+
window: ScaledSize;
|
|
18
|
+
}) => void;
|
|
19
|
+
isDesktop: (size: ScaledSize) => boolean;
|
|
20
|
+
render(): React.ReactNode;
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DimensionsMonitor = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
class DimensionsMonitor extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.handleDimensionsChange = ({ window }) => {
|
|
10
|
+
const isDesktop = this.isDesktop(window);
|
|
11
|
+
this.setState({ isDesktop });
|
|
12
|
+
if (this.props.onDimensionChange && isDesktop !== this.state.isDesktop) {
|
|
13
|
+
this.props.onDimensionChange(isDesktop);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
this.isDesktop = (size) => {
|
|
17
|
+
const largura = react_native_1.Platform.OS === 'web' ? window.innerWidth : size.width;
|
|
18
|
+
return largura >= 1024;
|
|
19
|
+
};
|
|
20
|
+
this.state = {
|
|
21
|
+
isDesktop: this.isDesktop(react_native_1.Dimensions.get('window'))
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
componentDidMount() {
|
|
25
|
+
react_native_1.Dimensions.addEventListener('change', this.handleDimensionsChange);
|
|
26
|
+
}
|
|
27
|
+
componentWillUnmount() {
|
|
28
|
+
react_native_1.Dimensions.removeEventListener('change', this.handleDimensionsChange);
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
if (!this.props.children) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return this.props.children({ isDesktop: this.state.isDesktop });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.DimensionsMonitor = DimensionsMonitor;
|