react-native-input-select 0.25.0 → 0.26.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 +9 -7
- package/lib/commonjs/components/Dropdown/Dropdown.js +3 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +2 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +3 -1
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +2 -1
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/typescript/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownSelectedItemsView.d.ts +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/types/index.types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Dropdown/Dropdown.tsx +2 -0
- package/src/components/Dropdown/DropdownSelectedItemsView.tsx +2 -1
- package/src/index.tsx +2 -0
- package/src/types/index.types.ts +1 -0
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
|
|
|
56
56
|
| | | |
|
|
57
57
|
|:-------------------------:|:-------------------------:|:-------------------------:|
|
|
58
58
|
|<img width="529" alt="Screenshot 2023-03-23 at 5 11 54 PM" src="https://user-images.githubusercontent.com/9849221/227392644-a039424a-9bdf-4253-b984-7b043e4a9545.png"> | <img width="529" alt="Screenshot 2023-03-23 at 5 00 19 PM" src="https://user-images.githubusercontent.com/9849221/227391036-44b5e935-bc5e-48d6-a3a9-7a285a4879fd.png"> | <img width="529" alt="Screenshot 2023-03-23 at 5 00 29 PM" src="https://user-images.githubusercontent.com/9849221/227391040-45772980-e51c-4ebf-aabf-30886ff06e7c.png">|
|
|
59
|
-
|<img width="529" alt="Screenshot 2023-03-23 at 5 00 35 PM" src="https://user-images.githubusercontent.com/9849221/227391043-9e5fe1aa-86aa-438c-9e84-8c38975d3d57.png"> | <img width="529" alt="Screenshot 2023-03-23 at 5 11 54 PM" src="https://user-images.githubusercontent.com/9849221/227391594-f672b97a-c3c0-466c-b615-a887e4a8a6c0.png">|
|
|
59
|
+
|<img width="529" alt="Screenshot 2023-03-23 at 5 00 35 PM" src="https://user-images.githubusercontent.com/9849221/227391043-9e5fe1aa-86aa-438c-9e84-8c38975d3d57.png"> | <img width="529" alt="Screenshot 2023-03-23 at 5 11 54 PM" src="https://user-images.githubusercontent.com/9849221/227391594-f672b97a-c3c0-466c-b615-a887e4a8a6c0.png">| <img width="529" alt="Screenshot 2023-04-06 at 5 26 46 PM" src="https://user-images.githubusercontent.com/9849221/230516858-b11168be-3144-4914-a31a-15663c5d0404.png">|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
# Android
|
|
@@ -64,6 +64,7 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
|
|
|
64
64
|
|:-------------------------:|:-------------------------:|:-------------------------:|
|
|
65
65
|
|<img width="456" alt="Screenshot 2023-03-23 at 5 25 07 PM" src="https://user-images.githubusercontent.com/9849221/227393546-3aba8a28-f437-4f8f-9611-bf300c5af8f2.png"> | <img width="456" alt="Screenshot 2023-03-23 at 5 26 58 PM" src="https://user-images.githubusercontent.com/9849221/227393548-28796d7b-9760-43a9-8ed3-fb1618cd1b7d.png"> | <img width="456" alt="Screenshot 2023-03-23 at 5 28 49 PM" src="https://user-images.githubusercontent.com/9849221/227393554-91ed1a92-d229-4814-84d8-5f9095e8d048.png">|
|
|
66
66
|
|
|
67
|
+
|
|
67
68
|
## Props
|
|
68
69
|
|
|
69
70
|
| Proptypes | Datatype | Example |
|
|
@@ -80,7 +81,8 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
|
|
|
80
81
|
| isMultiple | `Boolean` | `true` |
|
|
81
82
|
| isSearchable | `Boolean` | `true` |
|
|
82
83
|
| disabled | `Boolean` | `true` |
|
|
83
|
-
| labelStyle | `Object` | `{color: 'red',
|
|
84
|
+
| labelStyle | `Object` | `{color: 'red', fontSize: 15, fontWeight: '500'}` |
|
|
85
|
+
| placeholderStyle | `Object` | `{color: 'red', fontSize: 15, fontWeight: '500'}` |
|
|
84
86
|
| dropdownStyle | `Object` | `{borderColor: 'blue', margin: 5, borderWidth:0 ...}` |
|
|
85
87
|
| dropdownContainerStyle | `Object` | `{backgroundColor: 'red', width: '30%', ...}` |
|
|
86
88
|
| searchInputStyle | `Object` | `{backgroundColor: 'red', borderRadius: 0, ...}` |
|
|
@@ -92,9 +94,9 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
|
|
|
92
94
|
| dropdownErrorTextStyle | `Object` | `{color: 'red', fontWeight:'500'}` |
|
|
93
95
|
| dropdownHelperTextStyle | `Object` | `{color: 'green', fontWeight:'500'}` |
|
|
94
96
|
| primaryColor | `string` | `blue` |
|
|
95
|
-
| checkboxSize | `number` | `
|
|
96
|
-
| checkboxStyle | `Object` | `{backgroundColor: 'blue',
|
|
97
|
-
| checkboxLabelStyle | `Object` | `{color: 'red', fontWeight:'500'`
|
|
97
|
+
| checkboxSize | `number` | `20` |
|
|
98
|
+
| checkboxStyle | `Object` | `{backgroundColor: 'blue', borderRadius: 30, padding: 10}` |
|
|
99
|
+
| checkboxLabelStyle | `Object` | `{color: 'red', fontWeight:'500'}` |
|
|
98
100
|
|
|
99
101
|
|
|
100
102
|
## Contributing
|
|
@@ -105,6 +107,6 @@ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the
|
|
|
105
107
|
|
|
106
108
|
MIT
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
# Video Demo
|
|
111
|
+
https://user-images.githubusercontent.com/9849221/230516294-a1aca5a7-65f5-4d9c-9b7f-a057807cf35f.mov
|
|
109
112
|
|
|
110
|
-
https://user-images.githubusercontent.com/9849221/226240418-efa4fe9f-4055-4c03-888e-8b7093adcd63.mov
|
|
@@ -25,6 +25,7 @@ const Dropdown = _ref => {
|
|
|
25
25
|
dropdownStyle,
|
|
26
26
|
dropdownContainerStyle,
|
|
27
27
|
selectedItemStyle,
|
|
28
|
+
placeholderStyle,
|
|
28
29
|
multipleSelectedItemStyle,
|
|
29
30
|
dropdownErrorStyle,
|
|
30
31
|
dropdownErrorTextStyle,
|
|
@@ -49,7 +50,8 @@ const Dropdown = _ref => {
|
|
|
49
50
|
multipleSelectedItemStyle: multipleSelectedItemStyle,
|
|
50
51
|
dropdownErrorStyle: dropdownErrorStyle,
|
|
51
52
|
primaryColor: primaryColor,
|
|
52
|
-
disabled: disabled
|
|
53
|
+
disabled: disabled,
|
|
54
|
+
placeholderStyle: placeholderStyle
|
|
53
55
|
}), error && error !== '' && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
54
56
|
style: [styles.error, dropdownErrorTextStyle]
|
|
55
57
|
}, error), helperText && helperText !== '' && !error && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_DropdownSelectedItemsView","_colors","_typography","obj","__esModule","default","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","labelStyle","dropdownStyle","dropdownContainerStyle","selectedItemStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","createElement","View","style","styles","dropdownInputContainer","Text","helper","StyleSheet","create","marginBottom","color","colors","gray","typography","caption","inputFocusErrorState","borderWidth","borderStyle","borderColor","red","marginTop","primary","width","blackText","black","_default","exports"],"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 labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n selectedItemStyle,\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 dropdownStyle={dropdownStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n primaryColor={primaryColor}\n disabled={disabled}\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 inputFocusErrorState: {\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: colors.red,\n },\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 blackText: { color: colors.black },\n});\n\nexport default Dropdown;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAqD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErD,MAAMG,QAAQ,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_DropdownSelectedItemsView","_colors","_typography","obj","__esModule","default","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","labelStyle","dropdownStyle","dropdownContainerStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","createElement","View","style","styles","dropdownInputContainer","Text","helper","StyleSheet","create","marginBottom","color","colors","gray","typography","caption","inputFocusErrorState","borderWidth","borderStyle","borderColor","red","marginTop","primary","width","blackText","black","_default","exports"],"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 labelStyle,\n dropdownStyle,\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 dropdownStyle={dropdownStyle}\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 inputFocusErrorState: {\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: colors.red,\n },\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 blackText: { color: colors.black },\n});\n\nexport default Dropdown;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAqD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErD,MAAMG,QAAQ,GAAGC,IAAA,IAqBN;EAAA,IArBO;IAChBC,KAAK;IACLC,WAAW;IACXC,UAAU;IACVC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,UAAU;IACVC,aAAa;IACbC,sBAAsB;IACt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B,aAAA,CAAC7B,YAAA,CAAAkC,IAAI;IAACH,KAAK,EAAE,CAACC,MAAM,CAACG,MAAM,EAAET,uBAAuB;EAAE,GACnDf,UAAU,CAEd,CACI;AAEX,CAAC;AAED,MAAMqB,MAAM,GAAGI,uBAAU,CAACC,MAAM,CAAC;EAC/B5B,KAAK,EAAE;IAAE6B,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAEC,cAAM,CAACC,IAAI;IAAE,GAAGC,sBAAU,CAACC;EAAQ,CAAC;EACtEC,oBAAoB,EAAE;IACpBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,WAAW,EAAEP,cAAM,CAACQ;EACtB,CAAC;EACDpC,KAAK,EAAE;IAAE2B,KAAK,EAAEC,cAAM,CAACQ,GAAG;IAAEC,SAAS,EAAE,CAAC;IAAE,GAAGP,sBAAU,CAACC;EAAQ,CAAC;EACjER,MAAM,EAAE;IAAEc,SAAS,EAAE,CAAC;IAAEV,KAAK,EAAEC,cAAM,CAACU,OAAO;IAAE,GAAGR,sBAAU,CAACC;EAAQ,CAAC;EACtEV,sBAAsB,EAAE;IAAEK,YAAY,EAAE,EAAE;IAAEa,KAAK,EAAE;EAAO,CAAC;EAC3DC,SAAS,EAAE;IAAEb,KAAK,EAAEC,cAAM,CAACa;EAAM;AACnC,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY/C,QAAQ;AAAAgD,OAAA,CAAAjD,OAAA,GAAAgD,QAAA"}
|
|
@@ -20,6 +20,7 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
20
20
|
selectedItems,
|
|
21
21
|
dropdownStyle,
|
|
22
22
|
selectedItemStyle,
|
|
23
|
+
placeholderStyle,
|
|
23
24
|
multipleSelectedItemStyle,
|
|
24
25
|
dropdownErrorStyle,
|
|
25
26
|
primaryColor,
|
|
@@ -63,7 +64,7 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
63
64
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
64
65
|
style: [styles.blackText, selectedItemStyle]
|
|
65
66
|
}, getSelectedItemsLabel()))), !selectedItem && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) === 0 && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
66
|
-
style: styles.blackText
|
|
67
|
+
style: [styles.blackText, placeholderStyle]
|
|
67
68
|
}, placeholder ?? 'Select an option')), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
68
69
|
style: styles.iconStyle
|
|
69
70
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_input","obj","__esModule","default","DropdownSelectedItemsView","_ref","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownStyle","selectedItemStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","createElement","Pressable","onPress","style","_ref2","pressed","inputStyles","inputFocusState","borderColor","input","inputFocusErrorState","ScrollView","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","View","styles","selectedItemsContainer","onStartShouldSetResponder","map","item","i","TouchableOpacity","key","Math","random","Text","backgroundColor","blackText","length","iconStyle","Image","source","StyleSheet","create","position","right","top","flexDirection","flexWrap","color","colors","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","overflow","black","_default","exports"],"sources":["DropdownSelectedItemsView.tsx"],"sourcesContent":["import React from 'react';\nimport {\n View,\n Text,\n Pressable,\n ScrollView,\n StyleSheet,\n Image,\n TouchableOpacity,\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 dropdownStyle,\n selectedItemStyle,\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 <TouchableOpacity\n onPress={() => handleToggleModal()}\n key={`react-native-input-select-${Math.random()}-${i}`}\n disabled={disabled}\n >\n <Text\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n >\n {item}\n </Text>\n </TouchableOpacity>\n ))\n ) : (\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n disabled={disabled}\n >\n <Text style={[styles.blackText, selectedItemStyle]}>\n {getSelectedItemsLabel()}\n </Text>\n </TouchableOpacity>\n )}\n </View>\n\n {!selectedItem && selectedItems?.length === 0 && (\n <Text style={styles.blackText}>\n {placeholder ?? 'Select an option'}\n </Text>\n )}\n </ScrollView>\n <View style={styles.iconStyle}>\n <Image source={require('../../asset/arrow-down.png')} />\n </View>\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: { flexDirection: 'row', flexWrap: 'nowrap' },\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAiD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEjD,MAAMG,yBAAyB,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_input","obj","__esModule","default","DropdownSelectedItemsView","_ref","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","createElement","Pressable","onPress","style","_ref2","pressed","inputStyles","inputFocusState","borderColor","input","inputFocusErrorState","ScrollView","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","View","styles","selectedItemsContainer","onStartShouldSetResponder","map","item","i","TouchableOpacity","key","Math","random","Text","backgroundColor","blackText","length","iconStyle","Image","source","StyleSheet","create","position","right","top","flexDirection","flexWrap","color","colors","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","overflow","black","_default","exports"],"sources":["DropdownSelectedItemsView.tsx"],"sourcesContent":["import React from 'react';\nimport {\n View,\n Text,\n Pressable,\n ScrollView,\n StyleSheet,\n Image,\n TouchableOpacity,\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 dropdownStyle,\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 <TouchableOpacity\n onPress={() => handleToggleModal()}\n key={`react-native-input-select-${Math.random()}-${i}`}\n disabled={disabled}\n >\n <Text\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n >\n {item}\n </Text>\n </TouchableOpacity>\n ))\n ) : (\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n disabled={disabled}\n >\n <Text style={[styles.blackText, selectedItemStyle]}>\n {getSelectedItemsLabel()}\n </Text>\n </TouchableOpacity>\n )}\n </View>\n\n {!selectedItem && selectedItems?.length === 0 && (\n <Text style={[styles.blackText, placeholderStyle]}>\n {placeholder ?? 'Select an option'}\n </Text>\n )}\n </ScrollView>\n <View style={styles.iconStyle}>\n <Image source={require('../../asset/arrow-down.png')} />\n </View>\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: { flexDirection: 'row', flexWrap: 'nowrap' },\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAiD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,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uBAAU,CAACC,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IAAEK,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAAE,EAAE;IAAEC,GAAG,EAAE;EAAG,CAAC;EACvDpB,sBAAsB,EAAE;IAAEqB,aAAa,EAAE,KAAK;IAAEC,QAAQ,EAAE;EAAS,CAAC;EACpE/C,aAAa,EAAE;IACbgD,KAAK,EAAEC,cAAM,CAACC,KAAK;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE,EAAE;IAChBlB,eAAe,EAAEc,cAAM,CAACK,OAAO;IAC/BC,WAAW,EAAE,EAAE;IACfC,QAAQ,EAAE;EACZ,CAAC;EACDpB,SAAS,EAAE;IAAEY,KAAK,EAAEC,cAAM,CAACQ;EAAM;AACnC,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEYlE,yBAAyB;AAAAmE,OAAA,CAAApE,OAAA,GAAAmE,QAAA"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -46,6 +46,7 @@ const DropdownSelect = _ref => {
|
|
|
46
46
|
checkboxSize,
|
|
47
47
|
checkboxStyle,
|
|
48
48
|
checkboxLabelStyle,
|
|
49
|
+
placeholderStyle,
|
|
49
50
|
...rest
|
|
50
51
|
} = _ref;
|
|
51
52
|
const [newOptions, setNewOptions] = (0, _react.useState)(options ? options : []);
|
|
@@ -159,7 +160,8 @@ const DropdownSelect = _ref => {
|
|
|
159
160
|
multipleSelectedItemStyle: multipleSelectedItemStyle,
|
|
160
161
|
isMultiple: isMultiple,
|
|
161
162
|
primaryColor: primary,
|
|
162
|
-
disabled: disabled
|
|
163
|
+
disabled: disabled,
|
|
164
|
+
placeholderStyle: placeholderStyle
|
|
163
165
|
}, rest)), /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
|
|
164
166
|
open: open,
|
|
165
167
|
handleToggleModal: handleToggleModal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_Dropdown","_interopRequireDefault","_DropdownList","_CustomModal","_Input","_CheckBox","_colors","_constants","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownSelect","_ref","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","labelStyle","dropdownStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainer","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","rest","newOptions","setNewOptions","useState","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","Array","isArray","undefined","searchValue","setSearchValue","handleSingleSelection","value","handleMultipleSelections","selectedValues","includes","filter","item","push","handleSelectAll","prevVal","filteredOptions","getSelectedItemsLabel","selectedLabels","forEach","element","_options$find","selectedItemLabel","find","DEFAULT_OPTION_VALUE","DEFAULT_OPTION_LABEL","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","toLowerCase","search","handleToggleModal","primary","colors","gray","createElement","Fragment","onRequestClose","ListHeaderComponent","Input","onChangeText","text","style","View","styles","optionsContainerStyle","TouchableOpacity","onPress","onChange","exports","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","_default"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownList from './components/Dropdown/DropdownList';\nimport CustomModal from './components/CustomModal';\nimport { Input } from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type { DropdownProps } from './types/index.types';\n\nexport const DropdownSelect = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainer,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n ...rest\n}: DropdownProps) => {\n const [newOptions, setNewOptions] = useState(options ? options : []);\n const [open, setOpen] = useState(false);\n const [selectAll, setSelectAll] = useState(false);\n const [selectedItem, setSelectedItem] = useState(selectedValue); //for single selection\n const [selectedItems, setSelectedItems] = useState(\n Array.isArray(selectedValue)\n ? selectedValue\n : selectedValue === '' || selectedValue === undefined\n ? []\n : [selectedValue]\n ); //for multiple selection\n const [searchValue, setSearchValue] = useState('');\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: any) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: any) => {\n let selectedValues = [...selectedItems];\n\n if (selectedValues.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n\n if (options.length === selectedValues.length) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n const filteredOptions = newOptions.filter((item) => !item.disabled); //don't select disabled items\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optionValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n return !prevVal;\n });\n };\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple) {\n let selectedLabels: Array<string> = [];\n selectedItems &&\n selectedItems.forEach((element) => {\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === element\n )?.[optionLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === selectedItem\n );\n return selectedItemLabel?.[optionLabel ?? DEFAULT_OPTION_LABEL];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n const searchResults = options.filter((item: any) => {\n if (\n item[optionLabel ?? DEFAULT_OPTION_LABEL]\n .toString()\n .toLowerCase()\n .search(regexFilter) !== -1 ||\n item[optionValue ?? DEFAULT_OPTION_VALUE]\n .toString(regexFilter)\n .toLowerCase()\n .search(regexFilter) !== -1\n ) {\n return item;\n }\n });\n\n setNewOptions(searchResults);\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n };\n\n let primary = primaryColor || colors.gray;\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownStyle={dropdownStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainer={modalOptionsContainer}\n onRequestClose={() => {}}\n >\n <DropdownList\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n {isMultiple && newOptions.length > 1 && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={selectAll ? 'Clear all' : 'Select all'}\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n options={newOptions}\n optionLabel={optionLabel}\n optionValue={optionValue}\n isMultiple={isMultiple}\n isSearchable={isSearchable}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </CustomModal>\n </>\n );\n};\n\nconst styles = StyleSheet.create({\n optionsContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n },\n});\n\nexport default DropdownSelect;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,YAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;A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AAC,QAAA,GAEYpG,cAAc;AAAA8F,OAAA,CAAA3H,OAAA,GAAAiI,QAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_Dropdown","_interopRequireDefault","_DropdownList","_CustomModal","_Input","_CheckBox","_colors","_constants","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownSelect","_ref","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","labelStyle","dropdownStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainer","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","placeholderStyle","rest","newOptions","setNewOptions","useState","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","Array","isArray","undefined","searchValue","setSearchValue","handleSingleSelection","value","handleMultipleSelections","selectedValues","includes","filter","item","push","handleSelectAll","prevVal","filteredOptions","getSelectedItemsLabel","selectedLabels","forEach","element","_options$find","selectedItemLabel","find","DEFAULT_OPTION_VALUE","DEFAULT_OPTION_LABEL","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","toLowerCase","search","handleToggleModal","primary","colors","gray","createElement","Fragment","onRequestClose","ListHeaderComponent","Input","onChangeText","text","style","View","styles","optionsContainerStyle","TouchableOpacity","onPress","onChange","exports","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","_default"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownList from './components/Dropdown/DropdownList';\nimport CustomModal from './components/CustomModal';\nimport { Input } from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type { DropdownProps } from './types/index.types';\n\nexport const DropdownSelect = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainer,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n placeholderStyle,\n ...rest\n}: DropdownProps) => {\n const [newOptions, setNewOptions] = useState(options ? options : []);\n const [open, setOpen] = useState(false);\n const [selectAll, setSelectAll] = useState(false);\n const [selectedItem, setSelectedItem] = useState(selectedValue); //for single selection\n const [selectedItems, setSelectedItems] = useState(\n Array.isArray(selectedValue)\n ? selectedValue\n : selectedValue === '' || selectedValue === undefined\n ? []\n : [selectedValue]\n ); //for multiple selection\n const [searchValue, setSearchValue] = useState('');\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: any) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: any) => {\n let selectedValues = [...selectedItems];\n\n if (selectedValues.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n\n if (options.length === selectedValues.length) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n const filteredOptions = newOptions.filter((item) => !item.disabled); //don't select disabled items\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optionValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n return !prevVal;\n });\n };\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple) {\n let selectedLabels: Array<string> = [];\n selectedItems &&\n selectedItems.forEach((element) => {\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === element\n )?.[optionLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === selectedItem\n );\n return selectedItemLabel?.[optionLabel ?? DEFAULT_OPTION_LABEL];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n const searchResults = options.filter((item: any) => {\n if (\n item[optionLabel ?? DEFAULT_OPTION_LABEL]\n .toString()\n .toLowerCase()\n .search(regexFilter) !== -1 ||\n item[optionValue ?? DEFAULT_OPTION_VALUE]\n .toString(regexFilter)\n .toLowerCase()\n .search(regexFilter) !== -1\n ) {\n return item;\n }\n });\n\n setNewOptions(searchResults);\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n };\n\n let primary = primaryColor || colors.gray;\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownStyle={dropdownStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n placeholderStyle={placeholderStyle}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainer={modalOptionsContainer}\n onRequestClose={() => {}}\n >\n <DropdownList\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n {isMultiple && newOptions.length > 1 && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={selectAll ? 'Clear all' : 'Select all'}\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n options={newOptions}\n optionLabel={optionLabel}\n optionValue={optionValue}\n isMultiple={isMultiple}\n isSearchable={isSearchable}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </CustomModal>\n </>\n );\n};\n\nconst styles = StyleSheet.create({\n optionsContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n },\n});\n\nexport default DropdownSelect;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAA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,cAAA,GAAAA,cAAA;AAEF,MAAM0F,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC/BN,qBAAqB,EAAE;IACrBO,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEYrG,cAAc;AAAA+F,OAAA,CAAA5H,OAAA,GAAAkI,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type { ViewStyle, ColorValue, TextStyle } from 'react-native';\n\nexport type DropdownProps = {\n placeholder?: string;\n label?: string;\n error?: string;\n helperText?: string;\n options: any[];\n optionLabel: string;\n optionValue: string;\n onValueChange: Function;\n selectedValue?: string | any[] | null;\n isMultiple?: boolean;\n isSearchable?: boolean;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: ViewStyle;\n multipleSelectedItemStyle?: ViewStyle;\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainer?: ViewStyle;\n searchInputStyle?: ViewStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type { ViewStyle, ColorValue, TextStyle } from 'react-native';\n\nexport type DropdownProps = {\n placeholder?: string;\n label?: string;\n error?: string;\n helperText?: string;\n options: any[];\n optionLabel: string;\n optionValue: string;\n onValueChange: Function;\n selectedValue?: string | any[] | null;\n isMultiple?: boolean;\n isSearchable?: boolean;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: ViewStyle;\n multipleSelectedItemStyle?: ViewStyle;\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainer?: ViewStyle;\n searchInputStyle?: ViewStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n placeholderStyle?: TextStyle;\n};\n"],"mappings":""}
|
|
@@ -18,6 +18,7 @@ const Dropdown = _ref => {
|
|
|
18
18
|
dropdownStyle,
|
|
19
19
|
dropdownContainerStyle,
|
|
20
20
|
selectedItemStyle,
|
|
21
|
+
placeholderStyle,
|
|
21
22
|
multipleSelectedItemStyle,
|
|
22
23
|
dropdownErrorStyle,
|
|
23
24
|
dropdownErrorTextStyle,
|
|
@@ -42,7 +43,8 @@ const Dropdown = _ref => {
|
|
|
42
43
|
multipleSelectedItemStyle: multipleSelectedItemStyle,
|
|
43
44
|
dropdownErrorStyle: dropdownErrorStyle,
|
|
44
45
|
primaryColor: primaryColor,
|
|
45
|
-
disabled: disabled
|
|
46
|
+
disabled: disabled,
|
|
47
|
+
placeholderStyle: placeholderStyle
|
|
46
48
|
}), error && error !== '' && /*#__PURE__*/React.createElement(Text, {
|
|
47
49
|
style: [styles.error, dropdownErrorTextStyle]
|
|
48
50
|
}, error), helperText && helperText !== '' && !error && /*#__PURE__*/React.createElement(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","StyleSheet","DropdownSelectedItemsView","colors","typography","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","labelStyle","dropdownStyle","dropdownContainerStyle","selectedItemStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","createElement","style","styles","dropdownInputContainer","helper","create","marginBottom","color","gray","caption","inputFocusErrorState","borderWidth","borderStyle","borderColor","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 labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n selectedItemStyle,\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 dropdownStyle={dropdownStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n primaryColor={primaryColor}\n disabled={disabled}\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 inputFocusErrorState: {\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: colors.red,\n },\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 blackText: { color: colors.black },\n});\n\nexport default Dropdown;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,MAAMC,QAAQ,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["React","View","Text","StyleSheet","DropdownSelectedItemsView","colors","typography","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","labelStyle","dropdownStyle","dropdownContainerStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","createElement","style","styles","dropdownInputContainer","helper","create","marginBottom","color","gray","caption","inputFocusErrorState","borderWidth","borderStyle","borderColor","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 labelStyle,\n dropdownStyle,\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 dropdownStyle={dropdownStyle}\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 inputFocusErrorState: {\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: colors.red,\n },\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 blackText: { color: colors.black },\n});\n\nexport default Dropdown;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,MAAMC,QAAQ,GAAGC,IAAA,IAqBN;EAAA,IArBO;IAChBC,KAAK;IACLC,WAAW;IACXC,UAAU;IACVC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,UAAU;IACVC,aAAa;IACbC,sBAAsB;IACtBC,iBAAiB;IACjBC,gBAAgB;IAChBC,yBAAyB;IACzBC,kBAAkB;IAClBC,sBAAsB;IACtBC,uBAAuB;IACvBC,YAAY;IACZC;EACG,CAAC,GAAApB,IAAA;EACJ,oBACER,KAAA,CAAA6B,aAAA,CAAC5B,IAAI;IAAC6B,KAAK,EAAE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oBAAoB,EAAE;IACpBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,WAAW,EAAErC,MAAM,CAACsC;EACtB,CAAC;EACD/B,KAAK,EAAE;IAAEwB,KAAK,EAAE/B,MAAM,CAACsC,GAAG;IAAEC,SAAS,EAAE,CAAC;IAAE,GAAGtC,UAAU,CAACgC;EAAQ,CAAC;EACjEL,MAAM,EAAE;IAAEW,SAAS,EAAE,CAAC;IAAER,KAAK,EAAE/B,MAAM,CAACwC,OAAO;IAAE,GAAGvC,UAAU,CAACgC;EAAQ,CAAC;EACtEN,sBAAsB,EAAE;IAAEG,YAAY,EAAE,EAAE;IAAEW,KAAK,EAAE;EAAO,CAAC;EAC3DC,SAAS,EAAE;IAAEX,KAAK,EAAE/B,MAAM,CAAC2C;EAAM;AACnC,CAAC,CAAC;AAEF,eAAezC,QAAQ"}
|
|
@@ -13,6 +13,7 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
13
13
|
selectedItems,
|
|
14
14
|
dropdownStyle,
|
|
15
15
|
selectedItemStyle,
|
|
16
|
+
placeholderStyle,
|
|
16
17
|
multipleSelectedItemStyle,
|
|
17
18
|
dropdownErrorStyle,
|
|
18
19
|
primaryColor,
|
|
@@ -56,7 +57,7 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
56
57
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
57
58
|
style: [styles.blackText, selectedItemStyle]
|
|
58
59
|
}, getSelectedItemsLabel()))), !selectedItem && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
59
|
-
style: styles.blackText
|
|
60
|
+
style: [styles.blackText, placeholderStyle]
|
|
60
61
|
}, placeholder ?? 'Select an option')), /*#__PURE__*/React.createElement(View, {
|
|
61
62
|
style: styles.iconStyle
|
|
62
63
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","Pressable","ScrollView","StyleSheet","Image","TouchableOpacity","colors","inputStyles","DropdownSelectedItemsView","_ref","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownStyle","selectedItemStyle","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","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 TouchableOpacity,\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 dropdownStyle,\n selectedItemStyle,\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 <TouchableOpacity\n onPress={() => handleToggleModal()}\n key={`react-native-input-select-${Math.random()}-${i}`}\n disabled={disabled}\n >\n <Text\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n >\n {item}\n </Text>\n </TouchableOpacity>\n ))\n ) : (\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n disabled={disabled}\n >\n <Text style={[styles.blackText, selectedItemStyle]}>\n {getSelectedItemsLabel()}\n </Text>\n </TouchableOpacity>\n )}\n </View>\n\n {!selectedItem && selectedItems?.length === 0 && (\n <Text style={styles.blackText}>\n {placeholder ?? 'Select an option'}\n </Text>\n )}\n </ScrollView>\n <View style={styles.iconStyle}>\n <Image source={require('../../asset/arrow-down.png')} />\n </View>\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: { flexDirection: 'row', flexWrap: 'nowrap' },\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,EACLC,gBAAgB,QACX,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,MAAMC,yBAAyB,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["React","View","Text","Pressable","ScrollView","StyleSheet","Image","TouchableOpacity","colors","inputStyles","DropdownSelectedItemsView","_ref","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownStyle","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","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 TouchableOpacity,\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 dropdownStyle,\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 <TouchableOpacity\n onPress={() => handleToggleModal()}\n key={`react-native-input-select-${Math.random()}-${i}`}\n disabled={disabled}\n >\n <Text\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n >\n {item}\n </Text>\n </TouchableOpacity>\n ))\n ) : (\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n disabled={disabled}\n >\n <Text style={[styles.blackText, selectedItemStyle]}>\n {getSelectedItemsLabel()}\n </Text>\n </TouchableOpacity>\n )}\n </View>\n\n {!selectedItem && selectedItems?.length === 0 && (\n <Text style={[styles.blackText, placeholderStyle]}>\n {placeholder ?? 'Select an option'}\n </Text>\n )}\n </ScrollView>\n <View style={styles.iconStyle}>\n <Image source={require('../../asset/arrow-down.png')} />\n </View>\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: { flexDirection: 'row', flexWrap: 'nowrap' },\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,EACLC,gBAAgB,QACX,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,MAAMC,yBAAyB,GAAGC,IAAA,IAevB;EAAA,IAfwB;IACjCC,WAAW;IACXC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,aAAa;IACbC,iBAAiB;IACjBC,gBAAgB;IAChBC,yBAAyB;IACzBC,kBAAkB;IAClBC,YAAY;IACZC;EACG,CAAC,GAAAd,IAAA;EACJ,oBACEX,KAAA,CAAA0B,aAAA,CAACvB,SAAS;IACRwB,OAAO,EAAEA,CAAA,KAAMZ,iBAAiB,EAAG;IACnCa,KAAK,EAAEC,KAAA;MAAA,IAAC;QAAEC;MAAQ,CAAC,GAAAD,KAAA;MAAA,OAAK,CACtBC,OAAO,IAAI;QACT,GAAGrB,WAAW,CAACsB,eAAe;QAC9BC,WAAW,EAAER;MACf,CAAC,EACDf,WAAW,CAACwB,KAAK,EACjBd,aAAa,EACbN,KAAK;MAAI;MACPA,KAAK,KA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AI;IAAC0B,KAAK,EAAE,CAACU,MAAM,CAACU,SAAS,EAAE3B,gBAAgB;EAAE,GAC/CT,WAAW,IAAI,kBAAkB,CAErC,CACU,eACbZ,KAAA,CAAA0B,aAAA,CAACzB,IAAI;IAAC2B,KAAK,EAAEU,MAAM,CAACY;EAAU,gBAC5BlD,KAAA,CAAA0B,aAAA,CAACpB,KAAK;IAAC6C,MAAM,EAAEC,OAAO,CAAC,4BAA4B;EAAE,EAAG,CACnD,CACG;AAEhB,CAAC;AAED,MAAMd,MAAM,GAAGjC,UAAU,CAACgD,MAAM,CAAC;EAC/BH,SAAS,EAAE;IAAEI,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAAE,EAAE;IAAEC,GAAG,EAAE;EAAG,CAAC;EACvDjB,sBAAsB,EAAE;IAAEkB,aAAa,EAAE,KAAK;IAAEC,QAAQ,EAAE;EAAS,CAAC;EACpExC,aAAa,EAAE;IACbyC,KAAK,EAAEnD,MAAM,CAACoD,KAAK;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE,EAAE;IAChBhB,eAAe,EAAEvC,MAAM,CAACwD,OAAO;IAC/BC,WAAW,EAAE,EAAE;IACfC,QAAQ,EAAE;EACZ,CAAC;EACDlB,SAAS,EAAE;IAAEW,KAAK,EAAEnD,MAAM,CAAC2D;EAAM;AACnC,CAAC,CAAC;AAEF,eAAezD,yBAAyB"}
|
package/lib/module/index.js
CHANGED
|
@@ -37,6 +37,7 @@ export const DropdownSelect = _ref => {
|
|
|
37
37
|
checkboxSize,
|
|
38
38
|
checkboxStyle,
|
|
39
39
|
checkboxLabelStyle,
|
|
40
|
+
placeholderStyle,
|
|
40
41
|
...rest
|
|
41
42
|
} = _ref;
|
|
42
43
|
const [newOptions, setNewOptions] = useState(options ? options : []);
|
|
@@ -150,7 +151,8 @@ export const DropdownSelect = _ref => {
|
|
|
150
151
|
multipleSelectedItemStyle: multipleSelectedItemStyle,
|
|
151
152
|
isMultiple: isMultiple,
|
|
152
153
|
primaryColor: primary,
|
|
153
|
-
disabled: disabled
|
|
154
|
+
disabled: disabled,
|
|
155
|
+
placeholderStyle: placeholderStyle
|
|
154
156
|
}, rest)), /*#__PURE__*/React.createElement(CustomModal, {
|
|
155
157
|
open: open,
|
|
156
158
|
handleToggleModal: handleToggleModal,
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","TouchableOpacity","StyleSheet","View","Dropdown","DropdownList","CustomModal","Input","CheckBox","colors","DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","DropdownSelect","_ref","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","labelStyle","dropdownStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainer","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","rest","newOptions","setNewOptions","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","Array","isArray","undefined","searchValue","setSearchValue","handleSingleSelection","value","handleMultipleSelections","selectedValues","includes","filter","item","push","length","handleSelectAll","prevVal","filteredOptions","i","getSelectedItemsLabel","selectedLabels","forEach","element","_options$find","selectedItemLabel","find","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","toLowerCase","search","handleToggleModal","primary","gray","createElement","Fragment","_extends","onRequestClose","ListHeaderComponent","onChangeText","text","style","styles","optionsContainerStyle","onPress","onChange","create","paddingHorizontal","paddingVertical","flexDirection"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownList from './components/Dropdown/DropdownList';\nimport CustomModal from './components/CustomModal';\nimport { Input } from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type { DropdownProps } from './types/index.types';\n\nexport const DropdownSelect = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainer,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n ...rest\n}: DropdownProps) => {\n const [newOptions, setNewOptions] = useState(options ? options : []);\n const [open, setOpen] = useState(false);\n const [selectAll, setSelectAll] = useState(false);\n const [selectedItem, setSelectedItem] = useState(selectedValue); //for single selection\n const [selectedItems, setSelectedItems] = useState(\n Array.isArray(selectedValue)\n ? selectedValue\n : selectedValue === '' || selectedValue === undefined\n ? []\n : [selectedValue]\n ); //for multiple selection\n const [searchValue, setSearchValue] = useState('');\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: any) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: any) => {\n let selectedValues = [...selectedItems];\n\n if (selectedValues.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n\n if (options.length === selectedValues.length) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n const filteredOptions = newOptions.filter((item) => !item.disabled); //don't select disabled items\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optionValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n return !prevVal;\n });\n };\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple) {\n let selectedLabels: Array<string> = [];\n selectedItems &&\n selectedItems.forEach((element) => {\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === element\n )?.[optionLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === selectedItem\n );\n return selectedItemLabel?.[optionLabel ?? DEFAULT_OPTION_LABEL];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n const searchResults = options.filter((item: any) => {\n if (\n item[optionLabel ?? DEFAULT_OPTION_LABEL]\n .toString()\n .toLowerCase()\n .search(regexFilter) !== -1 ||\n item[optionValue ?? DEFAULT_OPTION_VALUE]\n .toString(regexFilter)\n .toLowerCase()\n .search(regexFilter) !== -1\n ) {\n return item;\n }\n });\n\n setNewOptions(searchResults);\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n };\n\n let primary = primaryColor || colors.gray;\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownStyle={dropdownStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainer={modalOptionsContainer}\n onRequestClose={() => {}}\n >\n <DropdownList\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n {isMultiple && newOptions.length > 1 && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={selectAll ? 'Clear all' : 'Select all'}\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n options={newOptions}\n optionLabel={optionLabel}\n optionValue={optionValue}\n isMultiple={isMultiple}\n isSearchable={isSearchable}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </CustomModal>\n </>\n );\n};\n\nconst styles = StyleSheet.create({\n optionsContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n },\n});\n\nexport default DropdownSelect;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,QAAQ,MAAM,gCAAgC;AACrD,OAAOC,YAAY,MAAM,oCAAoC;AAC7D,OAAOC,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CAEJ;IACDtB,OAAO,EAAEwB,UAAW;IACpBvB,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA,WAAY;IACzBG,UAAU,EAAEA,UAAW;IACvBC,YAAY,EAAEA,YAAa;IAC3B0B,aAAa,EAAEA,aAAc;IAC7BF,YAAY,EAAEA,YAAa;IAC3BW,wBAAwB,EAAEA,wBAAyB;IACnDF,qBAAqB,EAAEA,qBAAsB;IAC7CrB,YAAY,EAAEoD,OAAQ;IACtBlD,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACU,CACb;AAEP,CAAC;AAED,MAAM0D,MAAM,GAAGhG,UAAU,CAACoG,MAAM,CAAC;EAC/BH,qBAAqB,EAAE;IACrBI,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAe7F,cAAc"}
|
|
1
|
+
{"version":3,"names":["React","useState","TouchableOpacity","StyleSheet","View","Dropdown","DropdownList","CustomModal","Input","CheckBox","colors","DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","DropdownSelect","_ref","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","labelStyle","dropdownStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainer","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","placeholderStyle","rest","newOptions","setNewOptions","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","Array","isArray","undefined","searchValue","setSearchValue","handleSingleSelection","value","handleMultipleSelections","selectedValues","includes","filter","item","push","length","handleSelectAll","prevVal","filteredOptions","i","getSelectedItemsLabel","selectedLabels","forEach","element","_options$find","selectedItemLabel","find","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","toLowerCase","search","handleToggleModal","primary","gray","createElement","Fragment","_extends","onRequestClose","ListHeaderComponent","onChangeText","text","style","styles","optionsContainerStyle","onPress","onChange","create","paddingHorizontal","paddingVertical","flexDirection"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownList from './components/Dropdown/DropdownList';\nimport CustomModal from './components/CustomModal';\nimport { Input } from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type { DropdownProps } from './types/index.types';\n\nexport const DropdownSelect = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainer,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n placeholderStyle,\n ...rest\n}: DropdownProps) => {\n const [newOptions, setNewOptions] = useState(options ? options : []);\n const [open, setOpen] = useState(false);\n const [selectAll, setSelectAll] = useState(false);\n const [selectedItem, setSelectedItem] = useState(selectedValue); //for single selection\n const [selectedItems, setSelectedItems] = useState(\n Array.isArray(selectedValue)\n ? selectedValue\n : selectedValue === '' || selectedValue === undefined\n ? []\n : [selectedValue]\n ); //for multiple selection\n const [searchValue, setSearchValue] = useState('');\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: any) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: any) => {\n let selectedValues = [...selectedItems];\n\n if (selectedValues.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n\n if (options.length === selectedValues.length) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n const filteredOptions = newOptions.filter((item) => !item.disabled); //don't select disabled items\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optionValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n return !prevVal;\n });\n };\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple) {\n let selectedLabels: Array<string> = [];\n selectedItems &&\n selectedItems.forEach((element) => {\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === element\n )?.[optionLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === selectedItem\n );\n return selectedItemLabel?.[optionLabel ?? DEFAULT_OPTION_LABEL];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n const searchResults = options.filter((item: any) => {\n if (\n item[optionLabel ?? DEFAULT_OPTION_LABEL]\n .toString()\n .toLowerCase()\n .search(regexFilter) !== -1 ||\n item[optionValue ?? DEFAULT_OPTION_VALUE]\n .toString(regexFilter)\n .toLowerCase()\n .search(regexFilter) !== -1\n ) {\n return item;\n }\n });\n\n setNewOptions(searchResults);\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n };\n\n let primary = primaryColor || colors.gray;\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownStyle={dropdownStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n placeholderStyle={placeholderStyle}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainer={modalOptionsContainer}\n onRequestClose={() => {}}\n >\n <DropdownList\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n {isMultiple && newOptions.length > 1 && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={selectAll ? 'Clear all' : 'Select all'}\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n options={newOptions}\n optionLabel={optionLabel}\n optionValue={optionValue}\n isMultiple={isMultiple}\n isSearchable={isSearchable}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </CustomModal>\n </>\n );\n};\n\nconst styles = StyleSheet.create({\n optionsContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n },\n});\n\nexport default DropdownSelect;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,QAAQ,MAAM,gCAAgC;AACrD,OAAOC,YAAY,MAAM,oCAAoC;AAC7D,OAAOC,WAAW,MAAM,0BAA0B;AAClD,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,aAAa;AAGxE,OAAO,MAAMC,cAAc,GAAGC,IAAA,IA8BT;EAAA,IA9BU;IAC7BC,WAAW;IACXC,KAAK;IACLC,KAAK;IACLC,UAAU;IACVC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,aAAa;IACbC,aAAa;IACbC,UAAU;IACVC,YAAY;IACZC,UAAU;IACVC,aAAa;IACbC,sBAAsB;IACtBC,kBAAkB;IAClBC,sBAAsB;IACtBC,uBAAuB;IACvBC,iBAAiB;IACjBC,yBAAyB;IACzBC,oBAAoB;IACpBC,qBAAqB;IACrBC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC,gBAAgB;IAChB,GAAGC;EACU,CAAC,GAAA7B,IAAA;EACd,MAAM,CAAC8B,UAAU,EAAEC,aAAa,CAAC,GAAG5C,QAAQ,CAACkB,OAAO,GAAGA,OAAO,GAAG,EAAE,CAAC;EACpE,MAAM,CAAC2B,IAAI,EAAEC,OAAO,CAAC,GAAG9C,QAAQ,CAAC,KAAK,CAAC;EACvC,MAAM,C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AAK,EAAEC,MAAM,CAACC;IAAsB,gBACxCrG,KAAA,CAAA4F,aAAA,CAAC1F,gBAAgB;MAACoG,OAAO,EAAEA,CAAA,KAAM,CAAC;IAAE,gBAClCtG,KAAA,CAAA4F,aAAA,CAACnF,QAAQ;MACPmD,KAAK,EAAEZ,SAAU;MACjBhC,KAAK,EAAEgC,SAAS,GAAG,WAAW,GAAG,YAAa;MAC9CuD,QAAQ,EAAEA,CAAA,KAAMnC,eAAe,EAAG;MAClC/B,YAAY,EAAEqD,OAAQ;MACtBnD,YAAY,EAAEA,YAAa;MAC3BC,aAAa,EAAEA,aAAc;MAC7BC,kBAAkB,EAAEA;IAAmB,EACvC,CACe,CAEtB,CAEJ;IACDtB,OAAO,EAAEyB,UAAW;IACpBxB,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA,WAAY;IACzBG,UAAU,EAAEA,UAAW;IACvBC,YAAY,EAAEA,YAAa;IAC3B2B,aAAa,EAAEA,aAAc;IAC7BF,YAAY,EAAEA,YAAa;IAC3BW,wBAAwB,EAAEA,wBAAyB;IACnDF,qBAAqB,EAAEA,qBAAsB;IAC7CtB,YAAY,EAAEqD,OAAQ;IACtBnD,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACU,CACb;AAEP,CAAC;AAED,MAAM2D,MAAM,GAAGjG,UAAU,CAACqG,MAAM,CAAC;EAC/BH,qBAAqB,EAAE;IACrBI,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAe9F,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type { ViewStyle, ColorValue, TextStyle } from 'react-native';\n\nexport type DropdownProps = {\n placeholder?: string;\n label?: string;\n error?: string;\n helperText?: string;\n options: any[];\n optionLabel: string;\n optionValue: string;\n onValueChange: Function;\n selectedValue?: string | any[] | null;\n isMultiple?: boolean;\n isSearchable?: boolean;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: ViewStyle;\n multipleSelectedItemStyle?: ViewStyle;\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainer?: ViewStyle;\n searchInputStyle?: ViewStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type { ViewStyle, ColorValue, TextStyle } from 'react-native';\n\nexport type DropdownProps = {\n placeholder?: string;\n label?: string;\n error?: string;\n helperText?: string;\n options: any[];\n optionLabel: string;\n optionValue: string;\n onValueChange: Function;\n selectedValue?: string | any[] | null;\n isMultiple?: boolean;\n isSearchable?: boolean;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: ViewStyle;\n multipleSelectedItemStyle?: ViewStyle;\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainer?: ViewStyle;\n searchInputStyle?: ViewStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n placeholderStyle?: TextStyle;\n};\n"],"mappings":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const Dropdown: ({ label, placeholder, helperText, error, getSelectedItemsLabel, handleToggleModal, isMultiple, selectedItem, selectedItems, labelStyle, dropdownStyle, dropdownContainerStyle, selectedItemStyle, multipleSelectedItemStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, primaryColor, disabled, }: any) => JSX.Element;
|
|
2
|
+
declare const Dropdown: ({ label, placeholder, helperText, error, getSelectedItemsLabel, handleToggleModal, isMultiple, selectedItem, selectedItems, labelStyle, dropdownStyle, dropdownContainerStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, primaryColor, disabled, }: any) => JSX.Element;
|
|
3
3
|
export default Dropdown;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const DropdownSelectedItemsView: ({ placeholder, error, getSelectedItemsLabel, handleToggleModal, isMultiple, selectedItem, selectedItems, dropdownStyle, selectedItemStyle, multipleSelectedItemStyle, dropdownErrorStyle, primaryColor, disabled, }: any) => JSX.Element;
|
|
2
|
+
declare const DropdownSelectedItemsView: ({ placeholder, error, getSelectedItemsLabel, handleToggleModal, isMultiple, selectedItem, selectedItems, dropdownStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, primaryColor, disabled, }: any) => JSX.Element;
|
|
3
3
|
export default DropdownSelectedItemsView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DropdownProps } from './types/index.types';
|
|
3
|
-
export declare const DropdownSelect: ({ placeholder, label, error, helperText, options, optionLabel, optionValue, onValueChange, selectedValue, isMultiple, isSearchable, labelStyle, dropdownStyle, dropdownContainerStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, selectedItemStyle, multipleSelectedItemStyle, modalBackgroundStyle, modalOptionsContainer, searchInputStyle, primaryColor, disabled, checkboxSize, checkboxStyle, checkboxLabelStyle, ...rest }: DropdownProps) => JSX.Element;
|
|
3
|
+
export declare const DropdownSelect: ({ placeholder, label, error, helperText, options, optionLabel, optionValue, onValueChange, selectedValue, isMultiple, isSearchable, labelStyle, dropdownStyle, dropdownContainerStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, selectedItemStyle, multipleSelectedItemStyle, modalBackgroundStyle, modalOptionsContainer, searchInputStyle, primaryColor, disabled, checkboxSize, checkboxStyle, checkboxLabelStyle, placeholderStyle, ...rest }: DropdownProps) => JSX.Element;
|
|
4
4
|
export default DropdownSelect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-input-select",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "A customizable dropdown selection package for react-native for android and iOS with multiple select and search capabilities.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -18,6 +18,7 @@ const Dropdown = ({
|
|
|
18
18
|
dropdownStyle,
|
|
19
19
|
dropdownContainerStyle,
|
|
20
20
|
selectedItemStyle,
|
|
21
|
+
placeholderStyle,
|
|
21
22
|
multipleSelectedItemStyle,
|
|
22
23
|
dropdownErrorStyle,
|
|
23
24
|
dropdownErrorTextStyle,
|
|
@@ -44,6 +45,7 @@ const Dropdown = ({
|
|
|
44
45
|
dropdownErrorStyle={dropdownErrorStyle}
|
|
45
46
|
primaryColor={primaryColor}
|
|
46
47
|
disabled={disabled}
|
|
48
|
+
placeholderStyle={placeholderStyle}
|
|
47
49
|
/>
|
|
48
50
|
|
|
49
51
|
{error && error !== '' && (
|
|
@@ -21,6 +21,7 @@ const DropdownSelectedItemsView = ({
|
|
|
21
21
|
selectedItems,
|
|
22
22
|
dropdownStyle,
|
|
23
23
|
selectedItemStyle,
|
|
24
|
+
placeholderStyle,
|
|
24
25
|
multipleSelectedItemStyle,
|
|
25
26
|
dropdownErrorStyle,
|
|
26
27
|
primaryColor,
|
|
@@ -85,7 +86,7 @@ const DropdownSelectedItemsView = ({
|
|
|
85
86
|
</View>
|
|
86
87
|
|
|
87
88
|
{!selectedItem && selectedItems?.length === 0 && (
|
|
88
|
-
<Text style={styles.blackText}>
|
|
89
|
+
<Text style={[styles.blackText, placeholderStyle]}>
|
|
89
90
|
{placeholder ?? 'Select an option'}
|
|
90
91
|
</Text>
|
|
91
92
|
)}
|
package/src/index.tsx
CHANGED
|
@@ -37,6 +37,7 @@ export const DropdownSelect = ({
|
|
|
37
37
|
checkboxSize,
|
|
38
38
|
checkboxStyle,
|
|
39
39
|
checkboxLabelStyle,
|
|
40
|
+
placeholderStyle,
|
|
40
41
|
...rest
|
|
41
42
|
}: DropdownProps) => {
|
|
42
43
|
const [newOptions, setNewOptions] = useState(options ? options : []);
|
|
@@ -187,6 +188,7 @@ export const DropdownSelect = ({
|
|
|
187
188
|
isMultiple={isMultiple}
|
|
188
189
|
primaryColor={primary}
|
|
189
190
|
disabled={disabled}
|
|
191
|
+
placeholderStyle={placeholderStyle}
|
|
190
192
|
{...rest}
|
|
191
193
|
/>
|
|
192
194
|
<CustomModal
|