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,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface RadioGroupProperties {
|
|
3
|
+
items: Array<{
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}>;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
disabled?: Array<string>;
|
|
10
|
+
nativeID?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class RadioGroup extends React.Component<RadioGroupProperties> {
|
|
13
|
+
getStyles: () => {
|
|
14
|
+
container: {
|
|
15
|
+
borderColor: string;
|
|
16
|
+
borderWidth: number;
|
|
17
|
+
borderRadius: number;
|
|
18
|
+
backgroundColor: string;
|
|
19
|
+
flexDirection: "row";
|
|
20
|
+
justifyContent: "space-around";
|
|
21
|
+
};
|
|
22
|
+
item: {
|
|
23
|
+
paddingVertical: number;
|
|
24
|
+
borderColor: string;
|
|
25
|
+
flex: number;
|
|
26
|
+
alignItems: "center";
|
|
27
|
+
};
|
|
28
|
+
itemText: {
|
|
29
|
+
fontFamily: string;
|
|
30
|
+
fontSize: number;
|
|
31
|
+
lineHeight: number;
|
|
32
|
+
color: string;
|
|
33
|
+
};
|
|
34
|
+
selectedItem: {
|
|
35
|
+
backgroundColor: string;
|
|
36
|
+
};
|
|
37
|
+
selectedItemText: {
|
|
38
|
+
color: string;
|
|
39
|
+
};
|
|
40
|
+
readonly: {
|
|
41
|
+
backgroundColor: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
render(): JSX.Element;
|
|
45
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RadioGroup = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const theme_1 = require("../modules/theme");
|
|
7
|
+
const layout_1 = require("../modules/layout");
|
|
8
|
+
const test_1 = require("../modules/test");
|
|
9
|
+
class RadioGroup extends React.Component {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.getStyles = () => {
|
|
13
|
+
const theme = (0, theme_1.getTheme)();
|
|
14
|
+
const styles = react_native_1.StyleSheet.create({
|
|
15
|
+
container: {
|
|
16
|
+
borderColor: theme.borderColor1,
|
|
17
|
+
borderWidth: 1,
|
|
18
|
+
borderRadius: 3,
|
|
19
|
+
backgroundColor: theme.backgroundColor2,
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
justifyContent: 'space-around'
|
|
22
|
+
},
|
|
23
|
+
item: {
|
|
24
|
+
paddingVertical: (0, layout_1.isTablet)() ? 10 : 5,
|
|
25
|
+
borderColor: theme.borderColor1,
|
|
26
|
+
flex: 1,
|
|
27
|
+
alignItems: 'center'
|
|
28
|
+
},
|
|
29
|
+
itemText: {
|
|
30
|
+
fontFamily: theme.fontFamily1,
|
|
31
|
+
fontSize: (0, layout_1.isTablet)() ? 16 : 12,
|
|
32
|
+
lineHeight: (0, layout_1.isTablet)() ? 20 : 16,
|
|
33
|
+
color: theme.textColor3
|
|
34
|
+
},
|
|
35
|
+
selectedItem: {
|
|
36
|
+
backgroundColor: theme.backgroundColor3
|
|
37
|
+
},
|
|
38
|
+
selectedItemText: {
|
|
39
|
+
color: theme.textColor4
|
|
40
|
+
},
|
|
41
|
+
readonly: {
|
|
42
|
+
backgroundColor: theme.disabledColor
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return styles;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const { items, value, onChange, disabled, nativeID } = this.props;
|
|
50
|
+
const styles = this.getStyles();
|
|
51
|
+
return (React.createElement(react_native_1.View, { style: styles.container }, items.map((item, index) => {
|
|
52
|
+
const itemNativeID = nativeID
|
|
53
|
+
? nativeID + '-' + item.value
|
|
54
|
+
: undefined;
|
|
55
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { key: index, disabled: disabled && disabled.includes(item.value), onPress: () => onChange(item.value) },
|
|
56
|
+
React.createElement(react_native_1.View, { style: [
|
|
57
|
+
styles.item,
|
|
58
|
+
{ borderRightWidth: index === items.length - 1 ? 0 : 1 },
|
|
59
|
+
item.value === value ? styles.selectedItem : null,
|
|
60
|
+
disabled && disabled.includes(item.value)
|
|
61
|
+
? styles.readonly
|
|
62
|
+
: null
|
|
63
|
+
], testID: (0, test_1.getTestID)(itemNativeID), nativeID: itemNativeID },
|
|
64
|
+
React.createElement(react_native_1.Text, { style: [
|
|
65
|
+
styles.itemText,
|
|
66
|
+
item.value === value ? styles.selectedItemText : null
|
|
67
|
+
] }, item.label))));
|
|
68
|
+
})));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.RadioGroup = RadioGroup;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface RangeDatePickerProperties {
|
|
4
|
+
label: string;
|
|
5
|
+
startDate: Date;
|
|
6
|
+
endDate: Date;
|
|
7
|
+
onStartDateChange: (date: Date) => void;
|
|
8
|
+
onEndDateChange: (date: Date) => void;
|
|
9
|
+
onEndDateCancel?: () => void;
|
|
10
|
+
style?: StyleProp<ViewStyle>;
|
|
11
|
+
nativeID?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RangeDatePickerState {
|
|
14
|
+
showStartDateModal: boolean;
|
|
15
|
+
showEndDateModal: boolean;
|
|
16
|
+
isDarkModeEnabled: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class RangeDatePicker extends React.Component<RangeDatePickerProperties, RangeDatePickerState> {
|
|
19
|
+
state: RangeDatePickerState;
|
|
20
|
+
appearanceSubscription: any;
|
|
21
|
+
componentDidMount(): void;
|
|
22
|
+
UNSAFE_componentWillUnmount(): void;
|
|
23
|
+
handleDatePickerPress: () => void;
|
|
24
|
+
handleStartDateConfirm: (date: Date) => void;
|
|
25
|
+
handleStartDateCancel: () => void;
|
|
26
|
+
handleEndDateConfirm: (date: Date) => void;
|
|
27
|
+
handleEndDateCancel: () => void;
|
|
28
|
+
getStyles: () => {
|
|
29
|
+
container: {
|
|
30
|
+
paddingHorizontal: number;
|
|
31
|
+
paddingVertical: number;
|
|
32
|
+
borderWidth: number;
|
|
33
|
+
borderColor: string;
|
|
34
|
+
borderRadius: number;
|
|
35
|
+
flexDirection: "row";
|
|
36
|
+
alignItems: "center";
|
|
37
|
+
};
|
|
38
|
+
label: {
|
|
39
|
+
color: string;
|
|
40
|
+
fontFamily: string;
|
|
41
|
+
fontSize: number;
|
|
42
|
+
lineHeight: number;
|
|
43
|
+
};
|
|
44
|
+
value: {
|
|
45
|
+
color: string;
|
|
46
|
+
fontFamily: string;
|
|
47
|
+
fontSize: number;
|
|
48
|
+
lineHeight: number;
|
|
49
|
+
};
|
|
50
|
+
icon: {
|
|
51
|
+
marginLeft: string;
|
|
52
|
+
color: string;
|
|
53
|
+
fontSize: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
render(): JSX.Element;
|
|
57
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RangeDatePicker = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_modal_datetime_picker_1 = require("react-native-modal-datetime-picker");
|
|
6
|
+
const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
|
|
7
|
+
const format_1 = require("../modules/format");
|
|
8
|
+
const layout_1 = require("../modules/layout");
|
|
9
|
+
const theme_1 = require("../modules/theme");
|
|
10
|
+
const Delay_1 = require("./Delay");
|
|
11
|
+
const test_1 = require("../modules/test");
|
|
12
|
+
const react_native_1 = require("react-native");
|
|
13
|
+
class RangeDatePicker extends React.Component {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.state = {
|
|
17
|
+
showStartDateModal: false,
|
|
18
|
+
showEndDateModal: false,
|
|
19
|
+
isDarkModeEnabled: react_native_1.Appearance.getColorScheme() === 'dark'
|
|
20
|
+
};
|
|
21
|
+
this.handleDatePickerPress = () => {
|
|
22
|
+
this.setState({
|
|
23
|
+
showStartDateModal: true
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
this.handleStartDateConfirm = (date) => {
|
|
27
|
+
this.setState({
|
|
28
|
+
showStartDateModal: false,
|
|
29
|
+
showEndDateModal: true
|
|
30
|
+
}, () => {
|
|
31
|
+
// When using RangeDatePicker on Android devices the end date modal were not being displayed, in order to avoid it,
|
|
32
|
+
// the setTimeOut was implemented so as it will set a little delay (enough time to update the state) before execute other functions.
|
|
33
|
+
// Related issue on gitlab: 3487
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
if (date > this.props.endDate) {
|
|
36
|
+
this.props.onEndDateChange(date);
|
|
37
|
+
}
|
|
38
|
+
this.props.onStartDateChange(date);
|
|
39
|
+
}, 1);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
this.handleStartDateCancel = () => {
|
|
43
|
+
this.setState({
|
|
44
|
+
showStartDateModal: false,
|
|
45
|
+
showEndDateModal: true
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
this.handleEndDateConfirm = (date) => {
|
|
49
|
+
this.setState({
|
|
50
|
+
showEndDateModal: false
|
|
51
|
+
}, () => {
|
|
52
|
+
this.props.onEndDateChange(date);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
this.handleEndDateCancel = () => {
|
|
56
|
+
if (this.props.onEndDateCancel) {
|
|
57
|
+
this.props.onEndDateCancel();
|
|
58
|
+
}
|
|
59
|
+
this.setState({
|
|
60
|
+
showEndDateModal: false
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
this.getStyles = () => {
|
|
64
|
+
const theme = (0, theme_1.getTheme)();
|
|
65
|
+
const styles = react_native_1.StyleSheet.create({
|
|
66
|
+
container: {
|
|
67
|
+
paddingHorizontal: 16,
|
|
68
|
+
paddingVertical: 8,
|
|
69
|
+
borderWidth: 1,
|
|
70
|
+
borderColor: theme.borderColor1,
|
|
71
|
+
borderRadius: 3,
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'center'
|
|
74
|
+
},
|
|
75
|
+
label: {
|
|
76
|
+
color: theme.textColor2,
|
|
77
|
+
fontFamily: theme.fontFamily3,
|
|
78
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
79
|
+
lineHeight: 16
|
|
80
|
+
},
|
|
81
|
+
value: {
|
|
82
|
+
color: theme.textColor1,
|
|
83
|
+
fontFamily: theme.fontFamily1,
|
|
84
|
+
fontSize: 16,
|
|
85
|
+
lineHeight: 22
|
|
86
|
+
},
|
|
87
|
+
icon: {
|
|
88
|
+
marginLeft: 'auto',
|
|
89
|
+
color: theme.textColor2,
|
|
90
|
+
fontSize: 22
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return styles;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
componentDidMount() {
|
|
97
|
+
this.appearanceSubscription = react_native_1.Appearance.addChangeListener(({ colorScheme }) => {
|
|
98
|
+
this.setState({ isDarkModeEnabled: colorScheme === 'dark' });
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
UNSAFE_componentWillUnmount() {
|
|
102
|
+
this.appearanceSubscription.remove();
|
|
103
|
+
}
|
|
104
|
+
render() {
|
|
105
|
+
const { label, startDate, endDate, style, nativeID } = this.props;
|
|
106
|
+
const { showStartDateModal, showEndDateModal, isDarkModeEnabled } = this.state;
|
|
107
|
+
const displayFormat = 'MMM d, yyyy';
|
|
108
|
+
const displayText = (0, format_1.formatDate)(startDate, displayFormat) +
|
|
109
|
+
' - ' +
|
|
110
|
+
(0, format_1.formatDate)(endDate, displayFormat);
|
|
111
|
+
const styles = this.getStyles();
|
|
112
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handleDatePickerPress },
|
|
113
|
+
React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.container, style] },
|
|
114
|
+
React.createElement(react_native_1.View, { style: { flex: 1 } },
|
|
115
|
+
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
116
|
+
React.createElement(react_native_1.Text, { numberOfLines: 1, style: styles.value }, displayText)),
|
|
117
|
+
React.createElement(FontAwesome_1.default, { name: "calendar", style: styles.icon }),
|
|
118
|
+
react_native_1.Platform.OS !== 'web' &&
|
|
119
|
+
(showStartDateModal ? (React.createElement(react_native_modal_datetime_picker_1.default, { date: startDate, isVisible: true, onConfirm: this.handleStartDateConfirm, onCancel: this.handleStartDateCancel, isDarkModeEnabled: isDarkModeEnabled,
|
|
120
|
+
//@ts-ignore
|
|
121
|
+
display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' })) : showEndDateModal ? (React.createElement(Delay_1.Delay, { wait: 5 },
|
|
122
|
+
React.createElement(react_native_modal_datetime_picker_1.default, { date: endDate, isVisible: true, onConfirm: this.handleEndDateConfirm, onCancel: this.handleEndDateCancel, isDarkModeEnabled: isDarkModeEnabled,
|
|
123
|
+
//@ts-ignore
|
|
124
|
+
display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' }))) : null))));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.RangeDatePicker = RangeDatePicker;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SelectedRanges } from 'react-date-range';
|
|
3
|
+
import 'react-date-range/dist/styles.css';
|
|
4
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
5
|
+
import '../../styles/RangeDatePicker.css';
|
|
6
|
+
export interface RangeDatePickerProperties {
|
|
7
|
+
label: string;
|
|
8
|
+
startDate: Date;
|
|
9
|
+
endDate: Date;
|
|
10
|
+
onStartDateChange: (date: Date) => void;
|
|
11
|
+
onEndDateChange: (date: Date) => void;
|
|
12
|
+
onEndDateCancel?: () => void;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
nativeID?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RangeDatePickerState {
|
|
17
|
+
showStartDateModal: boolean;
|
|
18
|
+
count: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class RangeDatePicker extends React.Component<RangeDatePickerProperties, RangeDatePickerState> {
|
|
21
|
+
state: RangeDatePickerState;
|
|
22
|
+
private calendarRef;
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentWillUnmount(): void;
|
|
25
|
+
handleClick: (event: MouseEvent) => void;
|
|
26
|
+
handleDatePickerPress: () => void;
|
|
27
|
+
handleRangeDateConfirm: (ranges: SelectedRanges) => void;
|
|
28
|
+
getStyles: () => {
|
|
29
|
+
container: {
|
|
30
|
+
paddingHorizontal: number;
|
|
31
|
+
paddingVertical: number;
|
|
32
|
+
borderWidth: number;
|
|
33
|
+
borderColor: string;
|
|
34
|
+
borderRadius: number;
|
|
35
|
+
flexDirection: "row";
|
|
36
|
+
alignItems: "center";
|
|
37
|
+
};
|
|
38
|
+
modalOverlay: {
|
|
39
|
+
justifyContent: "center";
|
|
40
|
+
alignItems: "center";
|
|
41
|
+
};
|
|
42
|
+
label: {
|
|
43
|
+
color: string;
|
|
44
|
+
fontFamily: string;
|
|
45
|
+
fontSize: number;
|
|
46
|
+
lineHeight: number;
|
|
47
|
+
};
|
|
48
|
+
value: {
|
|
49
|
+
color: string;
|
|
50
|
+
fontFamily: string;
|
|
51
|
+
fontSize: number;
|
|
52
|
+
lineHeight: number;
|
|
53
|
+
};
|
|
54
|
+
icon: {
|
|
55
|
+
marginLeft: string;
|
|
56
|
+
color: string;
|
|
57
|
+
fontSize: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
render(): JSX.Element;
|
|
61
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RangeDatePicker = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
|
|
6
|
+
const format_1 = require("../modules/format");
|
|
7
|
+
const theme_1 = require("../modules/theme");
|
|
8
|
+
const react_date_range_1 = require("react-date-range");
|
|
9
|
+
const Modal_1 = require("./Modal");
|
|
10
|
+
const layout_1 = require("../modules/layout");
|
|
11
|
+
require("react-date-range/dist/styles.css");
|
|
12
|
+
const react_native_1 = require("react-native");
|
|
13
|
+
require("../../styles/RangeDatePicker.css");
|
|
14
|
+
function compareDates(date1, date2) {
|
|
15
|
+
if (date1 instanceof Date && date2 instanceof Date) {
|
|
16
|
+
return date1.getTime() === date2.getTime();
|
|
17
|
+
}
|
|
18
|
+
return date1 === date2;
|
|
19
|
+
}
|
|
20
|
+
class PureDateRange extends React.Component {
|
|
21
|
+
// Without this check, every time the parent re-renders it would
|
|
22
|
+
// recreate the DateRange with the initial startDate value,
|
|
23
|
+
// even if the date hasn't actually changed.
|
|
24
|
+
// This causes the calendar to reset and the user loses the current
|
|
25
|
+
// selection while interacting.
|
|
26
|
+
// Related issue on GitLab 12293
|
|
27
|
+
shouldComponentUpdate(nextProps) {
|
|
28
|
+
if (nextProps.onChange !== this.props.onChange) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return (!compareDates(nextProps.startDate, this.props.startDate) ||
|
|
32
|
+
!compareDates(nextProps.endDate, this.props.endDate));
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
const { startDate, endDate, onChange } = this.props;
|
|
36
|
+
const theme = (0, theme_1.getTheme)();
|
|
37
|
+
return (React.createElement(react_date_range_1.DateRange, { locale: (0, format_1.getDateFnsLocale)(), showDateDisplay: false, ranges: [
|
|
38
|
+
{
|
|
39
|
+
startDate,
|
|
40
|
+
endDate,
|
|
41
|
+
key: 'selection'
|
|
42
|
+
}
|
|
43
|
+
], rangeColors: [theme.backgroundColor3], onChange: onChange, weekdayDisplayFormat: (0, format_1.getLocale)() === 'pt' ? 'EEEEEE' : 'E' }));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
class RangeDatePicker extends React.Component {
|
|
47
|
+
constructor() {
|
|
48
|
+
super(...arguments);
|
|
49
|
+
this.state = {
|
|
50
|
+
showStartDateModal: false,
|
|
51
|
+
count: 0
|
|
52
|
+
};
|
|
53
|
+
this.calendarRef = React.createRef();
|
|
54
|
+
this.handleClick = (event) => {
|
|
55
|
+
if (this.calendarRef.current &&
|
|
56
|
+
!this.calendarRef.current.contains(event.target)) {
|
|
57
|
+
this.setState({ showStartDateModal: false, count: 0 });
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
this.handleDatePickerPress = () => {
|
|
61
|
+
this.setState({
|
|
62
|
+
showStartDateModal: true
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
this.handleRangeDateConfirm = (ranges) => {
|
|
66
|
+
if (this.state.count == 1) {
|
|
67
|
+
this.props.onStartDateChange(ranges.selection.startDate);
|
|
68
|
+
// Sometimes the parent component is not ready because the setState method
|
|
69
|
+
// is async, so we wait a little.
|
|
70
|
+
setTimeout(() => this.props.onEndDateChange(ranges.selection.endDate), 1);
|
|
71
|
+
this.setState({ showStartDateModal: false, count: 0 });
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.props.onStartDateChange(ranges.selection.startDate);
|
|
75
|
+
this.setState({ count: 1 });
|
|
76
|
+
};
|
|
77
|
+
this.getStyles = () => {
|
|
78
|
+
const theme = (0, theme_1.getTheme)();
|
|
79
|
+
const styles = react_native_1.StyleSheet.create({
|
|
80
|
+
container: {
|
|
81
|
+
paddingHorizontal: 16,
|
|
82
|
+
paddingVertical: 8,
|
|
83
|
+
borderWidth: 1,
|
|
84
|
+
borderColor: theme.borderColor1,
|
|
85
|
+
borderRadius: 3,
|
|
86
|
+
flexDirection: 'row',
|
|
87
|
+
alignItems: 'center'
|
|
88
|
+
},
|
|
89
|
+
modalOverlay: {
|
|
90
|
+
justifyContent: 'center',
|
|
91
|
+
alignItems: 'center'
|
|
92
|
+
},
|
|
93
|
+
label: {
|
|
94
|
+
color: theme.textColor2,
|
|
95
|
+
fontFamily: theme.fontFamily3,
|
|
96
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
97
|
+
lineHeight: 16
|
|
98
|
+
},
|
|
99
|
+
value: {
|
|
100
|
+
color: theme.textColor1,
|
|
101
|
+
fontFamily: theme.fontFamily1,
|
|
102
|
+
fontSize: 16,
|
|
103
|
+
lineHeight: 22
|
|
104
|
+
},
|
|
105
|
+
icon: {
|
|
106
|
+
marginLeft: 'auto',
|
|
107
|
+
color: theme.textColor2,
|
|
108
|
+
fontSize: 22
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return styles;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
componentDidMount() {
|
|
115
|
+
document.addEventListener('mousedown', this.handleClick, false);
|
|
116
|
+
}
|
|
117
|
+
componentWillUnmount() {
|
|
118
|
+
document.removeEventListener('mousedown', this.handleClick, false);
|
|
119
|
+
}
|
|
120
|
+
render() {
|
|
121
|
+
const { label, startDate, endDate, style, nativeID } = this.props;
|
|
122
|
+
const { showStartDateModal } = this.state;
|
|
123
|
+
const displayFormat = 'MMM d, yyyy';
|
|
124
|
+
const displayText = (0, format_1.formatDate)(startDate, displayFormat) +
|
|
125
|
+
' - ' +
|
|
126
|
+
(0, format_1.formatDate)(endDate, displayFormat);
|
|
127
|
+
const theme = (0, theme_1.getTheme)();
|
|
128
|
+
const styles = this.getStyles();
|
|
129
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handleDatePickerPress },
|
|
130
|
+
React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style] },
|
|
131
|
+
React.createElement(react_native_1.View, null,
|
|
132
|
+
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
133
|
+
React.createElement(react_native_1.Text, { style: styles.value }, displayText)),
|
|
134
|
+
React.createElement(FontAwesome_1.default, { name: "calendar", style: styles.icon }),
|
|
135
|
+
React.createElement(Modal_1.Modal, { visible: showStartDateModal, overlayStyle: styles.modalOverlay },
|
|
136
|
+
React.createElement("div", { ref: this.calendarRef, style: {
|
|
137
|
+
borderRadius: '5px',
|
|
138
|
+
position: 'absolute',
|
|
139
|
+
top: '50%',
|
|
140
|
+
marginTop: '-150px',
|
|
141
|
+
fontFamily: theme.fontFamily1
|
|
142
|
+
} },
|
|
143
|
+
React.createElement(PureDateRange, { startDate: startDate, endDate: endDate, onChange: this.handleRangeDateConfirm }))))));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.RangeDatePicker = RangeDatePicker;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SpaceProperties {
|
|
3
|
+
height?: number;
|
|
4
|
+
width?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class Space extends React.Component<SpaceProperties> {
|
|
7
|
+
static defaultProps: {
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
render(): JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Space = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
class Space extends React.Component {
|
|
7
|
+
render() {
|
|
8
|
+
const { height, width } = this.props;
|
|
9
|
+
return React.createElement(react_native_1.View, { style: { height, width } });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.Space = Space;
|
|
13
|
+
Space.defaultProps = {
|
|
14
|
+
height: 16
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
extraHeight: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class StatusBar extends React.Component<Props> {
|
|
6
|
+
static height: number;
|
|
7
|
+
getStyles: () => {
|
|
8
|
+
statusBar: {
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
static defaultProps: {
|
|
14
|
+
extraHeight: number;
|
|
15
|
+
};
|
|
16
|
+
render(): JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusBar = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const react_native_status_bar_height_1 = require("react-native-status-bar-height");
|
|
7
|
+
const theme_1 = require("../modules/theme");
|
|
8
|
+
class StatusBar extends React.Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.getStyles = () => {
|
|
12
|
+
const theme = (0, theme_1.getTheme)();
|
|
13
|
+
const { extraHeight } = this.props;
|
|
14
|
+
const styles = react_native_1.StyleSheet.create({
|
|
15
|
+
statusBar: {
|
|
16
|
+
backgroundColor: theme.statusBarColor,
|
|
17
|
+
height: (0, react_native_status_bar_height_1.getStatusBarHeight)() + extraHeight
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return styles;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
const styles = this.getStyles();
|
|
25
|
+
return (React.createElement(react_native_1.View, { style: styles.statusBar },
|
|
26
|
+
React.createElement(react_native_1.StatusBar, { backgroundColor: "transparent", barStyle: "light-content", translucent: true })));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.StatusBar = StatusBar;
|
|
30
|
+
StatusBar.height = (0, react_native_status_bar_height_1.getStatusBarHeight)();
|
|
31
|
+
StatusBar.defaultProps = {
|
|
32
|
+
extraHeight: 0
|
|
33
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
export interface SwitchProperties {
|
|
4
|
+
value: boolean;
|
|
5
|
+
label?: string;
|
|
6
|
+
onChange?: (value: boolean) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
10
|
+
}
|
|
11
|
+
export declare class Switch extends React.Component<SwitchProperties> {
|
|
12
|
+
getStyles: () => {
|
|
13
|
+
container: {
|
|
14
|
+
paddingHorizontal: number;
|
|
15
|
+
paddingVertical: number;
|
|
16
|
+
borderWidth: number;
|
|
17
|
+
borderColor: string;
|
|
18
|
+
borderRadius: number;
|
|
19
|
+
flexDirection: "row";
|
|
20
|
+
alignItems: "center";
|
|
21
|
+
justifyContent: "space-between";
|
|
22
|
+
};
|
|
23
|
+
label: {
|
|
24
|
+
color: string;
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
fontSize: number;
|
|
27
|
+
lineHeight: number;
|
|
28
|
+
};
|
|
29
|
+
readonly: {
|
|
30
|
+
backgroundColor: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
render(): JSX.Element;
|
|
34
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Switch = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const theme_1 = require("../modules/theme");
|
|
7
|
+
const layout_1 = require("../modules/layout");
|
|
8
|
+
class Switch 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
|
+
container: {
|
|
15
|
+
paddingHorizontal: 16,
|
|
16
|
+
paddingVertical: 8,
|
|
17
|
+
borderWidth: 1,
|
|
18
|
+
borderColor: theme.borderColor1,
|
|
19
|
+
borderRadius: 3,
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'space-between'
|
|
23
|
+
},
|
|
24
|
+
label: {
|
|
25
|
+
color: theme.textColor2,
|
|
26
|
+
fontFamily: theme.fontFamily2,
|
|
27
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
28
|
+
lineHeight: 16
|
|
29
|
+
},
|
|
30
|
+
readonly: {
|
|
31
|
+
backgroundColor: theme.disabledColor
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return styles;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
const { label, value, onChange, style, labelStyle, disabled } = this.props;
|
|
39
|
+
const styles = this.getStyles();
|
|
40
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: () => {
|
|
41
|
+
if (onChange) {
|
|
42
|
+
onChange(!value);
|
|
43
|
+
}
|
|
44
|
+
} },
|
|
45
|
+
React.createElement(react_native_1.View, { style: [styles.container, style, disabled ? styles.readonly : null] },
|
|
46
|
+
label && React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label),
|
|
47
|
+
React.createElement(react_native_1.Switch, { disabled: disabled, value: value, onValueChange: onChange }))));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.Switch = Switch;
|