@axelor/aos-mobile-ui 6.4.4 → 6.4.6
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.js +4 -6
- package/lib/components/atoms/Icon/Icon.js.map +1 -1
- package/lib/components/atoms/Input/Input.d.ts +5 -3
- package/lib/components/atoms/Input/Input.js +2 -2
- package/lib/components/atoms/Input/Input.js.map +1 -1
- package/lib/components/molecules/Checkbox/Checkbox.d.ts +2 -2
- package/lib/components/molecules/Checkbox/Checkbox.js +19 -6
- package/lib/components/molecules/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/molecules/DropdownCard/DropdownCard.d.ts +3 -2
- package/lib/components/molecules/DropdownCard/DropdownCard.js +24 -24
- package/lib/components/molecules/DropdownCard/DropdownCard.js.map +1 -1
- package/lib/components/molecules/FormHtmlInput/FormHtmlInput.js +4 -1
- package/lib/components/molecules/FormHtmlInput/FormHtmlInput.js.map +1 -1
- package/lib/components/molecules/FormIncrementInput/FormIncrementInput.d.ts +12 -3
- package/lib/components/molecules/FormIncrementInput/FormIncrementInput.js +19 -17
- package/lib/components/molecules/FormIncrementInput/FormIncrementInput.js.map +1 -1
- package/lib/components/molecules/FormInput/FormInput.d.ts +4 -1
- package/lib/components/molecules/FormInput/FormInput.js +7 -3
- package/lib/components/molecules/FormInput/FormInput.js.map +1 -1
- package/lib/components/molecules/IconButton/IconButton.d.ts +1 -1
- package/lib/components/molecules/IconInput/IconInput.d.ts +4 -2
- package/lib/components/molecules/IconInput/IconInput.js +2 -2
- package/lib/components/molecules/IconInput/IconInput.js.map +1 -1
- package/lib/components/molecules/Image/Image.d.ts +2 -2
- package/lib/components/molecules/Increment/Increment.d.ts +10 -1
- package/lib/components/molecules/Increment/Increment.js +64 -46
- package/lib/components/molecules/Increment/Increment.js.map +1 -1
- package/lib/components/molecules/Increment/IncrementButton.d.ts +10 -0
- package/lib/components/molecules/Increment/IncrementButton.js +56 -0
- package/lib/components/molecules/Increment/IncrementButton.js.map +1 -0
- package/lib/components/molecules/InfoBubble/InfoBubble.d.ts +2 -1
- package/lib/components/molecules/InfoBubble/InfoBubble.js +8 -8
- package/lib/components/molecules/InfoBubble/InfoBubble.js.map +1 -1
- package/lib/components/molecules/Label/Label.d.ts +14 -0
- package/lib/components/molecules/Label/Label.js +100 -0
- package/lib/components/molecules/Label/Label.js.map +1 -0
- package/lib/components/molecules/NumberBubble/NumberBubble.d.ts +10 -0
- package/lib/components/molecules/NumberBubble/NumberBubble.js +51 -0
- package/lib/components/molecules/NumberBubble/NumberBubble.js.map +1 -0
- package/lib/components/molecules/index.d.ts +3 -1
- package/lib/components/molecules/index.js +3 -1
- package/lib/components/molecules/index.js.map +1 -1
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.js +5 -1
- package/lib/components/organisms/AutoCompleteSearch/AutoCompleteSearch.js.map +1 -1
- package/lib/components/organisms/DropdownCardSwitch/DropdownCardSwitch.js +1 -1
- package/lib/components/organisms/Picker/Picker.js +8 -4
- package/lib/components/organisms/Picker/Picker.js.map +1 -1
- package/lib/components/organisms/ScrollList/ScrollList.d.ts +3 -1
- package/lib/components/organisms/ScrollList/ScrollList.js +2 -2
- package/lib/components/organisms/ScrollList/ScrollList.js.map +1 -1
- package/lib/components/organisms/SearchBar/SearchBar.d.ts +4 -1
- package/lib/components/organisms/SearchBar/SearchBar.js +2 -2
- package/lib/components/organisms/SearchBar/SearchBar.js.map +1 -1
- package/lib/utils/formatters.js +1 -1
- package/lib/utils/formatters.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,64 +19,90 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
19
19
|
import { StyleSheet, View } from 'react-native';
|
|
20
20
|
import { formatNumber as _format, unformatNumber as _unformat, } from '../../../utils/formatters';
|
|
21
21
|
import { useThemeColor } from '../../../theme';
|
|
22
|
-
import {
|
|
22
|
+
import { Input } from '../../atoms';
|
|
23
|
+
import IncrementButton from './IncrementButton';
|
|
23
24
|
const cutDecimalExcess = number => {
|
|
25
|
+
if (number == null) {
|
|
26
|
+
return '0.00';
|
|
27
|
+
}
|
|
28
|
+
if (typeof number === 'string') {
|
|
29
|
+
return parseFloat(number).toFixed(2).toString();
|
|
30
|
+
}
|
|
24
31
|
return number.toFixed(2).toString();
|
|
25
32
|
};
|
|
26
|
-
const Increment = ({ style, inputStyle, value, decimalSpacer, thousandSpacer, onValueChange, onFocus = () => { }, onBlur = () => { }, }) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
const Increment = ({ style, inputStyle, value, decimalSpacer, thousandSpacer, onValueChange, onFocus = () => { }, onBlur = () => { }, readonly = false, defaultFormatting = true, stepSize = 1, minValue = 0, maxValue = null, isBigButton = false, keyboardType = 'numeric', scale, }) => {
|
|
34
|
+
const Colors = useThemeColor();
|
|
35
|
+
const [valueQty, setValueQty] = useState();
|
|
36
|
+
const handleDecimal = useCallback((numberToFormat) => {
|
|
37
|
+
if (scale == null) {
|
|
38
|
+
return cutDecimalExcess(numberToFormat);
|
|
39
|
+
}
|
|
40
|
+
const _scale = Math.max(scale, 0);
|
|
41
|
+
const _value = typeof numberToFormat === 'string'
|
|
42
|
+
? parseFloat(numberToFormat)
|
|
43
|
+
: numberToFormat;
|
|
44
|
+
return _value.toFixed(_scale);
|
|
45
|
+
}, [scale]);
|
|
46
|
+
const format = useCallback((number) => {
|
|
47
|
+
return _format(handleDecimal(number), decimalSpacer, thousandSpacer);
|
|
48
|
+
}, [handleDecimal, decimalSpacer, thousandSpacer]);
|
|
30
49
|
const unformat = useCallback(number => {
|
|
31
50
|
return _unformat(number, decimalSpacer, thousandSpacer);
|
|
32
51
|
}, [decimalSpacer, thousandSpacer]);
|
|
33
|
-
const
|
|
34
|
-
|
|
52
|
+
const handleValueFormatting = useCallback((_value) => {
|
|
53
|
+
if (defaultFormatting) {
|
|
54
|
+
setValueQty(format(_value));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
setValueQty(typeof _value === 'string' ? _value : _value.toString());
|
|
58
|
+
}
|
|
59
|
+
}, [defaultFormatting, format]);
|
|
60
|
+
const handleResult = useCallback((_value) => {
|
|
61
|
+
let resultValue;
|
|
62
|
+
if (minValue != null && _value <= minValue) {
|
|
63
|
+
resultValue = minValue;
|
|
64
|
+
}
|
|
65
|
+
else if (maxValue != null && _value >= maxValue) {
|
|
66
|
+
resultValue = maxValue;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
resultValue = _value;
|
|
70
|
+
}
|
|
71
|
+
handleValueFormatting(resultValue);
|
|
72
|
+
onValueChange(resultValue);
|
|
73
|
+
}, [handleValueFormatting, maxValue, minValue, onValueChange]);
|
|
35
74
|
useEffect(() => {
|
|
36
|
-
|
|
37
|
-
}, [
|
|
75
|
+
handleValueFormatting(parseFloat(value || '0')?.toString());
|
|
76
|
+
}, [handleValueFormatting, value]);
|
|
38
77
|
const handlePlus = () => {
|
|
39
|
-
const unformatedValue = unformat(valueQty);
|
|
40
|
-
const newValue = parseFloat(unformatedValue) +
|
|
41
|
-
|
|
42
|
-
onValueChange(newValue);
|
|
78
|
+
const unformatedValue = defaultFormatting ? unformat(valueQty) : valueQty;
|
|
79
|
+
const newValue = parseFloat(unformatedValue) + stepSize;
|
|
80
|
+
handleResult(newValue);
|
|
43
81
|
};
|
|
44
82
|
const handleMinus = () => {
|
|
45
|
-
const unformatedValue = unformat(valueQty);
|
|
46
|
-
const newValue = parseFloat(unformatedValue) -
|
|
47
|
-
|
|
48
|
-
setValueQty(format(cutDecimalExcess(newValue)));
|
|
49
|
-
onValueChange(newValue);
|
|
50
|
-
}
|
|
83
|
+
const unformatedValue = defaultFormatting ? unformat(valueQty) : valueQty;
|
|
84
|
+
const newValue = parseFloat(unformatedValue) - stepSize;
|
|
85
|
+
handleResult(newValue);
|
|
51
86
|
};
|
|
52
87
|
const handleEndInput = () => {
|
|
53
88
|
if (valueQty.slice(-1) === decimalSpacer) {
|
|
54
89
|
valueQty.replace(/.,$/, '');
|
|
55
90
|
}
|
|
56
91
|
if (valueQty === '' || valueQty === null) {
|
|
57
|
-
|
|
58
|
-
onValueChange(0.0);
|
|
92
|
+
handleResult(0);
|
|
59
93
|
}
|
|
60
94
|
else {
|
|
61
|
-
|
|
62
|
-
if (newValue >= 0) {
|
|
63
|
-
setValueQty(format(cutDecimalExcess(newValue)));
|
|
64
|
-
onValueChange(newValue.toFixed(2));
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
setValueQty(`0${decimalSpacer}00`);
|
|
68
|
-
onValueChange(0.0);
|
|
69
|
-
}
|
|
95
|
+
handleResult(valueQty);
|
|
70
96
|
}
|
|
71
97
|
onBlur();
|
|
72
98
|
};
|
|
73
99
|
const styles = useMemo(() => getStyles(Colors), [Colors]);
|
|
74
100
|
return (<View style={[styles.container_increment, style]}>
|
|
75
|
-
<
|
|
76
|
-
<View style={styles.inputLine}>
|
|
77
|
-
<Input style={[styles.input, inputStyle]} value={valueQty} onChange={input => setValueQty(input)} keyboardType=
|
|
101
|
+
<IncrementButton iconName="minus" onPress={handleMinus} readonly={readonly} disabled={minValue != null && parseFloat(valueQty) <= minValue} isBigButton={isBigButton}/>
|
|
102
|
+
<View style={[styles.inputLine, isBigButton ? styles.fixedInputWidth : null]}>
|
|
103
|
+
<Input style={[styles.input, inputStyle]} value={valueQty} onChange={input => setValueQty(input)} keyboardType={keyboardType} onSelection={onFocus} onEndFocus={handleEndInput}/>
|
|
78
104
|
</View>
|
|
79
|
-
<
|
|
105
|
+
<IncrementButton iconName="plus" onPress={handlePlus} readonly={readonly} disabled={maxValue != null && parseFloat(valueQty) >= maxValue} isBigButton={isBigButton}/>
|
|
80
106
|
</View>);
|
|
81
107
|
};
|
|
82
108
|
const getStyles = (Colors) => StyleSheet.create({
|
|
@@ -84,22 +110,11 @@ const getStyles = (Colors) => StyleSheet.create({
|
|
|
84
110
|
flexDirection: 'row',
|
|
85
111
|
alignItems: 'center',
|
|
86
112
|
},
|
|
87
|
-
container_icon: {
|
|
88
|
-
backgroundColor: Colors.backgroundColor,
|
|
89
|
-
elevation: 3,
|
|
90
|
-
justifyContent: 'center',
|
|
91
|
-
alignItems: 'center',
|
|
92
|
-
marginHorizontal: 8,
|
|
93
|
-
padding: 2,
|
|
94
|
-
paddingHorizontal: 5,
|
|
95
|
-
borderColor: Colors.secondaryColor.background,
|
|
96
|
-
borderWidth: 0.5,
|
|
97
|
-
borderRadius: 10,
|
|
98
|
-
},
|
|
99
113
|
input: {
|
|
100
114
|
fontSize: 23,
|
|
101
115
|
fontWeight: 'bold',
|
|
102
116
|
paddingBottom: 0,
|
|
117
|
+
textAlign: 'center',
|
|
103
118
|
},
|
|
104
119
|
inputLine: {
|
|
105
120
|
borderStyle: 'dashed',
|
|
@@ -107,6 +122,9 @@ const getStyles = (Colors) => StyleSheet.create({
|
|
|
107
122
|
borderBottomWidth: 0.7,
|
|
108
123
|
marginBottom: 9,
|
|
109
124
|
},
|
|
125
|
+
fixedInputWidth: {
|
|
126
|
+
width: '40%',
|
|
127
|
+
},
|
|
110
128
|
});
|
|
111
129
|
export default Increment;
|
|
112
130
|
//# sourceMappingURL=Increment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Increment.js","sourceRoot":"","sources":["../../../../src/components/molecules/Increment/Increment.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"Increment.js","sourceRoot":"","sources":["../../../../src/components/molecules/Increment/Increment.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvE,OAAO,EAAsB,UAA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AAC,UAAU,CAAC,CACpB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,QAAQ,CAAC,CAAC,QAAQ,IAAI,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAC/D,WAAW,CAAC,CAAC,WAAW,CAAC,EAE7B;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAmB,EAAE,EAAE,CACxC,UAAU,CAAC,MAAM,CAAC;IAChB,mBAAmB,EAAE;QACnB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;KACrB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;QAClB,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,WAAW,EAAE,QAAQ;QACrB,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC,UAAU;QACnD,iBAAiB,EAAE,GAAG;QACtB,YAAY,EAAE,CAAC;KAChB;IACD,eAAe,EAAE;QACf,KAAK,EAAE,KAAK;KACb;CACF,CAAC,CAAC;AAEL,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface IncrementButtonProps {
|
|
2
|
+
style?: any;
|
|
3
|
+
iconName: 'plus' | 'minus';
|
|
4
|
+
onPress?: () => void;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
isBigButton?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const IncrementButton: ({ style, iconName, onPress, readonly, disabled, isBigButton, }: IncrementButtonProps) => JSX.Element;
|
|
10
|
+
export default IncrementButton;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme';
|
|
21
|
+
import { Icon } from '../../atoms';
|
|
22
|
+
const ICON_SIZE = 24;
|
|
23
|
+
const DEFAULT_BUTTON_SIZE = 35;
|
|
24
|
+
const BIG_BUTTON_SIZE = 75;
|
|
25
|
+
const IncrementButton = ({ style, iconName, onPress = () => { }, readonly = false, disabled, isBigButton = false, }) => {
|
|
26
|
+
const Colors = useThemeColor();
|
|
27
|
+
const buttonSize = useMemo(() => (isBigButton ? BIG_BUTTON_SIZE : DEFAULT_BUTTON_SIZE), [isBigButton]);
|
|
28
|
+
const styles = useMemo(() => getStyles(Colors, buttonSize), [Colors, buttonSize]);
|
|
29
|
+
if (readonly) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return (<Icon name={iconName} size={ICON_SIZE} color={disabled
|
|
33
|
+
? Colors.secondaryColor.background
|
|
34
|
+
: Colors.primaryColor.background} touchable={!disabled} onPress={onPress} style={[styles.container_icon, style]}/>);
|
|
35
|
+
};
|
|
36
|
+
const getStyles = (Colors, buttonSize) => StyleSheet.create({
|
|
37
|
+
container_icon: {
|
|
38
|
+
backgroundColor: Colors.backgroundColor,
|
|
39
|
+
elevation: 3,
|
|
40
|
+
shadowOpacity: 0.5,
|
|
41
|
+
shadowColor: Colors.secondaryColor.background,
|
|
42
|
+
shadowOffset: { width: 0, height: 0 },
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
marginHorizontal: 8,
|
|
46
|
+
padding: 2,
|
|
47
|
+
paddingHorizontal: 5,
|
|
48
|
+
borderColor: Colors.secondaryColor.background,
|
|
49
|
+
borderWidth: 0.5,
|
|
50
|
+
borderRadius: 10,
|
|
51
|
+
width: buttonSize ?? DEFAULT_BUTTON_SIZE,
|
|
52
|
+
height: buttonSize ?? DEFAULT_BUTTON_SIZE,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
export default IncrementButton;
|
|
56
|
+
//# sourceMappingURL=IncrementButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IncrementButton.js","sourceRoot":"","sources":["../../../../src/components/molecules/Increment/IncrementButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAc,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAEjC,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,EAAE,CAAC;AAW3B,MAAM,eAAe,GAAG,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,EAClB,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,WAAW,GAAG,KAAK,GACE,EAAE,EAAE;IACzB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,UAAU,GAAG,OAAO,CACxB,GAAG,EAAE,CAAC,CAAC,WAAW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AAE,EAAE;QAChB,KAAK,EAAE,UAAU,IAAI,mBAAmB;QACxC,MAAM,EAAE,UAAU,IAAI,mBAAmB;KAC1C;CACF,CAAC,CAAC;AAEL,eAAe,eAAe,CAAC"}
|
|
@@ -4,6 +4,7 @@ interface InfoBubbleProps {
|
|
|
4
4
|
iconName: string;
|
|
5
5
|
badgeColor: Color;
|
|
6
6
|
indication: string;
|
|
7
|
+
size?: number;
|
|
7
8
|
}
|
|
8
|
-
declare const InfoBubble: ({ style, iconName, badgeColor, indication, }: InfoBubbleProps) => JSX.Element;
|
|
9
|
+
declare const InfoBubble: ({ style, iconName, badgeColor, indication, size, }: InfoBubbleProps) => JSX.Element;
|
|
9
10
|
export default InfoBubble;
|
|
@@ -20,12 +20,12 @@ import { Dimensions, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
|
20
20
|
import { Card, Icon, Text } from '../../atoms';
|
|
21
21
|
import { useThemeColor } from '../../../theme/ThemeContext';
|
|
22
22
|
import { OUTSIDE_INDICATOR, useClickOutside, } from '../../../hooks/use-click-outside';
|
|
23
|
-
const InfoBubble = ({ style, iconName, badgeColor, indication, }) => {
|
|
23
|
+
const InfoBubble = ({ style, iconName, badgeColor, indication, size = Dimensions.get('window').width * 0.07, }) => {
|
|
24
24
|
const [isOpen, setIsOpen] = useState(false);
|
|
25
25
|
const wrapperRef = useRef(null);
|
|
26
26
|
const Colors = useThemeColor();
|
|
27
27
|
const clickOutside = useClickOutside({ wrapperRef, visible: isOpen });
|
|
28
|
-
const styles = useMemo(() => getStyles(badgeColor, Colors), [badgeColor, Colors]);
|
|
28
|
+
const styles = useMemo(() => getStyles(badgeColor, Colors, isOpen, size), [badgeColor, Colors, isOpen, size]);
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
if (clickOutside === OUTSIDE_INDICATOR && isOpen) {
|
|
31
31
|
setIsOpen(false);
|
|
@@ -36,29 +36,29 @@ const InfoBubble = ({ style, iconName, badgeColor, indication, }) => {
|
|
|
36
36
|
};
|
|
37
37
|
return (<View ref={wrapperRef} style={[styles.container, style]}>
|
|
38
38
|
<TouchableOpacity onPress={onPress} activeOpacity={0.95}>
|
|
39
|
-
<Icon name={iconName} style={styles.
|
|
39
|
+
<Icon name={iconName} style={styles.icon} color={badgeColor.foreground} size={size * 0.5}/>
|
|
40
40
|
</TouchableOpacity>
|
|
41
41
|
{isOpen ? (<Card style={styles.indicationCard}>
|
|
42
42
|
<Text>{indication}</Text>
|
|
43
43
|
</Card>) : null}
|
|
44
44
|
</View>);
|
|
45
45
|
};
|
|
46
|
-
const getStyles = (badgeColor, Colors) => StyleSheet.create({
|
|
46
|
+
const getStyles = (badgeColor, Colors, isOpen, size) => StyleSheet.create({
|
|
47
47
|
container: {
|
|
48
48
|
alignItems: 'center',
|
|
49
49
|
flexDirection: 'row',
|
|
50
50
|
marginVertical: 5,
|
|
51
51
|
},
|
|
52
|
-
|
|
52
|
+
icon: {
|
|
53
53
|
alignSelf: 'center',
|
|
54
54
|
justifyContent: 'center',
|
|
55
55
|
alignItems: 'center',
|
|
56
56
|
backgroundColor: badgeColor.background_light,
|
|
57
57
|
borderWidth: 2,
|
|
58
58
|
borderColor: badgeColor.background,
|
|
59
|
-
borderRadius:
|
|
60
|
-
width:
|
|
61
|
-
height:
|
|
59
|
+
borderRadius: size,
|
|
60
|
+
width: size,
|
|
61
|
+
height: size,
|
|
62
62
|
},
|
|
63
63
|
indicationCard: {
|
|
64
64
|
position: 'absolute',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBubble.js","sourceRoot":"","sources":["../../../../src/components/molecules/InfoBubble/InfoBubble.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAC,MAAM,cAAc,C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,EAAE,CACrD,UAAU,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,CAAC;KAClB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,QAAQ;QACnB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,UAAU,CAAC,gBAAgB;QAC5C,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,UAAU,CAAC,UAAU;QAClC,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;KACb;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,EAAE;QACf,eAAe,EAAE,EAAE;QACnB,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,MAAM,CAAC,eAAe;KACxC;CACF,CAAC,CAAC;AAEL,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Color } from '../../../theme';
|
|
2
|
+
type LabelType = 'info' | 'success' | 'danger' | 'error';
|
|
3
|
+
interface LabelProps {
|
|
4
|
+
style?: any;
|
|
5
|
+
message: string;
|
|
6
|
+
type?: LabelType;
|
|
7
|
+
iconName?: string;
|
|
8
|
+
color?: Color;
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
showClose?: boolean;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const Label: ({ style, message, type, iconName, color, visible, showClose, onClose, }: LabelProps) => JSX.Element;
|
|
14
|
+
export default Label;
|
|
@@ -0,0 +1,100 @@
|
|
|
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, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import { StyleSheet, View } from 'react-native';
|
|
20
|
+
import { useThemeColor } from '../../../theme';
|
|
21
|
+
import { Icon, Text } from '../../atoms';
|
|
22
|
+
import { hexToRgb } from '../../../utils/commons-utlis';
|
|
23
|
+
const Label = ({ style, message, type = 'error', iconName, color, visible = true, showClose = false, onClose = () => { }, }) => {
|
|
24
|
+
const Colors = useThemeColor();
|
|
25
|
+
const [isVisible, setIsVisible] = useState(visible);
|
|
26
|
+
const typeConfig = useMemo(() => {
|
|
27
|
+
let config = null;
|
|
28
|
+
switch (type) {
|
|
29
|
+
case 'error':
|
|
30
|
+
config = { color: Colors.errorColor, iconName: 'warning' };
|
|
31
|
+
break;
|
|
32
|
+
case 'danger':
|
|
33
|
+
config = { color: Colors.cautionColor, iconName: 'exclamation-circle' };
|
|
34
|
+
break;
|
|
35
|
+
case 'info':
|
|
36
|
+
config = { color: Colors.infoColor, iconName: 'info-circle' };
|
|
37
|
+
break;
|
|
38
|
+
case 'success':
|
|
39
|
+
config = { color: Colors.successColor, iconName: 'check-circle' };
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
config = { color: null, iconName: null };
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
if (color != null) {
|
|
46
|
+
config.color = color;
|
|
47
|
+
}
|
|
48
|
+
if (iconName != null) {
|
|
49
|
+
config.iconName = iconName;
|
|
50
|
+
}
|
|
51
|
+
return { ...config };
|
|
52
|
+
}, [Colors, color, iconName, type]);
|
|
53
|
+
const styles = useMemo(() => {
|
|
54
|
+
return getStyles(typeConfig?.color);
|
|
55
|
+
}, [typeConfig]);
|
|
56
|
+
const handleClose = useCallback(() => {
|
|
57
|
+
setIsVisible(false);
|
|
58
|
+
onClose();
|
|
59
|
+
}, [onClose]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setIsVisible(_current => {
|
|
62
|
+
if (visible == null || _current === visible) {
|
|
63
|
+
return _current;
|
|
64
|
+
}
|
|
65
|
+
return visible;
|
|
66
|
+
});
|
|
67
|
+
}, [visible]);
|
|
68
|
+
if (!isVisible) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return (<View style={[styles.container, style]}>
|
|
72
|
+
<Icon name={typeConfig?.iconName} FontAwesome5={false} color={typeConfig?.color?.foreground}/>
|
|
73
|
+
<Text style={styles.text}>{message}</Text>
|
|
74
|
+
{showClose && (<Icon name="times" FontAwesome5={false} color={typeConfig?.color?.foreground} touchable={true} onPress={handleClose}/>)}
|
|
75
|
+
</View>);
|
|
76
|
+
};
|
|
77
|
+
const getStyles = color => StyleSheet.create({
|
|
78
|
+
container: {
|
|
79
|
+
width: '100%',
|
|
80
|
+
borderColor: color?.background_light,
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderRadius: 13,
|
|
83
|
+
backgroundColor: `rgba(${hexToRgb(color?.background_light)}, 0.4)`,
|
|
84
|
+
flexDirection: 'row',
|
|
85
|
+
justifyContent: 'flex-start',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
marginVertical: 10,
|
|
88
|
+
marginHorizontal: 0,
|
|
89
|
+
paddingVertical: 10,
|
|
90
|
+
paddingHorizontal: 10,
|
|
91
|
+
},
|
|
92
|
+
text: {
|
|
93
|
+
marginLeft: 10,
|
|
94
|
+
color: color?.foreground,
|
|
95
|
+
alignSelf: 'center',
|
|
96
|
+
width: '85%',
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
export default Label;
|
|
100
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../src/components/molecules/Label/Label.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACvE,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAQ,aAAa,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,8BAA8B,CAAC;AAoBtD,MAAM,KAAK,GAAG,CAAC,EACb,KAAK,EACL,OAAO,EACP,IAAI,GAAG,OAAO,EACd,QAAQ,EACR,KAAK,EACL,OAAO,GAAG,IAAI,EACd,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,GACP,EAAE,EAAE;IACf,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAe,OAAO,CAAC,GAAG,EAAE;QAC1C,IAAI,MAAM,GAAe,IAAI,CAAC;QAE9B,QAAQ,IAAI,EAAE;YACZ,KAAK,OAAO;gBACV,MAAM,GAAG,EAAC,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAC,CAAC;gBACzD,MAAM;YACR,KAAK,QAAQ;gBACX,MAAM,GAAG,EAAC,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAC,CAAC;gBACtE,MAA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E,KAAK,EAAE,UAAU;QACxB,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,KAAK;KACb;CACF,CAAC,CAAC;AAEL,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Color } from '../../../theme';
|
|
2
|
+
interface NumberBubbleProps {
|
|
3
|
+
style?: any;
|
|
4
|
+
number: number;
|
|
5
|
+
color: Color;
|
|
6
|
+
isNeutralBackground: boolean;
|
|
7
|
+
size?: number;
|
|
8
|
+
}
|
|
9
|
+
declare const NumberBubble: ({ style, number, color, isNeutralBackground, size, }: NumberBubbleProps) => JSX.Element;
|
|
10
|
+
export default NumberBubble;
|
|
@@ -0,0 +1,51 @@
|
|
|
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, Dimensions } from 'react-native';
|
|
20
|
+
import { Text } from '../../atoms';
|
|
21
|
+
import { useThemeColor } from '../../../theme';
|
|
22
|
+
const DEFAULT_SIZE = Dimensions.get('window').width * 0.07;
|
|
23
|
+
const NumberBubble = ({ style, number, color, isNeutralBackground = true, size = DEFAULT_SIZE, }) => {
|
|
24
|
+
const Colors = useThemeColor();
|
|
25
|
+
const _color = useMemo(() => isNeutralBackground
|
|
26
|
+
? {
|
|
27
|
+
background: color.background,
|
|
28
|
+
background_light: Colors.backgroundColor,
|
|
29
|
+
foreground: Colors.text,
|
|
30
|
+
}
|
|
31
|
+
: color, [Colors, color, isNeutralBackground]);
|
|
32
|
+
const styles = useMemo(() => getStyles(_color, size), [_color, size]);
|
|
33
|
+
return (<View style={[styles.bubble, style]}>
|
|
34
|
+
<Text textColor={_color.foreground}>{number}</Text>
|
|
35
|
+
</View>);
|
|
36
|
+
};
|
|
37
|
+
const getStyles = (color, size) => StyleSheet.create({
|
|
38
|
+
bubble: {
|
|
39
|
+
alignSelf: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
width: size,
|
|
43
|
+
height: size,
|
|
44
|
+
backgroundColor: color.background_light,
|
|
45
|
+
borderColor: color.background,
|
|
46
|
+
borderRadius: size,
|
|
47
|
+
borderWidth: 2,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
export default NumberBubble;
|
|
51
|
+
//# sourceMappingURL=NumberBubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberBubble.js","sourceRoot":"","sources":["../../../../src/components/molecules/NumberBubble/NumberBubble.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAQ,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAEpD,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC;AAU3D,MAAM,YAAY,GAAG,CAAC,EACpB,KAAK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 -14,18 +14,20 @@ export { default as EditableInput } from './EditableInput/EditableInput';
|
|
|
14
14
|
export { default as FormInput } from './FormInput/FormInput';
|
|
15
15
|
export { default as FromTo } from './FromTo/FromTo';
|
|
16
16
|
export { default as HalfLabelCard } from './HalfLabelCard/HalfLabelCard';
|
|
17
|
+
export { default as HeaderIndicator } from './HeaderIndicator/HeaderIndicator';
|
|
17
18
|
export { default as IconButton } from './IconButton/IconButton';
|
|
18
19
|
export { default as IconInput } from './IconInput/IconInput';
|
|
19
20
|
export { default as Image } from './Image/Image';
|
|
20
21
|
export { default as Increment } from './Increment/Increment';
|
|
21
22
|
export { default as InfoBubble } from './InfoBubble/InfoBubble';
|
|
22
|
-
export { default as
|
|
23
|
+
export { default as Label } from './Label/Label';
|
|
23
24
|
export { default as LabelText } from './LabelText/LabelText';
|
|
24
25
|
export { default as LoadingIndicator } from './LoadingIndicator/LoadingIndicator';
|
|
25
26
|
export { default as MessageBox } from './MessageBox/MessageBox';
|
|
26
27
|
export { default as MovementIndicationCard } from './MovementIndicationCard/MovementIndicationCard';
|
|
27
28
|
export { default as MultiValuePickerButton } from './MultiValuePickerButton/MultiValuePickerButton';
|
|
28
29
|
export { default as NotesCard } from './NotesCard/NotesCard';
|
|
30
|
+
export { default as NumberBubble } from './NumberBubble/NumberBubble';
|
|
29
31
|
export { default as PanelTabs } from './PanelTabs/PanelTabs';
|
|
30
32
|
export { default as PopUp } from './PopUp/PopUp';
|
|
31
33
|
export { default as RightIconButton } from './RightIconButton/RightIconButton';
|
|
@@ -31,18 +31,20 @@ export { default as EditableInput } from './EditableInput/EditableInput';
|
|
|
31
31
|
export { default as FormInput } from './FormInput/FormInput';
|
|
32
32
|
export { default as FromTo } from './FromTo/FromTo';
|
|
33
33
|
export { default as HalfLabelCard } from './HalfLabelCard/HalfLabelCard';
|
|
34
|
+
export { default as HeaderIndicator } from './HeaderIndicator/HeaderIndicator';
|
|
34
35
|
export { default as IconButton } from './IconButton/IconButton';
|
|
35
36
|
export { default as IconInput } from './IconInput/IconInput';
|
|
36
37
|
export { default as Image } from './Image/Image';
|
|
37
38
|
export { default as Increment } from './Increment/Increment';
|
|
38
39
|
export { default as InfoBubble } from './InfoBubble/InfoBubble';
|
|
39
|
-
export { default as
|
|
40
|
+
export { default as Label } from './Label/Label';
|
|
40
41
|
export { default as LabelText } from './LabelText/LabelText';
|
|
41
42
|
export { default as LoadingIndicator } from './LoadingIndicator/LoadingIndicator';
|
|
42
43
|
export { default as MessageBox } from './MessageBox/MessageBox';
|
|
43
44
|
export { default as MovementIndicationCard } from './MovementIndicationCard/MovementIndicationCard';
|
|
44
45
|
export { default as MultiValuePickerButton } from './MultiValuePickerButton/MultiValuePickerButton';
|
|
45
46
|
export { default as NotesCard } from './NotesCard/NotesCard';
|
|
47
|
+
export { default as NumberBubble } from './NumberBubble/NumberBubble';
|
|
46
48
|
export { default as PanelTabs } from './PanelTabs/PanelTabs';
|
|
47
49
|
export { default as PopUp } from './PopUp/PopUp';
|
|
48
50
|
export { default as RightIconButton } from './RightIconButton/RightIconButton';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/molecules/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,OAAO,IAAI,uBAAuB,EAAC,MAAM,mDAAmD,CAAC;AACrG,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,aAAa,CAAC;AAC5C,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AC;AAC/C,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,OAAO,IAAI,sBAAsB,EAAC,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAC,OAAO,IAAI,sBAAsB,EAAC,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAC,OAAO,IAAI,kBAAkB,EAAC,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,qCAAqC,CAAC"}
|
|
@@ -32,6 +32,7 @@ const AutoCompleteSearch = ({ objectList, value = null, onChangeValue, fetchData
|
|
|
32
32
|
const [searchText, setSearchText] = useState(value ? displayValue(value) : null);
|
|
33
33
|
let timeOutRequestCall = useRef();
|
|
34
34
|
let intervalRequestCall = useRef();
|
|
35
|
+
const inputRef = useRef(null);
|
|
35
36
|
const wrapperRef = useRef(null);
|
|
36
37
|
const clickOutside = useClickOutside({
|
|
37
38
|
wrapperRef,
|
|
@@ -39,6 +40,7 @@ const AutoCompleteSearch = ({ objectList, value = null, onChangeValue, fetchData
|
|
|
39
40
|
});
|
|
40
41
|
useEffect(() => {
|
|
41
42
|
if (clickOutside === OUTSIDE_INDICATOR && displayList) {
|
|
43
|
+
inputRef.current.blur();
|
|
42
44
|
setDisplayList(false);
|
|
43
45
|
}
|
|
44
46
|
}, [clickOutside, displayList]);
|
|
@@ -139,10 +141,12 @@ const AutoCompleteSearch = ({ objectList, value = null, onChangeValue, fetchData
|
|
|
139
141
|
}
|
|
140
142
|
if (value != null && isValidString(displayValue(value))) {
|
|
141
143
|
handleSearchValueChange(displayValue(value));
|
|
144
|
+
setSelected(true);
|
|
145
|
+
setDisplayList(false);
|
|
142
146
|
}
|
|
143
147
|
}, [displayValue, handleSearchValueChange, value]);
|
|
144
148
|
return (<View ref={wrapperRef}>
|
|
145
|
-
<SearchBar style={style} valueTxt={searchText} placeholder={placeholder} onClearPress={handleClear} onChangeTxt={handleSearchValueChange} onSelection={handleFocus} onSearchPress={handleSearchPress} onEndFocus={() => selected && setDisplayList(false)} isFocus={isFocus} onScanPress={onScanPress} scanIconColor={scanIconColor}/>
|
|
149
|
+
<SearchBar inputRef={inputRef} style={style} valueTxt={searchText} placeholder={placeholder} onClearPress={handleClear} onChangeTxt={handleSearchValueChange} onSelection={handleFocus} onSearchPress={handleSearchPress} onEndFocus={() => selected && setDisplayList(false)} isFocus={isFocus} onScanPress={onScanPress} scanIconColor={scanIconColor}/>
|
|
146
150
|
{displayList && !oneFilter && (<SelectionContainer objectList={objectList} displayValue={displayValue} handleSelect={handleSelect}/>)}
|
|
147
151
|
</View>);
|
|
148
152
|
};
|