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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/lib/components/AppShell.d.ts +24 -0
  2. package/lib/components/AppShell.js +79 -0
  3. package/lib/components/Button.d.ts +47 -0
  4. package/lib/components/Button.js +65 -0
  5. package/lib/components/Card.d.ts +65 -0
  6. package/lib/components/Card.js +125 -0
  7. package/lib/components/CheckBox.d.ts +34 -0
  8. package/lib/components/CheckBox.js +46 -0
  9. package/lib/components/DatePicker.d.ts +67 -0
  10. package/lib/components/DatePicker.js +105 -0
  11. package/lib/components/DatePicker.web.d.ts +64 -0
  12. package/lib/components/DatePicker.web.js +105 -0
  13. package/lib/components/Delay.d.ts +12 -0
  14. package/lib/components/Delay.js +21 -0
  15. package/lib/components/Details.d.ts +66 -0
  16. package/lib/components/Details.js +94 -0
  17. package/lib/components/DetailsHeader.d.ts +37 -0
  18. package/lib/components/DetailsHeader.js +63 -0
  19. package/lib/components/DimensionsMonitor.d.ts +21 -0
  20. package/lib/components/DimensionsMonitor.js +35 -0
  21. package/lib/components/DropDown.d.ts +35 -0
  22. package/lib/components/DropDown.js +263 -0
  23. package/lib/components/ErrorMessage.d.ts +16 -0
  24. package/lib/components/ErrorMessage.js +29 -0
  25. package/lib/components/FilePicker.d.ts +28 -0
  26. package/lib/components/FilePicker.js +44 -0
  27. package/lib/components/Header.d.ts +56 -0
  28. package/lib/components/Header.js +89 -0
  29. package/lib/components/HeaderDesktop.d.ts +59 -0
  30. package/lib/components/HeaderDesktop.js +80 -0
  31. package/lib/components/ImageButton.d.ts +14 -0
  32. package/lib/components/ImageButton.js +32 -0
  33. package/lib/components/KeyboardAvoidingView.d.ts +34 -0
  34. package/lib/components/KeyboardAvoidingView.js +92 -0
  35. package/lib/components/Link.d.ts +17 -0
  36. package/lib/components/Link.js +28 -0
  37. package/lib/components/Loading.d.ts +4 -0
  38. package/lib/components/Loading.js +37 -0
  39. package/lib/components/Menu.d.ts +42 -0
  40. package/lib/components/Menu.js +112 -0
  41. package/lib/components/MenuDesktop.d.ts +24 -0
  42. package/lib/components/MenuDesktop.js +38 -0
  43. package/lib/components/MenuMobile.d.ts +47 -0
  44. package/lib/components/MenuMobile.js +85 -0
  45. package/lib/components/Message.d.ts +37 -0
  46. package/lib/components/Message.js +50 -0
  47. package/lib/components/Modal.d.ts +11 -0
  48. package/lib/components/Modal.js +20 -0
  49. package/lib/components/MultiSelect.d.ts +51 -0
  50. package/lib/components/MultiSelect.js +376 -0
  51. package/lib/components/NoRecordMessage.d.ts +23 -0
  52. package/lib/components/NoRecordMessage.js +35 -0
  53. package/lib/components/Question.d.ts +57 -0
  54. package/lib/components/Question.js +72 -0
  55. package/lib/components/RadioButton.d.ts +42 -0
  56. package/lib/components/RadioButton.js +53 -0
  57. package/lib/components/RadioGroup.d.ts +44 -0
  58. package/lib/components/RadioGroup.js +64 -0
  59. package/lib/components/RangeDatePicker.d.ts +57 -0
  60. package/lib/components/RangeDatePicker.js +126 -0
  61. package/lib/components/RangeDatePicker.web.d.ts +61 -0
  62. package/lib/components/RangeDatePicker.web.js +119 -0
  63. package/lib/components/Space.d.ts +11 -0
  64. package/lib/components/Space.js +14 -0
  65. package/lib/components/StatusBar.d.ts +11 -0
  66. package/lib/components/StatusBar.js +27 -0
  67. package/lib/components/Switch.d.ts +34 -0
  68. package/lib/components/Switch.js +49 -0
  69. package/lib/components/Table.d.ts +28 -0
  70. package/lib/components/Table.js +62 -0
  71. package/lib/components/Table.web.d.ts +18 -0
  72. package/lib/components/Table.web.js +108 -0
  73. package/lib/components/Text.d.ts +28 -0
  74. package/lib/components/Text.js +36 -0
  75. package/lib/components/TextBox.d.ts +115 -0
  76. package/lib/components/TextBox.js +103 -0
  77. package/lib/components/TextBoxMask.d.ts +12 -0
  78. package/lib/components/TextBoxMask.js +29 -0
  79. package/lib/components/TimePicker.d.ts +63 -0
  80. package/lib/components/TimePicker.js +111 -0
  81. package/lib/components/TimePicker.web.d.ts +48 -0
  82. package/lib/components/TimePicker.web.js +82 -0
  83. package/lib/index.d.ts +39 -0
  84. package/lib/index.js +44 -0
  85. package/lib/modules/browser.d.ts +2 -0
  86. package/lib/modules/browser.js +50 -0
  87. package/lib/modules/format.d.ts +6 -0
  88. package/lib/modules/format.js +99 -0
  89. package/lib/modules/layout.d.ts +1 -0
  90. package/lib/modules/layout.js +10 -0
  91. package/lib/modules/theme.d.ts +41 -0
  92. package/lib/modules/theme.js +49 -0
  93. package/lib/modules/validation.d.ts +3 -0
  94. package/lib/modules/validation.js +12 -0
  95. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const theme_1 = require("../modules/theme");
5
+ const react_native_1 = require("react-native");
6
+ class StatusBar extends React.Component {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.getStyles = () => {
10
+ const theme = theme_1.getTheme();
11
+ const styles = react_native_1.StyleSheet.create({
12
+ statusBar: {
13
+ backgroundColor: theme.statusBarColor,
14
+ height: react_native_1.StatusBar.currentHeight || 20
15
+ }
16
+ });
17
+ return styles;
18
+ };
19
+ }
20
+ render() {
21
+ const styles = this.getStyles();
22
+ return (React.createElement(react_native_1.View, { style: styles.statusBar },
23
+ React.createElement(react_native_1.StatusBar, { backgroundColor: "transparent", barStyle: "light-content", translucent: true })));
24
+ }
25
+ }
26
+ StatusBar.height = react_native_1.StatusBar.currentHeight || 20;
27
+ exports.StatusBar = StatusBar;
@@ -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,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const theme_1 = require("../modules/theme");
6
+ const layout_1 = require("../modules/layout");
7
+ class Switch extends React.Component {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.getStyles = () => {
11
+ const theme = theme_1.getTheme();
12
+ const styles = react_native_1.StyleSheet.create({
13
+ container: {
14
+ paddingHorizontal: 16,
15
+ paddingVertical: 8,
16
+ borderWidth: 1,
17
+ borderColor: theme.borderColor1,
18
+ borderRadius: 3,
19
+ flexDirection: 'row',
20
+ alignItems: 'center',
21
+ justifyContent: 'space-between'
22
+ },
23
+ label: {
24
+ color: theme.textColor2,
25
+ fontFamily: theme.fontFamily2,
26
+ fontSize: layout_1.isTablet() ? 15 : 12,
27
+ lineHeight: 16
28
+ },
29
+ readonly: {
30
+ backgroundColor: theme.disabledColor
31
+ }
32
+ });
33
+ return styles;
34
+ };
35
+ }
36
+ render() {
37
+ const { label, value, onChange, style, labelStyle, disabled } = this.props;
38
+ const styles = this.getStyles();
39
+ return (React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: () => {
40
+ if (onChange) {
41
+ onChange(!value);
42
+ }
43
+ } },
44
+ React.createElement(react_native_1.View, { style: [styles.container, style, disabled ? styles.readonly : null] },
45
+ label && React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label),
46
+ React.createElement(react_native_1.Switch, { disabled: disabled, value: value, onValueChange: onChange }))));
47
+ }
48
+ }
49
+ exports.Switch = Switch;
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+ export interface TableColumn {
4
+ key: string;
5
+ title: string;
6
+ headerStyle?: StyleProp<TextStyle>;
7
+ style?: StyleProp<TextStyle>;
8
+ type: 'text' | 'icon' | 'checkbox';
9
+ }
10
+ export interface TableCellStyle {
11
+ [id: string]: {
12
+ [column: string]: StyleProp<TextStyle>;
13
+ };
14
+ }
15
+ export interface TableProperties {
16
+ columns: Array<TableColumn>;
17
+ subHeaderData?: Array<TableColumn>;
18
+ data: Array<any>;
19
+ idAttribute: string;
20
+ style?: StyleProp<ViewStyle>;
21
+ cellStyle?: TableCellStyle;
22
+ nativeID?: string;
23
+ onSelect?: (name: string, value: boolean) => void;
24
+ onSelectAll?: (value: boolean) => void;
25
+ }
26
+ export declare class Table extends React.Component<TableProperties> {
27
+ render(): JSX.Element;
28
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
5
+ const theme_1 = require("../modules/theme");
6
+ const react_native_1 = require("react-native");
7
+ const CheckBox_1 = require("./CheckBox");
8
+ class Table extends React.Component {
9
+ render() {
10
+ const { columns, data, idAttribute, style, cellStyle, nativeID, onSelect, onSelectAll } = this.props;
11
+ return (React.createElement(react_native_1.ScrollView, { horizontal: true },
12
+ React.createElement(react_native_1.View, { nativeID: nativeID, style: style },
13
+ React.createElement(react_native_1.View, { style: styles.row }, columns.map(column => {
14
+ return column.type === 'checkbox' ? (React.createElement(CheckBox_1.CheckBox, { key: column.key, style: { marginLeft: 8 }, value: data.every(x => x.selected) || false, onChange: value => onSelectAll && onSelectAll(value) })) : (React.createElement(react_native_1.Text, { key: column.key, style: [
15
+ styles.cell,
16
+ styles.cellHeader,
17
+ column.style,
18
+ column.headerStyle
19
+ ] }, column.title));
20
+ })),
21
+ data.map((row, rowIndex) => (React.createElement(react_native_1.View, { key: row[idAttribute].toString(), style: [
22
+ styles.row,
23
+ {
24
+ backgroundColor: rowIndex % 2 === 0
25
+ ? theme.backgroundColor2
26
+ : theme.backgroundColor1
27
+ }
28
+ ] }, columns.map(column => {
29
+ const style = cellStyle &&
30
+ cellStyle[row[idAttribute].toString()] &&
31
+ cellStyle[row[idAttribute].toString()][column.key];
32
+ return column.type === 'icon' ? (React.createElement(FontAwesome_1.default, { key: column.key, name: row[column.key].toString(), style: [styles.cellIcon, style, column.style] })) : column.type === 'checkbox' ? (React.createElement(CheckBox_1.CheckBox, { key: column.key, style: { marginLeft: 8 }, value: row.selected || false, onChange: value => onSelect && onSelect(row[column.key].toString(), value) })) : (React.createElement(react_native_1.Text, { key: column.key, style: [styles.cell, style, column.style] }, row[column.key].toString()));
33
+ })))))));
34
+ }
35
+ }
36
+ exports.Table = Table;
37
+ const theme = theme_1.getTheme();
38
+ const styles = react_native_1.StyleSheet.create({
39
+ row: {
40
+ flexDirection: 'row',
41
+ alignItems: 'center',
42
+ paddingVertical: 8,
43
+ minHeight: 45
44
+ },
45
+ cell: {
46
+ fontFamily: theme.fontFamily2,
47
+ fontSize: 14,
48
+ marginLeft: 8,
49
+ lineHeight: 18,
50
+ color: theme.textColor1
51
+ },
52
+ cellHeader: {
53
+ fontFamily: theme.fontFamily1,
54
+ color: theme.textColor1
55
+ },
56
+ cellIcon: {
57
+ fontSize: 24,
58
+ marginLeft: 8,
59
+ textAlign: 'center',
60
+ textAlignVertical: 'center'
61
+ }
62
+ });
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import { TableProperties, TableColumn } from './Table';
3
+ interface State {
4
+ leftHeader: number;
5
+ }
6
+ interface Props {
7
+ heightContainer: number;
8
+ }
9
+ export declare class Table extends React.Component<Props & TableProperties, State> {
10
+ state: State;
11
+ static defaultProps: {
12
+ heightContainer: number;
13
+ };
14
+ renderHeaderTable: (headerData: TableColumn[]) => JSX.Element;
15
+ renderDataTable: () => JSX.Element;
16
+ render(): JSX.Element;
17
+ }
18
+ export {};
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
5
+ const theme_1 = require("../modules/theme");
6
+ const react_native_1 = require("react-native");
7
+ const browser_1 = require("../modules/browser");
8
+ const CheckBox_1 = require("./CheckBox");
9
+ class Table extends React.Component {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.state = {
13
+ leftHeader: 0
14
+ };
15
+ this.renderHeaderTable = (headerData) => {
16
+ const { onSelectAll, data, nativeID } = this.props;
17
+ const { leftHeader } = this.state;
18
+ return (React.createElement("div", { style: {
19
+ overflow: 'hidden',
20
+ position: 'relative',
21
+ height: 45
22
+ } },
23
+ React.createElement("div", { style: {
24
+ flexDirection: 'row',
25
+ alignItems: 'center',
26
+ paddingBottom: 8,
27
+ minHeight: 45,
28
+ position: 'absolute',
29
+ left: leftHeader,
30
+ display: 'flex',
31
+ paddingTop: browser_1.ehIE() ? 15 : 0
32
+ } }, headerData.map((column, index) => {
33
+ const headerId = nativeID && `${nativeID}-header-${index + 1}`;
34
+ return column.type === 'checkbox' ? (React.createElement(CheckBox_1.CheckBox, { nativeID: headerId, key: column.key, style: { marginLeft: 8 }, value: data.every(x => x.selected) || false, onChange: value => onSelectAll && onSelectAll(value) })) : (React.createElement(react_native_1.Text, { nativeID: headerId, key: column.key, style: [
35
+ styles.cell,
36
+ styles.cellHeader,
37
+ column.style,
38
+ column.headerStyle
39
+ ] }, column.title));
40
+ }))));
41
+ };
42
+ this.renderDataTable = () => {
43
+ const { columns, data, idAttribute, cellStyle, heightContainer, subHeaderData, onSelect, nativeID } = this.props;
44
+ const height = subHeaderData ? heightContainer - 45 : heightContainer;
45
+ return (React.createElement("div", { style: {
46
+ height,
47
+ display: 'flex',
48
+ overflowX: 'scroll',
49
+ overflowY: 'scroll'
50
+ }, onScroll: (event) => {
51
+ this.setState({ leftHeader: event ? -event.target.scrollLeft : 0 });
52
+ } },
53
+ React.createElement("div", null,
54
+ React.createElement(react_native_1.FlatList, { data: data, keyExtractor: item => item.id.toString(), renderItem: ({ item, index }) => (React.createElement(react_native_1.View, { key: index, style: [
55
+ styles.row,
56
+ {
57
+ backgroundColor: index % 2 === 0
58
+ ? theme.backgroundColor2
59
+ : theme.backgroundColor1
60
+ }
61
+ ] }, columns.map((column, columnIndex) => {
62
+ const style = cellStyle &&
63
+ cellStyle[item[idAttribute].toString()] &&
64
+ cellStyle[item[idAttribute].toString()][column.key];
65
+ const cellID = nativeID && `${nativeID}-${index + 1}-${columnIndex + 1}`;
66
+ return column.type === 'icon' ? (React.createElement(FontAwesome_1.default, { nativeID: cellID, key: column.key, name: item[column.key].toString(), style: [styles.cellIcon, style, column.style] })) : column.type === 'checkbox' ? (React.createElement(CheckBox_1.CheckBox, { nativeID: cellID, key: column.key, style: { marginLeft: 8 }, value: item.selected || false, onChange: value => onSelect && onSelect(item[column.key].toString(), value) })) : (React.createElement(react_native_1.Text, { nativeID: cellID, key: column.key, style: [styles.cell, style, column.style] }, item[column.key].toString()));
67
+ }))) }))));
68
+ };
69
+ }
70
+ render() {
71
+ const { columns, nativeID, subHeaderData } = this.props;
72
+ return (React.createElement(react_native_1.View, { nativeID: nativeID },
73
+ this.renderHeaderTable(columns),
74
+ subHeaderData && this.renderHeaderTable(subHeaderData),
75
+ this.renderDataTable()));
76
+ }
77
+ }
78
+ Table.defaultProps = {
79
+ //Top = 60px, padding = 16px, filters = 143px, padding = 16px, header = 45px, padding = 16
80
+ heightContainer: react_native_1.Dimensions.get('window').height - 296
81
+ };
82
+ exports.Table = Table;
83
+ const theme = theme_1.getTheme();
84
+ const styles = react_native_1.StyleSheet.create({
85
+ row: {
86
+ flexDirection: 'row',
87
+ alignItems: 'center',
88
+ paddingVertical: 8,
89
+ minHeight: 45
90
+ },
91
+ cell: {
92
+ fontFamily: theme.fontFamily2,
93
+ fontSize: 14,
94
+ marginLeft: 8,
95
+ lineHeight: 18,
96
+ color: theme.textColor1
97
+ },
98
+ cellHeader: {
99
+ fontFamily: theme.fontFamily1,
100
+ color: theme.textColor1
101
+ },
102
+ cellIcon: {
103
+ fontSize: 24,
104
+ marginLeft: 8,
105
+ textAlign: 'center',
106
+ textAlignVertical: 'center'
107
+ }
108
+ });
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, TextStyle } from 'react-native';
3
+ export interface TextProperties {
4
+ style?: StyleProp<TextStyle>;
5
+ bold: boolean;
6
+ size: number;
7
+ flex?: number;
8
+ color: string;
9
+ align?: 'auto' | 'left' | 'right' | 'center' | 'justify';
10
+ nativeID?: string;
11
+ }
12
+ export declare class Text extends React.Component<TextProperties> {
13
+ getStyles: () => {
14
+ text: {
15
+ color: string;
16
+ flex: number | undefined;
17
+ fontSize: number;
18
+ textAlign: "left" | "right" | "center" | "auto" | "justify" | undefined;
19
+ fontFamily: string;
20
+ };
21
+ };
22
+ static defaultProps: {
23
+ bold: boolean;
24
+ size: number;
25
+ color: string;
26
+ };
27
+ render(): JSX.Element;
28
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const theme_1 = require("../modules/theme");
6
+ const theme = theme_1.getTheme();
7
+ class Text extends React.Component {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.getStyles = () => {
11
+ const { bold, color, size, flex, align } = this.props;
12
+ const theme = theme_1.getTheme();
13
+ const styles = react_native_1.StyleSheet.create({
14
+ text: {
15
+ color,
16
+ flex,
17
+ fontSize: size,
18
+ textAlign: align,
19
+ fontFamily: bold ? theme.fontFamily1 : theme.fontFamily2
20
+ }
21
+ });
22
+ return styles;
23
+ };
24
+ }
25
+ render() {
26
+ const { style, children, nativeID } = this.props;
27
+ const textStyle = this.getStyles();
28
+ return (React.createElement(react_native_1.Text, { nativeID: nativeID, style: [textStyle.text, style] }, children));
29
+ }
30
+ }
31
+ Text.defaultProps = {
32
+ bold: false,
33
+ size: 14,
34
+ color: theme.textColor1
35
+ };
36
+ exports.Text = Text;
@@ -0,0 +1,115 @@
1
+ import * as React from 'react';
2
+ import { KeyboardType, StyleProp, TextInput, TextInputKeyPressEventData, TextStyle, ViewStyle, TextInputProps, ReturnKeyTypeOptions } from 'react-native';
3
+ export interface TextBoxInputProps extends TextInputProps {
4
+ ref: (ref: TextInput) => void;
5
+ }
6
+ export interface TextBoxProperties {
7
+ autoFocus?: boolean;
8
+ label?: string;
9
+ icon?: string;
10
+ placeholder?: string;
11
+ value: string;
12
+ onChange?: (value: string) => void;
13
+ onKeyPress?: (nativeEvent: TextInputKeyPressEventData) => void;
14
+ onBlur?: () => void;
15
+ renderInput?: (props: TextBoxInputProps) => JSX.Element;
16
+ onSubmitEditing?: () => void;
17
+ inputRef?: (value: TextInput) => void;
18
+ secureTextEntry?: boolean;
19
+ multiline?: boolean;
20
+ keyboardType?: KeyboardType;
21
+ style?: StyleProp<ViewStyle>;
22
+ labelStyle?: StyleProp<TextStyle>;
23
+ inputStyle?: StyleProp<TextStyle>;
24
+ editable?: boolean;
25
+ autoCorrect?: boolean;
26
+ maxLength?: number;
27
+ autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
28
+ returnKeyType?: ReturnKeyTypeOptions;
29
+ blurOnSubmit?: boolean;
30
+ nativeID?: string;
31
+ selection?: {
32
+ start: number;
33
+ end?: number;
34
+ };
35
+ }
36
+ export declare class TextBox extends React.Component<TextBoxProperties> {
37
+ input: TextInput | null;
38
+ static defaultProps: {
39
+ editable: boolean;
40
+ autoCorrect: boolean;
41
+ blurOnSubmit: boolean;
42
+ };
43
+ getStyles: () => {
44
+ container: {
45
+ flexDirection: "row";
46
+ paddingHorizontal: number;
47
+ paddingVertical: number;
48
+ borderWidth: number;
49
+ borderColor: string;
50
+ borderRadius: number;
51
+ } | {
52
+ paddingHorizontal: number;
53
+ paddingVertical: number;
54
+ borderWidth: number;
55
+ borderColor: string;
56
+ borderRadius: number;
57
+ };
58
+ icon: {
59
+ color: string;
60
+ fontSize: number;
61
+ marginRight: number;
62
+ alignSelf: "center";
63
+ minHeight: number;
64
+ };
65
+ label: {
66
+ color: string;
67
+ fontFamily: string;
68
+ fontSize: number;
69
+ lineHeight: number;
70
+ };
71
+ input: {
72
+ flex: number;
73
+ outline: string;
74
+ color: string;
75
+ fontFamily: string;
76
+ fontWeight: "normal";
77
+ fontSize: number;
78
+ minHeight: number;
79
+ padding: number;
80
+ margin: number;
81
+ } | {
82
+ outline: string;
83
+ color: string;
84
+ fontFamily: string;
85
+ fontWeight: "normal";
86
+ fontSize: number;
87
+ minHeight: number;
88
+ padding: number;
89
+ margin: number;
90
+ } | {
91
+ flex: number;
92
+ color: string;
93
+ fontFamily: string;
94
+ fontWeight: "normal";
95
+ fontSize: number;
96
+ minHeight: number;
97
+ padding: number;
98
+ margin: number;
99
+ } | {
100
+ color: string;
101
+ fontFamily: string;
102
+ fontWeight: "normal";
103
+ fontSize: number;
104
+ minHeight: number;
105
+ padding: number;
106
+ margin: number;
107
+ };
108
+ readonly: {
109
+ backgroundColor: string;
110
+ };
111
+ };
112
+ focus: () => void;
113
+ renderInput: (props: TextInputProps) => JSX.Element;
114
+ render(): JSX.Element;
115
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const theme_1 = require("../modules/theme");
5
+ const layout_1 = require("../modules/layout");
6
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
+ const react_native_1 = require("react-native");
8
+ class TextBox extends React.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.input = null;
12
+ this.getStyles = () => {
13
+ const theme = theme_1.getTheme();
14
+ const { icon } = this.props;
15
+ const styles = react_native_1.StyleSheet.create({
16
+ container: Object.assign({ paddingHorizontal: 16, paddingVertical: 8, borderWidth: 1, borderColor: theme.borderColor1, borderRadius: 3 }, (icon ? { flexDirection: 'row' } : {})),
17
+ icon: {
18
+ color: theme.textColor2,
19
+ fontSize: layout_1.isTablet() ? 21 : 19,
20
+ marginRight: 10,
21
+ alignSelf: 'center',
22
+ minHeight: 22
23
+ },
24
+ label: {
25
+ color: theme.textColor2,
26
+ fontFamily: theme.fontFamily3,
27
+ fontSize: layout_1.isTablet() ? 15 : 12,
28
+ lineHeight: 16
29
+ },
30
+ input: Object.assign({ color: theme.textColor1, fontFamily: this.props.value ? theme.fontFamily1 : theme.fontFamily3, fontWeight: 'normal', fontSize: 16, minHeight: 22, padding: 0, margin: 0 }, (react_native_1.Platform.OS === 'web' ? { outline: 'none' } : {}), (icon ? { flex: 1 } : {})),
31
+ readonly: {
32
+ backgroundColor: theme.disabledColor
33
+ }
34
+ });
35
+ return styles;
36
+ };
37
+ this.focus = () => {
38
+ if (this.input && this.props.editable) {
39
+ this.input.focus();
40
+ }
41
+ };
42
+ this.renderInput = (props) => React.createElement(react_native_1.TextInput, Object.assign({}, props));
43
+ }
44
+ render() {
45
+ const { label, style, labelStyle, editable, inputRef, renderInput, icon } = this.props;
46
+ const styles = this.getStyles();
47
+ const incomingProps = {
48
+ nativeID: this.props.nativeID,
49
+ autoFocus: this.props.autoFocus,
50
+ value: this.props.value,
51
+ onChangeText: this.props.onChange,
52
+ onBlur: this.props.onBlur,
53
+ style: [
54
+ styles.input,
55
+ this.props.inputStyle,
56
+ this.props.editable ? null : styles.readonly
57
+ ],
58
+ underlineColorAndroid: 'transparent',
59
+ //@ts-ignore: no Android < 6 essa é a prop que deixa o underline transparente. https://stackoverflow.com/questions/40478246/remove-underline-in-inputtext-in-react-native
60
+ borderWidth: 0,
61
+ placeholder: this.props.placeholder,
62
+ secureTextEntry: this.props.secureTextEntry,
63
+ multiline: this.props.multiline,
64
+ editable: this.props.editable,
65
+ keyboardType: this.props.keyboardType,
66
+ maxLength: this.props.maxLength,
67
+ onSubmitEditing: this.props.onSubmitEditing,
68
+ autoCapitalize: this.props.autoCapitalize,
69
+ autoCorrect: this.props.autoCorrect,
70
+ returnKeyType: react_native_1.Platform.OS === 'ios' &&
71
+ this.props.keyboardType === 'numeric' &&
72
+ this.props.returnKeyType === 'next'
73
+ ? 'done'
74
+ : this.props.returnKeyType,
75
+ ref: (input) => {
76
+ this.input = input;
77
+ if (inputRef)
78
+ inputRef(input);
79
+ },
80
+ selection: this.props.selection,
81
+ onKeyPress: (event) => {
82
+ if (!this.props.onKeyPress) {
83
+ return;
84
+ }
85
+ this.props.onKeyPress(react_native_1.Platform.OS === 'web' ? event : event.nativeEvent);
86
+ }
87
+ };
88
+ return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, onPress: () => {
89
+ this.focus();
90
+ } },
91
+ React.createElement(react_native_1.View, { style: [styles.container, style, editable ? null : styles.readonly] },
92
+ icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.icon })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
93
+ renderInput
94
+ ? renderInput(incomingProps)
95
+ : this.renderInput(incomingProps))));
96
+ }
97
+ }
98
+ TextBox.defaultProps = {
99
+ editable: true,
100
+ autoCorrect: false,
101
+ blurOnSubmit: true
102
+ };
103
+ exports.TextBox = TextBox;
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { TextBoxProperties } from './TextBox';
3
+ import { TextInputMaskTypeProp, TextInputMaskOptionProp } from 'react-native-masked-text';
4
+ export declare type MaskType = TextInputMaskTypeProp;
5
+ export declare type MaskOptions = TextInputMaskOptionProp;
6
+ export interface TextBoxMaskProperties extends TextBoxProperties {
7
+ type: MaskType;
8
+ options?: MaskOptions;
9
+ }
10
+ export declare class TextBoxMask extends React.Component<TextBoxMaskProperties> {
11
+ render(): JSX.Element;
12
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
8
+ t[p[i]] = s[p[i]];
9
+ return t;
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const React = require("react");
13
+ const TextBox_1 = require("./TextBox");
14
+ const react_native_1 = require("react-native");
15
+ const react_native_masked_text_1 = require("react-native-masked-text");
16
+ class TextBoxMask extends React.Component {
17
+ render() {
18
+ const _a = this.props, { type, options } = _a, textBoxProps = __rest(_a, ["type", "options"]);
19
+ return (React.createElement(TextBox_1.TextBox, Object.assign({}, textBoxProps, { renderInput: props => {
20
+ const { ref } = props, otherProps = __rest(props, ["ref"]);
21
+ return react_native_1.Platform.OS === 'web' ? (
22
+ // @ts-ignore :Waiting for typing https://github.com/benhurott/react-native-masked-text/pull/74
23
+ React.createElement(react_native_masked_text_1.TextInputMask, Object.assign({}, otherProps, { type: type, options: options }))) : (
24
+ // @ts-ignore :Waiting for typing https://github.com/benhurott/react-native-masked-text/pull/74
25
+ React.createElement(react_native_masked_text_1.TextInputMask, Object.assign({}, otherProps, { refInput: ref, type: type, options: options })));
26
+ } })));
27
+ }
28
+ }
29
+ exports.TextBoxMask = TextBoxMask;