react-native-input-select 0.35.0 → 1.1.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/README.md +103 -30
- package/lib/commonjs/components/CheckBox/index.js +16 -13
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CheckBox/types.js.map +1 -1
- package/lib/commonjs/components/CustomModal/index.js +1 -9
- package/lib/commonjs/components/CustomModal/index.js.map +1 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js +0 -9
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/{DropdownList.js → DropdownFlatList.js} +22 -32
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -0
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +11 -22
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js +139 -0
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -0
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +10 -22
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/commonjs/components/Input/index.js +4 -11
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/components/Others/index.js +93 -0
- package/lib/commonjs/components/Others/index.js.map +1 -0
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/index.js +73 -59
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/styles/colors.js.map +1 -1
- package/lib/commonjs/styles/input.js +0 -4
- package/lib/commonjs/styles/input.js.map +1 -1
- package/lib/commonjs/styles/typography.js +0 -3
- package/lib/commonjs/styles/typography.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/commonjs/utils/index.js +26 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/components/CheckBox/index.js +14 -6
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CheckBox/types.js.map +1 -1
- package/lib/module/components/CustomModal/index.js +1 -4
- package/lib/module/components/CustomModal/index.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +0 -2
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/{DropdownList.js → DropdownFlatList.js} +23 -27
- package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -0
- package/lib/module/components/Dropdown/DropdownListItem.js +11 -14
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js +130 -0
- package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -0
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +11 -17
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/module/components/Input/index.js +2 -2
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/Others/index.js +82 -0
- package/lib/module/components/Others/index.js.map +1 -0
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/index.js +72 -42
- package/lib/module/index.js.map +1 -1
- package/lib/module/styles/colors.js.map +1 -1
- package/lib/module/styles/input.js.map +1 -1
- package/lib/module/styles/typography.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/module/utils/index.js +18 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/components/CheckBox/index.d.ts +6 -1
- package/lib/typescript/components/CheckBox/types.d.ts +6 -1
- package/lib/typescript/components/Dropdown/DropdownFlatList.d.ts +3 -0
- package/lib/typescript/components/Dropdown/DropdownListItem.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownSectionList.d.ts +3 -0
- package/lib/typescript/components/Input/index.d.ts +1 -0
- package/lib/typescript/components/Others/index.d.ts +14 -0
- package/lib/typescript/types/index.types.d.ts +24 -5
- package/lib/typescript/utils/index.d.ts +6 -0
- package/package.json +2 -2
- package/src/components/CheckBox/index.tsx +32 -5
- package/src/components/CheckBox/types.ts +5 -0
- package/src/components/Dropdown/{DropdownList.tsx → DropdownFlatList.tsx} +22 -20
- package/src/components/Dropdown/DropdownListItem.tsx +13 -11
- package/src/components/Dropdown/DropdownSectionList.tsx +135 -0
- package/src/components/Dropdown/DropdownSelectedItemsView.tsx +16 -28
- package/src/components/Input/index.tsx +2 -0
- package/src/components/Others/index.tsx +91 -0
- package/src/index.tsx +114 -41
- package/src/types/index.types.ts +22 -4
- package/src/utils/index.ts +25 -0
- package/lib/commonjs/components/Dropdown/DropdownList.js.map +0 -1
- package/lib/module/components/Dropdown/DropdownList.js.map +0 -1
- package/lib/typescript/components/Dropdown/DropdownList.d.ts +0 -3
|
@@ -3,7 +3,6 @@ import { View, Text, StyleSheet } from 'react-native';
|
|
|
3
3
|
import DropdownSelectedItemsView from './DropdownSelectedItemsView';
|
|
4
4
|
import { colors } from '../../styles/colors';
|
|
5
5
|
import { typography } from '../../styles/typography';
|
|
6
|
-
|
|
7
6
|
const Dropdown = _ref => {
|
|
8
7
|
let {
|
|
9
8
|
label,
|
|
@@ -56,7 +55,6 @@ const Dropdown = _ref => {
|
|
|
56
55
|
style: [styles.helper, dropdownHelperTextStyle]
|
|
57
56
|
}, helperText));
|
|
58
57
|
};
|
|
59
|
-
|
|
60
58
|
const styles = StyleSheet.create({
|
|
61
59
|
label: {
|
|
62
60
|
marginBottom: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","View","Text","StyleSheet","DropdownSelectedItemsView","colors","typography","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownIcon","labelStyle","dropdownStyle","dropdownIconStyle","dropdownContainerStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","createElement","style","styles","dropdownInputContainer","helper","create","marginBottom","color","gray","caption","red","marginTop","primary","width","blackText","black"],"sources":["Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, StyleSheet } from 'react-native';\nimport DropdownSelectedItemsView from './DropdownSelectedItemsView';\nimport { colors } from '../../styles/colors';\nimport { typography } from '../../styles/typography';\n\nconst Dropdown = ({\n label,\n placeholder,\n helperText,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n dropdownIcon,\n labelStyle,\n dropdownStyle,\n dropdownIconStyle,\n dropdownContainerStyle,\n selectedItemStyle,\n placeholderStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n primaryColor,\n disabled,\n}: any) => {\n return (\n <View style={[styles.dropdownInputContainer, dropdownContainerStyle]}>\n {label && label !== '' && (\n <Text style={[styles.label, labelStyle]}>{label}</Text>\n )}\n <DropdownSelectedItemsView\n placeholder={placeholder}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n handleToggleModal={handleToggleModal}\n isMultiple={isMultiple}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n dropdownIcon={dropdownIcon}\n dropdownStyle={dropdownStyle}\n dropdownIconStyle={dropdownIconStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n primaryColor={primaryColor}\n disabled={disabled}\n placeholderStyle={placeholderStyle}\n />\n\n {error && error !== '' && (\n <Text style={[styles.error, dropdownErrorTextStyle]}>{error}</Text>\n )}\n\n {helperText && helperText !== '' && !error && (\n <Text style={[styles.helper, dropdownHelperTextStyle]}>\n {helperText}\n </Text>\n )}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n label: { marginBottom: 16, color: colors.gray, ...typography.caption },\n error: { color: colors.red, marginTop: 8, ...typography.caption },\n helper: { marginTop: 8, color: colors.primary, ...typography.caption },\n dropdownInputContainer: { marginBottom: 23, width: '100%' },\n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Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
/* eslint-disable react-native/no-inline-styles */
|
|
4
3
|
import React from 'react';
|
|
5
|
-
import {
|
|
4
|
+
import { FlatList, StyleSheet } from 'react-native';
|
|
6
5
|
import DropdownListItem from './DropdownListItem';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const DropdownList = _ref => {
|
|
6
|
+
import { ItemSeparatorComponent, ListEmptyComponent } from '../Others';
|
|
7
|
+
const DropdownFlatList = _ref => {
|
|
10
8
|
let {
|
|
11
9
|
options,
|
|
12
10
|
optionLabel,
|
|
@@ -19,22 +17,27 @@ const DropdownList = _ref => {
|
|
|
19
17
|
handleSingleSelection,
|
|
20
18
|
primaryColor,
|
|
21
19
|
checkboxSize,
|
|
20
|
+
// kept for backwards compatibility to be removed in future release
|
|
22
21
|
checkboxStyle,
|
|
22
|
+
// kept for backwards compatibility to be removed in future release
|
|
23
23
|
checkboxLabelStyle,
|
|
24
|
+
// kept for backwards compatibility to be removed in future release
|
|
25
|
+
checkboxComponentStyles,
|
|
26
|
+
listComponentStyles,
|
|
24
27
|
...rest
|
|
25
28
|
} = _ref;
|
|
26
29
|
return /*#__PURE__*/React.createElement(FlatList, _extends({
|
|
27
30
|
data: options,
|
|
28
31
|
extraData: isMultiple ? selectedItems : selectedItem,
|
|
29
32
|
initialNumToRender: 5,
|
|
30
|
-
ListEmptyComponent: /*#__PURE__*/React.createElement(
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
+
ListEmptyComponent: /*#__PURE__*/React.createElement(ListEmptyComponent, {
|
|
34
|
+
listEmptyComponentStyle: listComponentStyles === null || listComponentStyles === void 0 ? void 0 : listComponentStyles.listEmptyComponentStyle
|
|
35
|
+
}),
|
|
33
36
|
contentContainerStyle: [isSearchable ? {
|
|
34
37
|
paddingTop: 0
|
|
35
38
|
} : styles.contentContainerStyle],
|
|
36
|
-
ItemSeparatorComponent: () => /*#__PURE__*/React.createElement(
|
|
37
|
-
|
|
39
|
+
ItemSeparatorComponent: () => /*#__PURE__*/React.createElement(ItemSeparatorComponent, {
|
|
40
|
+
itemSeparatorStyle: listComponentStyles === null || listComponentStyles === void 0 ? void 0 : listComponentStyles.itemSeparatorStyle
|
|
38
41
|
}),
|
|
39
42
|
renderItem: item => _renderItem(item, {
|
|
40
43
|
optionLabel,
|
|
@@ -44,13 +47,16 @@ const DropdownList = _ref => {
|
|
|
44
47
|
onChange: isMultiple ? handleMultipleSelections : handleSingleSelection,
|
|
45
48
|
primaryColor,
|
|
46
49
|
checkboxSize,
|
|
50
|
+
// kept for backwards compatibility
|
|
47
51
|
checkboxStyle,
|
|
48
|
-
|
|
52
|
+
// kept for backwards compatibility
|
|
53
|
+
checkboxLabelStyle,
|
|
54
|
+
// kept for backwards compatibility
|
|
55
|
+
checkboxComponentStyles
|
|
49
56
|
}),
|
|
50
57
|
keyExtractor: (_item, index) => `Options${index}`
|
|
51
58
|
}, rest));
|
|
52
59
|
};
|
|
53
|
-
|
|
54
60
|
const _renderItem = (_ref2, props) => {
|
|
55
61
|
let {
|
|
56
62
|
item
|
|
@@ -65,24 +71,14 @@ const _renderItem = (_ref2, props) => {
|
|
|
65
71
|
primaryColor: props.primaryColor,
|
|
66
72
|
checkboxSize: props.checkboxSize,
|
|
67
73
|
checkboxStyle: props.checkboxStyle,
|
|
68
|
-
checkboxLabelStyle: props.checkboxLabelStyle
|
|
74
|
+
checkboxLabelStyle: props.checkboxLabelStyle,
|
|
75
|
+
checkboxComponentStyles: props.checkboxComponentStyles
|
|
69
76
|
});
|
|
70
77
|
};
|
|
71
|
-
|
|
72
78
|
const styles = StyleSheet.create({
|
|
73
|
-
itemSeparatorStyle: {
|
|
74
|
-
backgroundColor: colors.gray,
|
|
75
|
-
height: 1,
|
|
76
|
-
opacity: 0.15
|
|
77
|
-
},
|
|
78
|
-
emptyListStyle: {
|
|
79
|
-
alignItems: 'center',
|
|
80
|
-
width: '100%',
|
|
81
|
-
marginVertical: 20
|
|
82
|
-
},
|
|
83
79
|
contentContainerStyle: {
|
|
84
80
|
paddingTop: 20
|
|
85
81
|
}
|
|
86
82
|
});
|
|
87
|
-
export default
|
|
88
|
-
//# sourceMappingURL=
|
|
83
|
+
export default DropdownFlatList;
|
|
84
|
+
//# sourceMappingURL=DropdownFlatList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","FlatList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","DropdownFlatList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","rest","createElement","_extends","data","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","index","_ref2","props","create"],"sources":["DropdownFlatList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React from 'react';\nimport { FlatList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport { ItemSeparatorComponent, ListEmptyComponent } from '../Others';\n\nconst DropdownFlatList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility to be removed in future release\n checkboxStyle, // kept for backwards compatibility to be removed in future release\n checkboxLabelStyle, // kept for backwards compatibility to be removed in future release\n checkboxComponentStyles,\n listComponentStyles,\n ...rest\n}: any) => {\n return (\n <FlatList\n data={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n })\n }\n keyExtractor={(_item, index) => `Options${index}`}\n {...rest}\n />\n );\n};\n\nconst _renderItem = ({ item }: any, props: any) => {\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n checkboxComponentStyles={props.checkboxComponentStyles}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownFlatList;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ,WAAW;AAEtE,MAAMC,gBAAgB,GAAGC,IAAA,IAiBd;EAAA,IAjBe;IACxBC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,wBAAwB;IACxBC,qBAAqB;IACrBC,YAAY;IACZC,YAAY;IAA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BACE1C,KAAA,CAAAwB,aAAA,CAACrB,gBAAgB;IACfgC,IAAI,EAAEA,IAAK;IACX1B,WAAW,EAAEkC,KAAK,CAAClC,WAAY;IAC/BC,WAAW,EAAEiC,KAAK,CAACjC,WAAY;IAC/BC,UAAU,EAAEgC,KAAK,CAAChC,UAAW;IAC7B0B,cAAc,EAAEM,KAAK,CAACN,cAAe;IACrCC,QAAQ,EAAEK,KAAK,CAACL,QAAS;IACzBrB,YAAY,EAAE0B,KAAK,CAAC1B,YAAa;IACjCC,YAAY,EAAEyB,KAAK,CAACzB,YAAa;IACjCC,aAAa,EAAEwB,KAAK,CAACxB,aAAc;IACnCC,kBAAkB,EAAEuB,KAAK,CAACvB,kBAAmB;IAC7CC,uBAAuB,EAAEsB,KAAK,CAACtB;EAAwB,CACxD,CAAC;AAEN,CAAC;AAED,MAAMW,MAAM,GAAG9B,UAAU,CAAC0C,MAAM,CAAC;EAC/Bd,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAEF,eAAezB,gBAAgB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
3
|
import CheckBox from '../CheckBox';
|
|
4
|
-
|
|
5
4
|
const DropdownListItem = _ref => {
|
|
6
5
|
let {
|
|
7
6
|
item,
|
|
@@ -13,27 +12,25 @@ const DropdownListItem = _ref => {
|
|
|
13
12
|
primaryColor,
|
|
14
13
|
checkboxSize,
|
|
15
14
|
checkboxStyle,
|
|
16
|
-
checkboxLabelStyle
|
|
15
|
+
checkboxLabelStyle,
|
|
16
|
+
checkboxComponentStyles
|
|
17
17
|
} = _ref;
|
|
18
|
-
const selectedOptionValue = optionValue !== null && optionValue !== void 0 ? optionValue : 'value';
|
|
19
18
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
20
|
-
style: styles.
|
|
21
|
-
onPress: item.disabled ? () => {} : () => onChange(item[
|
|
22
|
-
|
|
19
|
+
style: styles.listItemContainerStyle,
|
|
20
|
+
onPress: item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property
|
|
23
21
|
}, /*#__PURE__*/React.createElement(CheckBox, {
|
|
24
|
-
value: isMultiple ? selectedOption.includes(item[
|
|
25
|
-
label: item[optionLabel
|
|
26
|
-
onChange: () => onChange(item[
|
|
22
|
+
value: isMultiple ? selectedOption.includes(item[optionValue]) : [selectedOption].includes(item[optionValue]),
|
|
23
|
+
label: item[optionLabel],
|
|
24
|
+
onChange: () => onChange(item[optionValue]),
|
|
27
25
|
primaryColor: primaryColor,
|
|
28
|
-
checkboxSize: checkboxSize,
|
|
29
|
-
checkboxStyle: checkboxStyle,
|
|
30
|
-
checkboxLabelStyle: checkboxLabelStyle,
|
|
26
|
+
checkboxSize: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize,
|
|
27
|
+
checkboxStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxStyle) || checkboxStyle,
|
|
28
|
+
checkboxLabelStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxLabelStyle) || checkboxLabelStyle,
|
|
31
29
|
disabled: item.disabled
|
|
32
30
|
}));
|
|
33
31
|
};
|
|
34
|
-
|
|
35
32
|
const styles = StyleSheet.create({
|
|
36
|
-
|
|
33
|
+
listItemContainerStyle: {
|
|
37
34
|
paddingHorizontal: 20,
|
|
38
35
|
paddingVertical: 10,
|
|
39
36
|
flexDirection: 'row',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","memo","TouchableOpacity","StyleSheet","CheckBox","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","createElement","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","create","paddingHorizontal","paddingVertical","flexDirection","alignItems"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n}: any) => {\n return (\n <TouchableOpacity\n style={styles.listItemContainerStyle}\n onPress={\n item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[optionValue])\n : [selectedOption].includes(item[optionValue])\n }\n label={item[optionLabel]}\n onChange={() => onChange(item[optionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxComponentStyles?.checkboxSize || checkboxSize}\n checkboxStyle={checkboxComponentStyles?.checkboxStyle || checkboxStyle}\n checkboxLabelStyle={\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle\n }\n disabled={item.disabled}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AAC3D,OAAOC,QAAQ,MAAM,aAAa;AAElC,MAAMC,gBAAgB,GAAGC,IAAA,IAYd;EAAA,IAZe;IACxBC,IAAI;IACJC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,cAAc;IACdC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC;EACG,CAAC,GAAAX,IAAA;EACJ,oBACEN,KAAA,CAAA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function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/* eslint-disable react-native/no-inline-styles */
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { SectionList, StyleSheet } from 'react-native';
|
|
5
|
+
import DropdownListItem from './DropdownListItem';
|
|
6
|
+
import { ItemSeparatorComponent, ListEmptyComponent, SectionHeaderTitle } from '../Others';
|
|
7
|
+
import { extractPropertyFromArray } from '../../utils';
|
|
8
|
+
const DropdownSectionList = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
options,
|
|
11
|
+
optionLabel,
|
|
12
|
+
optionValue,
|
|
13
|
+
isMultiple,
|
|
14
|
+
isSearchable,
|
|
15
|
+
selectedItems,
|
|
16
|
+
selectedItem,
|
|
17
|
+
handleMultipleSelections,
|
|
18
|
+
handleSingleSelection,
|
|
19
|
+
primaryColor,
|
|
20
|
+
checkboxSize,
|
|
21
|
+
checkboxStyle,
|
|
22
|
+
checkboxLabelStyle,
|
|
23
|
+
checkboxComponentStyles,
|
|
24
|
+
listComponentStyles,
|
|
25
|
+
...rest
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [expandedSections, setExpandedSections] = useState(new Set());
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Expand all sections
|
|
31
|
+
*/
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
let initialState = new Set(extractPropertyFromArray(options, 'title'));
|
|
34
|
+
setExpandedSections(initialState);
|
|
35
|
+
}, [options]);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param title
|
|
39
|
+
*/
|
|
40
|
+
const handleToggleListExpansion = title => {
|
|
41
|
+
setExpandedSections(expandedSectionsState => {
|
|
42
|
+
// Using Set here but you can use an array too
|
|
43
|
+
const next = new Set(expandedSectionsState);
|
|
44
|
+
if (next.has(title)) {
|
|
45
|
+
next.delete(title);
|
|
46
|
+
} else {
|
|
47
|
+
next.add(title);
|
|
48
|
+
}
|
|
49
|
+
return next;
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/React.createElement(SectionList, _extends({
|
|
53
|
+
sections: options,
|
|
54
|
+
extraData: isMultiple ? selectedItems : selectedItem,
|
|
55
|
+
initialNumToRender: 5,
|
|
56
|
+
ListEmptyComponent: /*#__PURE__*/React.createElement(ListEmptyComponent, {
|
|
57
|
+
listEmptyComponentStyle: listComponentStyles === null || listComponentStyles === void 0 ? void 0 : listComponentStyles.listEmptyComponentStyle
|
|
58
|
+
}),
|
|
59
|
+
contentContainerStyle: [isSearchable ? {
|
|
60
|
+
paddingTop: 0
|
|
61
|
+
} : styles.contentContainerStyle],
|
|
62
|
+
ItemSeparatorComponent: () => /*#__PURE__*/React.createElement(ItemSeparatorComponent, {
|
|
63
|
+
itemSeparatorStyle: listComponentStyles === null || listComponentStyles === void 0 ? void 0 : listComponentStyles.itemSeparatorStyle
|
|
64
|
+
}),
|
|
65
|
+
renderItem: item => _renderItem(item, {
|
|
66
|
+
optionLabel,
|
|
67
|
+
optionValue,
|
|
68
|
+
isMultiple,
|
|
69
|
+
selectedOption: isMultiple ? selectedItems : selectedItem,
|
|
70
|
+
onChange: isMultiple ? handleMultipleSelections : handleSingleSelection,
|
|
71
|
+
primaryColor,
|
|
72
|
+
checkboxSize,
|
|
73
|
+
// kept for backwards compatibility
|
|
74
|
+
checkboxStyle,
|
|
75
|
+
// kept for backwards compatibility
|
|
76
|
+
checkboxLabelStyle,
|
|
77
|
+
// kept for backwards compatibility
|
|
78
|
+
checkboxComponentStyles,
|
|
79
|
+
expandedSections
|
|
80
|
+
}),
|
|
81
|
+
renderSectionHeader: _ref2 => {
|
|
82
|
+
let {
|
|
83
|
+
section: {
|
|
84
|
+
title,
|
|
85
|
+
data
|
|
86
|
+
}
|
|
87
|
+
} = _ref2;
|
|
88
|
+
return data.length > 0 && /*#__PURE__*/React.createElement(SectionHeaderTitle, {
|
|
89
|
+
title: title,
|
|
90
|
+
sectionHeaderStyle: listComponentStyles === null || listComponentStyles === void 0 ? void 0 : listComponentStyles.sectionHeaderStyle,
|
|
91
|
+
onPress: () => handleToggleListExpansion(title),
|
|
92
|
+
isExpanded: expandedSections.has(title)
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
keyExtractor: (_item, index) => `Options${index}`,
|
|
96
|
+
stickySectionHeadersEnabled: false
|
|
97
|
+
}, rest));
|
|
98
|
+
};
|
|
99
|
+
const _renderItem = (_ref3, props) => {
|
|
100
|
+
let {
|
|
101
|
+
section: {
|
|
102
|
+
title
|
|
103
|
+
},
|
|
104
|
+
item
|
|
105
|
+
} = _ref3;
|
|
106
|
+
const isExpanded = props === null || props === void 0 ? void 0 : props.expandedSections.has(title);
|
|
107
|
+
|
|
108
|
+
//return null if it is not expanded
|
|
109
|
+
if (!isExpanded) return null;
|
|
110
|
+
return /*#__PURE__*/React.createElement(DropdownListItem, {
|
|
111
|
+
item: item,
|
|
112
|
+
optionLabel: props.optionLabel,
|
|
113
|
+
optionValue: props.optionValue,
|
|
114
|
+
isMultiple: props.isMultiple,
|
|
115
|
+
selectedOption: props.selectedOption,
|
|
116
|
+
onChange: props.onChange,
|
|
117
|
+
primaryColor: props.primaryColor,
|
|
118
|
+
checkboxSize: props.checkboxSize,
|
|
119
|
+
checkboxStyle: props.checkboxStyle,
|
|
120
|
+
checkboxLabelStyle: props.checkboxLabelStyle,
|
|
121
|
+
checkboxComponentStyles: props.checkboxComponentStyles
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
const styles = StyleSheet.create({
|
|
125
|
+
contentContainerStyle: {
|
|
126
|
+
paddingTop: 20
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
export default DropdownSectionList;
|
|
130
|
+
//# sourceMappingURL=DropdownSectionList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","SectionList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","SectionHeaderTitle","extractPropertyFromArray","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","rest","expandedSections","setExpandedSections","Set","initialState","handleToggleListExpansion","title","expandedSectionsState","next","has","delete","add","createElement","_extends","sections","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","data","length","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","_ref3","props","create"],"sources":["DropdownSectionList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useState } from 'react';\nimport { SectionList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport {\n ItemSeparatorComponent,\n ListEmptyComponent,\n SectionHeaderTitle,\n} from '../Others';\nimport { extractPropertyFromArray } from '../../utils';\n\nconst DropdownSectionList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n listComponentStyles,\n ...rest\n}: any) => {\n const [expandedSections, setExpandedSections] = useState(new Set());\n\n /**\n * Expand all sections\n */\n useEffect(() => {\n let initialState = new Set(extractPropertyFromArray(options, 'title'));\n setExpandedSections(initialState);\n }, [options]);\n\n /**\n * @param title\n */\n const handleToggleListExpansion = (title: string) => {\n setExpandedSections((expandedSectionsState) => {\n // Using Set here but you can use an array too\n const next = new Set(expandedSectionsState);\n if (next.has(title)) {\n next.delete(title);\n } else {\n next.add(title);\n }\n return next;\n });\n };\n\n return (\n <SectionList\n sections={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n expandedSections,\n })\n }\n renderSectionHeader={({ section: { title, data } }) =>\n data.length > 0 && (\n <SectionHeaderTitle\n title={title}\n sectionHeaderStyle={listComponentStyles?.sectionHeaderStyle}\n onPress={() => handleToggleListExpansion(title)}\n isExpanded={expandedSections.has(title)}\n />\n )\n }\n keyExtractor={(_item, index) => `Options${index}`}\n stickySectionHeadersEnabled={false}\n {...rest}\n />\n );\n};\n\nconst _renderItem = ({ section: { title }, item }: any, props: any) => {\n const isExpanded = props?.expandedSections.has(title);\n\n //return null if it is not expanded\n if (!isExpanded) return null;\n\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n checkboxComponentStyles={props.checkboxComponentStyles}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownSectionList;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ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 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, Text, Pressable, ScrollView, StyleSheet, Image
|
|
2
|
+
import { View, Text, Pressable, ScrollView, StyleSheet, Image } from 'react-native';
|
|
3
3
|
import { colors } from '../../styles/colors';
|
|
4
4
|
import { inputStyles } from '../../styles/input';
|
|
5
|
-
|
|
6
5
|
const DropdownSelectedItemsView = _ref => {
|
|
7
6
|
var _getSelectedItemsLabe;
|
|
8
|
-
|
|
9
7
|
let {
|
|
10
8
|
placeholder,
|
|
11
9
|
error,
|
|
@@ -30,10 +28,13 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
30
28
|
let {
|
|
31
29
|
pressed
|
|
32
30
|
} = _ref2;
|
|
33
|
-
return [pressed && {
|
|
31
|
+
return [pressed && {
|
|
32
|
+
...inputStyles.inputFocusState,
|
|
34
33
|
borderColor: primaryColor
|
|
35
|
-
}, inputStyles.input, dropdownStyle, error &&
|
|
36
|
-
|
|
34
|
+
}, inputStyles.input, dropdownStyle, error &&
|
|
35
|
+
//this must be last
|
|
36
|
+
error !== '' && !pressed && {
|
|
37
|
+
...inputStyles.inputFocusErrorState,
|
|
37
38
|
...dropdownErrorStyle
|
|
38
39
|
}];
|
|
39
40
|
},
|
|
@@ -45,28 +46,21 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
45
46
|
}, /*#__PURE__*/React.createElement(View, {
|
|
46
47
|
style: styles.selectedItemsContainer,
|
|
47
48
|
onStartShouldSetResponder: () => true
|
|
48
|
-
}, isMultiple ? (_getSelectedItemsLabe = getSelectedItemsLabel()) === null || _getSelectedItemsLabe === void 0 ? void 0 : _getSelectedItemsLabe.map((item, i) => /*#__PURE__*/React.createElement(
|
|
49
|
-
onPress: () => handleToggleModal(),
|
|
49
|
+
}, isMultiple ? (_getSelectedItemsLabe = getSelectedItemsLabel()) === null || _getSelectedItemsLabe === void 0 ? void 0 : _getSelectedItemsLabe.map((item, i) => /*#__PURE__*/React.createElement(Text, {
|
|
50
50
|
key: `react-native-input-select-${Math.random()}-${i}`,
|
|
51
|
-
disabled: disabled
|
|
52
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
53
51
|
style: [styles.selectedItems, {
|
|
54
52
|
backgroundColor: primaryColor
|
|
55
53
|
}, multipleSelectedItemStyle]
|
|
56
|
-
}, item))
|
|
57
|
-
onPress: () => handleToggleModal(),
|
|
58
|
-
disabled: disabled
|
|
59
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
54
|
+
}, item)) : /*#__PURE__*/React.createElement(Text, {
|
|
60
55
|
style: [styles.blackText, selectedItemStyle]
|
|
61
|
-
}, getSelectedItemsLabel())
|
|
56
|
+
}, getSelectedItemsLabel()), !selectedItem && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
62
57
|
style: [styles.blackText, placeholderStyle]
|
|
63
|
-
}, placeholder
|
|
58
|
+
}, placeholder ?? 'Select an option'))), /*#__PURE__*/React.createElement(View, {
|
|
64
59
|
style: [styles.iconStyle, dropdownIconStyle]
|
|
65
60
|
}, dropdownIcon || /*#__PURE__*/React.createElement(Image, {
|
|
66
61
|
source: require('../../asset/arrow-down.png')
|
|
67
62
|
})));
|
|
68
63
|
};
|
|
69
|
-
|
|
70
64
|
const styles = StyleSheet.create({
|
|
71
65
|
iconStyle: {
|
|
72
66
|
position: 'absolute',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","View","Text","Pressable","ScrollView","StyleSheet","Image","colors","inputStyles","DropdownSelectedItemsView","_ref","_getSelectedItemsLabe","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownIcon","dropdownStyle","dropdownIconStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","createElement","onPress","style","_ref2","pressed","inputFocusState","borderColor","input","inputFocusErrorState","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","styles","selectedItemsContainer","onStartShouldSetResponder","map","item","i","key","Math","random","backgroundColor","blackText","length","iconStyle","source","require","create","position","right","top","flexDirection","flexWrap","alignItems","color","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","overflow","black"],"sources":["DropdownSelectedItemsView.tsx"],"sourcesContent":["import React from 'react';\nimport {\n View,\n Text,\n Pressable,\n ScrollView,\n StyleSheet,\n Image,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\nimport { inputStyles } from '../../styles/input';\n\nconst DropdownSelectedItemsView = ({\n placeholder,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n dropdownIcon,\n dropdownStyle,\n dropdownIconStyle,\n selectedItemStyle,\n placeholderStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n primaryColor,\n disabled,\n}: any) => {\n return (\n <Pressable\n onPress={() => handleToggleModal()}\n style={({ pressed }) => [\n pressed && {\n ...inputStyles.inputFocusState,\n borderColor: primaryColor,\n },\n inputStyles.input,\n dropdownStyle,\n error && //this must be last\n error !== '' &&\n !pressed && {\n ...inputStyles.inputFocusErrorState,\n ...dropdownErrorStyle,\n },\n ]}\n disabled={disabled}\n >\n <ScrollView\n horizontal\n alwaysBounceHorizontal\n showsHorizontalScrollIndicator={false}\n >\n <View\n style={styles.selectedItemsContainer}\n onStartShouldSetResponder={() => true}\n >\n {isMultiple ? (\n getSelectedItemsLabel()?.map((item: any, i: Number) => (\n <Text\n key={`react-native-input-select-${Math.random()}-${i}`}\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n >\n {item}\n </Text>\n ))\n ) : (\n <Text style={[styles.blackText, selectedItemStyle]}>\n {getSelectedItemsLabel()}\n </Text>\n )}\n {!selectedItem && selectedItems?.length === 0 && (\n <Text style={[styles.blackText, placeholderStyle]}>\n {placeholder ?? 'Select an option'}\n </Text>\n )}\n </View>\n </ScrollView>\n <View style={[styles.iconStyle, dropdownIconStyle]}>\n {dropdownIcon || (\n <Image source={require('../../asset/arrow-down.png')} />\n )}\n </View>\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n },\n selectedItems: {\n color: colors.white,\n paddingHorizontal: 10,\n paddingVertical: 5,\n borderRadius: 10,\n backgroundColor: colors.primary,\n marginRight: 10,\n overflow: 'hidden',\n },\n blackText: { color: colors.black },\n});\n\nexport default DropdownSelectedItemsView;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,IAAI,EACJC,IAAI,EACJC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,KAAK,QACA,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,MAAMC,yBAAyB,GAAGC,IAAA,IAiBvB;EAAA,IAAAC,qBAAA;EAAA,IAjBwB;IACjCC,WAAW;IACXC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,aAAa;IACbC,iBAAiB;IACjBC,iBAAiB;IACjBC,gBAAgB;IAChBC,yBAAyB;IACzBC,kBAAkB;IAClBC,YAAY;IACZC;EACG,CAAC,GAAAjB,IAAA;EACJ,oBACEV,KAAA,CAAA4B,aAAA,CAACzB,SAAS;IACR0B,OAAO,EAAEA,CAAA,KAAMd,iBAAiB,CAAC,CAAE;IACnCe,KAAK,EAAEC,KAAA;MAAA,IAAC;QAAEC;MAAQ,CAAC,GAAAD,KAAA;MAAA,OAAK,CACtBC,OAAO,IAAI;QACT,GAAGxB,WAAW,CAACyB,eAAe;QAC9BC,WAAW,EAAER;MACf,CAAC,EACDlB,WAAW,CAAC2B,KAAK,EACjBf,aAAa,EACbP,KAAK;MAAI;MACPA,KAAK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SAAS,EAAE/B,iBAAiB;EAAE,GAChDF,YAAY,iBACXnB,KAAA,CAAA4B,aAAA,CAACtB,KAAK;IAAC+C,MAAM,EAAEC,OAAO,CAAC,4BAA4B;EAAE,CAAE,CAErD,CACG,CAAC;AAEhB,CAAC;AAED,MAAMd,MAAM,GAAGnC,UAAU,CAACkD,MAAM,CAAC;EAC/BH,SAAS,EAAE;IAAEI,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAAE,EAAE;IAAEC,GAAG,EAAE;EAAG,CAAC;EACvDjB,sBAAsB,EAAE;IACtBkB,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACD3C,aAAa,EAAE;IACb4C,KAAK,EAAEvD,MAAM,CAACwD,KAAK;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE,EAAE;IAChBjB,eAAe,EAAE1C,MAAM,CAAC4D,OAAO;IAC/BC,WAAW,EAAE,EAAE;IACfC,QAAQ,EAAE;EACZ,CAAC;EACDnB,SAAS,EAAE;IAAEY,KAAK,EAAEvD,MAAM,CAAC+D;EAAM;AACnC,CAAC,CAAC;AAEF,eAAe7D,yBAAyB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
import React, { useState } from 'react';
|
|
4
3
|
import { TextInput, StyleSheet, View, Platform } from 'react-native';
|
|
5
4
|
import { inputStyles } from '../../styles/input';
|
|
@@ -35,4 +34,5 @@ const styles = StyleSheet.create({
|
|
|
35
34
|
margin: 23
|
|
36
35
|
}
|
|
37
36
|
});
|
|
37
|
+
export default Input;
|
|
38
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","useState","TextInput","StyleSheet","View","Platform","inputStyles","Input","_ref","placeholder","value","onChangeText","style","primaryColor","rest","isFocused","setFocus","createElement","styles","container","_extends","input","select","web","outlineColor","borderColor","onFocus","onBlur","create","margin"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TextInput, StyleSheet, View, Platform } from 'react-native';\nimport { inputStyles } from '../../styles/input';\n\nexport const Input = ({\n placeholder,\n value,\n onChangeText,\n style,\n primaryColor,\n ...rest\n}: any) => {\n const [isFocused, setFocus] = useState(false);\n\n return (\n <View style={styles.container}>\n <TextInput\n placeholder={placeholder}\n style={[\n inputStyles.input,\n Platform.select({\n web: {\n outlineColor: primaryColor,\n },\n }),\n isFocused && { borderColor: primaryColor },\n style,\n ]}\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n value={value}\n onChangeText={onChangeText}\n {...rest}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { margin: 23 },\n});\n\nexport default Input;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,cAAc;AACpE,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,OAAO,MAAMC,KAAK,GAAGC,IAAA,IAOV;EAAA,IAPW;IACpBC,WAAW;IACXC,KAAK;IACLC,YAAY;IACZC,KAAK;IACLC,YAAY;IACZ,GAAGC;EACA,CAAC,GAAAN,IAAA;EACJ,MAAM,CAACO,SAAS,EAAEC,QAAQ,CAAC,GAAGf,QAAQ,CAAC,KAAK,CAAC;EAE7C,oBACED,KAAA,CAAAiB,aAAA,CAACb,IAAI;IAACQ,KAAK,EAAEM,MAAM,CAACC;EAAU,gBAC5BnB,KAAA,CAAAiB,aAAA,CAACf,SAAS,EAAAkB,QAAA;IACRX,WAAW,EAAEA,WAAY;IACzBG,KAAK,EAAE,CACLN,WAAW,CAACe,KAAK,EACjBhB,QAAQ,CAACiB,MAAM,CAAC;MACdC,GAAG,EAAE;QACHC,YAAY,EAAEX;MAChB;IACF,CAAC,CAAC,EACFE,SAAS,IAAI;MAAEU,WAAW,EAAEZ;IAAa,CAAC,EAC1CD,KAAK,CACL;IACFc,OAAO,EAAEA,CAAA,KAAMV,QAAQ,CAAC,IAAI,CAAE;IAC9BW,MAAM,EAAEA,CAAA,KAAMX,QAAQ,CAAC,KAAK,CAAE;IAC9BN,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA;EAAa,GACvBG,IAAI,CACT,CACG,CAAC;AAEX,CAAC;AAED,MAAMI,MAAM,GAAGf,UAAU,CAACyB,MAAM,CAAC;EAC/BT,SAAS,EAAE;IAAEU,MAAM,EAAE;EAAG;AAC1B,CAAC,CAAC;AAEF,eAAetB,KAAK"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity, Image } from 'react-native';
|
|
3
|
+
import { colors } from '../../styles/colors';
|
|
4
|
+
export const ListEmptyComponent = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
listEmptyComponentStyle
|
|
7
|
+
} = _ref;
|
|
8
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
9
|
+
style: styles.listEmptyComponentStyle
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
11
|
+
style: listEmptyComponentStyle
|
|
12
|
+
}, "No options available"));
|
|
13
|
+
};
|
|
14
|
+
export const ItemSeparatorComponent = _ref2 => {
|
|
15
|
+
let {
|
|
16
|
+
itemSeparatorStyle
|
|
17
|
+
} = _ref2;
|
|
18
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
19
|
+
style: [styles.itemSeparatorStyle, itemSeparatorStyle]
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export const ListItemContainer = _ref3 => {
|
|
23
|
+
let {
|
|
24
|
+
children,
|
|
25
|
+
listItemContainerStyle
|
|
26
|
+
} = _ref3;
|
|
27
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
28
|
+
style: [styles.listItemContainerStyle, listItemContainerStyle]
|
|
29
|
+
}, children);
|
|
30
|
+
};
|
|
31
|
+
export const SectionHeaderTitle = _ref4 => {
|
|
32
|
+
let {
|
|
33
|
+
title,
|
|
34
|
+
sectionHeaderStyle,
|
|
35
|
+
onPress,
|
|
36
|
+
isExpanded
|
|
37
|
+
} = _ref4;
|
|
38
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
39
|
+
onPress: onPress
|
|
40
|
+
}, /*#__PURE__*/React.createElement(ListItemContainer, {
|
|
41
|
+
listItemContainerStyle: styles.accordionStyle
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
43
|
+
style: [styles.sectionHeaderStyle, sectionHeaderStyle]
|
|
44
|
+
}, title), /*#__PURE__*/React.createElement(View, {
|
|
45
|
+
style: isExpanded ? null : styles.rotatedIcon90
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
47
|
+
source: require('../../asset/arrow-down.png')
|
|
48
|
+
}))));
|
|
49
|
+
};
|
|
50
|
+
const styles = StyleSheet.create({
|
|
51
|
+
listEmptyComponentStyle: {
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
width: '100%',
|
|
54
|
+
marginVertical: 20
|
|
55
|
+
},
|
|
56
|
+
itemSeparatorStyle: {
|
|
57
|
+
backgroundColor: colors.gray,
|
|
58
|
+
height: 1,
|
|
59
|
+
opacity: 0.15
|
|
60
|
+
},
|
|
61
|
+
listItemContainerStyle: {
|
|
62
|
+
paddingHorizontal: 20,
|
|
63
|
+
paddingVertical: 10,
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
alignItems: 'center'
|
|
66
|
+
},
|
|
67
|
+
sectionHeaderStyle: {
|
|
68
|
+
fontWeight: '500'
|
|
69
|
+
},
|
|
70
|
+
accordionStyle: {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
flexWrap: 'nowrap',
|
|
73
|
+
justifyContent: 'space-between',
|
|
74
|
+
alignContent: 'center'
|
|
75
|
+
},
|
|
76
|
+
rotatedIcon90: {
|
|
77
|
+
transform: [{
|
|
78
|
+
rotate: '-90deg'
|
|
79
|
+
}]
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Text","StyleSheet","TouchableOpacity","Image","colors","ListEmptyComponent","_ref","listEmptyComponentStyle","createElement","style","styles","ItemSeparatorComponent","_ref2","itemSeparatorStyle","ListItemContainer","_ref3","children","listItemContainerStyle","SectionHeaderTitle","_ref4","title","sectionHeaderStyle","onPress","isExpanded","accordionStyle","rotatedIcon90","source","require","create","alignItems","width","marginVertical","backgroundColor","gray","height","opacity","paddingHorizontal","paddingVertical","flexDirection","fontWeight","flexWrap","justifyContent","alignContent","transform","rotate"],"sources":["index.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport {\n View,\n Text,\n StyleSheet,\n TouchableOpacity,\n TextStyle,\n Image,\n ViewStyle,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\n\nexport const ListEmptyComponent = ({ listEmptyComponentStyle }: any) => {\n return (\n <View style={styles.listEmptyComponentStyle}>\n <Text style={listEmptyComponentStyle}>No options available</Text>\n </View>\n );\n};\n\nexport const ItemSeparatorComponent = ({ itemSeparatorStyle }: any) => {\n return <View style={[styles.itemSeparatorStyle, itemSeparatorStyle]} />;\n};\n\nexport const ListItemContainer = ({\n children,\n listItemContainerStyle,\n}: {\n children: ReactNode;\n listItemContainerStyle: ViewStyle;\n}) => {\n return (\n <View style={[styles.listItemContainerStyle, listItemContainerStyle]}>\n {children}\n </View>\n );\n};\n\nexport const SectionHeaderTitle = ({\n title,\n sectionHeaderStyle,\n onPress,\n isExpanded,\n}: {\n title: string;\n sectionHeaderStyle?: TextStyle;\n onPress?: () => void;\n isExpanded: Boolean;\n}) => {\n return (\n <TouchableOpacity onPress={onPress}>\n <ListItemContainer listItemContainerStyle={styles.accordionStyle}>\n <Text style={[styles.sectionHeaderStyle, sectionHeaderStyle]}>\n {title}\n </Text>\n <View style={isExpanded ? null : styles.rotatedIcon90}>\n <Image source={require('../../asset/arrow-down.png')} />\n </View>\n </ListItemContainer>\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listEmptyComponentStyle: {\n alignItems: 'center',\n width: '100%',\n marginVertical: 20,\n },\n itemSeparatorStyle: {\n backgroundColor: colors.gray,\n height: 1,\n opacity: 0.15,\n },\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n sectionHeaderStyle: { fontWeight: '500' },\n accordionStyle: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n justifyContent: 'space-between',\n alignContent: 'center',\n },\n rotatedIcon90: {\n transform: [{ rotate: '-90deg' }],\n },\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAqB,OAAO;AACxC,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAEhBC,KAAK,QAEA,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,OAAO,MAAMC,kBAAkB,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAD,IAAA;EACjE,oBACER,KAAA,CAAAU,aAAA,CAACT,IAAI;IAACU,KAAK,EAAEC,MAAM,CAACH;EAAwB,gBAC1CT,KAAA,CAAAU,aAAA,CAACR,IAAI;IAACS,KAAK,EAAEF;EAAwB,GAAC,sBAA0B,CAC5D,CAAC;AAEX,CAAC;AAED,OAAO,MAAMI,sBAAsB,GAAGC,KAAA,IAAiC;EAAA,IAAhC;IAAEC;EAAwB,CAAC,GAAAD,KAAA;EAChE,oBAAOd,KA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AI;IAC5BC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE;EACX,CAAC;EACDlB,sBAAsB,EAAE;IACtBmB,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBT,UAAU,EAAE;EACd,CAAC;EACDR,kBAAkB,EAAE;IAAEkB,UAAU,EAAE;EAAM,CAAC;EACzCf,cAAc,EAAE;IACdc,aAAa,EAAE,KAAK;IACpBE,QAAQ,EAAE,QAAQ;IAClBC,cAAc,EAAE,eAAe;IAC/BC,YAAY,EAAE;EAChB,CAAC;EACDjB,aAAa,EAAE;IACbkB,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAS,CAAC;EAClC;AACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","CHECKBOX_SIZE"],"sources":["index.ts"],"sourcesContent":["export const DEFAULT_OPTION_LABEL = 'label';\nexport const DEFAULT_OPTION_VALUE = 'value';\nexport const CHECKBOX_SIZE = 14;\n"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG,OAAO;AAC3C,OAAO,MAAMC,oBAAoB,GAAG,OAAO;AAC3C,OAAO,MAAMC,aAAa,GAAG,EAAE"}
|