parousya-shared 1.0.1
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/dist/components/AppVersion/index.d.ts +7 -0
- package/dist/components/AppVersion/index.js +15 -0
- package/dist/components/Button/index.d.ts +18 -0
- package/dist/components/Button/index.js +35 -0
- package/dist/components/Button/types.d.ts +6 -0
- package/dist/components/Button/types.js +2 -0
- package/dist/components/Footer/index.d.ts +3 -0
- package/dist/components/Footer/index.js +20 -0
- package/dist/components/Footer/styles.d.ts +34 -0
- package/dist/components/Footer/styles.js +17 -0
- package/dist/components/Footer/types.d.ts +4 -0
- package/dist/components/Footer/types.js +2 -0
- package/dist/components/Icons/index.d.ts +3 -0
- package/dist/components/Icons/index.js +64 -0
- package/dist/components/Icons/styles.d.ts +9 -0
- package/dist/components/Icons/styles.js +16 -0
- package/dist/components/Icons/types.d.ts +7 -0
- package/dist/components/Icons/types.js +2 -0
- package/dist/components/KeyboardWrapper/index.d.ts +3 -0
- package/dist/components/KeyboardWrapper/index.js +15 -0
- package/dist/components/KeyboardWrapper/types.d.ts +7 -0
- package/dist/components/KeyboardWrapper/types.js +2 -0
- package/dist/components/Loading/index.d.ts +7 -0
- package/dist/components/Loading/index.js +14 -0
- package/dist/components/Text/index.d.ts +3 -0
- package/dist/components/Text/index.js +60 -0
- package/dist/components/Text/types.d.ts +26 -0
- package/dist/components/Text/types.js +2 -0
- package/dist/components/TextField/index.d.ts +8 -0
- package/dist/components/TextField/index.js +48 -0
- package/dist/components/TextInput/index.d.ts +3 -0
- package/dist/components/TextInput/index.js +145 -0
- package/dist/components/TextInput/styles.d.ts +57 -0
- package/dist/components/TextInput/styles.js +35 -0
- package/dist/components/TextInput/types.d.ts +48 -0
- package/dist/components/TextInput/types.js +2 -0
- package/dist/components/ThemeProvider/index.d.ts +3 -0
- package/dist/components/ThemeProvider/index.js +18 -0
- package/dist/components/ThemeProvider/types.d.ts +5 -0
- package/dist/components/ThemeProvider/types.js +2 -0
- package/dist/components/View/index.d.ts +3 -0
- package/dist/components/View/index.js +281 -0
- package/dist/components/View/types.d.ts +39 -0
- package/dist/components/View/types.js +2 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +26 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/themes/colors.d.ts +256 -0
- package/dist/themes/colors.js +264 -0
- package/dist/themes/dark-theme.d.ts +2 -0
- package/dist/themes/dark-theme.js +17 -0
- package/dist/themes/default-theme.d.ts +3 -0
- package/dist/themes/default-theme.js +45 -0
- package/dist/themes/faith-dark-theme.d.ts +2 -0
- package/dist/themes/faith-dark-theme.js +17 -0
- package/dist/themes/faith-default-theme.d.ts +3 -0
- package/dist/themes/faith-default-theme.js +45 -0
- package/dist/themes/fonts.d.ts +5 -0
- package/dist/themes/fonts.js +53 -0
- package/dist/themes/index.d.ts +5 -0
- package/dist/themes/index.js +23 -0
- package/dist/themes/platform.d.ts +42 -0
- package/dist/themes/platform.js +78 -0
- package/dist/themes/types.d.ts +80 -0
- package/dist/themes/types.js +2 -0
- package/dist/themes/use-theme.d.ts +2 -0
- package/dist/themes/use-theme.js +22 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +18 -0
- package/dist/tools/modal-portal/index.d.ts +9 -0
- package/dist/tools/modal-portal/index.js +76 -0
- package/dist/tools/modal-portal/services.d.ts +8 -0
- package/dist/tools/modal-portal/services.js +26 -0
- package/dist/tools/modal-portal/types.d.ts +37 -0
- package/dist/tools/modal-portal/types.js +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/methods/index.d.ts +11 -0
- package/dist/utils/methods/index.js +21 -0
- package/dist/utils/string/index.d.ts +27 -0
- package/dist/utils/string/index.js +110 -0
- package/package.json +52 -0
|
@@ -0,0 +1,145 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TextInput = void 0;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const themes_1 = require("../../themes");
|
|
40
|
+
const Text_1 = require("../Text");
|
|
41
|
+
const TextField_1 = require("../TextField");
|
|
42
|
+
const styles_1 = require("./styles");
|
|
43
|
+
const react_native_paper_1 = require("react-native-paper");
|
|
44
|
+
const TextInput = (props) => {
|
|
45
|
+
const { label, errorMessage, type = 'outline', leadingIcon, trailingIcon, editable = true, style: styleRN, placeholder, noErrorMessage, containerInput, required = false, ...rest } = props;
|
|
46
|
+
const { colors, styles } = (0, styles_1.useTextInputStyles)();
|
|
47
|
+
const colorsKey = (0, react_1.useMemo)(() => {
|
|
48
|
+
if (!editable) {
|
|
49
|
+
return {
|
|
50
|
+
color: 'disabled',
|
|
51
|
+
borderColor: 'disabled',
|
|
52
|
+
background: 'ghostWhite',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (errorMessage) {
|
|
56
|
+
return {
|
|
57
|
+
color: 'error',
|
|
58
|
+
borderColor: 'error',
|
|
59
|
+
background: 'white',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
color: 'border',
|
|
64
|
+
borderColor: 'border',
|
|
65
|
+
background: 'white',
|
|
66
|
+
};
|
|
67
|
+
}, [editable, errorMessage]);
|
|
68
|
+
const renderByType = (0, react_1.useMemo)(() => {
|
|
69
|
+
return {
|
|
70
|
+
underline: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
71
|
+
label ? (react_1.default.createElement(react_native_1.View, { style: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
marginBottom: themes_1.Platform.SizeScale(8),
|
|
74
|
+
} },
|
|
75
|
+
react_1.default.createElement(Text_1.Text, { lineHeight: 18, medium: true, size: 13 }, label),
|
|
76
|
+
required ? (react_1.default.createElement(Text_1.Text, { lineHeight: 21, bold: true, size: 16, color: "error" }, "*")) : null)) : (react_1.default.createElement(react_1.default.Fragment, null)),
|
|
77
|
+
react_1.default.createElement(react_native_1.View, { style: [
|
|
78
|
+
styles.containerInput,
|
|
79
|
+
{
|
|
80
|
+
borderBottomWidth: 1,
|
|
81
|
+
borderBottomColor: colors[colorsKey.borderColor],
|
|
82
|
+
},
|
|
83
|
+
containerInput,
|
|
84
|
+
] },
|
|
85
|
+
leadingIcon ? (react_1.default.createElement(react_native_1.View, { style: { width: 24 } }, leadingIcon)) : (react_1.default.createElement(react_1.default.Fragment, null)),
|
|
86
|
+
react_1.default.createElement(TextField_1.TextField, { style: [
|
|
87
|
+
{
|
|
88
|
+
fontSize: themes_1.Platform.SizeScale(13),
|
|
89
|
+
color: colors.text,
|
|
90
|
+
flex: 1,
|
|
91
|
+
},
|
|
92
|
+
styleRN,
|
|
93
|
+
], placeholderTextColor: colors.placeholder, placeholder: placeholder, editable, ...rest }),
|
|
94
|
+
trailingIcon ? (react_1.default.createElement(react_native_1.View, { style: { width: 24, alignItems: 'flex-end' } }, trailingIcon)) : (react_1.default.createElement(react_1.default.Fragment, null))))),
|
|
95
|
+
outline: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
96
|
+
label ? (react_1.default.createElement(react_native_1.View, { style: {
|
|
97
|
+
flexDirection: 'row',
|
|
98
|
+
marginBottom: themes_1.Platform.SizeScale(8),
|
|
99
|
+
} },
|
|
100
|
+
react_1.default.createElement(Text_1.Text, { lineHeight: 18, medium: true, size: 16 }, label),
|
|
101
|
+
required ? (react_1.default.createElement(Text_1.Text, { bold: true, lineHeight: 18, size: 16, color: "error" }, "*")) : null)) : (react_1.default.createElement(react_1.default.Fragment, null)),
|
|
102
|
+
react_1.default.createElement(react_native_1.View, { style: [
|
|
103
|
+
styles.containerInput,
|
|
104
|
+
{
|
|
105
|
+
borderWidth: 1,
|
|
106
|
+
backgroundColor: colors[colorsKey.background],
|
|
107
|
+
borderColor: colors[colorsKey.borderColor],
|
|
108
|
+
paddingHorizontal: themes_1.Platform.SizeScale(17),
|
|
109
|
+
borderRadius: themes_1.Platform.SizeScale(8),
|
|
110
|
+
paddingVertical: themes_1.Platform.SizeScale(10),
|
|
111
|
+
},
|
|
112
|
+
containerInput,
|
|
113
|
+
] },
|
|
114
|
+
leadingIcon ? (react_1.default.createElement(react_native_1.View, { style: { marginRight: themes_1.Platform.SizeScale(8) } }, leadingIcon)) : (react_1.default.createElement(react_1.default.Fragment, null)),
|
|
115
|
+
react_1.default.createElement(TextField_1.TextField, { style: [
|
|
116
|
+
{
|
|
117
|
+
fontSize: themes_1.Platform.SizeScale(16),
|
|
118
|
+
color: colors.text,
|
|
119
|
+
flex: 1,
|
|
120
|
+
},
|
|
121
|
+
themes_1.Platform.isAndroid ? { padding: 0 } : {},
|
|
122
|
+
styleRN,
|
|
123
|
+
], placeholderTextColor: colors.placeholder, placeholder: placeholder, editable, ...rest }),
|
|
124
|
+
trailingIcon ? (react_1.default.createElement(react_native_1.View, { style: { marginLeft: themes_1.Platform.SizeScale(8) } }, trailingIcon)) : (react_1.default.createElement(react_1.default.Fragment, null))))),
|
|
125
|
+
};
|
|
126
|
+
}, [
|
|
127
|
+
label,
|
|
128
|
+
required,
|
|
129
|
+
styles.containerInput,
|
|
130
|
+
colors,
|
|
131
|
+
colorsKey.borderColor,
|
|
132
|
+
colorsKey.background,
|
|
133
|
+
containerInput,
|
|
134
|
+
leadingIcon,
|
|
135
|
+
styleRN,
|
|
136
|
+
placeholder,
|
|
137
|
+
editable,
|
|
138
|
+
rest,
|
|
139
|
+
trailingIcon,
|
|
140
|
+
]);
|
|
141
|
+
return (react_1.default.createElement(react_native_1.View, { style: styles.container },
|
|
142
|
+
react_1.default.createElement(react_native_1.View, { style: [styles.body] }, renderByType[type]),
|
|
143
|
+
!noErrorMessage ? (react_1.default.createElement(react_native_1.View, { style: { minHeight: themes_1.Platform.SizeScale(23) } }, errorMessage ? (react_1.default.createElement(react_native_paper_1.HelperText, { type: "error", visible: !!errorMessage }, errorMessage)) : (react_1.default.createElement(react_1.default.Fragment, null)))) : null));
|
|
144
|
+
};
|
|
145
|
+
exports.TextInput = TextInput;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const useTextInputStyles: () => {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: string;
|
|
4
|
+
secondary: string;
|
|
5
|
+
accent: string;
|
|
6
|
+
background: string;
|
|
7
|
+
card: string;
|
|
8
|
+
border: string;
|
|
9
|
+
surface: string;
|
|
10
|
+
error: string;
|
|
11
|
+
onSurface: string;
|
|
12
|
+
disabled: string;
|
|
13
|
+
placeholder: string;
|
|
14
|
+
backdrop: string;
|
|
15
|
+
notification: string;
|
|
16
|
+
tooltip: string;
|
|
17
|
+
modal: string;
|
|
18
|
+
text: string;
|
|
19
|
+
warning: string;
|
|
20
|
+
success: string;
|
|
21
|
+
white: string;
|
|
22
|
+
black: string;
|
|
23
|
+
lightGreen: string;
|
|
24
|
+
blue: string;
|
|
25
|
+
royalBlue: string;
|
|
26
|
+
ghostWhite: string;
|
|
27
|
+
};
|
|
28
|
+
styles: {
|
|
29
|
+
container: {
|
|
30
|
+
width: "100%";
|
|
31
|
+
};
|
|
32
|
+
body: {
|
|
33
|
+
justifyContent: "center";
|
|
34
|
+
};
|
|
35
|
+
containerInput: {
|
|
36
|
+
flexGrow: number;
|
|
37
|
+
flexDirection: "row";
|
|
38
|
+
alignItems: "center";
|
|
39
|
+
paddingVertical: number;
|
|
40
|
+
};
|
|
41
|
+
label: {
|
|
42
|
+
backgroundColor: string;
|
|
43
|
+
paddingHorizontal: number;
|
|
44
|
+
};
|
|
45
|
+
labelContainer: {
|
|
46
|
+
flexDirection: "row";
|
|
47
|
+
zIndex: number;
|
|
48
|
+
alignItems: "center";
|
|
49
|
+
maxHeight: number;
|
|
50
|
+
position: "absolute";
|
|
51
|
+
left: 0;
|
|
52
|
+
right: 0;
|
|
53
|
+
top: 0;
|
|
54
|
+
bottom: 0;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTextInputStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const themes_1 = require("../../themes");
|
|
6
|
+
const useTextInputStyles = () => {
|
|
7
|
+
const { colors } = (0, themes_1.useAppTheme)();
|
|
8
|
+
const styles = react_native_1.StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
width: '100%',
|
|
11
|
+
},
|
|
12
|
+
body: {
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
},
|
|
15
|
+
containerInput: {
|
|
16
|
+
flexGrow: 1,
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
paddingVertical: themes_1.Platform.SizeScale(2),
|
|
20
|
+
},
|
|
21
|
+
label: {
|
|
22
|
+
backgroundColor: colors.background,
|
|
23
|
+
paddingHorizontal: 5,
|
|
24
|
+
},
|
|
25
|
+
labelContainer: {
|
|
26
|
+
...react_native_1.StyleSheet.absoluteFillObject,
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
zIndex: -1,
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
maxHeight: 20,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
return { colors, styles };
|
|
34
|
+
};
|
|
35
|
+
exports.useTextInputStyles = useTextInputStyles;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { Colors } from '../../themes';
|
|
3
|
+
import { ITextFieldProps } from '../TextField';
|
|
4
|
+
export type TypeTextInput = 'underline' | 'outline';
|
|
5
|
+
export interface ITextInputProps extends ITextFieldProps {
|
|
6
|
+
/**
|
|
7
|
+
* type of text-input
|
|
8
|
+
*
|
|
9
|
+
* @default outlined
|
|
10
|
+
*/
|
|
11
|
+
type?: TypeTextInput;
|
|
12
|
+
/**
|
|
13
|
+
* Border Color when focus Input
|
|
14
|
+
*/
|
|
15
|
+
activeColor?: keyof Colors;
|
|
16
|
+
/**
|
|
17
|
+
* Border Color when not focus Input
|
|
18
|
+
*/
|
|
19
|
+
inActiveColor?: keyof Colors;
|
|
20
|
+
/**
|
|
21
|
+
* Label of input
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Message displayed when there is an error
|
|
26
|
+
*/
|
|
27
|
+
errorMessage?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Icon left
|
|
30
|
+
*/
|
|
31
|
+
leadingIcon?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Icon Right
|
|
34
|
+
*/
|
|
35
|
+
trailingIcon?: React.ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* no check with hook-form
|
|
38
|
+
*/
|
|
39
|
+
noErrorMessage?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* container of input
|
|
42
|
+
*/
|
|
43
|
+
containerInput?: ViewStyle;
|
|
44
|
+
/**
|
|
45
|
+
* Required field
|
|
46
|
+
*/
|
|
47
|
+
required?: boolean;
|
|
48
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ThemeProvider = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const react_native_paper_1 = require("react-native-paper");
|
|
10
|
+
const themes_1 = require("../../themes");
|
|
11
|
+
const ThemeProvider = ({ children, themeConfig: config }) => {
|
|
12
|
+
const isLightTheme = true;
|
|
13
|
+
const themeConfig = isLightTheme ? themes_1.DefaultTheme : themes_1.DarkTheme;
|
|
14
|
+
return (react_1.default.createElement(react_native_paper_1.Provider, { theme: (config || themeConfig) },
|
|
15
|
+
react_1.default.createElement(react_native_1.StatusBar, { barStyle: "dark-content", translucent: true, backgroundColor: "transparent" }),
|
|
16
|
+
children));
|
|
17
|
+
};
|
|
18
|
+
exports.ThemeProvider = ThemeProvider;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IViewProps } from './types';
|
|
3
|
+
export declare const View: ({ children, flex, top, left, right, bottom, padBottom, padLeft, padRight, padTop, padding, color, height, width, style, justifyContent, alignItems, radius, borderWidth, row, insetsTop, insetsBottom, borderColor, borderBottomWidth, borderBottomColor, maxWidth, minWidth, borderTopWidth, borderTopColor, padHorizontal, padVertical, horizontal, vertical, shadow, shadowTop, ...rest }: IViewProps) => React.JSX.Element;
|
|
@@ -0,0 +1,281 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.View = void 0;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
40
|
+
const themes_1 = require("../../themes");
|
|
41
|
+
const utils_1 = require("../../utils");
|
|
42
|
+
const View = ({ children, flex, top, left, right, bottom, padBottom, padLeft, padRight, padTop, padding, color, height, width = '100%', style, justifyContent, alignItems, radius = 0, borderWidth = 0, row = false, insetsTop = false, insetsBottom = false, borderColor, borderBottomWidth, borderBottomColor, maxWidth, minWidth, borderTopWidth, borderTopColor, padHorizontal, padVertical, horizontal, vertical, shadow, shadowTop, ...rest }) => {
|
|
43
|
+
const { colors } = (0, themes_1.useAppTheme)();
|
|
44
|
+
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
45
|
+
const insetTopValue = insetsTop ? insets.top : 0;
|
|
46
|
+
const insetBottomValue = insetsBottom ? insets.bottom : 0;
|
|
47
|
+
const arrayProps = (0, react_1.useMemo)(() => {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
key: 'flex',
|
|
51
|
+
value: flex,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: 'marginTop',
|
|
55
|
+
value: themes_1.Platform.SizeScale(top !== null && top !== void 0 ? top : 0),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: 'marginLeft',
|
|
59
|
+
value: themes_1.Platform.SizeScale(left !== null && left !== void 0 ? left : 0),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: 'marginRight',
|
|
63
|
+
value: themes_1.Platform.SizeScale(right !== null && right !== void 0 ? right : 0),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: 'marginBottom',
|
|
67
|
+
value: themes_1.Platform.SizeScale(bottom !== null && bottom !== void 0 ? bottom : 0),
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: 'paddingTop',
|
|
71
|
+
value: themes_1.Platform.SizeScale(padTop !== null && padTop !== void 0 ? padTop : 0) + insetTopValue,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: 'paddingBottom',
|
|
75
|
+
value: themes_1.Platform.SizeScale(padBottom !== null && padBottom !== void 0 ? padBottom : 0) + insetBottomValue,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: 'paddingRight',
|
|
79
|
+
value: themes_1.Platform.SizeScale(padRight !== null && padRight !== void 0 ? padRight : 0),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: 'paddingLeft',
|
|
83
|
+
value: themes_1.Platform.SizeScale(padLeft !== null && padLeft !== void 0 ? padLeft : 0),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: 'padding',
|
|
87
|
+
value: themes_1.Platform.SizeScale(padding !== null && padding !== void 0 ? padding : 0),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
key: 'backgroundColor',
|
|
91
|
+
value: color ? colors[color] : 'transparent',
|
|
92
|
+
},
|
|
93
|
+
height !== undefined
|
|
94
|
+
? {
|
|
95
|
+
key: 'height',
|
|
96
|
+
value: (0, utils_1.onCheckType)(height, 'number')
|
|
97
|
+
? themes_1.Platform.SizeScale(+height)
|
|
98
|
+
: height,
|
|
99
|
+
}
|
|
100
|
+
: {},
|
|
101
|
+
width !== 'none'
|
|
102
|
+
? {
|
|
103
|
+
key: 'width',
|
|
104
|
+
value: (0, utils_1.onCheckType)(width, 'number')
|
|
105
|
+
? themes_1.Platform.SizeScale(+width)
|
|
106
|
+
: width,
|
|
107
|
+
}
|
|
108
|
+
: {},
|
|
109
|
+
justifyContent
|
|
110
|
+
? {
|
|
111
|
+
key: 'justifyContent',
|
|
112
|
+
value: justifyContent,
|
|
113
|
+
}
|
|
114
|
+
: {},
|
|
115
|
+
alignItems
|
|
116
|
+
? {
|
|
117
|
+
key: 'alignItems',
|
|
118
|
+
value: alignItems,
|
|
119
|
+
}
|
|
120
|
+
: {},
|
|
121
|
+
{
|
|
122
|
+
key: 'borderRadius',
|
|
123
|
+
value: themes_1.Platform.SizeScale(radius),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: 'borderWidth',
|
|
127
|
+
value: borderWidth,
|
|
128
|
+
},
|
|
129
|
+
borderColor
|
|
130
|
+
? {
|
|
131
|
+
key: 'borderColor',
|
|
132
|
+
value: colors[borderColor],
|
|
133
|
+
}
|
|
134
|
+
: {},
|
|
135
|
+
borderBottomWidth !== undefined
|
|
136
|
+
? {
|
|
137
|
+
key: 'borderBottomWidth',
|
|
138
|
+
value: borderBottomWidth,
|
|
139
|
+
}
|
|
140
|
+
: {},
|
|
141
|
+
borderBottomColor
|
|
142
|
+
? {
|
|
143
|
+
key: 'borderBottomColor',
|
|
144
|
+
value: colors[borderBottomColor],
|
|
145
|
+
}
|
|
146
|
+
: {},
|
|
147
|
+
maxWidth
|
|
148
|
+
? {
|
|
149
|
+
key: 'maxWidth',
|
|
150
|
+
value: themes_1.Platform.SizeScale(maxWidth),
|
|
151
|
+
}
|
|
152
|
+
: {},
|
|
153
|
+
minWidth
|
|
154
|
+
? {
|
|
155
|
+
key: 'minWidth',
|
|
156
|
+
value: themes_1.Platform.SizeScale(minWidth),
|
|
157
|
+
}
|
|
158
|
+
: {},
|
|
159
|
+
borderTopWidth !== undefined
|
|
160
|
+
? {
|
|
161
|
+
key: 'borderTopWidth',
|
|
162
|
+
value: borderTopWidth,
|
|
163
|
+
}
|
|
164
|
+
: {},
|
|
165
|
+
borderTopColor
|
|
166
|
+
? {
|
|
167
|
+
key: 'borderTopColor',
|
|
168
|
+
value: colors[borderTopColor],
|
|
169
|
+
}
|
|
170
|
+
: {},
|
|
171
|
+
horizontal !== undefined
|
|
172
|
+
? {
|
|
173
|
+
key: 'marginHorizontal',
|
|
174
|
+
value: themes_1.Platform.SizeScale(horizontal),
|
|
175
|
+
}
|
|
176
|
+
: {},
|
|
177
|
+
vertical !== undefined
|
|
178
|
+
? {
|
|
179
|
+
key: 'marginVertical',
|
|
180
|
+
value: themes_1.Platform.SizeScale(vertical),
|
|
181
|
+
}
|
|
182
|
+
: {},
|
|
183
|
+
padHorizontal !== undefined
|
|
184
|
+
? {
|
|
185
|
+
key: 'paddingHorizontal',
|
|
186
|
+
value: themes_1.Platform.SizeScale(padHorizontal),
|
|
187
|
+
}
|
|
188
|
+
: {},
|
|
189
|
+
padVertical !== undefined
|
|
190
|
+
? {
|
|
191
|
+
key: 'paddingVertical',
|
|
192
|
+
value: themes_1.Platform.SizeScale(padVertical),
|
|
193
|
+
}
|
|
194
|
+
: {},
|
|
195
|
+
];
|
|
196
|
+
}, [
|
|
197
|
+
alignItems,
|
|
198
|
+
borderBottomColor,
|
|
199
|
+
borderBottomWidth,
|
|
200
|
+
borderColor,
|
|
201
|
+
borderTopColor,
|
|
202
|
+
borderTopWidth,
|
|
203
|
+
borderWidth,
|
|
204
|
+
bottom,
|
|
205
|
+
color,
|
|
206
|
+
colors,
|
|
207
|
+
flex,
|
|
208
|
+
height,
|
|
209
|
+
horizontal,
|
|
210
|
+
justifyContent,
|
|
211
|
+
left,
|
|
212
|
+
maxWidth,
|
|
213
|
+
minWidth,
|
|
214
|
+
padHorizontal,
|
|
215
|
+
padLeft,
|
|
216
|
+
padRight,
|
|
217
|
+
padVertical,
|
|
218
|
+
padding,
|
|
219
|
+
radius,
|
|
220
|
+
right,
|
|
221
|
+
top,
|
|
222
|
+
vertical,
|
|
223
|
+
width,
|
|
224
|
+
insetTopValue,
|
|
225
|
+
insetBottomValue,
|
|
226
|
+
padTop,
|
|
227
|
+
padBottom
|
|
228
|
+
]);
|
|
229
|
+
const viewStyle = {};
|
|
230
|
+
(function () {
|
|
231
|
+
arrayProps
|
|
232
|
+
.filter(item => Object.keys(item).length === 2)
|
|
233
|
+
.forEach(({ key, value }) => {
|
|
234
|
+
if (value) {
|
|
235
|
+
viewStyle[key] = value;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
if (row) {
|
|
239
|
+
viewStyle.flexDirection = 'row';
|
|
240
|
+
}
|
|
241
|
+
})();
|
|
242
|
+
const shadowStyle = (0, react_1.useMemo)(() => {
|
|
243
|
+
if (shadowTop) {
|
|
244
|
+
return react_native_1.StyleSheet.flatten([
|
|
245
|
+
{ backgroudColor: colors.background },
|
|
246
|
+
styles.shadowTop,
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
if (shadow) {
|
|
250
|
+
return react_native_1.StyleSheet.flatten([
|
|
251
|
+
{ backgroudColor: colors.background },
|
|
252
|
+
styles.shadow,
|
|
253
|
+
]);
|
|
254
|
+
}
|
|
255
|
+
return {};
|
|
256
|
+
}, [colors.background, shadow, shadowTop]);
|
|
257
|
+
return (react_1.default.createElement(react_native_1.View, { style: react_native_1.StyleSheet.flatten([shadowStyle, viewStyle, style]), ...rest }, children));
|
|
258
|
+
};
|
|
259
|
+
exports.View = View;
|
|
260
|
+
const styles = react_native_1.StyleSheet.create({
|
|
261
|
+
shadowTop: {
|
|
262
|
+
shadowColor: '#000',
|
|
263
|
+
shadowOffset: {
|
|
264
|
+
width: 0,
|
|
265
|
+
height: -3,
|
|
266
|
+
},
|
|
267
|
+
shadowOpacity: 0.2,
|
|
268
|
+
shadowRadius: 9,
|
|
269
|
+
elevation: 8,
|
|
270
|
+
},
|
|
271
|
+
shadow: {
|
|
272
|
+
shadowColor: '#000',
|
|
273
|
+
shadowOffset: {
|
|
274
|
+
width: 0,
|
|
275
|
+
height: 2,
|
|
276
|
+
},
|
|
277
|
+
shadowOpacity: 0.15,
|
|
278
|
+
shadowRadius: 2,
|
|
279
|
+
elevation: 2,
|
|
280
|
+
},
|
|
281
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FlexAlignType, StyleProp, ViewProps, ViewStyle } from 'react-native/types';
|
|
2
|
+
import { Colors } from '../../themes';
|
|
3
|
+
export interface IViewProps extends ViewProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
flex?: number;
|
|
6
|
+
top?: number;
|
|
7
|
+
left?: number;
|
|
8
|
+
right?: number;
|
|
9
|
+
bottom?: number;
|
|
10
|
+
padTop?: number;
|
|
11
|
+
padBottom?: number;
|
|
12
|
+
padLeft?: number;
|
|
13
|
+
padRight?: number;
|
|
14
|
+
padHorizontal?: number;
|
|
15
|
+
padVertical?: number;
|
|
16
|
+
horizontal?: number;
|
|
17
|
+
vertical?: number;
|
|
18
|
+
color?: keyof Colors;
|
|
19
|
+
height?: number | string;
|
|
20
|
+
width?: number | string | 'none';
|
|
21
|
+
style?: StyleProp<ViewStyle>;
|
|
22
|
+
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
23
|
+
alignItems?: FlexAlignType;
|
|
24
|
+
row?: boolean;
|
|
25
|
+
radius?: number;
|
|
26
|
+
borderWidth?: number;
|
|
27
|
+
insetsTop?: boolean;
|
|
28
|
+
insetsBottom?: boolean;
|
|
29
|
+
padding?: number;
|
|
30
|
+
borderColor?: keyof Colors;
|
|
31
|
+
borderBottomWidth?: number;
|
|
32
|
+
borderBottomColor?: keyof Colors;
|
|
33
|
+
maxWidth?: number;
|
|
34
|
+
minWidth?: number;
|
|
35
|
+
borderTopWidth?: number;
|
|
36
|
+
borderTopColor?: keyof Colors;
|
|
37
|
+
shadow?: boolean;
|
|
38
|
+
shadowTop?: boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './Text';
|
|
2
|
+
export * from './ThemeProvider';
|
|
3
|
+
export * from './View';
|
|
4
|
+
export * from './AppVersion';
|
|
5
|
+
export * from './Button';
|
|
6
|
+
export * from './TextInput';
|
|
7
|
+
export * from './Loading';
|
|
8
|
+
export * from './Footer';
|
|
9
|
+
export * from './Icons';
|
|
10
|
+
export * from './KeyboardWrapper';
|