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,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimePicker = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_native_modal_datetime_picker_1 = require("react-native-modal-datetime-picker");
|
|
6
|
+
const ImageButton_1 = require("./ImageButton");
|
|
7
|
+
const format_1 = require("../modules/format");
|
|
8
|
+
const layout_1 = require("../modules/layout");
|
|
9
|
+
const theme_1 = require("../modules/theme");
|
|
10
|
+
const test_1 = require("../modules/test");
|
|
11
|
+
const react_native_1 = require("react-native");
|
|
12
|
+
class TimePicker 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
|
+
if (this.props.onChange) {
|
|
25
|
+
this.props.onChange((0, format_1.formatDate)(value, 'HH:mm'));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
this.handleCancel = () => {
|
|
30
|
+
this.setState({ showModal: false }, () => {
|
|
31
|
+
if (this.props.onCancel) {
|
|
32
|
+
this.props.onCancel();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
this.handleClear = () => {
|
|
37
|
+
if (this.props.onChange) {
|
|
38
|
+
this.props.onChange('');
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.getStyles = () => {
|
|
42
|
+
const theme = (0, theme_1.getTheme)();
|
|
43
|
+
const styles = react_native_1.StyleSheet.create({
|
|
44
|
+
container: {
|
|
45
|
+
paddingHorizontal: 16,
|
|
46
|
+
paddingVertical: 8,
|
|
47
|
+
borderWidth: 1,
|
|
48
|
+
borderColor: theme.borderColor1,
|
|
49
|
+
borderRadius: 3,
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
alignItems: 'center'
|
|
52
|
+
},
|
|
53
|
+
label: {
|
|
54
|
+
color: theme.textColor2,
|
|
55
|
+
fontFamily: theme.fontFamily3,
|
|
56
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
57
|
+
lineHeight: 16
|
|
58
|
+
},
|
|
59
|
+
value: {
|
|
60
|
+
color: theme.textColor1,
|
|
61
|
+
fontFamily: theme.fontFamily1,
|
|
62
|
+
fontSize: 16,
|
|
63
|
+
lineHeight: 22,
|
|
64
|
+
minHeight: 22
|
|
65
|
+
},
|
|
66
|
+
readonly: {
|
|
67
|
+
backgroundColor: theme.disabledColor
|
|
68
|
+
},
|
|
69
|
+
clearIcon: {
|
|
70
|
+
borderWidth: 0,
|
|
71
|
+
marginLeft: 'auto',
|
|
72
|
+
height: 'auto',
|
|
73
|
+
width: 'auto'
|
|
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, disabled, nativeID } = this.props;
|
|
89
|
+
const { showModal, isDarkModeEnabled } = this.state;
|
|
90
|
+
const date = new Date();
|
|
91
|
+
const hourRegex = /(\d{2}):(\d{2})/;
|
|
92
|
+
const matches = hourRegex.exec(value);
|
|
93
|
+
const styles = this.getStyles();
|
|
94
|
+
const theme = (0, theme_1.getTheme)();
|
|
95
|
+
if (matches) {
|
|
96
|
+
date.setHours(parseInt(matches[1], 10));
|
|
97
|
+
date.setMinutes(parseInt(matches[2], 10));
|
|
98
|
+
}
|
|
99
|
+
return (React.createElement(React.Fragment, null,
|
|
100
|
+
React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: this.handlePress },
|
|
101
|
+
React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.container, style, disabled ? styles.readonly : null] },
|
|
102
|
+
React.createElement(react_native_1.View, null,
|
|
103
|
+
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
104
|
+
React.createElement(react_native_1.Text, { style: styles.value }, value)),
|
|
105
|
+
!disabled && (React.createElement(ImageButton_1.ImageButton, { icon: value && clearable ? 'times' : 'clock-o', style: styles.clearIcon, iconColor: value && clearable ? theme.textColor1 : theme.textColor2, onPress: value && clearable ? this.handleClear : this.handlePress, hitBoxSize: 30 })),
|
|
106
|
+
react_native_1.Platform.OS !== 'web' && (React.createElement(react_native_modal_datetime_picker_1.default, { mode: "time", date: date, isVisible: showModal, onConfirm: this.handleConfirm, onCancel: this.handleCancel, isDarkModeEnabled: isDarkModeEnabled, display: react_native_1.Platform.OS == 'ios' ? 'spinner' : 'default' }))))));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.TimePicker = TimePicker;
|
|
110
|
+
TimePicker.defaultProps = {
|
|
111
|
+
clearable: true
|
|
112
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleProp, TextInput, ViewStyle, TextInputProps } from 'react-native';
|
|
3
|
+
export interface TextBoxInputProps extends TextInputProps {
|
|
4
|
+
ref: (ref: TextInput) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface TimePickerProperties {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
clearable?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
nativeID?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class TimePicker extends React.Component<TimePickerProperties> {
|
|
16
|
+
private backspace;
|
|
17
|
+
static defaultProps: {
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
};
|
|
20
|
+
getStyles: () => {
|
|
21
|
+
container: {
|
|
22
|
+
paddingHorizontal: number;
|
|
23
|
+
paddingVertical: number;
|
|
24
|
+
borderWidth: number;
|
|
25
|
+
borderColor: string;
|
|
26
|
+
borderRadius: number;
|
|
27
|
+
};
|
|
28
|
+
label: {
|
|
29
|
+
color: string;
|
|
30
|
+
fontFamily: string;
|
|
31
|
+
fontSize: number;
|
|
32
|
+
lineHeight: number;
|
|
33
|
+
};
|
|
34
|
+
input: {
|
|
35
|
+
color: string;
|
|
36
|
+
fontFamily: string;
|
|
37
|
+
fontSize: number;
|
|
38
|
+
minHeight: number;
|
|
39
|
+
padding: number;
|
|
40
|
+
margin: number;
|
|
41
|
+
outlineStyle: string;
|
|
42
|
+
};
|
|
43
|
+
readonly: {
|
|
44
|
+
backgroundColor: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
render(): JSX.Element;
|
|
48
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimePicker = 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 validation_1 = require("../modules/validation");
|
|
9
|
+
class TimePicker extends React.Component {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.backspace = false;
|
|
13
|
+
this.getStyles = () => {
|
|
14
|
+
const theme = (0, theme_1.getTheme)();
|
|
15
|
+
const styles = react_native_1.StyleSheet.create({
|
|
16
|
+
container: {
|
|
17
|
+
paddingHorizontal: 16,
|
|
18
|
+
paddingVertical: 8,
|
|
19
|
+
borderWidth: 1,
|
|
20
|
+
borderColor: theme.borderColor1,
|
|
21
|
+
borderRadius: 3
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
color: theme.textColor2,
|
|
25
|
+
fontFamily: theme.fontFamily3,
|
|
26
|
+
fontSize: (0, layout_1.isTablet)() ? 15 : 12,
|
|
27
|
+
lineHeight: 16
|
|
28
|
+
},
|
|
29
|
+
input: {
|
|
30
|
+
color: theme.textColor1,
|
|
31
|
+
fontFamily: theme.fontFamily1,
|
|
32
|
+
fontSize: 16,
|
|
33
|
+
minHeight: 22,
|
|
34
|
+
padding: 0,
|
|
35
|
+
margin: 0,
|
|
36
|
+
outlineStyle: 'none'
|
|
37
|
+
},
|
|
38
|
+
readonly: {
|
|
39
|
+
backgroundColor: theme.disabledColor
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return styles;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const { label, style, disabled, value, nativeID } = this.props;
|
|
47
|
+
const styles = this.getStyles();
|
|
48
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, disabled: disabled, ref: ref => {
|
|
49
|
+
if (ref != null) {
|
|
50
|
+
//@ts-ignore
|
|
51
|
+
ref.tabIndex = -1;
|
|
52
|
+
}
|
|
53
|
+
} },
|
|
54
|
+
React.createElement(react_native_1.View, { style: [styles.container, style, !disabled ? null : styles.readonly] },
|
|
55
|
+
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
56
|
+
React.createElement(react_native_1.TextInput, { nativeID: nativeID, value: value, style: styles.input, maxLength: 5, onKeyPress: (e) => {
|
|
57
|
+
if (e.nativeEvent.key === 'Backspace') {
|
|
58
|
+
this.backspace = true;
|
|
59
|
+
}
|
|
60
|
+
}, onChangeText: (text) => {
|
|
61
|
+
if (value.length > 0 && value.match(/[a-zA-Z]+/) == null) {
|
|
62
|
+
if (text.length === 2 && !this.backspace) {
|
|
63
|
+
text += ':';
|
|
64
|
+
}
|
|
65
|
+
if (text.length === 3 && !text.includes(':')) {
|
|
66
|
+
text = text.substr(0, 2) + ':' + text.substr(2);
|
|
67
|
+
}
|
|
68
|
+
if (text.length <= 2) {
|
|
69
|
+
this.backspace = false;
|
|
70
|
+
}
|
|
71
|
+
if ((0, validation_1.isHour)(text + '00:00'.substr(text.length))) {
|
|
72
|
+
this.props.onChange(text);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.props.onChange(text);
|
|
77
|
+
}
|
|
78
|
+
}, onBlur: () => {
|
|
79
|
+
if (value.length > 0 && value.match(/[a-zA-Z]+/) == null) {
|
|
80
|
+
this.props.onChange(value + '00:00'.substr(value.length));
|
|
81
|
+
}
|
|
82
|
+
} }))));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.TimePicker = TimePicker;
|
|
86
|
+
TimePicker.defaultProps = {
|
|
87
|
+
disabled: false
|
|
88
|
+
};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export * from './components/AppShell';
|
|
2
|
+
export * from './components/Button';
|
|
3
|
+
export * from './components/Card';
|
|
4
|
+
export * from './components/CheckBox';
|
|
5
|
+
export * from './components/DatePicker';
|
|
6
|
+
export * from './components/Details';
|
|
7
|
+
export * from './components/DetailsHeader';
|
|
8
|
+
export * from './components/DimensionsMonitor';
|
|
9
|
+
export * from './components/DropDown';
|
|
10
|
+
export * from './components/FilePicker';
|
|
11
|
+
export * from './components/Header';
|
|
12
|
+
export * from './components/HeaderDesktop';
|
|
13
|
+
export * from './components/ImageButton';
|
|
14
|
+
export * from './components/KeyboardAvoidingView';
|
|
15
|
+
export * from './components/Link';
|
|
16
|
+
export * from './components/Loading';
|
|
17
|
+
export * from './components/MenuMobile';
|
|
18
|
+
export * from './components/MenuDesktop';
|
|
19
|
+
export * from './components/Message';
|
|
20
|
+
export * from './components/Modal';
|
|
21
|
+
export * from './components/MultiSelect';
|
|
22
|
+
export * from './components/Question';
|
|
23
|
+
export * from './components/RadioButton';
|
|
24
|
+
export * from './components/RadioGroup';
|
|
25
|
+
export * from './components/RangeDatePicker';
|
|
26
|
+
export * from './components/Space';
|
|
27
|
+
export * from './components/StatusBar';
|
|
28
|
+
export * from './components/Switch';
|
|
29
|
+
export * from './components/Table';
|
|
30
|
+
export * from './components/Text';
|
|
31
|
+
export * from './components/TextBox';
|
|
32
|
+
export * from './components/TimePicker';
|
|
33
|
+
export * from './components/ErrorMessage';
|
|
34
|
+
export * from './components/TextBoxMask';
|
|
35
|
+
export * from './modules/format';
|
|
36
|
+
export * from './modules/layout';
|
|
37
|
+
export * from './modules/theme';
|
|
38
|
+
export * from './modules/validation';
|
|
39
|
+
export * from './modules/test';
|
|
40
|
+
export * from './components/NoRecordMessage';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components/AppShell"), exports);
|
|
18
|
+
__exportStar(require("./components/Button"), exports);
|
|
19
|
+
__exportStar(require("./components/Card"), exports);
|
|
20
|
+
__exportStar(require("./components/CheckBox"), exports);
|
|
21
|
+
__exportStar(require("./components/DatePicker"), exports);
|
|
22
|
+
__exportStar(require("./components/Details"), exports);
|
|
23
|
+
__exportStar(require("./components/DetailsHeader"), exports);
|
|
24
|
+
__exportStar(require("./components/DimensionsMonitor"), exports);
|
|
25
|
+
__exportStar(require("./components/DropDown"), exports);
|
|
26
|
+
__exportStar(require("./components/FilePicker"), exports);
|
|
27
|
+
__exportStar(require("./components/Header"), exports);
|
|
28
|
+
__exportStar(require("./components/HeaderDesktop"), exports);
|
|
29
|
+
__exportStar(require("./components/ImageButton"), exports);
|
|
30
|
+
__exportStar(require("./components/KeyboardAvoidingView"), exports);
|
|
31
|
+
__exportStar(require("./components/Link"), exports);
|
|
32
|
+
__exportStar(require("./components/Loading"), exports);
|
|
33
|
+
__exportStar(require("./components/MenuMobile"), exports);
|
|
34
|
+
__exportStar(require("./components/MenuDesktop"), exports);
|
|
35
|
+
__exportStar(require("./components/Message"), exports);
|
|
36
|
+
__exportStar(require("./components/Modal"), exports);
|
|
37
|
+
__exportStar(require("./components/MultiSelect"), exports);
|
|
38
|
+
__exportStar(require("./components/Question"), exports);
|
|
39
|
+
__exportStar(require("./components/RadioButton"), exports);
|
|
40
|
+
__exportStar(require("./components/RadioGroup"), exports);
|
|
41
|
+
__exportStar(require("./components/RangeDatePicker"), exports);
|
|
42
|
+
__exportStar(require("./components/Space"), exports);
|
|
43
|
+
__exportStar(require("./components/StatusBar"), exports);
|
|
44
|
+
__exportStar(require("./components/Switch"), exports);
|
|
45
|
+
__exportStar(require("./components/Table"), exports);
|
|
46
|
+
__exportStar(require("./components/Text"), exports);
|
|
47
|
+
__exportStar(require("./components/TextBox"), exports);
|
|
48
|
+
__exportStar(require("./components/TimePicker"), exports);
|
|
49
|
+
__exportStar(require("./components/ErrorMessage"), exports);
|
|
50
|
+
__exportStar(require("./components/TextBoxMask"), exports);
|
|
51
|
+
__exportStar(require("./modules/format"), exports);
|
|
52
|
+
__exportStar(require("./modules/layout"), exports);
|
|
53
|
+
__exportStar(require("./modules/theme"), exports);
|
|
54
|
+
__exportStar(require("./modules/validation"), exports);
|
|
55
|
+
__exportStar(require("./modules/test"), exports);
|
|
56
|
+
__exportStar(require("./components/NoRecordMessage"), exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setDatePickerColor = exports.ehIE = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
function ehIE() {
|
|
6
|
+
return /MSIE|Trident\//.test(navigator.userAgent);
|
|
7
|
+
}
|
|
8
|
+
exports.ehIE = ehIE;
|
|
9
|
+
function setDatePickerColor(color) {
|
|
10
|
+
if (['ios', 'android'].includes(react_native_1.Platform.OS)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const STYLE_ID = 'custom-datepicker-color';
|
|
14
|
+
removeElements(`style#${STYLE_ID}`);
|
|
15
|
+
const style = document.createElement('style');
|
|
16
|
+
style.id = STYLE_ID;
|
|
17
|
+
style.innerHTML = `
|
|
18
|
+
.rdrMonthAndYearWrapper {
|
|
19
|
+
background-color: ${color};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.rdrDayToday .rdrDayNumber span:after {
|
|
23
|
+
background: ${color}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rdrSelected,
|
|
27
|
+
.rdrInRange,
|
|
28
|
+
.rdrStartEdge,
|
|
29
|
+
.rdrEndEdge {
|
|
30
|
+
background: ${color};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.rdrDay {
|
|
34
|
+
color: ${color} !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.rdrDayStartPreview,
|
|
38
|
+
.rdrDayInPreview,
|
|
39
|
+
.rdrDayEndPreview {
|
|
40
|
+
border: 0px solid ${color};
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
document.body.appendChild(style);
|
|
44
|
+
}
|
|
45
|
+
exports.setDatePickerColor = setDatePickerColor;
|
|
46
|
+
function removeElements(query) {
|
|
47
|
+
const elements = document.querySelectorAll(query);
|
|
48
|
+
if (elements) {
|
|
49
|
+
elements.forEach(el => el.remove());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare type Locale = 'pt' | 'en' | 'es';
|
|
2
|
+
export declare const setLocale: (locale: Locale) => void;
|
|
3
|
+
export declare const getLocale: () => Locale;
|
|
4
|
+
export declare const parseDate: (date: string, format: string) => Date;
|
|
5
|
+
export declare const getDateFnsLocale: () => any;
|
|
6
|
+
export declare const formatDate: (date: Date | string, format: string) => string;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDate = exports.getDateFnsLocale = exports.parseDate = exports.getLocale = exports.setLocale = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const dfnslocales = {
|
|
6
|
+
pt: require('date-fns/locale/pt-BR'),
|
|
7
|
+
en: require('date-fns/locale/en-US'),
|
|
8
|
+
es: require('date-fns/locale/es')
|
|
9
|
+
};
|
|
10
|
+
let currentLocale = 'pt';
|
|
11
|
+
const setLocale = (locale) => {
|
|
12
|
+
currentLocale = locale;
|
|
13
|
+
};
|
|
14
|
+
exports.setLocale = setLocale;
|
|
15
|
+
const getLocale = () => {
|
|
16
|
+
return currentLocale;
|
|
17
|
+
};
|
|
18
|
+
exports.getLocale = getLocale;
|
|
19
|
+
const parseDate = (date, format) => {
|
|
20
|
+
return (0, date_fns_1.parse)(date, format, new Date());
|
|
21
|
+
};
|
|
22
|
+
exports.parseDate = parseDate;
|
|
23
|
+
const getDateFnsLocale = () => {
|
|
24
|
+
let fnsLocate = dfnslocales.en;
|
|
25
|
+
switch (currentLocale) {
|
|
26
|
+
case 'pt':
|
|
27
|
+
fnsLocate = dfnslocales.pt;
|
|
28
|
+
break;
|
|
29
|
+
case 'es':
|
|
30
|
+
fnsLocate = dfnslocales.es;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
if (fnsLocate.default) {
|
|
34
|
+
return fnsLocate.default;
|
|
35
|
+
}
|
|
36
|
+
return fnsLocate;
|
|
37
|
+
};
|
|
38
|
+
exports.getDateFnsLocale = getDateFnsLocale;
|
|
39
|
+
const fixPortugueseLowercase = (formattedDate) => {
|
|
40
|
+
formattedDate = formattedDate.replace('segunda-feira', 'Segunda-Feira');
|
|
41
|
+
formattedDate = formattedDate.replace('terça-feira', 'Terça-Feira');
|
|
42
|
+
formattedDate = formattedDate.replace('quarta-feira', 'Quarta-Feira');
|
|
43
|
+
formattedDate = formattedDate.replace('quinta-feira', 'Quinta-Feira');
|
|
44
|
+
formattedDate = formattedDate.replace('sexta-feira', 'Sexta-Feira');
|
|
45
|
+
formattedDate = formattedDate.replace('sábado', 'Sábado');
|
|
46
|
+
formattedDate = formattedDate.replace('domingo', 'Domingo');
|
|
47
|
+
formattedDate = formattedDate.replace('seg', 'Seg');
|
|
48
|
+
formattedDate = formattedDate.replace('ter', 'Ter');
|
|
49
|
+
formattedDate = formattedDate.replace('qua', 'Qua');
|
|
50
|
+
formattedDate = formattedDate.replace('qui', 'Qui');
|
|
51
|
+
formattedDate = formattedDate.replace('sex', 'Sex');
|
|
52
|
+
formattedDate = formattedDate.replace('sab', 'Sáb');
|
|
53
|
+
formattedDate = formattedDate.replace('sáb', 'Sáb');
|
|
54
|
+
formattedDate = formattedDate.replace('dom', 'Dom');
|
|
55
|
+
formattedDate = formattedDate.replace('janeiro', 'Janeiro');
|
|
56
|
+
formattedDate = formattedDate.replace('fevereiro', 'Fevereiro');
|
|
57
|
+
formattedDate = formattedDate.replace('março', 'Março');
|
|
58
|
+
formattedDate = formattedDate.replace('abril', 'Abril');
|
|
59
|
+
formattedDate = formattedDate.replace('maio', 'Maio');
|
|
60
|
+
formattedDate = formattedDate.replace('junho', 'Junho');
|
|
61
|
+
formattedDate = formattedDate.replace('julho', 'Julho');
|
|
62
|
+
formattedDate = formattedDate.replace('agosto', 'Agosto');
|
|
63
|
+
formattedDate = formattedDate.replace('setembro', 'Setembro');
|
|
64
|
+
formattedDate = formattedDate.replace('outubro', 'Outubro');
|
|
65
|
+
formattedDate = formattedDate.replace('novembro', 'Novembro');
|
|
66
|
+
formattedDate = formattedDate.replace('dezembro', 'Dezembro');
|
|
67
|
+
return formattedDate;
|
|
68
|
+
};
|
|
69
|
+
const fixSpanishLowercase = (formattedDate) => {
|
|
70
|
+
formattedDate = formattedDate.replace('lunes', 'Lunes');
|
|
71
|
+
formattedDate = formattedDate.replace('martes', 'Martes');
|
|
72
|
+
formattedDate = formattedDate.replace('miércoles', 'Miércoles');
|
|
73
|
+
formattedDate = formattedDate.replace('jueves', 'Jueves');
|
|
74
|
+
formattedDate = formattedDate.replace('viernes', 'Viernes');
|
|
75
|
+
formattedDate = formattedDate.replace('sábado', 'Sábado');
|
|
76
|
+
formattedDate = formattedDate.replace('domingo', 'Domingo');
|
|
77
|
+
formattedDate = formattedDate.replace('lun', 'Lun');
|
|
78
|
+
formattedDate = formattedDate.replace('mar', 'Mar');
|
|
79
|
+
formattedDate = formattedDate.replace('mié', 'Mié');
|
|
80
|
+
formattedDate = formattedDate.replace('jue', 'Jue');
|
|
81
|
+
formattedDate = formattedDate.replace('vie', 'Vie');
|
|
82
|
+
formattedDate = formattedDate.replace('sáb', 'Sáb');
|
|
83
|
+
formattedDate = formattedDate.replace('dom', 'Dom');
|
|
84
|
+
formattedDate = formattedDate.replace('enero', 'Enero');
|
|
85
|
+
formattedDate = formattedDate.replace('febrero', 'Febrero');
|
|
86
|
+
formattedDate = formattedDate.replace('marzo', 'Marzo');
|
|
87
|
+
formattedDate = formattedDate.replace('abril', 'Abril');
|
|
88
|
+
formattedDate = formattedDate.replace('mayo', 'Mayo');
|
|
89
|
+
formattedDate = formattedDate.replace('junio', 'Junio');
|
|
90
|
+
formattedDate = formattedDate.replace('julio', 'Julio');
|
|
91
|
+
formattedDate = formattedDate.replace('agosto', 'Agosto');
|
|
92
|
+
formattedDate = formattedDate.replace('septiembre', 'Septiembre');
|
|
93
|
+
formattedDate = formattedDate.replace('octubre', 'Octubre');
|
|
94
|
+
formattedDate = formattedDate.replace('noviembre', 'Noviembre');
|
|
95
|
+
formattedDate = formattedDate.replace('diciembre', 'Diciembre');
|
|
96
|
+
return formattedDate;
|
|
97
|
+
};
|
|
98
|
+
const formatDate = (date, format) => {
|
|
99
|
+
if (typeof date === 'string') {
|
|
100
|
+
// case 135870 - Acontecia casos onde a data/horas estavam sendo alteradas pois o react-native assume o fuso sempre como '00:00',
|
|
101
|
+
// para que isso não aconteça, se a data for do tipo string o fuso horario será adicionado na data para que não tenha alteração.
|
|
102
|
+
// A regex busca datas no formato "yyyy-MM-DDTHH:mm:ss", podendo ter ou não milisegundos, mas sem fuso horário informado.
|
|
103
|
+
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?$/.test(date)) {
|
|
104
|
+
const timezoneOffset = new Date().getTimezoneOffset();
|
|
105
|
+
const hours = Math.floor(Math.abs(timezoneOffset) / 60);
|
|
106
|
+
const minutes = Math.abs(timezoneOffset) % 60;
|
|
107
|
+
const sign = timezoneOffset > 0 ? '-' : '+';
|
|
108
|
+
const timezone = sign +
|
|
109
|
+
hours.toString().padStart(2, '0') +
|
|
110
|
+
':' +
|
|
111
|
+
minutes.toString().padStart(2, '0');
|
|
112
|
+
date = date + timezone;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const formattedDate = (0, date_fns_1.format)(typeof date === 'string' ? new Date(date) : date, format, {
|
|
116
|
+
locale: (0, exports.getDateFnsLocale)()
|
|
117
|
+
});
|
|
118
|
+
switch (currentLocale) {
|
|
119
|
+
case 'pt':
|
|
120
|
+
return fixPortugueseLowercase(formattedDate);
|
|
121
|
+
case 'es':
|
|
122
|
+
return fixSpanishLowercase(formattedDate);
|
|
123
|
+
default:
|
|
124
|
+
return formattedDate;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
exports.formatDate = formatDate;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isTablet: () => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTablet = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const isTablet = () => {
|
|
6
|
+
if (react_native_1.Platform.OS === 'web') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return (react_native_1.Dimensions.get('window').height >= 800 &&
|
|
10
|
+
react_native_1.Dimensions.get('window').width >= 500);
|
|
11
|
+
};
|
|
12
|
+
exports.isTablet = isTablet;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTestID = exports.setTestIDPrefix = void 0;
|
|
4
|
+
let testIdPrefix = '';
|
|
5
|
+
const setTestIDPrefix = (value) => {
|
|
6
|
+
testIdPrefix = value;
|
|
7
|
+
};
|
|
8
|
+
exports.setTestIDPrefix = setTestIDPrefix;
|
|
9
|
+
const getTestID = (testID) => {
|
|
10
|
+
if (!testID) {
|
|
11
|
+
return testID;
|
|
12
|
+
}
|
|
13
|
+
if (testIdPrefix) {
|
|
14
|
+
return `${testIdPrefix}${testID}`;
|
|
15
|
+
}
|
|
16
|
+
return testID;
|
|
17
|
+
};
|
|
18
|
+
exports.getTestID = getTestID;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const BLACK = "#282c37";
|
|
2
|
+
export declare const WHITE = "#ffffff";
|
|
3
|
+
export declare const GRAY = "#555";
|
|
4
|
+
export declare const GRAY_1 = "#eef1f6";
|
|
5
|
+
export declare const GRAY_2 = "#dddddd";
|
|
6
|
+
export declare const GRAY_3 = "#c2c2c2";
|
|
7
|
+
export declare const GRAY_4 = "#aabec6";
|
|
8
|
+
export declare const BLUE = "#0047a9";
|
|
9
|
+
export declare const BLUE_LIGHT = "#0c65c7";
|
|
10
|
+
export declare const BLUE_LIGHT_2 = "#59cbe8";
|
|
11
|
+
export declare const YELLOW = "#f5a623";
|
|
12
|
+
export declare const GREEN = "#34bf6d";
|
|
13
|
+
export declare const GREEN_LIGHT = "#2ec562";
|
|
14
|
+
export declare const RED = "#d62729";
|
|
15
|
+
export interface Theme {
|
|
16
|
+
textColor1: string;
|
|
17
|
+
textColor2: string;
|
|
18
|
+
textColor3: string;
|
|
19
|
+
textColor4: string;
|
|
20
|
+
messageTextColor: string;
|
|
21
|
+
counterTextColor: string;
|
|
22
|
+
dropDownTextColor: string;
|
|
23
|
+
questionTextColor: string;
|
|
24
|
+
datePickerColor: string;
|
|
25
|
+
backgroundColor1: string;
|
|
26
|
+
backgroundColor2: string;
|
|
27
|
+
backgroundColor3: string;
|
|
28
|
+
borderColor1: string;
|
|
29
|
+
shadowColor1: string;
|
|
30
|
+
statusBarColor: string;
|
|
31
|
+
successColor: string;
|
|
32
|
+
warningColor: string;
|
|
33
|
+
errorColor: string;
|
|
34
|
+
disabledColor: string;
|
|
35
|
+
counterBackgroundColor: string;
|
|
36
|
+
fontFamily1: string;
|
|
37
|
+
fontFamily2: string;
|
|
38
|
+
fontFamily3: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const setTheme: (newTheme: Partial<Theme>) => void;
|
|
41
|
+
export declare const getTheme: () => Theme;
|