react-crud-mobile 1.3.333 → 1.3.335

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 (39) hide show
  1. package/dist/react-crud-mobile.cjs.development.js.map +1 -1
  2. package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
  3. package/dist/react-crud-mobile.esm.js.map +1 -1
  4. package/package.json +76 -76
  5. package/src/elements/UI.tsx +77 -77
  6. package/src/elements/UIChildren.tsx +142 -142
  7. package/src/elements/UIComplete.tsx +14 -14
  8. package/src/elements/UIElement.tsx +870 -870
  9. package/src/elements/UITag.tsx +13 -13
  10. package/src/elements/charts/ElChart.tsx +10 -10
  11. package/src/elements/core/GestureView.tsx +16 -16
  12. package/src/elements/core/SafeView.tsx +63 -63
  13. package/src/elements/core/UIAutoComplete.tsx +17 -17
  14. package/src/elements/core/UIButton.tsx +143 -143
  15. package/src/elements/core/UIHeader.tsx +38 -38
  16. package/src/elements/core/UIIcon.tsx +25 -25
  17. package/src/elements/core/UIInclude.tsx +40 -40
  18. package/src/elements/core/UIInput.tsx +147 -147
  19. package/src/elements/core/UILink.tsx +17 -17
  20. package/src/elements/core/UIList.tsx +180 -180
  21. package/src/elements/core/UIListItem.tsx +32 -32
  22. package/src/elements/core/UIListRow.tsx +132 -132
  23. package/src/elements/core/UIModal.tsx +212 -212
  24. package/src/elements/core/UIOption.tsx +17 -17
  25. package/src/elements/core/UIOrder.tsx +194 -194
  26. package/src/elements/core/UIQuantity.tsx +98 -98
  27. package/src/elements/core/UIRadio.tsx +17 -17
  28. package/src/elements/core/UISelect.tsx +175 -175
  29. package/src/elements/core/UISlider.tsx +61 -61
  30. package/src/elements/core/UIStatusBar.tsx +5 -5
  31. package/src/elements/core/UISwitch.tsx +27 -27
  32. package/src/elements/core/UIToast.tsx +44 -44
  33. package/src/elements/core/UIToggle.tsx +114 -114
  34. package/src/elements/core/UIView.tsx +69 -69
  35. package/src/elements/index.ts +1 -1
  36. package/src/elements/tabs/ElTabs.tsx +178 -178
  37. package/src/hooks/useIsVisible.ts +39 -39
  38. package/src/index.ts +1 -1
  39. package/src/utils/MobileUtils.ts +12 -12
@@ -1,13 +1,13 @@
1
- import React, { useState } from "react";
2
- import { Utils } from "react-crud-utils";
3
-
4
- interface UITagType {
5
- name: string;
6
- [otherOptions: string]: unknown;
7
- }
8
-
9
- export default function UITag(props: UITagType) {
10
- let Aux = Utils.nvl(props.name, "span");
11
-
12
- return <Aux {...props} />;
13
- }
1
+ import React, { useState } from "react";
2
+ import { Utils } from "react-crud-utils";
3
+
4
+ interface UITagType {
5
+ name: string;
6
+ [otherOptions: string]: unknown;
7
+ }
8
+
9
+ export default function UITag(props: UITagType) {
10
+ let Aux = Utils.nvl(props.name, "span");
11
+
12
+ return <Aux {...props} />;
13
+ }
@@ -1,10 +1,10 @@
1
- import React from "react";
2
- import { ChildType, Scope, Utils } from "react-crud-utils";
3
-
4
- export default function ElChart(props: ChildType) {
5
- let scope: Scope = props.scope;
6
- let items: any = scope.getItems();
7
- let columns = Utils.asList(scope.original.columns);
8
-
9
- return <div className="ui-chart-data"></div>;
10
- }
1
+ import React from "react";
2
+ import { ChildType, Scope, Utils } from "react-crud-utils";
3
+
4
+ export default function ElChart(props: ChildType) {
5
+ let scope: Scope = props.scope;
6
+ let items: any = scope.getItems();
7
+ let columns = Utils.asList(scope.original.columns);
8
+
9
+ return <div className="ui-chart-data"></div>;
10
+ }
@@ -1,16 +1,16 @@
1
- import { StyleProp, ViewStyle } from 'react-native';
2
- import { GestureHandlerRootView } from 'react-native-gesture-handler';
3
-
4
- interface SafeViewType {
5
- safeStyle?: StyleProp<ViewStyle> | any;
6
- viewStyle?: StyleProp<ViewStyle> | any;
7
- children?: any;
8
- }
9
-
10
- export default function GestureView(props: SafeViewType) {
11
- return (
12
- <GestureHandlerRootView style={{ flex: 1 }}>
13
- {props.children}
14
- </GestureHandlerRootView>
15
- );
16
- }
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
3
+
4
+ interface SafeViewType {
5
+ safeStyle?: StyleProp<ViewStyle> | any;
6
+ viewStyle?: StyleProp<ViewStyle> | any;
7
+ children?: any;
8
+ }
9
+
10
+ export default function GestureView(props: SafeViewType) {
11
+ return (
12
+ <GestureHandlerRootView style={{ flex: 1 }}>
13
+ {props.children}
14
+ </GestureHandlerRootView>
15
+ );
16
+ }
@@ -1,63 +1,63 @@
1
- import {
2
- Keyboard,
3
- KeyboardAvoidingView,
4
- Platform,
5
- StatusBar,
6
- StyleProp,
7
- TouchableWithoutFeedback,
8
- ViewStyle,
9
- } from 'react-native';
10
- import {
11
- SafeAreaProvider,
12
- SafeAreaView as SafeAreaContextView,
13
- } from 'react-native-safe-area-context';
14
- import { ThemeUtils, useTheme, Utils } from 'react-crud-utils';
15
-
16
- interface SafeViewType {
17
- safeStyle?: StyleProp<ViewStyle> | any;
18
- viewStyle?: StyleProp<ViewStyle> | any;
19
- children?: any;
20
- }
21
-
22
- export default function SafeView(props: SafeViewType) {
23
- let theme = ThemeUtils.getCurrentTheme();
24
- //v2
25
-
26
- if (Utils.isEmpty(theme)) {
27
- theme = useTheme();
28
- }
29
-
30
- const dismissKeyboard = () => {
31
- if (Platform.OS !== 'web') {
32
- Keyboard.dismiss();
33
- }
34
- };
35
-
36
- return (
37
- <SafeAreaProvider>
38
- <SafeAreaContextView
39
- style={{
40
- backgroundColor: theme.colors?.theme,
41
- ...props.viewStyle,
42
- flex: 1,
43
- }}
44
- >
45
- <StatusBar barStyle="dark-content" backgroundColor="#f5f5f5" />
46
- <KeyboardAvoidingView
47
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
48
- style={{
49
- flex: 1, // 🔹 Ocupa 100% da tela
50
- justifyContent: 'flex-start',
51
- }}
52
- >
53
- <TouchableWithoutFeedback
54
- onPress={dismissKeyboard}
55
- accessible={false}
56
- >
57
- <>{props.children}</>
58
- </TouchableWithoutFeedback>
59
- </KeyboardAvoidingView>
60
- </SafeAreaContextView>
61
- </SafeAreaProvider>
62
- );
63
- }
1
+ import {
2
+ Keyboard,
3
+ KeyboardAvoidingView,
4
+ Platform,
5
+ StatusBar,
6
+ StyleProp,
7
+ TouchableWithoutFeedback,
8
+ ViewStyle,
9
+ } from 'react-native';
10
+ import {
11
+ SafeAreaProvider,
12
+ SafeAreaView as SafeAreaContextView,
13
+ } from 'react-native-safe-area-context';
14
+ import { ThemeUtils, useTheme, Utils } from 'react-crud-utils';
15
+
16
+ interface SafeViewType {
17
+ safeStyle?: StyleProp<ViewStyle> | any;
18
+ viewStyle?: StyleProp<ViewStyle> | any;
19
+ children?: any;
20
+ }
21
+
22
+ export default function SafeView(props: SafeViewType) {
23
+ let theme = ThemeUtils.getCurrentTheme();
24
+ //v2
25
+
26
+ if (Utils.isEmpty(theme)) {
27
+ theme = useTheme();
28
+ }
29
+
30
+ const dismissKeyboard = () => {
31
+ if (Platform.OS !== 'web') {
32
+ Keyboard.dismiss();
33
+ }
34
+ };
35
+
36
+ return (
37
+ <SafeAreaProvider>
38
+ <SafeAreaContextView
39
+ style={{
40
+ backgroundColor: theme.colors?.theme,
41
+ ...props.viewStyle,
42
+ flex: 1,
43
+ }}
44
+ >
45
+ <StatusBar barStyle="dark-content" backgroundColor="#f5f5f5" />
46
+ <KeyboardAvoidingView
47
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
48
+ style={{
49
+ flex: 1, // 🔹 Ocupa 100% da tela
50
+ justifyContent: 'flex-start',
51
+ }}
52
+ >
53
+ <TouchableWithoutFeedback
54
+ onPress={dismissKeyboard}
55
+ accessible={false}
56
+ >
57
+ <>{props.children}</>
58
+ </TouchableWithoutFeedback>
59
+ </KeyboardAvoidingView>
60
+ </SafeAreaContextView>
61
+ </SafeAreaProvider>
62
+ );
63
+ }
@@ -1,17 +1,17 @@
1
- import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
-
3
- export default function UIAutoComplete(props: any) {
4
- const handlePress = () => {
5
- Linking.openURL('https://reactnative.dev/');
6
- };
7
-
8
- return (
9
- <TouchableOpacity onPress={handlePress}>
10
- <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
- </TouchableOpacity>
12
- );
13
- }
14
-
15
- const styles = {
16
- link: {},
17
- };
1
+ import { Text, TouchableOpacity, Linking, StyleSheet } from 'react-native';
2
+
3
+ export default function UIAutoComplete(props: any) {
4
+ const handlePress = () => {
5
+ Linking.openURL('https://reactnative.dev/');
6
+ };
7
+
8
+ return (
9
+ <TouchableOpacity onPress={handlePress}>
10
+ <Text style={styles.link}>Clique aqui para acessar o React Native</Text>
11
+ </TouchableOpacity>
12
+ );
13
+ }
14
+
15
+ const styles = {
16
+ link: {},
17
+ };
@@ -1,143 +1,143 @@
1
- import { Ionicons } from '@expo/vector-icons';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { Text, TouchableHighlight, View } from 'react-native';
4
-
5
- const BUTTONS_SIZE: any = { small: { minWidth: 30, height: 30 } };
6
-
7
- export default function UIButton(props: ChildType) {
8
- let scope = props.scope;
9
- let element = scope.original;
10
- let size = Utils.nvl(element.size, 'default');
11
- let align = Utils.nvl(element.align, 'center');
12
- let variant = Utils.nvl(element.variant, 'default');
13
-
14
- let color = element.color;
15
- let label = scope.getLabel();
16
- let icon = scope.getPart('icon');
17
-
18
- //ajuste align v5
19
- if (!color) color = 'primaryLight';
20
-
21
- const styles: any = {
22
- buttonLabel: {
23
- color: '#ffffff',
24
- fontWeight: 400,
25
- fontSize: 15,
26
- },
27
- buttonInner: {
28
- flexDirection: 'row',
29
- alignItems: 'center',
30
- justifyContent: 'center',
31
- height: 44,
32
- minWidth: 44,
33
- },
34
- buttonIcon: {
35
- color: '#fff',
36
- fontSize: 16,
37
- },
38
- button: {
39
- backgroundColor: color,
40
- borderRadius: 20,
41
- gap: 10,
42
- justifyContent: 'center',
43
- alignItems: 'center',
44
- flexDirection: 'row',
45
- },
46
- };
47
-
48
- const onClick = (e: any) => {
49
- scope.call('click', {});
50
- };
51
-
52
- const style = (part: string, extra?: any) => {
53
- let css = { ...styles[part], ...extra };
54
-
55
- if (variant === 'text' || variant === 'outlined') {
56
- css.backgroundColor = 'transparent';
57
- css.color = Utils.nvl(color, 'text');
58
- }
59
-
60
- if (size === 'small') {
61
- css.fontSize = 12;
62
- css.fontWeight = 500;
63
- }
64
-
65
- if (size === 'medium') {
66
- css.fontSize = 14;
67
- css.fontWeight = 500;
68
- }
69
-
70
- if (align === 'left') {
71
- css.justifyContent = 'flex-start';
72
- }
73
-
74
- return scope.getStyle(part, css);
75
- };
76
-
77
- let extra: any = {};
78
-
79
- if (icon) {
80
- extra.button = { height: 40, padding: 0 };
81
- } else {
82
- extra.button = { height: 50 };
83
- }
84
-
85
- const buttonStyle = Utils.call(() => {
86
- let def: any = { ...extra?.button };
87
-
88
- if (variant === 'outlined') {
89
- def.borderWidth = 1;
90
- def.borderColor = Utils.nvl(color, 'text');
91
- }
92
-
93
- if (size) {
94
- def = { ...def, ...BUTTONS_SIZE[size] };
95
- }
96
-
97
- if (!label) {
98
- def = { ...def, borderRadius: 20 };
99
- }
100
-
101
- let css = style('button', def);
102
-
103
- if (!css.width) {
104
- let h = css.height;
105
-
106
- if (typeof h === 'number') {
107
- css.minWidth = h;
108
- }
109
- }
110
-
111
- return css;
112
- });
113
-
114
- const buttonLabel = style('buttonLabel');
115
- const iconStyle = Utils.call(() => {
116
- let css: any = style('buttonIcon', extra.icon);
117
-
118
- css.fontSize = Utils.nvl(buttonLabel.fontSize, css.fontSize);
119
-
120
- return css;
121
- });
122
-
123
- return (
124
- <TouchableHighlight
125
- underlayColor={'transparent'}
126
- onPress={onClick}
127
- style={buttonStyle}
128
- >
129
- <>
130
- {icon && (
131
- <>
132
- <Ionicons
133
- size={Utils.nvl(element.iconSize, 30)}
134
- style={iconStyle}
135
- name={icon}
136
- />
137
- </>
138
- )}
139
- {label && <Text style={buttonLabel}>{label}</Text>}
140
- </>
141
- </TouchableHighlight>
142
- );
143
- }
1
+ import { Ionicons } from '@expo/vector-icons';
2
+ import { ChildType, Utils } from 'react-crud-utils';
3
+ import { Text, TouchableHighlight, View } from 'react-native';
4
+
5
+ const BUTTONS_SIZE: any = { small: { minWidth: 30, height: 30 } };
6
+
7
+ export default function UIButton(props: ChildType) {
8
+ let scope = props.scope;
9
+ let element = scope.original;
10
+ let size = Utils.nvl(element.size, 'default');
11
+ let align = Utils.nvl(element.align, 'center');
12
+ let variant = Utils.nvl(element.variant, 'default');
13
+
14
+ let color = element.color;
15
+ let label = scope.getLabel();
16
+ let icon = scope.getPart('icon');
17
+
18
+ //ajuste align v5
19
+ if (!color) color = 'primaryLight';
20
+
21
+ const styles: any = {
22
+ buttonLabel: {
23
+ color: '#ffffff',
24
+ fontWeight: 400,
25
+ fontSize: 15,
26
+ },
27
+ buttonInner: {
28
+ flexDirection: 'row',
29
+ alignItems: 'center',
30
+ justifyContent: 'center',
31
+ height: 44,
32
+ minWidth: 44,
33
+ },
34
+ buttonIcon: {
35
+ color: '#fff',
36
+ fontSize: 16,
37
+ },
38
+ button: {
39
+ backgroundColor: color,
40
+ borderRadius: 20,
41
+ gap: 10,
42
+ justifyContent: 'center',
43
+ alignItems: 'center',
44
+ flexDirection: 'row',
45
+ },
46
+ };
47
+
48
+ const onClick = (e: any) => {
49
+ scope.call('click', {});
50
+ };
51
+
52
+ const style = (part: string, extra?: any) => {
53
+ let css = { ...styles[part], ...extra };
54
+
55
+ if (variant === 'text' || variant === 'outlined') {
56
+ css.backgroundColor = 'transparent';
57
+ css.color = Utils.nvl(color, 'text');
58
+ }
59
+
60
+ if (size === 'small') {
61
+ css.fontSize = 12;
62
+ css.fontWeight = 500;
63
+ }
64
+
65
+ if (size === 'medium') {
66
+ css.fontSize = 14;
67
+ css.fontWeight = 500;
68
+ }
69
+
70
+ if (align === 'left') {
71
+ css.justifyContent = 'flex-start';
72
+ }
73
+
74
+ return scope.getStyle(part, css);
75
+ };
76
+
77
+ let extra: any = {};
78
+
79
+ if (icon) {
80
+ extra.button = { height: 40, padding: 0 };
81
+ } else {
82
+ extra.button = { height: 50 };
83
+ }
84
+
85
+ const buttonStyle = Utils.call(() => {
86
+ let def: any = { ...extra?.button };
87
+
88
+ if (variant === 'outlined') {
89
+ def.borderWidth = 1;
90
+ def.borderColor = Utils.nvl(color, 'text');
91
+ }
92
+
93
+ if (size) {
94
+ def = { ...def, ...BUTTONS_SIZE[size] };
95
+ }
96
+
97
+ if (!label) {
98
+ def = { ...def, borderRadius: 20 };
99
+ }
100
+
101
+ let css = style('button', def);
102
+
103
+ if (!css.width) {
104
+ let h = css.height;
105
+
106
+ if (typeof h === 'number') {
107
+ css.minWidth = h;
108
+ }
109
+ }
110
+
111
+ return css;
112
+ });
113
+
114
+ const buttonLabel = style('buttonLabel');
115
+ const iconStyle = Utils.call(() => {
116
+ let css: any = style('buttonIcon', extra.icon);
117
+
118
+ css.fontSize = Utils.nvl(buttonLabel.fontSize, css.fontSize);
119
+
120
+ return css;
121
+ });
122
+
123
+ return (
124
+ <TouchableHighlight
125
+ underlayColor={'transparent'}
126
+ onPress={onClick}
127
+ style={buttonStyle}
128
+ >
129
+ <>
130
+ {icon && (
131
+ <>
132
+ <Ionicons
133
+ size={Utils.nvl(element.iconSize, 30)}
134
+ style={iconStyle}
135
+ name={icon}
136
+ />
137
+ </>
138
+ )}
139
+ {label && <Text style={buttonLabel}>{label}</Text>}
140
+ </>
141
+ </TouchableHighlight>
142
+ );
143
+ }
@@ -1,38 +1,38 @@
1
- import { Text, View } from 'react-native';
2
-
3
- import { ChildType, HtmlUtils, Utils } from 'react-crud-utils';
4
-
5
- export default function UIHeader({ scope }: ChildType) {
6
- const theme = scope.getTheme();
7
- const header = scope.getPart('header', null, []);
8
- const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
9
- const headerTextStyle = Utils.nvl(theme.styles?.defaults?.headerText, {});
10
-
11
- let headerStyleFull = Utils.call(() => {
12
- let css = scope.getStyle('header', headerStyle);
13
- let bg = css.backgroundColor;
14
-
15
- if (bg) {
16
- css.color = HtmlUtils.getTextColor(bg);
17
- }
18
- return css;
19
- });
20
-
21
- let hasHeader = !Utils.isEmpty(header);
22
- let AuxHeader = () => {
23
- if (typeof header === 'string') {
24
- return <Text style={headerTextStyle}>{header}</Text>;
25
- }
26
- return <>{header}</>;
27
- };
28
-
29
- return (
30
- <>
31
- {hasHeader && (
32
- <View style={headerStyleFull}>
33
- <AuxHeader />
34
- </View>
35
- )}
36
- </>
37
- );
38
- }
1
+ import { Text, View } from 'react-native';
2
+
3
+ import { ChildType, HtmlUtils, Utils } from 'react-crud-utils';
4
+
5
+ export default function UIHeader({ scope }: ChildType) {
6
+ const theme = scope.getTheme();
7
+ const header = scope.getPart('header', null, []);
8
+ const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
9
+ const headerTextStyle = Utils.nvl(theme.styles?.defaults?.headerText, {});
10
+
11
+ let headerStyleFull = Utils.call(() => {
12
+ let css = scope.getStyle('header', headerStyle);
13
+ let bg = css.backgroundColor;
14
+
15
+ if (bg) {
16
+ css.color = HtmlUtils.getTextColor(bg);
17
+ }
18
+ return css;
19
+ });
20
+
21
+ let hasHeader = !Utils.isEmpty(header);
22
+ let AuxHeader = () => {
23
+ if (typeof header === 'string') {
24
+ return <Text style={headerTextStyle}>{header}</Text>;
25
+ }
26
+ return <>{header}</>;
27
+ };
28
+
29
+ return (
30
+ <>
31
+ {hasHeader && (
32
+ <View style={headerStyleFull}>
33
+ <AuxHeader />
34
+ </View>
35
+ )}
36
+ </>
37
+ );
38
+ }
@@ -1,25 +1,25 @@
1
- import {
2
- Ionicons,
3
- MaterialCommunityIcons,
4
- AntDesign,
5
- Entypo,
6
- EvilIcons,
7
- } from '@expo/vector-icons';
8
-
9
- import { ChildType, Utils } from 'react-crud-utils';
10
-
11
- export default function UIIcon({ scope }: ChildType) {
12
- let name = scope.getValue();
13
- let libs: any = {
14
- ion: Ionicons,
15
- ant: AntDesign,
16
- entypo: Entypo,
17
- evil: EvilIcons,
18
- material: MaterialCommunityIcons,
19
- };
20
-
21
- let library = Utils.nvl(scope.original.library, 'ion');
22
- let Aux = libs[library];
23
-
24
- return <Aux name={name} style={scope.getStyle('icon')} />;
25
- }
1
+ import {
2
+ Ionicons,
3
+ MaterialCommunityIcons,
4
+ AntDesign,
5
+ Entypo,
6
+ EvilIcons,
7
+ } from '@expo/vector-icons';
8
+
9
+ import { ChildType, Utils } from 'react-crud-utils';
10
+
11
+ export default function UIIcon({ scope }: ChildType) {
12
+ let name = scope.getValue();
13
+ let libs: any = {
14
+ ion: Ionicons,
15
+ ant: AntDesign,
16
+ entypo: Entypo,
17
+ evil: EvilIcons,
18
+ material: MaterialCommunityIcons,
19
+ };
20
+
21
+ let library = Utils.nvl(scope.original.library, 'ion');
22
+ let Aux = libs[library];
23
+
24
+ return <Aux name={name} style={scope.getStyle('icon')} />;
25
+ }