@axelor/aos-mobile-ui 7.1.1 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/atoms/Icon/Icon.d.ts +1 -2
- package/lib/components/atoms/Icon/Icon.js +6 -6
- package/lib/components/atoms/Icon/Icon.js.map +1 -1
- package/lib/components/atoms/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.d.ts +6 -1
- package/lib/components/atoms/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.js +3 -3
- package/lib/components/atoms/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.js.map +1 -1
- package/lib/components/atoms/RadioButton/RadioButton.d.ts +7 -0
- package/lib/components/atoms/RadioButton/RadioButton.js +73 -0
- package/lib/components/atoms/RadioButton/RadioButton.js.map +1 -0
- package/lib/components/atoms/Screen/Screen.js +13 -2
- package/lib/components/atoms/Screen/Screen.js.map +1 -1
- package/lib/components/atoms/ScrollView/ScrollView.d.ts +6 -1
- package/lib/components/atoms/ScrollView/ScrollView.js +3 -3
- package/lib/components/atoms/ScrollView/ScrollView.js.map +1 -1
- package/lib/components/atoms/Switch/Switch.js +3 -5
- package/lib/components/atoms/Switch/Switch.js.map +1 -1
- package/lib/components/atoms/index.d.ts +1 -0
- package/lib/components/atoms/index.js +1 -0
- package/lib/components/atoms/index.js.map +1 -1
- package/lib/components/molecules/Alert/Alert.d.ts +20 -0
- package/lib/components/molecules/Alert/Alert.js +124 -0
- package/lib/components/molecules/Alert/Alert.js.map +1 -0
- package/lib/components/molecules/BlockInteractionMessage/BlockInteractionMessage.js +1 -3
- package/lib/components/molecules/BlockInteractionMessage/BlockInteractionMessage.js.map +1 -1
- package/lib/components/molecules/Button/Button.d.ts +11 -4
- package/lib/components/molecules/Button/Button.js +34 -11
- package/lib/components/molecules/Button/Button.js.map +1 -1
- package/lib/components/molecules/CircleButton/CircleButton.d.ts +12 -5
- package/lib/components/molecules/CircleButton/CircleButton.js +11 -18
- package/lib/components/molecules/CircleButton/CircleButton.js.map +1 -1
- package/lib/components/molecules/FormHtmlInput/FormHtmlInput.d.ts +2 -1
- package/lib/components/molecules/FormHtmlInput/FormHtmlInput.js +11 -2
- package/lib/components/molecules/FormHtmlInput/FormHtmlInput.js.map +1 -1
- package/lib/components/molecules/FormInput/FormInput.js +1 -1
- package/lib/components/molecules/FormInput/FormInput.js.map +1 -1
- package/lib/components/molecules/Image/Image.js +13 -5
- package/lib/components/molecules/Image/Image.js.map +1 -1
- package/lib/components/molecules/Increment/Increment.js +2 -2
- package/lib/components/molecules/Increment/Increment.js.map +1 -1
- package/lib/components/molecules/InfoBubble/InfoBubble.d.ts +2 -1
- package/lib/components/molecules/InfoBubble/InfoBubble.js +4 -3
- package/lib/components/molecules/InfoBubble/InfoBubble.js.map +1 -1
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.d.ts +4 -3
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.js +4 -15
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.js.map +1 -1
- package/lib/components/molecules/RadioSelect/RadioSelect.d.ts +14 -0
- package/lib/components/molecules/RadioSelect/RadioSelect.js +59 -0
- package/lib/components/molecules/RadioSelect/RadioSelect.js.map +1 -0
- package/lib/components/molecules/SelectionContainer/SelectionContainer.d.ts +4 -3
- package/lib/components/molecules/SelectionContainer/SelectionContainer.js +17 -9
- package/lib/components/molecules/SelectionContainer/SelectionContainer.js.map +1 -1
- package/lib/components/molecules/SwitchCard/SwitchCard.js +22 -5
- package/lib/components/molecules/SwitchCard/SwitchCard.js.map +1 -1
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.d.ts +4 -1
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.js +4 -1
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.js.map +1 -1
- package/lib/components/molecules/index.d.ts +2 -2
- package/lib/components/molecules/index.js +2 -2
- package/lib/components/molecules/index.js.map +1 -1
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.d.ts +4 -1
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.js +17 -13
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.js.map +1 -1
- package/lib/components/organisms/AutoCompleteSearch/ItemCard.js +3 -2
- package/lib/components/organisms/AutoCompleteSearch/ItemCard.js.map +1 -1
- package/lib/components/organisms/AutoCompleteSearch/SearchDetailsPopUp.js +17 -19
- package/lib/components/organisms/AutoCompleteSearch/SearchDetailsPopUp.js.map +1 -1
- package/lib/components/organisms/ChipSelect/ChipSelect.d.ts +2 -1
- package/lib/components/organisms/ChipSelect/ChipSelect.js +29 -26
- package/lib/components/organisms/ChipSelect/ChipSelect.js.map +1 -1
- package/lib/components/organisms/FloatingButton/FloatingButton.js +17 -10
- package/lib/components/organisms/FloatingButton/FloatingButton.js.map +1 -1
- package/lib/components/organisms/MultiValuePicker/MultiValuePicker.d.ts +4 -5
- package/lib/components/organisms/MultiValuePicker/MultiValuePicker.js +22 -40
- package/lib/components/organisms/MultiValuePicker/MultiValuePicker.js.map +1 -1
- package/lib/components/organisms/Picker/Picker.d.ts +4 -5
- package/lib/components/organisms/Picker/Picker.js +67 -72
- package/lib/components/organisms/Picker/Picker.js.map +1 -1
- package/lib/components/organisms/SearchBar/SearchBar.d.ts +4 -1
- package/lib/components/organisms/SearchBar/SearchBar.js +36 -13
- package/lib/components/organisms/SearchBar/SearchBar.js.map +1 -1
- package/lib/components/organisms/index.d.ts +0 -3
- package/lib/components/organisms/index.js +0 -3
- package/lib/components/organisms/index.js.map +1 -1
- package/lib/components/templates/ObjectCard/ObjectCard.d.ts +3 -1
- package/lib/components/templates/ObjectCard/ObjectCard.js +5 -6
- package/lib/components/templates/ObjectCard/ObjectCard.js.map +1 -1
- package/lib/theme/writingTheme.js +4 -4
- package/lib/utils/commons-styles.d.ts +2 -2
- package/lib/utils/commons-styles.js +6 -6
- package/lib/utils/commons-styles.js.map +1 -1
- package/package.json +6 -3
- package/lib/components/molecules/IconButton/IconButton.d.ts +0 -12
- package/lib/components/molecules/IconButton/IconButton.js +0 -48
- package/lib/components/molecules/IconButton/IconButton.js.map +0 -1
- package/lib/components/molecules/PopUp/PopUp.d.ts +0 -10
- package/lib/components/molecules/PopUp/PopUp.js +0 -77
- package/lib/components/molecules/PopUp/PopUp.js.map +0 -1
- package/lib/components/organisms/MultiSelectValue/MultiSelectValue.d.ts +0 -9
- package/lib/components/organisms/MultiSelectValue/MultiSelectValue.js +0 -49
- package/lib/components/organisms/MultiSelectValue/MultiSelectValue.js.map +0 -1
- package/lib/components/organisms/PopUpOneButton/PopUpOneButton.d.ts +0 -9
- package/lib/components/organisms/PopUpOneButton/PopUpOneButton.js +0 -41
- package/lib/components/organisms/PopUpOneButton/PopUpOneButton.js.map +0 -1
- package/lib/components/organisms/PopUpTwoButton/PopUpTwoButton.d.ts +0 -11
- package/lib/components/organisms/PopUpTwoButton/PopUpTwoButton.js +0 -42
- package/lib/components/organisms/PopUpTwoButton/PopUpTwoButton.js.map +0 -1
|
@@ -7,7 +7,6 @@ interface IconProps {
|
|
|
7
7
|
touchable?: boolean;
|
|
8
8
|
visible?: boolean;
|
|
9
9
|
onPress?: () => void;
|
|
10
|
-
disabled?: boolean;
|
|
11
10
|
}
|
|
12
|
-
declare const Icon: ({ style, name, FontAwesome5, color, size, touchable, visible, onPress,
|
|
11
|
+
declare const Icon: ({ style, name, FontAwesome5, color, size, touchable, visible, onPress, }: IconProps) => JSX.Element;
|
|
13
12
|
export default Icon;
|
|
@@ -20,21 +20,21 @@ import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
|
20
20
|
import Icon5 from 'react-native-vector-icons/FontAwesome5';
|
|
21
21
|
import Icon4 from 'react-native-vector-icons/FontAwesome';
|
|
22
22
|
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
23
|
-
const Icon = ({ style, name, FontAwesome5 = true, color, size = 18, touchable = false, visible = true, onPress = () => { },
|
|
23
|
+
const Icon = ({ style, name, FontAwesome5 = true, color, size = 18, touchable = false, visible = true, onPress = () => { }, }) => {
|
|
24
24
|
const Colors = useThemeColor();
|
|
25
25
|
const styles = useMemo(() => {
|
|
26
|
-
return getStyles(
|
|
27
|
-
}, [Colors, color,
|
|
26
|
+
return getStyles(color == null ? Colors.secondaryColor_dark.background : color, size);
|
|
27
|
+
}, [Colors, color, size]);
|
|
28
28
|
if (!visible) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
return (<TouchableOpacity style={[styles.container, style]} onPress={onPress} disabled={!touchable
|
|
31
|
+
return (<TouchableOpacity style={[styles.container, style]} onPress={onPress} disabled={!touchable}>
|
|
32
32
|
{FontAwesome5 ? (<Icon5 name={name} style={styles.icon}/>) : (<Icon4 name={name} style={styles.icon}/>)}
|
|
33
33
|
</TouchableOpacity>);
|
|
34
34
|
};
|
|
35
|
-
const getStyles = (
|
|
35
|
+
const getStyles = (color, size) => StyleSheet.create({
|
|
36
36
|
icon: {
|
|
37
|
-
color:
|
|
37
|
+
color: color,
|
|
38
38
|
fontSize: size,
|
|
39
39
|
},
|
|
40
40
|
container: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../src/components/atoms/Icon/Icon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,MAAM,wCAAwC,CAAC;AAC3D,OAAO,KAAK,MAAM,uCAAuC,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../src/components/atoms/Icon/Icon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAA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,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAG,CAC1C,CACH;IAAA,EAAE,gBAAgB,CAAC,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAChC,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC,CAAC;AAEL,eAAe,IAAI,CAAC"}
|
|
@@ -3,10 +3,15 @@ interface Offset {
|
|
|
3
3
|
ios: number;
|
|
4
4
|
android: number;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface Refresh {
|
|
7
|
+
loading: boolean;
|
|
8
|
+
fetcher: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const KeyboardAvoidingScrollView: ({ globalStyle, style, children, keyboardOffset, refresh, }: {
|
|
7
11
|
globalStyle?: any;
|
|
8
12
|
style?: any;
|
|
9
13
|
children: ReactNode;
|
|
10
14
|
keyboardOffset?: Offset;
|
|
15
|
+
refresh?: Refresh;
|
|
11
16
|
}) => JSX.Element;
|
|
12
17
|
export default KeyboardAvoidingScrollView;
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
import React, { useMemo } from 'react';
|
|
19
|
-
import { KeyboardAvoidingView, Platform, ScrollView, StyleSheet, } from 'react-native';
|
|
19
|
+
import { KeyboardAvoidingView, Platform, RefreshControl, ScrollView, StyleSheet, } from 'react-native';
|
|
20
20
|
const DEFAULT_OFFSET = { ios: 70, android: 180 };
|
|
21
|
-
const KeyboardAvoidingScrollView = ({ globalStyle, style, children, keyboardOffset = DEFAULT_OFFSET, }) => {
|
|
21
|
+
const KeyboardAvoidingScrollView = ({ globalStyle, style, children, keyboardOffset = DEFAULT_OFFSET, refresh, }) => {
|
|
22
22
|
const keyboardVerticalOffset = useMemo(() => {
|
|
23
23
|
return { ...DEFAULT_OFFSET, ...keyboardOffset };
|
|
24
24
|
}, [keyboardOffset]);
|
|
@@ -29,7 +29,7 @@ const KeyboardAvoidingScrollView = ({ globalStyle, style, children, keyboardOffs
|
|
|
29
29
|
styles.scrollContent,
|
|
30
30
|
getZIndexStyles(10),
|
|
31
31
|
style,
|
|
32
|
-
]}>
|
|
32
|
+
]} refreshControl={refresh != null && (<RefreshControl refreshing={refresh.loading} onRefresh={refresh.fetcher}/>)}>
|
|
33
33
|
{children}
|
|
34
34
|
</ScrollView>
|
|
35
35
|
</KeyboardAvoidingView>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardAvoidingScrollView.js","sourceRoot":"","sources":["../../../../src/components/atoms/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAY,OAAO,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,MAAM,cAAc,GAAG,EAAC,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"KeyboardAvoidingScrollView.js","sourceRoot":"","sources":["../../../../src/components/atoms/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAY,OAAO,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,MAAM,cAAc,GA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,EAAE,CAC9B,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAEjD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,iBAAiB,EAAE;QACjB,IAAI,EAAE,CAAC;KACR;IACD,aAAa,EAAE;QACb,MAAM,EAAE,IAAI;KACb;CACF,CAAC,CAAC;AAEH,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
20
|
+
import { Text } from '../../atoms';
|
|
21
|
+
import { useThemeColor } from '../../../theme';
|
|
22
|
+
const DEFAULT_SIZE = 20;
|
|
23
|
+
const RadioButton = ({ onPress, selected, title, size = DEFAULT_SIZE, }) => {
|
|
24
|
+
const Colors = useThemeColor();
|
|
25
|
+
const styles = useMemo(() => getStyles(Colors, size), [Colors, size]);
|
|
26
|
+
return (<TouchableOpacity onPress={onPress} style={[styles.container, selected ? styles.selectedCard : null]}>
|
|
27
|
+
<View style={styles.buttonExt}>
|
|
28
|
+
{selected ? <View style={styles.buttonInt}/> : null}
|
|
29
|
+
</View>
|
|
30
|
+
<Text style={styles.title}>{title}</Text>
|
|
31
|
+
</TouchableOpacity>);
|
|
32
|
+
};
|
|
33
|
+
const getStyles = (Colors, size) => StyleSheet.create({
|
|
34
|
+
container: {
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
margin: 5,
|
|
38
|
+
flex: 1,
|
|
39
|
+
minWidth: 100,
|
|
40
|
+
padding: 10,
|
|
41
|
+
},
|
|
42
|
+
selectedCard: {
|
|
43
|
+
backgroundColor: Colors.backgroundColor,
|
|
44
|
+
borderColor: Colors.secondaryColor.background,
|
|
45
|
+
borderWidth: 1,
|
|
46
|
+
borderRadius: 7,
|
|
47
|
+
elevation: 2,
|
|
48
|
+
shadowOpacity: 0.5,
|
|
49
|
+
shadowColor: Colors.secondaryColor.background,
|
|
50
|
+
shadowOffset: { width: 0, height: 0 },
|
|
51
|
+
},
|
|
52
|
+
buttonExt: {
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
height: size,
|
|
56
|
+
width: size,
|
|
57
|
+
borderRadius: size,
|
|
58
|
+
borderWidth: 1,
|
|
59
|
+
borderColor: Colors.secondaryColor.background,
|
|
60
|
+
backgroundColor: Colors.backgroundColor,
|
|
61
|
+
},
|
|
62
|
+
buttonInt: {
|
|
63
|
+
height: size * 0.7,
|
|
64
|
+
width: size * 0.7,
|
|
65
|
+
borderRadius: size * 0.7,
|
|
66
|
+
backgroundColor: Colors.primaryColor.background,
|
|
67
|
+
},
|
|
68
|
+
title: {
|
|
69
|
+
marginLeft: 5,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export default RadioButton;
|
|
73
|
+
//# sourceMappingURL=RadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButton.js","sourceRoot":"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,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAmB,EAAE,IAAY,EAAE,EAAE,CACtD,UAAU,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,GAAG;QACb,OAAO,EAAE,EAAE;KACZ;IACD,YAAY,EAAE;QACZ,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU;QAC7C,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,CAAC;QACZ,aAAa,EAAE,GAAG;QAClB,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU;QAC7C,YAAY,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC;KACpC;IACD,SAAS,EAAE;QACT,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU;QAC7C,eAAe,EAAE,MAAM,CAAC,eAAe;KACxC;IACD,SAAS,EAAE;QACT,MAAM,EAAE,IAAI,GAAG,GAAG;QAClB,KAAK,EAAE,IAAI,GAAG,GAAG;QACjB,YAAY,EAAE,IAAI,GAAG,GAAG;QACxB,eAAe,EAAE,MAAM,CAAC,YAAY,CAAC,UAAU;KAChD;IACD,KAAK,EAAE;QACL,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC;AAEL,eAAe,WAAW,CAAC"}
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import React, { useEffect, useMemo } from 'react';
|
|
18
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
|
20
20
|
import SystemNavigationBar from 'react-native-system-navigation-bar';
|
|
21
21
|
import { useThemeColor } from '../../../theme';
|
|
22
22
|
import { useConfig } from '../../../config/ConfigContext';
|
|
23
|
+
const FIXED_CONTAINER_PADDING_VERTICAL = 10;
|
|
24
|
+
const FIXED_ITEMS_NOT_DISPLAY_HEIGHT = FIXED_CONTAINER_PADDING_VERTICAL * 2 + 1;
|
|
23
25
|
const immersiveMode = async () => {
|
|
24
26
|
await SystemNavigationBar.navigationHide();
|
|
25
27
|
};
|
|
@@ -27,6 +29,11 @@ const Screen = ({ style, children, fixedItems, removeSpaceOnTop = false, loading
|
|
|
27
29
|
const Colors = useThemeColor();
|
|
28
30
|
const styles = useMemo(() => getStyles(Colors), [Colors]);
|
|
29
31
|
const { showActivityIndicator } = useConfig();
|
|
32
|
+
const [fixedItemsHeight, setFixedItemsHeight] = useState(0);
|
|
33
|
+
const onLayout = event => {
|
|
34
|
+
const { height } = event.nativeEvent.layout;
|
|
35
|
+
setFixedItemsHeight(height);
|
|
36
|
+
};
|
|
30
37
|
useEffect(() => {
|
|
31
38
|
immersiveMode();
|
|
32
39
|
}, []);
|
|
@@ -39,7 +46,10 @@ const Screen = ({ style, children, fixedItems, removeSpaceOnTop = false, loading
|
|
|
39
46
|
style,
|
|
40
47
|
]}>
|
|
41
48
|
{children}
|
|
42
|
-
{
|
|
49
|
+
{!!fixedItems && (<View style={fixedItemsHeight > FIXED_ITEMS_NOT_DISPLAY_HEIGHT && [
|
|
50
|
+
styles.fixedContainer,
|
|
51
|
+
styles.smallTopShadow,
|
|
52
|
+
]} onLayout={onLayout}>
|
|
43
53
|
{fixedItems}
|
|
44
54
|
</View>)}
|
|
45
55
|
</View>);
|
|
@@ -56,6 +66,7 @@ const getStyles = (Colors) => StyleSheet.create({
|
|
|
56
66
|
backgroundColor: Colors.backgroundColor,
|
|
57
67
|
borderTopLeftRadius: 13,
|
|
58
68
|
borderTopRightRadius: 13,
|
|
69
|
+
paddingVertical: FIXED_CONTAINER_PADDING_VERTICAL,
|
|
59
70
|
},
|
|
60
71
|
smallTopShadow: {
|
|
61
72
|
borderTopWidth: 0.5,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.js","sourceRoot":"","sources":["../../../../src/components/atoms/Screen/Screen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Screen.js","sourceRoot":"","sources":["../../../../src/components/atoms/Screen/Screen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAC,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAc,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AAUxD,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAC5C,MAAM,8BAA8B,GAAG,gCAAgC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEhF,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IAC/B,MAAM,mBAAmB,CAAC,cAAc,EAAE,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,EACd,KAAK,EACL,QAAQ,EACR,UAAU,EACV,gBAAgB,GAAG,KAAK,EACxB,OAAO,GAAG,KAAK,GACH,EAAE,EAAE;IAChB,MAAM,MAAM,GAAG,a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;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAmB,EAAE,EAAE,CACxC,UAAU,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,eAAe,EAAE,MAAM,CAAC,qBAAqB;QAC7C,IAAI,EAAE,CAAC;KACR;IACD,cAAc,EAAE;QACd,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,UAAU;QACxB,SAAS,EAAE,UAAU;QACrB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,mBAAmB,EAAE,EAAE;QACvB,oBAAoB,EAAE,EAAE;QACxB,eAAe,EAAE,gCAAgC;KAClD;IACD,cAAc,EAAE;QACd,cAAc,EAAE,GAAG;QACnB,gBAAgB,EAAE,CAAC;QACnB,eAAe,EAAE,GAAG;QACpB,cAAc,EAAE,iBAAiB;QACjC,gBAAgB,EAAE,iBAAiB;QACnC,eAAe,EAAE,iBAAiB;QAClC,SAAS,EAAE,EAAE;QACb,aAAa,EAAE,GAAG;QAClB,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU;QAC7C,YAAY,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC;KACpC;IACD,SAAS,EAAE;QACT,UAAU,EAAE,MAAM;KACnB;CACF,CAAC,CAAC;AAEL,eAAe,MAAM,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
interface Refresh {
|
|
2
|
+
loading: boolean;
|
|
3
|
+
fetcher: () => void;
|
|
4
|
+
}
|
|
1
5
|
interface ScrollViewProps {
|
|
2
6
|
style?: any;
|
|
3
7
|
children?: any;
|
|
8
|
+
refresh?: Refresh;
|
|
4
9
|
}
|
|
5
|
-
declare const ScrollView: ({ style, children }: ScrollViewProps) => JSX.Element;
|
|
10
|
+
declare const ScrollView: ({ style, children, refresh }: ScrollViewProps) => JSX.Element;
|
|
6
11
|
export default ScrollView;
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
import React from 'react';
|
|
19
|
-
import { Platform, ScrollView as ReactNativeScrollView, StyleSheet, } from 'react-native';
|
|
20
|
-
const ScrollView = ({ style, children }) => {
|
|
19
|
+
import { Platform, ScrollView as ReactNativeScrollView, RefreshControl, StyleSheet, } from 'react-native';
|
|
20
|
+
const ScrollView = ({ style, children, refresh }) => {
|
|
21
21
|
return (<ReactNativeScrollView contentContainerStyle={[
|
|
22
22
|
styles.container,
|
|
23
23
|
Platform.OS === 'ios' ? styles.containerZIndex : null,
|
|
24
24
|
style,
|
|
25
|
-
]}>
|
|
25
|
+
]} refreshControl={refresh != null && (<RefreshControl refreshing={refresh.loading} onRefresh={refresh.fetcher}/>)}>
|
|
26
26
|
{children}
|
|
27
27
|
</ReactNativeScrollView>);
|
|
28
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.js","sourceRoot":"","sources":["../../../../src/components/atoms/ScrollView/ScrollView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,UAAU,IAAI,qBAAqB,EACnC,UAAU,GACX,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ScrollView.js","sourceRoot":"","sources":["../../../../src/components/atoms/ScrollView/ScrollView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,UAAU,IAAI,qBAAqB,EACnC,cAAc,EACd,UAAU,GACX,MAAM,cAAc,CAAC;AAatB,MAAM,UAAU,GAAG,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAkB,EAAE,EAAE;IACjE,OAAO,CACL,CAAC,qBAAqB,CACpB,qBAAqB,CAAC,CAAC;YACrB,MAAM,CAAC,SAAS;YAChB,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI;YACrD,KAAK;SACN,CAAC,CACF,cAAc,CAAC,CACb,OAAO,IAAI,IAAI,IAAI,CACjB,CAAC,cAAc,CACb,UAAU,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAC5B,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAC3B,CACH,CACF,CACD;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,qBAAqB,CAAC,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM;KACf;IACD,eAAe,EAAE;QACf,MAAM,EAAE,EAAE;KACX;CACF,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -15,20 +15,18 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import React
|
|
18
|
+
import React from 'react';
|
|
19
19
|
import { Switch as RNSwitch } from 'react-native';
|
|
20
20
|
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
21
21
|
const Switch = ({ isEnabled, handleToggle }) => {
|
|
22
|
-
const [enabled, setEnabled] = useState(isEnabled);
|
|
23
22
|
const Colors = useThemeColor();
|
|
24
23
|
const toggleSwitch = () => {
|
|
25
|
-
handleToggle(!
|
|
26
|
-
setEnabled(previousState => !previousState);
|
|
24
|
+
handleToggle(!isEnabled);
|
|
27
25
|
};
|
|
28
26
|
return (<RNSwitch trackColor={{
|
|
29
27
|
false: Colors.secondaryColor.background_light,
|
|
30
28
|
true: Colors.primaryColor.background_light,
|
|
31
|
-
}} thumbColor={Colors.secondaryColor_dark.background} ios_backgroundColor={Colors.backgroundColor} onValueChange={toggleSwitch} value={
|
|
29
|
+
}} thumbColor={Colors.secondaryColor_dark.background} ios_backgroundColor={Colors.backgroundColor} onValueChange={toggleSwitch} value={isEnabled}/>);
|
|
32
30
|
};
|
|
33
31
|
export default Switch;
|
|
34
32
|
//# sourceMappingURL=Switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAO1D,MAAM,MAAM,GAAG,CAAC,EAAC,SAAS,EAAE,YAAY,EAAc,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,QAAQ,CACP,UAAU,CAAC,CAAC;YACV,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,gBAAgB;YAC7C,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,gBAAgB;SAC3C,CAAC,CACF,UAAU,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAClD,mBAAmB,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAC5C,aAAa,CAAC,CAAC,YAAY,CAAC,CAC5B,KAAK,CAAC,CAAC,SAAS,CAAC,EACjB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -6,6 +6,7 @@ export { default as DottedLine } from './DottedLine/DottedLine';
|
|
|
6
6
|
export { default as Icon } from './Icon/Icon';
|
|
7
7
|
export { default as Input } from './Input/Input';
|
|
8
8
|
export { default as KeyboardAvoidingScrollView } from './KeyboardAvoidingScrollView/KeyboardAvoidingScrollView';
|
|
9
|
+
export { default as RadioButton } from './RadioButton/RadioButton';
|
|
9
10
|
export { default as Screen } from './Screen/Screen';
|
|
10
11
|
export { default as ScrollView } from './ScrollView/ScrollView';
|
|
11
12
|
export { default as Switch } from './Switch/Switch';
|
|
@@ -23,6 +23,7 @@ export { default as DottedLine } from './DottedLine/DottedLine';
|
|
|
23
23
|
export { default as Icon } from './Icon/Icon';
|
|
24
24
|
export { default as Input } from './Input/Input';
|
|
25
25
|
export { default as KeyboardAvoidingScrollView } from './KeyboardAvoidingScrollView/KeyboardAvoidingScrollView';
|
|
26
|
+
export { default as RadioButton } from './RadioButton/RadioButton';
|
|
26
27
|
export { default as Screen } from './Screen/Screen';
|
|
27
28
|
export { default as ScrollView } from './ScrollView/ScrollView';
|
|
28
29
|
export { default as Switch } from './Switch/Switch';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/atoms/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,sBAAsB,EAAC,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MA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MAAM,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ButtonProps } from '../Button/Button';
|
|
2
|
+
interface ButtonConfig extends ButtonProps {
|
|
3
|
+
hide?: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface CancelButtonConfig extends ButtonConfig {
|
|
6
|
+
showInHeader?: boolean;
|
|
7
|
+
headerSize?: number;
|
|
8
|
+
}
|
|
9
|
+
interface AlertProps {
|
|
10
|
+
style?: any;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
noBoldTitle?: boolean;
|
|
14
|
+
children: any;
|
|
15
|
+
cancelButtonConfig?: CancelButtonConfig;
|
|
16
|
+
confirmButtonConfig?: ButtonConfig;
|
|
17
|
+
translator?: (key: string) => string;
|
|
18
|
+
}
|
|
19
|
+
declare const Alert: ({ style, visible, title, noBoldTitle, children, cancelButtonConfig, confirmButtonConfig, translator, }: AlertProps) => JSX.Element;
|
|
20
|
+
export default Alert;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { StyleSheet, View, Modal } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme';
|
|
21
|
+
import { Card, Text, Icon } from '../../atoms';
|
|
22
|
+
import Button from '../Button/Button';
|
|
23
|
+
import { checkNullString } from '../../../utils';
|
|
24
|
+
const DEFAULT_BUTTON_WIDTH = 115;
|
|
25
|
+
const Alert = ({ style, visible = false, title, noBoldTitle = false, children, cancelButtonConfig, confirmButtonConfig, translator = key => key, }) => {
|
|
26
|
+
const Colors = useThemeColor();
|
|
27
|
+
const _cancelButtonConfig = useMemo(() => {
|
|
28
|
+
if (!cancelButtonConfig) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
title: translator('Base_Cancel'),
|
|
33
|
+
color: Colors.errorColor,
|
|
34
|
+
iconName: 'times',
|
|
35
|
+
hide: false,
|
|
36
|
+
showInHeader: false,
|
|
37
|
+
headerSize: 20,
|
|
38
|
+
width: DEFAULT_BUTTON_WIDTH,
|
|
39
|
+
...cancelButtonConfig,
|
|
40
|
+
};
|
|
41
|
+
}, [translator, Colors, cancelButtonConfig]);
|
|
42
|
+
const _confirmButtonConfig = useMemo(() => {
|
|
43
|
+
if (!confirmButtonConfig) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
title: translator('Base_OK'),
|
|
48
|
+
color: Colors.primaryColor,
|
|
49
|
+
iconName: 'check',
|
|
50
|
+
hide: false,
|
|
51
|
+
width: DEFAULT_BUTTON_WIDTH,
|
|
52
|
+
...confirmButtonConfig,
|
|
53
|
+
};
|
|
54
|
+
}, [translator, Colors, confirmButtonConfig]);
|
|
55
|
+
const isCancelButtonDisplayedBottom = useMemo(() => {
|
|
56
|
+
return !_cancelButtonConfig?.hide && !_cancelButtonConfig?.showInHeader;
|
|
57
|
+
}, [_cancelButtonConfig]);
|
|
58
|
+
const isConfirmButtonDisplayedBottom = useMemo(() => {
|
|
59
|
+
return !_confirmButtonConfig?.hide;
|
|
60
|
+
}, [_confirmButtonConfig]);
|
|
61
|
+
return (<Modal visible={visible} transparent animationType="fade" onRequestClose={_cancelButtonConfig?.onPress}>
|
|
62
|
+
<View style={styles.modalBackground}>
|
|
63
|
+
<Card style={[styles.container, style]}>
|
|
64
|
+
<View style={styles.headerContainer}>
|
|
65
|
+
{!checkNullString(title) && (<Text writingType={noBoldTitle ? null : 'title'} fontSize={20} style={[
|
|
66
|
+
styles.title,
|
|
67
|
+
{ marginHorizontal: _cancelButtonConfig?.headerSize },
|
|
68
|
+
]}>
|
|
69
|
+
{title}
|
|
70
|
+
</Text>)}
|
|
71
|
+
{!_cancelButtonConfig?.hide &&
|
|
72
|
+
_cancelButtonConfig?.showInHeader && (<Icon name="times" size={_cancelButtonConfig?.headerSize} style={styles.headerCancelButton} touchable onPress={_cancelButtonConfig?.onPress}/>)}
|
|
73
|
+
</View>
|
|
74
|
+
{children}
|
|
75
|
+
{(isCancelButtonDisplayedBottom ||
|
|
76
|
+
isConfirmButtonDisplayedBottom) && (<View style={styles.buttonsContainer}>
|
|
77
|
+
{isCancelButtonDisplayedBottom && (<Button {..._cancelButtonConfig} style={styles.cancelButton}/>)}
|
|
78
|
+
{isConfirmButtonDisplayedBottom && (<Button {..._confirmButtonConfig}/>)}
|
|
79
|
+
</View>)}
|
|
80
|
+
</Card>
|
|
81
|
+
</View>
|
|
82
|
+
</Modal>);
|
|
83
|
+
};
|
|
84
|
+
const styles = StyleSheet.create({
|
|
85
|
+
modalBackground: {
|
|
86
|
+
flex: 1,
|
|
87
|
+
justifyContent: 'center',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
90
|
+
},
|
|
91
|
+
container: {
|
|
92
|
+
width: '90%',
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
paddingHorizontal: 20,
|
|
96
|
+
paddingRight: 20,
|
|
97
|
+
paddingVertical: 15,
|
|
98
|
+
},
|
|
99
|
+
headerContainer: {
|
|
100
|
+
width: '100%',
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
marginBottom: 10,
|
|
104
|
+
},
|
|
105
|
+
title: {
|
|
106
|
+
textAlign: 'center',
|
|
107
|
+
},
|
|
108
|
+
headerCancelButton: {
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
right: 0,
|
|
111
|
+
top: 0,
|
|
112
|
+
},
|
|
113
|
+
buttonsContainer: {
|
|
114
|
+
width: '100%',
|
|
115
|
+
flexDirection: 'row',
|
|
116
|
+
justifyContent: 'flex-end',
|
|
117
|
+
marginTop: 10,
|
|
118
|
+
},
|
|
119
|
+
cancelButton: {
|
|
120
|
+
marginRight: 10,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
export default Alert;
|
|
124
|
+
//# sourceMappingURL=Alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../src/components/molecules/Alert/Alert.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,MAAqB,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAE/C,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAqBjC,MAAM,KAAK,GAAG,CAAC,EACb,KAAK,EACL,OAAO,GAAG,KAAK,EACf,KAAK,EACL,WAAW,GAAG,KAAK,EACnB,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-17,12 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import React from 'react';
|
|
19
19
|
import { StyleSheet, Dimensions, View } from 'react-native';
|
|
20
|
-
import { checkNullString } from '../../../utils/strings';
|
|
21
20
|
import { useConfig } from '../../../config/ConfigContext';
|
|
22
21
|
import { BlockInteractionScreen, Card } from '../../atoms';
|
|
23
22
|
import Button from '../Button/Button';
|
|
24
23
|
import WarningCard from '../WarningCard/WarningCard';
|
|
25
|
-
import IconButton from '../IconButton/IconButton';
|
|
26
24
|
/**
|
|
27
25
|
* @description To use this component, please use
|
|
28
26
|
* setBlockInteractionConfig({
|
|
@@ -50,7 +48,7 @@ const BlockInteractionMessage = ({}) => {
|
|
|
50
48
|
{Array.isArray(blockInteractionConfig.actionItems) &&
|
|
51
49
|
blockInteractionConfig.actionItems.length > 0 && (<View style={styles.buttonContainer}>
|
|
52
50
|
{blockInteractionConfig.actionItems.map((action, index) => {
|
|
53
|
-
return
|
|
51
|
+
return (<Button iconName={action.iconName} key={index} title={action.title} onPress={action.onPress} color={action.color} style={styles.width}/>);
|
|
54
52
|
})}
|
|
55
53
|
</View>)}
|
|
56
54
|
</Card>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockInteractionMessage.js","sourceRoot":"","sources":["../../../../src/components/molecules/BlockInteractionMessage/BlockInteractionMessage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"BlockInteractionMessage.js","sourceRoot":"","sources":["../../../../src/components/molecules/BlockInteractionMessage/BlockInteractionMessage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAE,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AAO,CAAC,CACxB,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpB,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACpB,CACH,CAAC;YACJ,CAAC,CAAC,CACJ;YAAA,EAAE,IAAI,CAAC,CACR,CACL;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,sBAAsB,CAAC,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,IAAI;QAC3C,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,GAAG;QAC1C,SAAS,EAAE,EAAE;QACb,aAAa,EAAE,EAAE;QACjB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,GAAG;KAC5C;IACD,KAAK,EAAE;QACL,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,IAAI;KAC7C;IACD,eAAe,EAAE;QACf,aAAa,EAAE,QAAQ;KACxB;CACF,CAAC,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { Color } from '../../../theme/themes';
|
|
2
|
-
interface ButtonProps {
|
|
2
|
+
export interface ButtonProps {
|
|
3
|
+
width?: string | number;
|
|
4
|
+
color?: Color;
|
|
5
|
+
isNeutralBackground?: boolean;
|
|
6
|
+
iconName?: string;
|
|
7
|
+
iconSize?: number;
|
|
8
|
+
FontAwesome5?: boolean;
|
|
9
|
+
title?: string;
|
|
3
10
|
style?: any;
|
|
11
|
+
styleIcon?: any;
|
|
4
12
|
styleTxt?: any;
|
|
5
|
-
color?: Color;
|
|
6
|
-
title: string;
|
|
7
13
|
onPress?: () => void;
|
|
8
14
|
disabled?: boolean;
|
|
15
|
+
onDisabledPress?: () => void;
|
|
9
16
|
}
|
|
10
|
-
declare const Button: ({
|
|
17
|
+
declare const Button: ({ width, color, isNeutralBackground, iconName, iconSize, FontAwesome5, title, style, styleIcon, styleTxt, onPress, disabled, onDisabledPress, }: ButtonProps) => JSX.Element;
|
|
11
18
|
export default Button;
|
|
@@ -19,29 +19,52 @@ import React, { useMemo } from 'react';
|
|
|
19
19
|
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
20
20
|
import { getCommonStyles } from '../../../utils/commons-styles';
|
|
21
21
|
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
22
|
-
import { Text } from '../../atoms';
|
|
23
|
-
const Button = ({
|
|
22
|
+
import { Icon, Text } from '../../atoms';
|
|
23
|
+
const Button = ({ width = '90%', color, isNeutralBackground = false, iconName, iconSize = 15, FontAwesome5 = true, title, style, styleIcon, styleTxt, onPress = () => { }, disabled = false, onDisabledPress = null, }) => {
|
|
24
24
|
const Colors = useThemeColor();
|
|
25
|
-
const buttonColor = useMemo(() =>
|
|
25
|
+
const buttonColor = useMemo(() => {
|
|
26
|
+
if (disabled) {
|
|
27
|
+
return Colors.secondaryColor;
|
|
28
|
+
}
|
|
29
|
+
let _buttonColor = color != null ? color : Colors.primaryColor;
|
|
30
|
+
if (isNeutralBackground) {
|
|
31
|
+
_buttonColor = {
|
|
32
|
+
background: _buttonColor.background,
|
|
33
|
+
background_light: Colors.backgroundColor,
|
|
34
|
+
foreground: Colors.text,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return _buttonColor;
|
|
38
|
+
}, [color, Colors, disabled, isNeutralBackground]);
|
|
26
39
|
const styles = useMemo(() => {
|
|
27
|
-
return getStyles(buttonColor
|
|
28
|
-
}, [buttonColor]);
|
|
40
|
+
return getStyles(buttonColor, width);
|
|
41
|
+
}, [buttonColor, width]);
|
|
29
42
|
const commonStyles = useMemo(() => {
|
|
30
43
|
return getCommonStyles(Colors);
|
|
31
44
|
}, [Colors]);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
if (!iconName && !title) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return (<TouchableOpacity style={[commonStyles.button, styles.colorButton, style]} onPress={disabled ? onDisabledPress : onPress} disabled={disabled && !onDisabledPress} activeOpacity={0.9}>
|
|
49
|
+
{!!iconName && (<Icon name={iconName} FontAwesome5={FontAwesome5} size={iconSize} color={buttonColor.foreground} style={[styles.icon, styleIcon]}/>)}
|
|
50
|
+
{!!title && (<Text style={[styles.text, styleTxt]} fontSize={17} textColor={buttonColor.foreground}>
|
|
51
|
+
{title}
|
|
52
|
+
</Text>)}
|
|
36
53
|
</TouchableOpacity>);
|
|
37
54
|
};
|
|
38
|
-
const getStyles =
|
|
55
|
+
const getStyles = (color, width) => StyleSheet.create({
|
|
39
56
|
colorButton: {
|
|
40
|
-
backgroundColor:
|
|
57
|
+
backgroundColor: color.background_light,
|
|
58
|
+
borderColor: color.background,
|
|
59
|
+
width: width,
|
|
41
60
|
},
|
|
42
61
|
text: {
|
|
43
62
|
fontWeight: 'bold',
|
|
44
63
|
textAlign: 'center',
|
|
64
|
+
marginHorizontal: 5,
|
|
65
|
+
},
|
|
66
|
+
icon: {
|
|
67
|
+
marginHorizontal: 5,
|
|
45
68
|
},
|
|
46
69
|
});
|
|
47
70
|
export default Button;
|