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,24 @@
1
+ import * as React from 'react';
2
+ import { HeaderButton } from './Header';
3
+ import { GreetingMessage } from './HeaderDesktop';
4
+ import { MenuProperties } from './Menu';
5
+ import { MenuMobile } from './MenuMobile';
6
+ import { StyleProp, TextStyle } from 'react-native';
7
+ export declare type AppShellProperties = MenuProperties & {
8
+ logoHeader: () => React.ReactNode;
9
+ logoMenu: () => React.ReactNode;
10
+ title?: string;
11
+ greeting?: GreetingMessage;
12
+ screenTitle: string;
13
+ renderUserData?: () => React.ReactNode;
14
+ rightButton?: HeaderButton;
15
+ headerStyle?: StyleProp<TextStyle>;
16
+ };
17
+ export declare class AppShell extends React.Component<AppShellProperties> {
18
+ menu: MenuMobile | null;
19
+ getMobileStyles: () => any;
20
+ getDesktopStyles: () => any;
21
+ renderMobile: () => JSX.Element;
22
+ renderDesktop: () => JSX.Element;
23
+ render(): JSX.Element;
24
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const DimensionsMonitor_1 = require("./DimensionsMonitor");
5
+ const Header_1 = require("./Header");
6
+ const HeaderDesktop_1 = require("./HeaderDesktop");
7
+ const MenuMobile_1 = require("./MenuMobile");
8
+ const MenuDesktop_1 = require("./MenuDesktop");
9
+ const theme_1 = require("../modules/theme");
10
+ const react_native_1 = require("react-native");
11
+ class AppShell extends React.Component {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.menu = null;
15
+ this.getMobileStyles = () => {
16
+ const theme = theme_1.getTheme();
17
+ const styles = react_native_1.StyleSheet.create({
18
+ container: {
19
+ flex: 1,
20
+ padding: 16,
21
+ height: react_native_1.Dimensions.get('window').height - HeaderDesktop_1.HeaderDesktop.height,
22
+ // @ts-ignore: O react-native não tem auto, mas o react-native-web aceita
23
+ overflow: 'auto'
24
+ },
25
+ logoText: {
26
+ color: theme.textColor1,
27
+ fontFamily: theme.fontFamily3,
28
+ fontSize: 22,
29
+ marginLeft: 10,
30
+ display: 'flex',
31
+ alignItems: 'center'
32
+ }
33
+ });
34
+ return styles;
35
+ };
36
+ this.getDesktopStyles = () => {
37
+ const styles = react_native_1.StyleSheet.create({
38
+ container: {
39
+ flexDirection: 'row',
40
+ flex: 1
41
+ },
42
+ content: {
43
+ flex: 1,
44
+ padding: 16,
45
+ height: react_native_1.Dimensions.get('window').height - HeaderDesktop_1.HeaderDesktop.height,
46
+ // @ts-ignore: O react-native não tem auto, mas o react-native-web aceita
47
+ overflow: 'auto'
48
+ }
49
+ });
50
+ return styles;
51
+ };
52
+ this.renderMobile = () => {
53
+ const { title, logoMenu, screenTitle, renderUserData, menu, onMenuPress, isCurrentMenuPath, children, rightButton } = this.props;
54
+ const styles = this.getMobileStyles();
55
+ return (React.createElement(MenuMobile_1.MenuMobile, { ref: ref => (this.menu = ref), menu: menu, onMenuPress: onMenuPress, isCurrentMenuPath: isCurrentMenuPath, renderLogo: () => (React.createElement(React.Fragment, null,
56
+ logoMenu(),
57
+ title && React.createElement(react_native_1.Text, { style: styles.logoText }, title))), renderUserData: renderUserData },
58
+ React.createElement(Header_1.Header, { title: screenTitle, leftButton: {
59
+ nativeID: 'menu-hamburguer',
60
+ icon: 'bars',
61
+ onPress: () => this.menu.open()
62
+ }, rightButton: rightButton }),
63
+ React.createElement(react_native_1.View, { style: styles.container }, children)));
64
+ };
65
+ this.renderDesktop = () => {
66
+ const { title, logoHeader, greeting, menu, onMenuPress, isCurrentMenuPath, children, rightButton, renderUserData, headerStyle } = this.props;
67
+ const styles = this.getDesktopStyles();
68
+ return (React.createElement(React.Fragment, null,
69
+ React.createElement(HeaderDesktop_1.HeaderDesktop, { title: title, logo: logoHeader, greeting: greeting, rightButton: rightButton, headerStyle: headerStyle }),
70
+ React.createElement(react_native_1.View, { style: styles.container },
71
+ React.createElement(MenuDesktop_1.MenuDesktop, { menu: menu, headerHeight: HeaderDesktop_1.HeaderDesktop.height, onMenuPress: onMenuPress, isCurrentMenuPath: isCurrentMenuPath, renderUserData: renderUserData }),
72
+ React.createElement(react_native_1.View, { nativeID: "app-shell-desktop-content", style: styles.content }, children))));
73
+ };
74
+ }
75
+ render() {
76
+ return (React.createElement(DimensionsMonitor_1.DimensionsMonitor, null, ({ isDesktop }) => isDesktop ? this.renderDesktop() : this.renderMobile()));
77
+ }
78
+ }
79
+ exports.AppShell = AppShell;
@@ -0,0 +1,47 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native';
3
+ export interface ButtonProperties {
4
+ text: string;
5
+ primary?: boolean;
6
+ style?: StyleProp<ViewStyle>;
7
+ textStyle?: StyleProp<TextStyle>;
8
+ onPress: () => void;
9
+ disabled?: boolean;
10
+ nativeID?: string;
11
+ }
12
+ export declare class Button extends React.Component<ButtonProperties> {
13
+ static defaultProps: {
14
+ primary: boolean;
15
+ };
16
+ getStyles: () => {
17
+ touchable: {
18
+ backgroundColor: string;
19
+ borderColor: string;
20
+ borderWidth: number;
21
+ borderRadius: number;
22
+ height: number;
23
+ alignItems: "center";
24
+ justifyContent: "center";
25
+ };
26
+ touchablePrimary: {
27
+ backgroundColor: string;
28
+ borderWidth: number;
29
+ };
30
+ text: {
31
+ fontFamily: string;
32
+ fontSize: number;
33
+ paddingHorizontal: number;
34
+ color: string;
35
+ };
36
+ textPrimary: {
37
+ color: string;
38
+ };
39
+ disabled: {
40
+ backgroundColor: string;
41
+ };
42
+ textDisabled: {
43
+ color: string;
44
+ };
45
+ };
46
+ render(): JSX.Element;
47
+ }
@@ -0,0 +1,65 @@
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
+ const layout_1 = require("../modules/layout");
7
+ class Button 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
+ touchable: {
14
+ backgroundColor: theme.backgroundColor1,
15
+ borderColor: theme.borderColor1,
16
+ borderWidth: 1,
17
+ borderRadius: 3,
18
+ height: layout_1.isTablet() ? 45 : 40,
19
+ alignItems: 'center',
20
+ justifyContent: 'center'
21
+ },
22
+ touchablePrimary: {
23
+ backgroundColor: theme.backgroundColor3,
24
+ borderWidth: 0
25
+ },
26
+ text: {
27
+ fontFamily: theme.fontFamily1,
28
+ fontSize: layout_1.isTablet() ? 18 : 13,
29
+ paddingHorizontal: 11,
30
+ color: theme.textColor1
31
+ },
32
+ textPrimary: {
33
+ color: theme.textColor4
34
+ },
35
+ disabled: {
36
+ backgroundColor: theme.backgroundColor2
37
+ },
38
+ textDisabled: {
39
+ color: 'silver'
40
+ }
41
+ });
42
+ return styles;
43
+ };
44
+ }
45
+ render() {
46
+ const { text, primary, style, textStyle, onPress, disabled, nativeID } = this.props;
47
+ const styles = this.getStyles();
48
+ return (React.createElement(react_native_1.TouchableOpacity, { activeOpacity: 0.7, style: [
49
+ styles.touchable,
50
+ primary && styles.touchablePrimary,
51
+ style,
52
+ disabled && styles.disabled
53
+ ], onPress: onPress, disabled: disabled },
54
+ React.createElement(react_native_1.Text, { nativeID: nativeID, style: [
55
+ styles.text,
56
+ primary && styles.textPrimary,
57
+ textStyle,
58
+ disabled && styles.textDisabled
59
+ ] }, text)));
60
+ }
61
+ }
62
+ Button.defaultProps = {
63
+ primary: true
64
+ };
65
+ exports.Button = Button;
@@ -0,0 +1,65 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, TextStyle, ViewProperties, ViewStyle } from 'react-native';
3
+ export interface CardHeaderProperties {
4
+ title: string;
5
+ titleStyle?: StyleProp<TextStyle>;
6
+ containerStyle?: StyleProp<TextStyle>;
7
+ nativeID?: string;
8
+ numberOfLines?: number;
9
+ onHelpPress?: () => void;
10
+ }
11
+ export declare class CardHeader extends React.Component<CardHeaderProperties> {
12
+ getStyles: () => {
13
+ container: {
14
+ padding: number;
15
+ };
16
+ title: {
17
+ color: string;
18
+ fontFamily: string;
19
+ fontSize: number;
20
+ marginRight: number;
21
+ };
22
+ help: {
23
+ position: "absolute";
24
+ right: number;
25
+ top: number;
26
+ };
27
+ helpIcon: {
28
+ fontSize: number;
29
+ color: string;
30
+ };
31
+ };
32
+ render(): JSX.Element;
33
+ }
34
+ export declare class CardFooter extends React.Component<ViewProperties> {
35
+ render(): JSX.Element;
36
+ }
37
+ export declare class CardSection extends React.Component<ViewProperties> {
38
+ render(): JSX.Element;
39
+ }
40
+ export declare class CardModal extends React.Component<ViewProperties> {
41
+ render(): JSX.Element;
42
+ }
43
+ export interface CardProperties extends ViewProperties {
44
+ children: React.ReactNode;
45
+ style?: StyleProp<ViewStyle>;
46
+ }
47
+ export declare class Card extends React.Component<CardProperties> {
48
+ static Header: typeof CardHeader;
49
+ static Section: typeof CardSection;
50
+ static Footer: typeof CardFooter;
51
+ static Modal: typeof CardModal;
52
+ getStyles: () => {
53
+ container: {
54
+ borderRadius: number;
55
+ backgroundColor: string;
56
+ shadowOpacity: number;
57
+ shadowRadius: number;
58
+ };
59
+ cardChild: {
60
+ borderTopColor: string;
61
+ borderTopWidth: number;
62
+ };
63
+ };
64
+ render(): JSX.Element;
65
+ }
@@ -0,0 +1,125 @@
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 react_native_elevated_view_1 = require("react-native-elevated-view");
14
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
15
+ const theme_1 = require("../modules/theme");
16
+ const layout_1 = require("../modules/layout");
17
+ const react_native_1 = require("react-native");
18
+ class CardHeader extends React.Component {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.getStyles = () => {
22
+ const theme = theme_1.getTheme();
23
+ const styles = react_native_1.StyleSheet.create({
24
+ container: {
25
+ padding: 16
26
+ },
27
+ title: {
28
+ color: theme.textColor1,
29
+ fontFamily: theme.fontFamily1,
30
+ fontSize: layout_1.isTablet() ? 22 : 18,
31
+ marginRight: 10
32
+ },
33
+ help: {
34
+ position: 'absolute',
35
+ right: 5,
36
+ top: 5
37
+ },
38
+ helpIcon: {
39
+ fontSize: layout_1.isTablet() ? 24 : 20,
40
+ color: '#6d819c'
41
+ }
42
+ });
43
+ return styles;
44
+ };
45
+ }
46
+ render() {
47
+ const { title, titleStyle, onHelpPress, nativeID, containerStyle, numberOfLines } = this.props;
48
+ const styles = this.getStyles();
49
+ return (React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, containerStyle] },
50
+ React.createElement(react_native_1.Text, { style: [styles.title, titleStyle], numberOfLines: numberOfLines }, title),
51
+ onHelpPress && (React.createElement(react_native_1.TouchableOpacity, { onPress: onHelpPress, style: styles.help },
52
+ React.createElement(FontAwesome_1.default, { name: "question-circle", style: styles.helpIcon })))));
53
+ }
54
+ }
55
+ exports.CardHeader = CardHeader;
56
+ class CardFooter extends React.Component {
57
+ render() {
58
+ const _a = this.props, { children } = _a, otherProps = __rest(_a, ["children"]);
59
+ return (React.createElement(react_native_1.View, Object.assign({ style: [cardFooterStyles.container] }, otherProps), children));
60
+ }
61
+ }
62
+ exports.CardFooter = CardFooter;
63
+ class CardSection extends React.Component {
64
+ render() {
65
+ const _a = this.props, { children, style } = _a, otherProps = __rest(_a, ["children", "style"]);
66
+ return (React.createElement(react_native_1.View, Object.assign({ style: [cardSectionStyles.container, style] }, otherProps), children));
67
+ }
68
+ }
69
+ exports.CardSection = CardSection;
70
+ class CardModal extends React.Component {
71
+ render() {
72
+ const _a = this.props, { children, style } = _a, otherProps = __rest(_a, ["children", "style"]);
73
+ return (React.createElement(react_native_1.TouchableOpacity, Object.assign({ activeOpacity: 1, style: [{ padding: 16 }, style] }, otherProps), children));
74
+ }
75
+ }
76
+ exports.CardModal = CardModal;
77
+ class Card extends React.Component {
78
+ constructor() {
79
+ super(...arguments);
80
+ this.getStyles = () => {
81
+ const theme = theme_1.getTheme();
82
+ const styles = react_native_1.StyleSheet.create({
83
+ container: {
84
+ borderRadius: 3,
85
+ backgroundColor: theme.backgroundColor1,
86
+ shadowOpacity: 0.15,
87
+ shadowRadius: 5
88
+ },
89
+ cardChild: {
90
+ borderTopColor: theme.borderColor1,
91
+ borderTopWidth: 1
92
+ }
93
+ });
94
+ return styles;
95
+ };
96
+ }
97
+ render() {
98
+ const _a = this.props, { children, style } = _a, otherProps = __rest(_a, ["children", "style"]);
99
+ const styles = this.getStyles();
100
+ const childrenMapped = React.Children.map(children, (child, index) => {
101
+ if (index === 0 || !child) {
102
+ return child;
103
+ }
104
+ return (React.createElement(React.Fragment, null,
105
+ React.createElement(react_native_1.View, { style: styles.cardChild }),
106
+ child));
107
+ });
108
+ return react_native_1.Platform.OS == 'web' ? (React.createElement(react_native_1.View, Object.assign({ style: [styles.container, style] }, otherProps), childrenMapped)) : (React.createElement(react_native_elevated_view_1.default, Object.assign({ elevation: 5, style: [styles.container, style] }, otherProps), childrenMapped));
109
+ }
110
+ }
111
+ Card.Header = CardHeader;
112
+ Card.Section = CardSection;
113
+ Card.Footer = CardFooter;
114
+ Card.Modal = CardModal;
115
+ exports.Card = Card;
116
+ const cardSectionStyles = react_native_1.StyleSheet.create({
117
+ container: {
118
+ padding: 16
119
+ }
120
+ });
121
+ const cardFooterStyles = react_native_1.StyleSheet.create({
122
+ container: {
123
+ padding: 16
124
+ }
125
+ });
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+ interface Props {
4
+ label?: string;
5
+ value: boolean;
6
+ onChange?: (value: boolean) => void;
7
+ disabled?: boolean;
8
+ style?: StyleProp<ViewStyle>;
9
+ renderLabel?: () => React.ReactNode;
10
+ labelStyle?: StyleProp<TextStyle>;
11
+ nativeID?: string;
12
+ }
13
+ export declare class CheckBox extends React.Component<Props> {
14
+ getStyles: () => {
15
+ container: {
16
+ flexDirection: "row";
17
+ alignItems: "center";
18
+ };
19
+ icon: {
20
+ color: string;
21
+ fontSize: number;
22
+ height: number;
23
+ width: number;
24
+ lineHeight: number;
25
+ };
26
+ label: {
27
+ color: string;
28
+ fontFamily: string;
29
+ fontSize: number;
30
+ };
31
+ };
32
+ render(): JSX.Element;
33
+ }
34
+ export {};
@@ -0,0 +1,46 @@
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 layout_1 = require("../modules/layout");
6
+ const theme_1 = require("../modules/theme");
7
+ const react_native_1 = require("react-native");
8
+ class CheckBox extends React.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.getStyles = () => {
12
+ const theme = theme_1.getTheme();
13
+ const { disabled } = this.props;
14
+ return react_native_1.StyleSheet.create({
15
+ container: {
16
+ flexDirection: 'row',
17
+ alignItems: 'center'
18
+ },
19
+ icon: {
20
+ color: disabled ? theme.disabledColor : theme.textColor1,
21
+ fontSize: 20,
22
+ height: 20,
23
+ width: 24,
24
+ lineHeight: 20
25
+ },
26
+ label: {
27
+ color: disabled ? theme.disabledColor : theme.textColor1,
28
+ fontFamily: theme.fontFamily3,
29
+ fontSize: layout_1.isTablet() ? 15 : 12
30
+ }
31
+ });
32
+ };
33
+ }
34
+ render() {
35
+ const { label, value, onChange, disabled, style, labelStyle, renderLabel, nativeID } = this.props;
36
+ const styles = this.getStyles();
37
+ return (React.createElement(react_native_1.TouchableOpacity, { style: [styles.container, style], disabled: disabled, onPress: () => {
38
+ if (onChange) {
39
+ onChange(!value);
40
+ }
41
+ } },
42
+ React.createElement(FontAwesome_1.default, { nativeID: nativeID, name: value ? 'check-square-o' : 'square-o', style: styles.icon }),
43
+ React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, renderLabel ? renderLabel() : label)));
44
+ }
45
+ }
46
+ exports.CheckBox = CheckBox;
@@ -0,0 +1,67 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ export interface DatePickerProperties {
4
+ label: string;
5
+ value?: Date;
6
+ clearable?: boolean;
7
+ onChange: (value?: Date) => void;
8
+ onCancel?: () => void;
9
+ style?: StyleProp<ViewStyle>;
10
+ nativeID?: string;
11
+ disabled?: boolean;
12
+ }
13
+ export interface DatePickerState {
14
+ showModal: boolean;
15
+ isDarkModeEnabled: boolean;
16
+ }
17
+ export declare class DatePicker extends React.Component<DatePickerProperties, DatePickerState> {
18
+ static defaultProps: {
19
+ clearable: boolean;
20
+ };
21
+ state: DatePickerState;
22
+ appearanceSubscription: any;
23
+ componentDidMount(): void;
24
+ componentWillUnmount(): void;
25
+ handlePress: () => void;
26
+ handleConfirm: (value: Date) => void;
27
+ handleCancel: () => void;
28
+ handleClear: () => void;
29
+ getStyles: () => {
30
+ container: {
31
+ paddingLeft: number;
32
+ paddingRight: number;
33
+ paddingVertical: number;
34
+ borderWidth: number;
35
+ borderColor: string;
36
+ borderRadius: number;
37
+ flexDirection: "row";
38
+ alignItems: "center";
39
+ };
40
+ label: {
41
+ color: string;
42
+ fontFamily: string;
43
+ fontSize: number;
44
+ lineHeight: number;
45
+ };
46
+ value: {
47
+ color: string;
48
+ fontFamily: string;
49
+ fontSize: number;
50
+ lineHeight: number;
51
+ minHeight: number;
52
+ };
53
+ calendarIcon: {
54
+ marginLeft: string;
55
+ color: string;
56
+ fontSize: number;
57
+ };
58
+ clearIcon: {
59
+ borderWidth: number;
60
+ marginLeft: string;
61
+ };
62
+ readonly: {
63
+ backgroundColor: string;
64
+ };
65
+ };
66
+ render(): JSX.Element;
67
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_appearance_1 = require("react-native-appearance");
5
+ const react_native_modal_datetime_picker_1 = require("react-native-modal-datetime-picker");
6
+ const format_1 = require("../modules/format");
7
+ const layout_1 = require("../modules/layout");
8
+ const theme_1 = require("../modules/theme");
9
+ const ImageButton_1 = require("./ImageButton");
10
+ const react_native_1 = require("react-native");
11
+ class DatePicker extends React.Component {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.state = {
15
+ showModal: false,
16
+ isDarkModeEnabled: react_native_appearance_1.Appearance.getColorScheme() === 'dark'
17
+ };
18
+ this.handlePress = () => {
19
+ this.setState({ showModal: true });
20
+ };
21
+ this.handleConfirm = (value) => {
22
+ this.setState({ showModal: false }, () => {
23
+ this.props.onChange(value);
24
+ });
25
+ };
26
+ this.handleCancel = () => {
27
+ this.setState({ showModal: false }, () => {
28
+ if (this.props.onCancel) {
29
+ this.props.onCancel();
30
+ }
31
+ });
32
+ };
33
+ this.handleClear = () => {
34
+ this.props.onChange(undefined);
35
+ };
36
+ this.getStyles = () => {
37
+ const theme = theme_1.getTheme();
38
+ const styles = react_native_1.StyleSheet.create({
39
+ container: {
40
+ paddingLeft: 16,
41
+ paddingRight: 4,
42
+ paddingVertical: 8,
43
+ borderWidth: 1,
44
+ borderColor: theme.borderColor1,
45
+ borderRadius: 3,
46
+ flexDirection: 'row',
47
+ alignItems: 'center'
48
+ },
49
+ label: {
50
+ color: theme.textColor2,
51
+ fontFamily: theme.fontFamily3,
52
+ fontSize: layout_1.isTablet() ? 15 : 12,
53
+ lineHeight: 16
54
+ },
55
+ value: {
56
+ color: theme.textColor1,
57
+ fontFamily: theme.fontFamily1,
58
+ fontSize: 16,
59
+ lineHeight: 22,
60
+ minHeight: 22
61
+ },
62
+ calendarIcon: {
63
+ marginLeft: 'auto',
64
+ color: theme.textColor2,
65
+ fontSize: 22
66
+ },
67
+ clearIcon: {
68
+ borderWidth: 0,
69
+ marginLeft: 'auto'
70
+ },
71
+ readonly: {
72
+ backgroundColor: theme.disabledColor
73
+ }
74
+ });
75
+ return styles;
76
+ };
77
+ }
78
+ componentDidMount() {
79
+ this.appearanceSubscription = react_native_appearance_1.Appearance.addChangeListener(({ colorScheme }) => {
80
+ this.setState({ isDarkModeEnabled: colorScheme === 'dark' });
81
+ });
82
+ }
83
+ componentWillUnmount() {
84
+ this.appearanceSubscription.remove();
85
+ }
86
+ render() {
87
+ const { label, value, clearable, style, nativeID, disabled } = this.props;
88
+ const { showModal, isDarkModeEnabled } = this.state;
89
+ const styles = this.getStyles();
90
+ const theme = theme_1.getTheme();
91
+ return (React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: this.handlePress },
92
+ React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
93
+ React.createElement(react_native_1.View, null,
94
+ React.createElement(react_native_1.Text, { style: styles.label }, label),
95
+ React.createElement(react_native_1.Text, { style: styles.value }, value != undefined ? format_1.formatDate(value, 'dddd, DD/MM/YYYY') : '')),
96
+ !disabled && (React.createElement(ImageButton_1.ImageButton, { icon: value && clearable ? 'times' : 'calendar', style: styles.clearIcon, iconColor: value && clearable ? theme.textColor1 : theme.textColor2, onPress: value && clearable ? this.handleClear : this.handlePress, hitBoxSize: 30 })),
97
+ react_native_1.Platform.OS !== 'web' && (React.createElement(react_native_modal_datetime_picker_1.default, { date: value, isVisible: showModal, onConfirm: this.handleConfirm, onCancel: this.handleCancel, isDarkModeEnabled: isDarkModeEnabled,
98
+ //@ts-ignore
99
+ display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' })))));
100
+ }
101
+ }
102
+ DatePicker.defaultProps = {
103
+ clearable: true
104
+ };
105
+ exports.DatePicker = DatePicker;