@rn-components-dropdown/dropdown 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dropdown/Dropdown.js +4 -4
- package/dist/components/dropdown/DropdownStyle.d.ts +2 -3
- package/dist/components/dropdown/DropdownStyle.js +1 -1
- package/dist/components/dropdown/component/chip/Chip.d.ts +3 -0
- package/dist/components/dropdown/component/chip/Chip.js +23 -0
- package/dist/components/dropdown/component/chip/ChipStyle.d.ts +83 -0
- package/dist/components/dropdown/component/chip/ChipStyle.js +62 -0
- package/dist/components/dropdown/component/input/TextInput.d.ts +3 -0
- package/dist/components/dropdown/component/input/TextInput.js +61 -0
- package/dist/components/dropdown/component/input/TextInputStyle.d.ts +32 -0
- package/dist/components/dropdown/component/input/TextInputStyle.js +33 -0
- package/dist/components/dropdown/interface/ChipInterface.d.ts +3 -3
- package/dist/components/dropdown/interface/DropdownInterface.d.ts +3 -4
- package/dist/components/text/AppText.d.ts +2 -3
- package/dist/components/text/AppText.js +1 -1
- package/dist/components/text/AppTextStyle.d.ts +18 -19
- package/dist/components/text/AppTextStyle.js +1 -5
- package/dist/interface/svg.interface.d.ts +2 -1
- package/dist/style/index.d.ts +0 -2
- package/dist/style/index.js +1 -7
- package/package.json +1 -1
- package/src/components/dropdown/Dropdown.tsx +4 -4
- package/src/components/dropdown/DropdownStyle.ts +7 -8
- package/src/components/dropdown/{components → component}/chip/Chip.tsx +1 -1
- package/src/components/dropdown/{components → component}/chip/ChipStyle.ts +3 -3
- package/src/components/dropdown/interface/ChipInterface.ts +4 -3
- package/src/components/dropdown/interface/DropdownInterface.ts +3 -4
- package/src/components/text/AppText.tsx +2 -3
- package/src/components/text/AppTextStyle.ts +3 -9
- package/src/interface/svg.interface.ts +3 -1
- package/src/style/index.ts +0 -7
- /package/src/components/dropdown/{components → component}/input/TextInput.tsx +0 -0
- /package/src/components/dropdown/{components → component}/input/TextInputStyle.ts +0 -0
|
@@ -40,14 +40,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
const react_native_1 = require("react-native");
|
|
41
41
|
const lodash_1 = __importDefault(require("lodash"));
|
|
42
42
|
const AppText_1 = __importDefault(require("../text/AppText"));
|
|
43
|
-
const Chip_1 = __importDefault(require("./
|
|
43
|
+
const Chip_1 = __importDefault(require("./component/chip/Chip"));
|
|
44
44
|
const react_1 = __importStar(require("react"));
|
|
45
45
|
const useDropdown_1 = __importDefault(require("./hooks/useDropdown"));
|
|
46
46
|
const SvgButton_1 = __importDefault(require("../svgButton/SvgButton"));
|
|
47
47
|
const DropdownStyle_1 = require("./DropdownStyle");
|
|
48
48
|
const CheckIcon_1 = __importDefault(require("../../assets/svg/CheckIcon"));
|
|
49
49
|
const svg_1 = require("../../assets/svg");
|
|
50
|
-
const TextInput_1 = __importDefault(require("./
|
|
50
|
+
const TextInput_1 = __importDefault(require("./component/input/TextInput"));
|
|
51
51
|
const DropdownComponent = (props) => {
|
|
52
52
|
const { label, testID, iconStyle, renderItem, style = {}, subfixIcon, labelField, valueField, onChangeText, itemTextStyle, flatListProps, minHeight = 0, containerStyle, search = false, renderLeftIcon, checkIconColor, radioIconColor, multiSelectIcon, itemTestIDField, maxHeight = 300, inverted = true, renderRightIcon, backgroundColor, placeholderStyle, inputSearchStyle, searchPlaceholder, selectedTextStyle, renderInputSearch, iconColor = 'gray', accessibilityLabel, itemContainerStyle, labelContainer = {}, labelTextStyle = {}, selectedTextProps = {}, chipContainerProps = {}, keyboardAvoiding = true, selectionType = 'single', activeColor = 'lightGray', dropdownPosition = 'auto', itemAccessibilityLabelField, placeholder = 'Please select', showsVerticalScrollIndicator = true, } = props;
|
|
53
53
|
const { chipColor, clearIcon, textColor, onClearPress: onClear, } = chipContainerProps;
|
|
@@ -99,7 +99,7 @@ const DropdownComponent = (props) => {
|
|
|
99
99
|
}, [styles]);
|
|
100
100
|
const renderCheckItem = (0, react_1.useCallback)(({ item, index }) => {
|
|
101
101
|
const isSelected = lodash_1.default.some(currentValue, (h) => lodash_1.default.isEqual(lodash_1.default.get(h, valueField), lodash_1.default.get(item, valueField)));
|
|
102
|
-
return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={
|
|
102
|
+
return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={activeColor} onPress={() => onCheckPress(item)}>
|
|
103
103
|
<react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
|
|
104
104
|
{renderItem ? (renderItem(item, isSelected, labelField, valueField)) : (<react_native_1.View style={styles.item}>
|
|
105
105
|
<SvgButton_1.default icon={multiSelectIcon ? (multiSelectIcon) : (<CheckIcon_1.default color={colors.white}/>)} onPress={() => onCheckPress(item)} style={[
|
|
@@ -141,7 +141,7 @@ const DropdownComponent = (props) => {
|
|
|
141
141
|
const isSelected = currentValue && lodash_1.default.get(currentValue, valueField);
|
|
142
142
|
const selected = lodash_1.default.isEqual(lodash_1.default.get(item, valueField), isSelected);
|
|
143
143
|
lodash_1.default.assign(item, { _index: index });
|
|
144
|
-
return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={
|
|
144
|
+
return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={activeColor} onPress={() => onSelect(item)}>
|
|
145
145
|
<react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
|
|
146
146
|
{renderItem ? (renderItem(item, selected, labelField, valueField)) : (<react_native_1.View style={styles.item}>
|
|
147
147
|
{renderRadio(selected)}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ThemeColors } from '../../interface/colors.interface';
|
|
2
1
|
interface Props {
|
|
3
2
|
size?: number;
|
|
4
|
-
radioIconColor?:
|
|
5
|
-
checkIconColor?:
|
|
3
|
+
radioIconColor?: string;
|
|
4
|
+
checkIconColor?: string;
|
|
6
5
|
}
|
|
7
6
|
export declare const useDropdownStyle: (props: Props) => {
|
|
8
7
|
styles: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useDropdownStyle = void 0;
|
|
4
|
+
const style_1 = require("../../style");
|
|
4
5
|
const react_1 = require("react");
|
|
5
6
|
const react_native_1 = require("react-native");
|
|
6
7
|
const useOrientation_1 = require("./hooks/useOrientation");
|
|
7
|
-
const style_1 = require("../../style");
|
|
8
8
|
const useDropdownStyle = (props) => {
|
|
9
9
|
const { ...colors } = style_1.LIGHT_COLORS;
|
|
10
10
|
const orientation = (0, useOrientation_1.useDeviceOrientation)();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const ChipStyle_1 = __importDefault(require("./ChipStyle"));
|
|
8
|
+
const AppText_1 = __importDefault(require("../../../text/AppText"));
|
|
9
|
+
const svg_1 = require("../../../../assets/svg");
|
|
10
|
+
const SvgButton_1 = __importDefault(require("../../../svgButton/SvgButton"));
|
|
11
|
+
const Chip = (props) => {
|
|
12
|
+
const { styles, colors } = (0, ChipStyle_1.default)({ ...props });
|
|
13
|
+
const { label, onClearPress, textColor, clearIcon } = props;
|
|
14
|
+
return (<react_native_1.View style={styles.box}>
|
|
15
|
+
<AppText_1.default size={12} fontFamily={'semiBold'} style={styles.chipText} color={textColor ? textColor : 'gray'}>
|
|
16
|
+
{label}
|
|
17
|
+
</AppText_1.default>
|
|
18
|
+
{clearIcon ? (clearIcon) : (<react_native_1.View style={styles.clearContainer}>
|
|
19
|
+
<SvgButton_1.default icon={<svg_1.ClearIcon size={8} color={textColor ? textColor : colors.white}/>} onPress={onClearPress} style={styles.clearIcon}/>
|
|
20
|
+
</react_native_1.View>)}
|
|
21
|
+
</react_native_1.View>);
|
|
22
|
+
};
|
|
23
|
+
exports.default = Chip;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ChipInterface } from '../../interface/ChipInterface';
|
|
2
|
+
declare const useChipStyle: (props: ChipInterface) => {
|
|
3
|
+
styles: {
|
|
4
|
+
box: {
|
|
5
|
+
elevation: number;
|
|
6
|
+
width: "auto";
|
|
7
|
+
borderRadius: number;
|
|
8
|
+
flexDirection: "row";
|
|
9
|
+
alignItems: "center";
|
|
10
|
+
justifyContent: "center";
|
|
11
|
+
backgroundColor: import("react-native").ColorValue;
|
|
12
|
+
margin: number;
|
|
13
|
+
height: number;
|
|
14
|
+
} | {
|
|
15
|
+
elevation: number;
|
|
16
|
+
width: "auto";
|
|
17
|
+
borderRadius: number;
|
|
18
|
+
flexDirection: "row";
|
|
19
|
+
alignItems: "center";
|
|
20
|
+
justifyContent: "center";
|
|
21
|
+
backgroundColor: import("react-native").ColorValue;
|
|
22
|
+
shadowRadius?: undefined;
|
|
23
|
+
shadowOpacity?: undefined;
|
|
24
|
+
shadowColor?: undefined;
|
|
25
|
+
shadowOffset?: undefined;
|
|
26
|
+
margin: number;
|
|
27
|
+
height: number;
|
|
28
|
+
} | {
|
|
29
|
+
elevation: number;
|
|
30
|
+
width: "auto";
|
|
31
|
+
borderRadius: number;
|
|
32
|
+
flexDirection: "row";
|
|
33
|
+
alignItems: "center";
|
|
34
|
+
justifyContent: "center";
|
|
35
|
+
backgroundColor: import("react-native").ColorValue;
|
|
36
|
+
shadowRadius: number;
|
|
37
|
+
shadowOpacity: number;
|
|
38
|
+
shadowColor: string;
|
|
39
|
+
shadowOffset: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
};
|
|
43
|
+
margin: number;
|
|
44
|
+
height: number;
|
|
45
|
+
};
|
|
46
|
+
chipText: {
|
|
47
|
+
paddingLeft: number;
|
|
48
|
+
fontWeight: "600";
|
|
49
|
+
};
|
|
50
|
+
clearContainer: {
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
borderWidth: number;
|
|
54
|
+
borderRadius: number;
|
|
55
|
+
marginHorizontal: number;
|
|
56
|
+
alignItems: "center";
|
|
57
|
+
justifyContent: "center";
|
|
58
|
+
borderColor: import("react-native").ColorValue;
|
|
59
|
+
backgroundColor: import("react-native").ColorValue;
|
|
60
|
+
};
|
|
61
|
+
clearIcon: {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
borderRadius: number;
|
|
65
|
+
alignItems: "center";
|
|
66
|
+
justifyContent: "center";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
colors: {
|
|
70
|
+
blue: string;
|
|
71
|
+
gray: string;
|
|
72
|
+
error: string;
|
|
73
|
+
green: string;
|
|
74
|
+
white: string;
|
|
75
|
+
black: string;
|
|
76
|
+
primary: string;
|
|
77
|
+
lightGray: string;
|
|
78
|
+
grayishBlue: string;
|
|
79
|
+
red: string;
|
|
80
|
+
border: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export default useChipStyle;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const style_1 = require("../../../../style");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const useChipStyle = (props) => {
|
|
7
|
+
const { chipColor, textColor } = props;
|
|
8
|
+
const { ...colors } = style_1.LIGHT_COLORS;
|
|
9
|
+
const styles = (0, react_1.useMemo)(() => {
|
|
10
|
+
return react_native_1.StyleSheet.create({
|
|
11
|
+
box: {
|
|
12
|
+
margin: 4,
|
|
13
|
+
height: 26,
|
|
14
|
+
...react_native_1.Platform.select({
|
|
15
|
+
android: {
|
|
16
|
+
elevation: 5,
|
|
17
|
+
},
|
|
18
|
+
ios: {
|
|
19
|
+
shadowRadius: 1.84,
|
|
20
|
+
shadowOpacity: 0.35,
|
|
21
|
+
shadowColor: colors.black,
|
|
22
|
+
shadowOffset: { width: 0, height: 2 },
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
elevation: 5,
|
|
26
|
+
width: 'auto',
|
|
27
|
+
borderRadius: 30,
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
backgroundColor: chipColor ? chipColor : colors.lightGray,
|
|
32
|
+
},
|
|
33
|
+
chipText: {
|
|
34
|
+
paddingLeft: 10,
|
|
35
|
+
fontWeight: '600',
|
|
36
|
+
},
|
|
37
|
+
clearContainer: {
|
|
38
|
+
width: 18,
|
|
39
|
+
height: 18,
|
|
40
|
+
borderWidth: 2,
|
|
41
|
+
borderRadius: 100,
|
|
42
|
+
marginHorizontal: 4,
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
borderColor: textColor ? textColor : colors.white,
|
|
46
|
+
backgroundColor: chipColor ? chipColor : colors.lightGray,
|
|
47
|
+
},
|
|
48
|
+
clearIcon: {
|
|
49
|
+
width: 12,
|
|
50
|
+
height: 12,
|
|
51
|
+
borderRadius: 100,
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}, [chipColor, colors, textColor]);
|
|
57
|
+
return {
|
|
58
|
+
styles,
|
|
59
|
+
colors,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.default = useChipStyle;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const TextInputStyle_1 = require("./TextInputStyle");
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const svg_1 = require("../../../../assets/svg");
|
|
42
|
+
const react_native_1 = require("react-native");
|
|
43
|
+
const AppTextInput_1 = __importDefault(require("../../../textInput/AppTextInput"));
|
|
44
|
+
const TextInputComponent = props => {
|
|
45
|
+
const { value, placeholder = '', placeholderTextColor = '#000', onChangeText = (_value) => { }, searchIcon, } = props;
|
|
46
|
+
const [searchtext, setSearchText] = (0, react_1.useState)('');
|
|
47
|
+
const { styles } = (0, TextInputStyle_1.useTextStyle)();
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
|
+
if (value) {
|
|
50
|
+
setSearchText(value);
|
|
51
|
+
}
|
|
52
|
+
}, [value]);
|
|
53
|
+
const onChange = (text) => {
|
|
54
|
+
setSearchText(text);
|
|
55
|
+
onChangeText(text);
|
|
56
|
+
};
|
|
57
|
+
return (<react_native_1.TouchableWithoutFeedback>
|
|
58
|
+
<AppTextInput_1.default {...props} value={searchtext} style={styles.input} onChangeText={onChange} placeholder={placeholder} textStyle={styles.inputContainer} placeholderTextColor={placeholderTextColor} icon={searchIcon ? searchIcon : <svg_1.SearchIcon />}/>
|
|
59
|
+
</react_native_1.TouchableWithoutFeedback>);
|
|
60
|
+
};
|
|
61
|
+
exports.default = TextInputComponent;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const useTextStyle: () => {
|
|
2
|
+
styles: {
|
|
3
|
+
input: {
|
|
4
|
+
height: number;
|
|
5
|
+
width: "95%";
|
|
6
|
+
fontSize: number;
|
|
7
|
+
borderWidth: number;
|
|
8
|
+
borderRadius: number;
|
|
9
|
+
marginVertical: number;
|
|
10
|
+
marginHorizontal: number;
|
|
11
|
+
borderColor: string;
|
|
12
|
+
};
|
|
13
|
+
inputContainer: {
|
|
14
|
+
width: "90%";
|
|
15
|
+
fontSize: number;
|
|
16
|
+
color: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
colors: {
|
|
20
|
+
blue: string;
|
|
21
|
+
gray: string;
|
|
22
|
+
error: string;
|
|
23
|
+
green: string;
|
|
24
|
+
white: string;
|
|
25
|
+
black: string;
|
|
26
|
+
primary: string;
|
|
27
|
+
lightGray: string;
|
|
28
|
+
grayishBlue: string;
|
|
29
|
+
red: string;
|
|
30
|
+
border: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTextStyle = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const style_1 = require("../../../../style");
|
|
7
|
+
const useTextStyle = () => {
|
|
8
|
+
const { ...colors } = style_1.LIGHT_COLORS;
|
|
9
|
+
const styles = (0, react_1.useMemo)(() => {
|
|
10
|
+
return react_native_1.StyleSheet.create({
|
|
11
|
+
input: {
|
|
12
|
+
height: 40,
|
|
13
|
+
width: '95%',
|
|
14
|
+
fontSize: 16,
|
|
15
|
+
borderWidth: 1,
|
|
16
|
+
borderRadius: 3,
|
|
17
|
+
marginVertical: 10,
|
|
18
|
+
marginHorizontal: 8,
|
|
19
|
+
borderColor: colors.border,
|
|
20
|
+
},
|
|
21
|
+
inputContainer: {
|
|
22
|
+
width: '90%',
|
|
23
|
+
fontSize: 14,
|
|
24
|
+
color: colors.gray,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}, [colors]);
|
|
28
|
+
return {
|
|
29
|
+
styles,
|
|
30
|
+
colors,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.useTextStyle = useTextStyle;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColorValue } from "react-native";
|
|
2
2
|
export interface ChipInterface {
|
|
3
3
|
label?: string;
|
|
4
4
|
onClearPress?: () => void;
|
|
5
|
-
chipColor?:
|
|
6
|
-
textColor?:
|
|
5
|
+
chipColor?: ColorValue;
|
|
6
|
+
textColor?: ColorValue;
|
|
7
7
|
clearIcon?: React.JSX.Element;
|
|
8
8
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { StyleProp, TextStyle, ViewStyle, TextProps, ImageStyle, FlatListProps } from 'react-native';
|
|
3
3
|
import { ChipInterface } from './ChipInterface';
|
|
4
|
-
import { ThemeColors } from '../../../interface/colors.interface';
|
|
5
4
|
export type IDropdownRef = {
|
|
6
5
|
open: () => void;
|
|
7
6
|
close: () => void;
|
|
@@ -24,8 +23,11 @@ export type DropdownProps<S, T extends SelectionType> = {
|
|
|
24
23
|
placeholder?: string;
|
|
25
24
|
onFocus?: () => void;
|
|
26
25
|
autoScroll?: boolean;
|
|
26
|
+
activeColor?: string;
|
|
27
27
|
searchField?: keyof S;
|
|
28
28
|
value?: S[] | undefined;
|
|
29
|
+
checkIconColor?: string;
|
|
30
|
+
radioIconColor?: string;
|
|
29
31
|
itemTestIDField?: string;
|
|
30
32
|
backgroundColor?: string;
|
|
31
33
|
keyboardAvoiding?: boolean;
|
|
@@ -37,11 +39,8 @@ export type DropdownProps<S, T extends SelectionType> = {
|
|
|
37
39
|
selectedTextProps?: TextProps;
|
|
38
40
|
subfixIcon?: React.JSX.Element;
|
|
39
41
|
onClear?: (id?: number) => void;
|
|
40
|
-
activeColor?: keyof ThemeColors;
|
|
41
42
|
iconStyle?: StyleProp<ImageStyle>;
|
|
42
43
|
chipContainerProps?: ChipInterface;
|
|
43
|
-
checkIconColor?: keyof ThemeColors;
|
|
44
|
-
radioIconColor?: keyof ThemeColors;
|
|
45
44
|
multiSelectIcon?: React.JSX.Element;
|
|
46
45
|
mode?: 'default' | 'modal' | 'auto';
|
|
47
46
|
itemTextStyle?: StyleProp<TextStyle>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TextProps } from 'react-native';
|
|
3
|
-
import { ThemeColors } from '../../interface/colors.interface';
|
|
2
|
+
import { ColorValue, TextProps } from 'react-native';
|
|
4
3
|
interface props extends TextProps {
|
|
5
4
|
size?: number;
|
|
6
5
|
fontFamily?: any;
|
|
7
6
|
required?: boolean;
|
|
8
|
-
color?:
|
|
7
|
+
color?: ColorValue;
|
|
9
8
|
type?: 'error' | 'normal';
|
|
10
9
|
}
|
|
11
10
|
declare const AppText: ({ size, style, color, children, type, fontFamily, required, ...props }: props) => React.JSX.Element;
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
7
|
const AppTextStyle_1 = require("./AppTextStyle");
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
9
|
const AppText = ({ size, style, color, children, type = 'normal', fontFamily = 'regular', required, ...props }) => {
|
|
10
10
|
const family = fontFamily;
|
|
11
11
|
const styles = (0, AppTextStyle_1.useAppTextStyle)({
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { TextStyle } from 'react-native';
|
|
2
|
-
import { ThemeColors } from '../../interface/colors.interface';
|
|
1
|
+
import { ColorValue, TextStyle } from 'react-native';
|
|
3
2
|
interface props {
|
|
4
3
|
size?: number;
|
|
5
4
|
style?: TextStyle;
|
|
6
|
-
color?:
|
|
5
|
+
color?: ColorValue;
|
|
7
6
|
type?: 'error' | 'normal';
|
|
8
7
|
}
|
|
9
8
|
export declare const useAppTextStyle: ({ size, style, color, type, }: props) => {
|
|
10
9
|
container: {
|
|
11
|
-
color:
|
|
10
|
+
color: ColorValue;
|
|
12
11
|
fontFamily?: string | undefined;
|
|
13
12
|
fontSize: number;
|
|
14
13
|
fontStyle?: "normal" | "italic" | undefined;
|
|
@@ -18,8 +17,8 @@ export declare const useAppTextStyle: ({ size, style, color, type, }: props) =>
|
|
|
18
17
|
textAlign?: "auto" | "left" | "right" | "center" | "justify" | undefined;
|
|
19
18
|
textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
|
|
20
19
|
textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | undefined;
|
|
21
|
-
textDecorationColor?:
|
|
22
|
-
textShadowColor?:
|
|
20
|
+
textDecorationColor?: ColorValue | undefined;
|
|
21
|
+
textShadowColor?: ColorValue | undefined;
|
|
23
22
|
textShadowOffset?: {
|
|
24
23
|
width: number;
|
|
25
24
|
height: number;
|
|
@@ -30,33 +29,33 @@ export declare const useAppTextStyle: ({ size, style, color, type, }: props) =>
|
|
|
30
29
|
fontVariant?: import("react-native").FontVariant[] | undefined;
|
|
31
30
|
writingDirection?: "auto" | "ltr" | "rtl" | undefined;
|
|
32
31
|
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
33
|
-
backgroundColor?:
|
|
34
|
-
borderBlockColor?:
|
|
35
|
-
borderBlockEndColor?:
|
|
36
|
-
borderBlockStartColor?:
|
|
37
|
-
borderBottomColor?:
|
|
32
|
+
backgroundColor?: ColorValue | undefined;
|
|
33
|
+
borderBlockColor?: ColorValue | undefined;
|
|
34
|
+
borderBlockEndColor?: ColorValue | undefined;
|
|
35
|
+
borderBlockStartColor?: ColorValue | undefined;
|
|
36
|
+
borderBottomColor?: ColorValue | undefined;
|
|
38
37
|
borderBottomEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
39
38
|
borderBottomLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
40
39
|
borderBottomRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
41
40
|
borderBottomStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
42
|
-
borderColor?:
|
|
41
|
+
borderColor?: ColorValue | undefined;
|
|
43
42
|
borderCurve?: "circular" | "continuous" | undefined;
|
|
44
|
-
borderEndColor?:
|
|
43
|
+
borderEndColor?: ColorValue | undefined;
|
|
45
44
|
borderEndEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
46
45
|
borderEndStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
47
|
-
borderLeftColor?:
|
|
46
|
+
borderLeftColor?: ColorValue | undefined;
|
|
48
47
|
borderRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
49
|
-
borderRightColor?:
|
|
50
|
-
borderStartColor?:
|
|
48
|
+
borderRightColor?: ColorValue | undefined;
|
|
49
|
+
borderStartColor?: ColorValue | undefined;
|
|
51
50
|
borderStartEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
52
51
|
borderStartStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
53
52
|
borderStyle?: "solid" | "dotted" | "dashed" | undefined;
|
|
54
|
-
borderTopColor?:
|
|
53
|
+
borderTopColor?: ColorValue | undefined;
|
|
55
54
|
borderTopEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
56
55
|
borderTopLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
57
56
|
borderTopRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
58
57
|
borderTopStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
|
|
59
|
-
outlineColor?:
|
|
58
|
+
outlineColor?: ColorValue | undefined;
|
|
60
59
|
outlineOffset?: import("react-native").AnimatableNumericValue | undefined;
|
|
61
60
|
outlineStyle?: "solid" | "dotted" | "dashed" | undefined;
|
|
62
61
|
outlineWidth?: import("react-native").AnimatableNumericValue | undefined;
|
|
@@ -145,7 +144,7 @@ export declare const useAppTextStyle: ({ size, style, color, type, }: props) =>
|
|
|
145
144
|
paddingInline?: import("react-native").DimensionValue | undefined;
|
|
146
145
|
paddingInlineEnd?: import("react-native").DimensionValue | undefined;
|
|
147
146
|
paddingInlineStart?: import("react-native").DimensionValue | undefined;
|
|
148
|
-
shadowColor?:
|
|
147
|
+
shadowColor?: ColorValue | undefined;
|
|
149
148
|
shadowOffset?: Readonly<{
|
|
150
149
|
width: number;
|
|
151
150
|
height: number;
|
|
@@ -10,11 +10,7 @@ const useAppTextStyle = ({ size, style, color, type = 'normal', }) => {
|
|
|
10
10
|
return react_native_1.StyleSheet.create({
|
|
11
11
|
container: {
|
|
12
12
|
fontSize: size || 14,
|
|
13
|
-
color: type === 'error'
|
|
14
|
-
? colors.error
|
|
15
|
-
: color
|
|
16
|
-
? colors[color]
|
|
17
|
-
: colors.primary,
|
|
13
|
+
color: type === 'error' ? colors.error : color ? color : colors.primary,
|
|
18
14
|
...style,
|
|
19
15
|
},
|
|
20
16
|
require: {
|
package/dist/style/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from './colors';
|
|
2
2
|
export * from './spacing';
|
|
3
3
|
export * from './shadow';
|
|
4
|
-
export declare const addAlphaToHex: (color: string, opacity: number) => string;
|
|
5
4
|
export declare const SCREEN_WIDTH: number;
|
|
6
5
|
export declare const SCREEN_HEIGHT: number;
|
|
7
|
-
export declare const MIN_DEVICE_WIDTH: number;
|
package/dist/style/index.js
CHANGED
|
@@ -14,16 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.SCREEN_HEIGHT = exports.SCREEN_WIDTH = void 0;
|
|
18
18
|
__exportStar(require("./colors"), exports);
|
|
19
19
|
__exportStar(require("./spacing"), exports);
|
|
20
20
|
__exportStar(require("./shadow"), exports);
|
|
21
21
|
const react_native_1 = require("react-native");
|
|
22
|
-
const addAlphaToHex = (color, opacity) => {
|
|
23
|
-
const _opacity = Math.round(Math.min(Math.max(opacity || 1, 0), 1) * 255);
|
|
24
|
-
return color + _opacity.toString(16).toUpperCase();
|
|
25
|
-
};
|
|
26
|
-
exports.addAlphaToHex = addAlphaToHex;
|
|
27
22
|
exports.SCREEN_WIDTH = react_native_1.Dimensions.get('window').width;
|
|
28
23
|
exports.SCREEN_HEIGHT = react_native_1.Dimensions.get('window').height;
|
|
29
|
-
exports.MIN_DEVICE_WIDTH = react_native_1.Platform.OS === 'ios' ? 390 : 360;
|
package/package.json
CHANGED
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
import AppText from '../text/AppText';
|
|
14
|
-
import Chip from './
|
|
14
|
+
import Chip from './component/chip/Chip';
|
|
15
15
|
import React, { useCallback } from 'react';
|
|
16
16
|
import useDropdown from './hooks/useDropdown';
|
|
17
17
|
import SvgButton from '../svgButton/SvgButton';
|
|
18
18
|
import { useDropdownStyle } from './DropdownStyle';
|
|
19
19
|
import CheckIcon from '../../assets/svg/CheckIcon';
|
|
20
20
|
import { ArrowDown, ArrowUp } from '../../assets/svg';
|
|
21
|
-
import SearchInput from './
|
|
21
|
+
import SearchInput from './component/input/TextInput';
|
|
22
22
|
import { DropdownProps } from './interface/DropdownInterface';
|
|
23
23
|
|
|
24
24
|
const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
|
|
@@ -207,7 +207,7 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
|
|
|
207
207
|
item,
|
|
208
208
|
itemAccessibilityLabelField || labelField,
|
|
209
209
|
)}
|
|
210
|
-
underlayColor={
|
|
210
|
+
underlayColor={activeColor}
|
|
211
211
|
onPress={() => onCheckPress(item)}
|
|
212
212
|
>
|
|
213
213
|
<View style={StyleSheet.flatten([itemContainerStyle])}>
|
|
@@ -281,7 +281,7 @@ const DropdownComponent = <T, Mode extends 'single' | 'multi'>(
|
|
|
281
281
|
item,
|
|
282
282
|
itemAccessibilityLabelField || labelField,
|
|
283
283
|
)}
|
|
284
|
-
underlayColor={
|
|
284
|
+
underlayColor={activeColor}
|
|
285
285
|
onPress={() => onSelect(item)}
|
|
286
286
|
>
|
|
287
287
|
<View style={StyleSheet.flatten([itemContainerStyle])}>
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { I18nManager, StyleSheet } from 'react-native';
|
|
3
|
-
import { useDeviceOrientation } from './hooks/useOrientation';
|
|
4
|
-
import { ThemeColors } from '../../interface/colors.interface';
|
|
5
1
|
import {
|
|
6
|
-
DEFAULT_COLORS,
|
|
7
|
-
SCREEN_WIDTH,
|
|
8
2
|
SPACING,
|
|
9
3
|
LIGHT_COLORS,
|
|
4
|
+
SCREEN_WIDTH,
|
|
5
|
+
DEFAULT_COLORS,
|
|
10
6
|
} from '../../style';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
import { I18nManager, StyleSheet } from 'react-native';
|
|
9
|
+
import { useDeviceOrientation } from './hooks/useOrientation';
|
|
11
10
|
|
|
12
11
|
interface Props {
|
|
13
12
|
size?: number;
|
|
14
|
-
radioIconColor?:
|
|
15
|
-
checkIconColor?:
|
|
13
|
+
radioIconColor?: string;
|
|
14
|
+
checkIconColor?: string;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export const useDropdownStyle = (props: Props) => {
|
|
@@ -28,7 +28,7 @@ const useChipStyle = (props: ChipInterface) => {
|
|
|
28
28
|
flexDirection: 'row',
|
|
29
29
|
alignItems: 'center',
|
|
30
30
|
justifyContent: 'center',
|
|
31
|
-
backgroundColor: chipColor ?
|
|
31
|
+
backgroundColor: chipColor ? chipColor : colors.lightGray,
|
|
32
32
|
},
|
|
33
33
|
chipText: {
|
|
34
34
|
paddingLeft: 10,
|
|
@@ -42,8 +42,8 @@ const useChipStyle = (props: ChipInterface) => {
|
|
|
42
42
|
marginHorizontal: 4,
|
|
43
43
|
alignItems: 'center',
|
|
44
44
|
justifyContent: 'center',
|
|
45
|
-
borderColor: textColor ?
|
|
46
|
-
backgroundColor: chipColor ?
|
|
45
|
+
borderColor: textColor ? textColor : colors.white,
|
|
46
|
+
backgroundColor: chipColor ? chipColor : colors.lightGray,
|
|
47
47
|
},
|
|
48
48
|
clearIcon: {
|
|
49
49
|
width: 12,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColorValue } from "react-native";
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
export interface ChipInterface {
|
|
4
5
|
label?: string;
|
|
5
6
|
onClearPress?: () => void;
|
|
6
|
-
chipColor?:
|
|
7
|
-
textColor?:
|
|
7
|
+
chipColor?: ColorValue;
|
|
8
|
+
textColor?: ColorValue;
|
|
8
9
|
clearIcon?: React.JSX.Element;
|
|
9
10
|
}
|
|
@@ -8,7 +8,6 @@ import type {
|
|
|
8
8
|
FlatListProps,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import { ChipInterface } from './ChipInterface';
|
|
11
|
-
import { ThemeColors } from '../../../interface/colors.interface';
|
|
12
11
|
|
|
13
12
|
export type IDropdownRef = {
|
|
14
13
|
open: () => void;
|
|
@@ -34,8 +33,11 @@ export type DropdownProps<S, T extends SelectionType> = {
|
|
|
34
33
|
placeholder?: string;
|
|
35
34
|
onFocus?: () => void;
|
|
36
35
|
autoScroll?: boolean;
|
|
36
|
+
activeColor?: string;
|
|
37
37
|
searchField?: keyof S;
|
|
38
38
|
value?: S[] | undefined;
|
|
39
|
+
checkIconColor?: string;
|
|
40
|
+
radioIconColor?: string;
|
|
39
41
|
itemTestIDField?: string;
|
|
40
42
|
backgroundColor?: string;
|
|
41
43
|
keyboardAvoiding?: boolean;
|
|
@@ -47,11 +49,8 @@ export type DropdownProps<S, T extends SelectionType> = {
|
|
|
47
49
|
selectedTextProps?: TextProps;
|
|
48
50
|
subfixIcon?: React.JSX.Element;
|
|
49
51
|
onClear?: (id?: number) => void;
|
|
50
|
-
activeColor?: keyof ThemeColors;
|
|
51
52
|
iconStyle?: StyleProp<ImageStyle>;
|
|
52
53
|
chipContainerProps?: ChipInterface;
|
|
53
|
-
checkIconColor?: keyof ThemeColors;
|
|
54
|
-
radioIconColor?: keyof ThemeColors;
|
|
55
54
|
multiSelectIcon?: React.JSX.Element;
|
|
56
55
|
mode?: 'default' | 'modal' | 'auto';
|
|
57
56
|
itemTextStyle?: StyleProp<TextStyle>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Text, TextProps } from 'react-native';
|
|
3
2
|
import { useAppTextStyle } from './AppTextStyle';
|
|
4
|
-
import {
|
|
3
|
+
import { ColorValue, Text, TextProps } from 'react-native';
|
|
5
4
|
|
|
6
5
|
interface props extends TextProps {
|
|
7
6
|
size?: number;
|
|
8
7
|
fontFamily?: any;
|
|
9
8
|
required?: boolean;
|
|
10
|
-
color?:
|
|
9
|
+
color?: ColorValue;
|
|
11
10
|
type?: 'error' | 'normal';
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { LIGHT_COLORS } from '../../style';
|
|
3
|
-
import { StyleSheet, TextStyle } from 'react-native';
|
|
4
|
-
import { ThemeColors } from '../../interface/colors.interface';
|
|
3
|
+
import { ColorValue, StyleSheet, TextStyle } from 'react-native';
|
|
5
4
|
|
|
6
5
|
interface props {
|
|
7
6
|
size?: number;
|
|
8
7
|
style?: TextStyle;
|
|
9
|
-
color?:
|
|
8
|
+
color?: ColorValue;
|
|
10
9
|
type?: 'error' | 'normal';
|
|
11
10
|
}
|
|
12
11
|
|
|
@@ -22,12 +21,7 @@ export const useAppTextStyle = ({
|
|
|
22
21
|
return StyleSheet.create({
|
|
23
22
|
container: {
|
|
24
23
|
fontSize: size || 14,
|
|
25
|
-
color:
|
|
26
|
-
type === 'error'
|
|
27
|
-
? colors.error
|
|
28
|
-
: color
|
|
29
|
-
? colors[color]
|
|
30
|
-
: colors.primary,
|
|
24
|
+
color: type === 'error' ? colors.error : color ? color : colors.primary,
|
|
31
25
|
...style,
|
|
32
26
|
},
|
|
33
27
|
require: {
|
package/src/style/index.ts
CHANGED
|
@@ -3,12 +3,5 @@ export * from './spacing';
|
|
|
3
3
|
export * from './shadow';
|
|
4
4
|
import { Dimensions, Platform } from 'react-native';
|
|
5
5
|
|
|
6
|
-
export const addAlphaToHex = (color: string, opacity: number) => {
|
|
7
|
-
const _opacity = Math.round(Math.min(Math.max(opacity || 1, 0), 1) * 255);
|
|
8
|
-
return color + _opacity.toString(16).toUpperCase();
|
|
9
|
-
};
|
|
10
|
-
|
|
11
6
|
export const SCREEN_WIDTH = Dimensions.get('window').width;
|
|
12
7
|
export const SCREEN_HEIGHT = Dimensions.get('window').height;
|
|
13
|
-
export const MIN_DEVICE_WIDTH = Platform.OS === 'ios' ? 390 : 360;
|
|
14
|
-
|
|
File without changes
|
|
File without changes
|