react-native-input-select 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/CheckBox/index.js +6 -2
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CheckBox/types.js.map +1 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js +2 -2
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownList.js +12 -16
- package/lib/commonjs/components/Dropdown/DropdownList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +6 -6
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/{SelectedItemsView.js → DropdownSelectedItemsView.js} +5 -4
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -0
- package/lib/commonjs/index.js +51 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/styles/colors.js +3 -2
- package/lib/commonjs/styles/colors.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/module/components/CheckBox/index.js +6 -2
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CheckBox/types.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +2 -2
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownList.js +13 -16
- package/lib/module/components/Dropdown/DropdownList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +6 -6
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/{SelectedItemsView.js → DropdownSelectedItemsView.js} +5 -4
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -0
- package/lib/module/index.js +51 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/styles/colors.js +3 -2
- package/lib/module/styles/colors.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/typescript/components/CheckBox/index.d.ts +1 -1
- package/lib/typescript/components/CheckBox/types.d.ts +1 -0
- package/lib/typescript/components/Dropdown/DropdownList.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownSelectedItemsView.d.ts +3 -0
- package/lib/typescript/types/index.types.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/CheckBox/index.tsx +10 -1
- package/src/components/CheckBox/types.ts +1 -0
- package/src/components/Dropdown/Dropdown.tsx +2 -2
- package/src/components/Dropdown/DropdownList.tsx +8 -11
- package/src/components/Dropdown/DropdownListItem.tsx +7 -5
- package/src/components/Dropdown/{SelectedItemsView.tsx → DropdownSelectedItemsView.tsx} +3 -2
- package/src/index.tsx +63 -10
- package/src/styles/colors.ts +2 -1
- package/src/types/index.types.ts +1 -1
- package/lib/commonjs/components/Dropdown/SelectedItemsView.js.map +0 -1
- package/lib/module/components/Dropdown/SelectedItemsView.js.map +0 -1
- package/lib/typescript/components/Dropdown/SelectedItemsView.d.ts +0 -3
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _colors = require("../../styles/colors");
|
|
9
10
|
var _constants = require("../../constants");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
/* eslint-disable react-native/no-inline-styles */
|
|
@@ -14,6 +15,7 @@ const CheckBox = _ref => {
|
|
|
14
15
|
let {
|
|
15
16
|
label,
|
|
16
17
|
value,
|
|
18
|
+
disabled,
|
|
17
19
|
primaryColor,
|
|
18
20
|
checkboxSize,
|
|
19
21
|
checkboxStyle,
|
|
@@ -21,11 +23,13 @@ const CheckBox = _ref => {
|
|
|
21
23
|
onChange
|
|
22
24
|
} = _ref;
|
|
23
25
|
const fillColor = {
|
|
24
|
-
backgroundColor: value ? primaryColor || 'green' : 'white'
|
|
26
|
+
backgroundColor: disabled ? '#d3d3d3' : value ? (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.backgroundColor) || primaryColor || 'green' : 'white',
|
|
27
|
+
borderColor: disabled ? _colors.colors.disabled : styles.checkbox.borderColor
|
|
25
28
|
};
|
|
26
29
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
27
30
|
onPress: onChange ? () => onChange(!value) : () => {},
|
|
28
|
-
style: [styles.checkboxContainer]
|
|
31
|
+
style: [styles.checkboxContainer],
|
|
32
|
+
disabled: disabled
|
|
29
33
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
30
34
|
style: [styles.checkbox, checkboxStyle, fillColor]
|
|
31
35
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_constants","obj","__esModule","default","CheckBox","_ref","label","value","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","onChange","fillColor","backgroundColor","createElement","Pressable","onPress","style","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_constants","obj","__esModule","default","CheckBox","_ref","label","value","disabled","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","onChange","fillColor","backgroundColor","borderColor","colors","styles","checkbox","createElement","Pressable","onPress","style","checkboxContainer","View","Image","source","height","CHECKBOX_SIZE","width","Text","labelStyle","StyleSheet","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","marginLeft","_default","exports"],"sources":["index.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React from 'react';\nimport { Pressable, Text, StyleSheet, Image, View } from 'react-native';\nimport { colors } from '../../styles/colors';\nimport { CHECKBOX_SIZE } from '../../constants';\nimport type { CheckboxProps } from './types';\n\nconst CheckBox = ({\n label,\n value,\n disabled,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n onChange,\n}: CheckboxProps) => {\n const fillColor = {\n backgroundColor: disabled\n ? '#d3d3d3'\n : value\n ? checkboxStyle?.backgroundColor || primaryColor || 'green'\n : 'white',\n borderColor: disabled ? colors.disabled : styles.checkbox.borderColor,\n };\n\n return (\n <Pressable\n onPress={onChange ? () => onChange(!value) : () => {}}\n style={[styles.checkboxContainer]}\n disabled={disabled}\n >\n <View style={[styles.checkbox, checkboxStyle, fillColor]}>\n <Image\n source={require('../../asset/check.png')}\n style={[\n {\n height: checkboxSize || CHECKBOX_SIZE,\n width: checkboxSize || CHECKBOX_SIZE,\n },\n ]}\n />\n </View>\n {label && (\n <Text style={[checkboxLabelStyle, styles.labelStyle]}>{label}</Text>\n )}\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n checkboxContainer: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n },\n checkbox: {\n padding: 4,\n borderWidth: 1,\n borderStyle: 'solid',\n borderRadius: 4,\n borderColor: 'black',\n },\n labelStyle: { marginLeft: 10 },\n});\n\nexport default CheckBox;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAgD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAJhD;;AAOA,MAAMG,QAAQ,GAAGC,IAAA,IASI;EAAA,IATH;IAChBC,KAAK;IACLC,KAAK;IACLC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC;EACa,CAAC,GAAAR,IAAA;EACd,MAAMS,SAAS,GAAG;IAChBC,eAAe,EAAEP,QAAQ,GACrB,SAAS,GACTD,KAAK,GACL,C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AE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,YAAY,EAAE,CAAC;IACfzB,WAAW,EAAE;EACf,CAAC;EACDgB,UAAU,EAAE;IAAEU,UAAU,EAAE;EAAG;AAC/B,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEYvC,QAAQ;AAAAwC,OAAA,CAAAzC,OAAA,GAAAwC,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue, ViewStyle, TextStyle } from 'react-native';\n\nexport type CheckboxProps = {\n label?: string;\n value?: boolean;\n primaryColor?: ColorValue;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n onChange?: (value: boolean | string | number) => void;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue, ViewStyle, TextStyle } from 'react-native';\n\nexport type CheckboxProps = {\n label?: string;\n value?: boolean;\n disabled?: boolean;\n primaryColor?: ColorValue;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n onChange?: (value: boolean | string | number) => void;\n};\n"],"mappings":""}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var
|
|
9
|
+
var _DropdownSelectedItemsView = _interopRequireDefault(require("./DropdownSelectedItemsView"));
|
|
10
10
|
var _colors = require("../../styles/colors");
|
|
11
11
|
var _typography = require("../../styles/typography");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -36,7 +36,7 @@ const Dropdown = _ref => {
|
|
|
36
36
|
style: [styles.dropdownInputContainer, dropdownContainerStyle]
|
|
37
37
|
}, label && label !== '' && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
38
38
|
style: [styles.label, labelStyle]
|
|
39
|
-
}, label), /*#__PURE__*/_react.default.createElement(
|
|
39
|
+
}, label), /*#__PURE__*/_react.default.createElement(_DropdownSelectedItemsView.default, {
|
|
40
40
|
placeholder: placeholder,
|
|
41
41
|
error: error,
|
|
42
42
|
getSelectedItemsLabel: getSelectedItemsLabel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","
|
|
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,IAoBN;EAAA,IApBO;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,yBAAyB;IACzBC,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M,EAAET,uBAAuB;EAAE,GACnDd,UAAU,CAEd,CACI;AAEX,CAAC;AAED,MAAMoB,MAAM,GAAGI,uBAAU,CAACC,MAAM,CAAC;EAC/B3B,KAAK,EAAE;IAAE4B,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;EACDnC,KAAK,EAAE;IAAE0B,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,GAEY9C,QAAQ;AAAA+C,OAAA,CAAAhD,OAAA,GAAA+C,QAAA"}
|
|
@@ -9,12 +9,14 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _DropdownListItem = _interopRequireDefault(require("./DropdownListItem"));
|
|
10
10
|
var _colors = require("../../styles/colors");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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); }
|
|
12
13
|
const DropdownList = _ref => {
|
|
13
14
|
let {
|
|
14
15
|
options,
|
|
15
16
|
optionLabel,
|
|
16
17
|
optionValue,
|
|
17
18
|
isMultiple,
|
|
19
|
+
isSearchable,
|
|
18
20
|
selectedItems,
|
|
19
21
|
selectedItem,
|
|
20
22
|
handleMultipleSelections,
|
|
@@ -22,15 +24,19 @@ const DropdownList = _ref => {
|
|
|
22
24
|
primaryColor,
|
|
23
25
|
checkboxSize,
|
|
24
26
|
checkboxStyle,
|
|
25
|
-
checkboxLabelStyle
|
|
27
|
+
checkboxLabelStyle,
|
|
28
|
+
...rest
|
|
26
29
|
} = _ref;
|
|
27
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, _extends({
|
|
28
31
|
data: options,
|
|
29
32
|
extraData: isMultiple ? selectedItems : selectedItem,
|
|
30
33
|
initialNumToRender: 5,
|
|
31
34
|
ListEmptyComponent: /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
32
35
|
style: styles.emptyListStyle
|
|
33
36
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, null, "No options available")),
|
|
37
|
+
contentContainerStyle: [isSearchable ? {
|
|
38
|
+
paddingTop: 0
|
|
39
|
+
} : styles.contentContainerStyle],
|
|
34
40
|
ItemSeparatorComponent: () => /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
35
41
|
style: styles.itemSeparatorStyle
|
|
36
42
|
}),
|
|
@@ -46,7 +52,7 @@ const DropdownList = _ref => {
|
|
|
46
52
|
checkboxLabelStyle
|
|
47
53
|
}),
|
|
48
54
|
keyExtractor: (_item, index) => `Options${index}`
|
|
49
|
-
});
|
|
55
|
+
}, rest));
|
|
50
56
|
};
|
|
51
57
|
const _renderItem = (_ref2, props) => {
|
|
52
58
|
let {
|
|
@@ -66,19 +72,6 @@ const _renderItem = (_ref2, props) => {
|
|
|
66
72
|
});
|
|
67
73
|
};
|
|
68
74
|
const styles = _reactNative.StyleSheet.create({
|
|
69
|
-
modalContainer: {
|
|
70
|
-
flex: 1,
|
|
71
|
-
justifyContent: 'flex-end'
|
|
72
|
-
},
|
|
73
|
-
modalBackgroundStyle: {
|
|
74
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)'
|
|
75
|
-
},
|
|
76
|
-
modalOptionsContainer: {
|
|
77
|
-
maxHeight: '50%',
|
|
78
|
-
backgroundColor: _colors.colors.white,
|
|
79
|
-
borderTopLeftRadius: 16,
|
|
80
|
-
borderTopRightRadius: 16
|
|
81
|
-
},
|
|
82
75
|
itemSeparatorStyle: {
|
|
83
76
|
backgroundColor: _colors.colors.gray,
|
|
84
77
|
height: 1,
|
|
@@ -88,6 +81,9 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
88
81
|
alignItems: 'center',
|
|
89
82
|
width: '100%',
|
|
90
83
|
marginVertical: 20
|
|
84
|
+
},
|
|
85
|
+
contentContainerStyle: {
|
|
86
|
+
paddingTop: 20
|
|
91
87
|
}
|
|
92
88
|
});
|
|
93
89
|
var _default = DropdownList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_DropdownListItem","_colors","obj","__esModule","default","DropdownList","_ref","options","optionLabel","optionValue","isMultiple","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","createElement","FlatList","data","extraData","initialNumToRender","ListEmptyComponent","View","style","styles","emptyListStyle","Text","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","index","_ref2","props","StyleSheet","create","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_DropdownListItem","_colors","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","DropdownList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","rest","createElement","FlatList","data","extraData","initialNumToRender","ListEmptyComponent","View","style","styles","emptyListStyle","Text","contentContainerStyle","paddingTop","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","index","_ref2","props","StyleSheet","create","backgroundColor","colors","gray","height","opacity","alignItems","width","marginVertical","_default","exports"],"sources":["DropdownList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React from 'react';\nimport { View, FlatList, StyleSheet, Text } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport { colors } from '../../styles/colors';\n\nconst DropdownList = ({\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 ...rest\n}: any) => {\n return (\n <FlatList\n data={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <View style={styles.emptyListStyle}>\n <Text>No options available</Text>\n </View>\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => <View style={styles.itemSeparatorStyle} />}\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,\n checkboxStyle,\n checkboxLabelStyle,\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 />\n );\n};\n\nconst styles = StyleSheet.create({\n itemSeparatorStyle: {\n backgroundColor: colors.gray,\n height: 1,\n opacity: 0.15,\n },\n emptyListStyle: { alignItems: 'center', width: '100%', marginVertical: 20 },\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownList;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAA6C,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAE7C,MAAMQ,YAAY,GAAGC,IAAA,IAeV;EAAA,IAfW;IACpBC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,wBAAwB;IACxBC,qBAAqB;IACrBC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClB,GAAGC;EACA,CAAC,GAAAd,IAAA;EACJ,oBACExB,MAAA,CAAAQ,OAAA,CAAA+B,aAAA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,KAAK,CAACrC,WAAY;IAC/BC,WAAW,EAAEoC,KAAK,CAACpC,WAAY;IAC/BC,UAAU,EAAEmC,KAAK,CAACnC,UAAW;IAC7B6B,cAAc,EAAEM,KAAK,CAACN,cAAe;IACrCC,QAAQ,EAAEK,KAAK,CAACL,QAAS;IACzBxB,YAAY,EAAE6B,KAAK,CAAC7B,YAAa;IACjCC,YAAY,EAAE4B,KAAK,CAAC5B,YAAa;IACjCC,aAAa,EAAE2B,KAAK,CAAC3B,aAAc;IACnCC,kBAAkB,EAAE0B,KAAK,CAAC1B;EAAmB,EAC7C;AAEN,CAAC;AAED,MAAMU,MAAM,GAAGiB,uBAAU,CAACC,MAAM,CAAC;EAC/BZ,kBAAkB,EAAE;IAClBa,eAAe,EAAEC,cAAM,CAACC,IAAI;IAC5BC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE;EACX,CAAC;EACDtB,cAAc,EAAE;IAAEuB,UAAU,EAAE,QAAQ;IAAEC,KAAK,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAG,CAAC;EAC3EvB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAAC,IAAAuB,QAAA,GAEYnD,YAAY;AAAAoD,OAAA,CAAAnE,OAAA,GAAAkE,QAAA"}
|
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _CheckBox = _interopRequireDefault(require("../CheckBox"));
|
|
10
|
-
var _colors = require("../../styles/colors");
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -26,20 +25,21 @@ const DropdownListItem = _ref => {
|
|
|
26
25
|
} = _ref;
|
|
27
26
|
const selectedOptionValue = optionValue ?? 'value';
|
|
28
27
|
return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
29
|
-
style: styles.
|
|
30
|
-
onPress: () => onChange(item[selectedOptionValue])
|
|
28
|
+
style: styles.dropdownModalOptions,
|
|
29
|
+
onPress: item.disabled ? () => {} : () => onChange(item[selectedOptionValue]) // intentionally didn't use the disable property
|
|
31
30
|
}, /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
32
31
|
value: isMultiple ? selectedOption.includes(item[selectedOptionValue]) : [selectedOption].includes(item[selectedOptionValue]),
|
|
33
32
|
label: item[optionLabel ?? ''],
|
|
34
33
|
onChange: () => onChange(item[selectedOptionValue]),
|
|
35
|
-
primaryColor: primaryColor
|
|
34
|
+
primaryColor: primaryColor,
|
|
36
35
|
checkboxSize: checkboxSize,
|
|
37
36
|
checkboxStyle: checkboxStyle,
|
|
38
|
-
checkboxLabelStyle: checkboxLabelStyle
|
|
37
|
+
checkboxLabelStyle: checkboxLabelStyle,
|
|
38
|
+
disabled: item.disabled
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
41
|
const styles = _reactNative.StyleSheet.create({
|
|
42
|
-
|
|
42
|
+
dropdownModalOptions: {
|
|
43
43
|
paddingHorizontal: 20,
|
|
44
44
|
paddingVertical: 10,
|
|
45
45
|
flexDirection: 'row',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CheckBox","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CheckBox","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","selectedOptionValue","createElement","TouchableOpacity","style","styles","dropdownModalOptions","onPress","disabled","value","includes","label","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","_default","memo","exports"],"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}: any) => {\n const selectedOptionValue = optionValue ?? 'value';\n return (\n <TouchableOpacity\n style={styles.dropdownModalOptions}\n onPress={\n item.disabled ? () => {} : () => onChange(item[selectedOptionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[selectedOptionValue])\n : [selectedOption].includes(item[selectedOptionValue])\n }\n label={item[optionLabel ?? '']}\n onChange={() => onChange(item[selectedOptionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n disabled={item.disabled}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n dropdownModalOptions: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAK,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAf,GAAA,EAAAgB,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV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c;IAC7BC,kBAAkB,EAAEA,kBAAmB;IACvCQ,QAAQ,EAAEjB,IAAI,CAACiB;EAAS,EACxB,CACe;AAEvB,CAAC;AAED,MAAMH,MAAM,GAAGO,uBAAU,CAACC,MAAM,CAAC;EAC/BP,oBAAoB,EAAE;IACpBQ,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,gBAEY,IAAAC,WAAI,EAAC9B,gBAAgB,CAAC;AAAA+B,OAAA,CAAAnD,OAAA,GAAAiD,QAAA"}
|
package/lib/commonjs/components/Dropdown/{SelectedItemsView.js → DropdownSelectedItemsView.js}
RENAMED
|
@@ -9,7 +9,7 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _colors = require("../../styles/colors");
|
|
10
10
|
var _input = require("../../styles/input");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
const
|
|
12
|
+
const DropdownSelectedItemsView = _ref => {
|
|
13
13
|
let {
|
|
14
14
|
placeholder,
|
|
15
15
|
error,
|
|
@@ -86,12 +86,13 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
86
86
|
paddingVertical: 5,
|
|
87
87
|
borderRadius: 10,
|
|
88
88
|
backgroundColor: _colors.colors.primary,
|
|
89
|
-
marginRight: 10
|
|
89
|
+
marginRight: 10,
|
|
90
|
+
overflow: 'hidden'
|
|
90
91
|
},
|
|
91
92
|
blackText: {
|
|
92
93
|
color: _colors.colors.black
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
|
-
var _default =
|
|
96
|
+
var _default = DropdownSelectedItemsView;
|
|
96
97
|
exports.default = _default;
|
|
97
|
-
//# sourceMappingURL=
|
|
98
|
+
//# sourceMappingURL=DropdownSelectedItemsView.js.map
|
|
@@ -0,0 +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,IAcvB;EAAA,IAdwB;IACjCC,WAAW;IACXC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,aAAa;IACbC,iBAAiB;IACjBC,yBAAyB;IACzBC,kBAAkB;IAClBC,YAAY;IACZC;EACG,CAAC,GAAAb,IAAA;EACJ,o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Ae,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,GAEYjE,yBAAyB;AAAAkE,OAAA,CAAAnE,OAAA,GAAAkE,QAAA"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.DropdownSelect = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
8
9
|
var _Dropdown = _interopRequireDefault(require("./components/Dropdown/Dropdown"));
|
|
9
10
|
var _DropdownList = _interopRequireDefault(require("./components/Dropdown/DropdownList"));
|
|
10
11
|
var _CustomModal = _interopRequireDefault(require("./components/CustomModal"));
|
|
11
|
-
var _constants = require("./constants");
|
|
12
12
|
var _Input = require("./components/Input");
|
|
13
|
+
var _CheckBox = _interopRequireDefault(require("./components/CheckBox"));
|
|
13
14
|
var _colors = require("./styles/colors");
|
|
15
|
+
var _constants = require("./constants");
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -48,6 +50,7 @@ const DropdownSelect = _ref => {
|
|
|
48
50
|
} = _ref;
|
|
49
51
|
const [newOptions, setNewOptions] = (0, _react.useState)(options ? options : []);
|
|
50
52
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
53
|
+
const [selectAll, setSelectAll] = (0, _react.useState)(false);
|
|
51
54
|
const [selectedItem, setSelectedItem] = (0, _react.useState)(selectedValue); //for single selection
|
|
52
55
|
const [selectedItems, setSelectedItems] = (0, _react.useState)(Array.isArray(selectedValue) ? selectedValue : selectedValue === '' || selectedValue === undefined ? [] : [selectedValue]); //for multiple selection
|
|
53
56
|
const [searchValue, setSearchValue] = (0, _react.useState)('');
|
|
@@ -74,6 +77,26 @@ const DropdownSelect = _ref => {
|
|
|
74
77
|
}
|
|
75
78
|
setSelectedItems(selectedValues);
|
|
76
79
|
onValueChange(selectedValues); //send value to parent
|
|
80
|
+
|
|
81
|
+
if (options.length === selectedValues.length) {
|
|
82
|
+
setSelectAll(true);
|
|
83
|
+
} else {
|
|
84
|
+
setSelectAll(false);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const handleSelectAll = () => {
|
|
88
|
+
setSelectAll(prevVal => {
|
|
89
|
+
const selectedValues = [];
|
|
90
|
+
const filteredOptions = newOptions.filter(item => !item.disabled); //don't select disabled items
|
|
91
|
+
if (!prevVal) {
|
|
92
|
+
for (let i = 0; i < filteredOptions.length; i++) {
|
|
93
|
+
selectedValues.push(filteredOptions[i][optionValue]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
setSelectedItems(selectedValues);
|
|
97
|
+
onValueChange(selectedValues); //send value to parent
|
|
98
|
+
return !prevVal;
|
|
99
|
+
});
|
|
77
100
|
};
|
|
78
101
|
|
|
79
102
|
/*===========================================
|
|
@@ -143,16 +166,30 @@ const DropdownSelect = _ref => {
|
|
|
143
166
|
modalBackgroundStyle: modalBackgroundStyle,
|
|
144
167
|
modalOptionsContainer: modalOptionsContainer,
|
|
145
168
|
onRequestClose: () => {}
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
169
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownList.default, {
|
|
170
|
+
ListHeaderComponent: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isSearchable && /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
171
|
+
value: searchValue,
|
|
172
|
+
onChangeText: text => onSearch(text),
|
|
173
|
+
style: searchInputStyle,
|
|
174
|
+
primaryColor: primary
|
|
175
|
+
}), isMultiple && newOptions.length > 1 && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
176
|
+
style: styles.optionsContainerStyle
|
|
177
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
178
|
+
onPress: () => {}
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
180
|
+
value: selectAll,
|
|
181
|
+
label: selectAll ? 'Clear all' : 'Select all',
|
|
182
|
+
onChange: () => handleSelectAll(),
|
|
183
|
+
primaryColor: primary,
|
|
184
|
+
checkboxSize: checkboxSize,
|
|
185
|
+
checkboxStyle: checkboxStyle,
|
|
186
|
+
checkboxLabelStyle: checkboxLabelStyle
|
|
187
|
+
})))),
|
|
152
188
|
options: newOptions,
|
|
153
189
|
optionLabel: optionLabel,
|
|
154
190
|
optionValue: optionValue,
|
|
155
191
|
isMultiple: isMultiple,
|
|
192
|
+
isSearchable: isSearchable,
|
|
156
193
|
selectedItems: selectedItems,
|
|
157
194
|
selectedItem: selectedItem,
|
|
158
195
|
handleMultipleSelections: handleMultipleSelections,
|
|
@@ -164,6 +201,13 @@ const DropdownSelect = _ref => {
|
|
|
164
201
|
})));
|
|
165
202
|
};
|
|
166
203
|
exports.DropdownSelect = DropdownSelect;
|
|
204
|
+
const styles = _reactNative.StyleSheet.create({
|
|
205
|
+
optionsContainerStyle: {
|
|
206
|
+
paddingHorizontal: 20,
|
|
207
|
+
paddingVertical: 10,
|
|
208
|
+
flexDirection: 'row'
|
|
209
|
+
}
|
|
210
|
+
});
|
|
167
211
|
var _default = DropdownSelect;
|
|
168
212
|
exports.default = _default;
|
|
169
213
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_Dropdown","_interopRequireDefault","_DropdownList","_CustomModal","_constants","_Input","_colors","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","selectedItem","setSelectedItem","selectedItems","setSelectedItems","Array","isArray","undefined","searchValue","setSearchValue","handleSingleSelection","value","handleMultipleSelections","selectedValues","includes","filter","item","push","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","Input","onChangeText","text","style","exports","_default"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownList from './components/Dropdown/DropdownList';\nimport CustomModal from './components/CustomModal';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type { DropdownProps } from './types/index.types';\nimport { Input } from './components/Input';\nimport { colors } from './styles/colors';\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 [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\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 {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n <DropdownList\n options={newOptions}\n optionLabel={optionLabel}\n optionValue={optionValue}\n isMultiple={isMultiple}\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\nexport default DropdownSelect;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,YAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAAyC,SAAAE,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAb,wBAAAS,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA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,qBAAsB;IAC7CpB,YAAY,EAAEgD,OAAQ;IACtB9C,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACU,CACb;AAEP,CAAC;AAACsD,OAAA,CAAAlF,cAAA,GAAAA,cAAA;AAAA,IAAAmF,QAAA,GAEanF,cAAc;AAAAkF,OAAA,CAAA/G,OAAA,GAAAgH,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","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: 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;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACU,CACb;AAEP,CAAC;AAACkE,OAAA,CAAA9F,cAAA,GAAAA,cAAA;AAEF,MAAMyF,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,GAEYpG,cAAc;AAAA8F,OAAA,CAAA3H,OAAA,GAAAiI,QAAA"}
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.colors = void 0;
|
|
7
7
|
const colors = {
|
|
8
|
-
primary: '
|
|
8
|
+
primary: 'green',
|
|
9
9
|
red: '#FA4169',
|
|
10
10
|
black: '#000000',
|
|
11
11
|
white: '#FFFFFF',
|
|
12
12
|
dark: '#11142D',
|
|
13
13
|
gray: '#808191',
|
|
14
|
-
lightGray: '#F7F7F7'
|
|
14
|
+
lightGray: '#F7F7F7',
|
|
15
|
+
disabled: '#d3d3d3'
|
|
15
16
|
};
|
|
16
17
|
exports.colors = colors;
|
|
17
18
|
//# sourceMappingURL=colors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["colors","primary","red","black","white","dark","gray","lightGray","exports"],"sources":["colors.ts"],"sourcesContent":["export const colors: any = {\n primary: '
|
|
1
|
+
{"version":3,"names":["colors","primary","red","black","white","dark","gray","lightGray","disabled","exports"],"sources":["colors.ts"],"sourcesContent":["export const colors: any = {\n primary: 'green',\n red: '#FA4169',\n black: '#000000',\n white: '#FFFFFF',\n dark: '#11142D',\n gray: '#808191',\n lightGray: '#F7F7F7',\n disabled: '#d3d3d3',\n};\n"],"mappings":";;;;;;AAAO,MAAMA,MAAW,GAAG;EACzBC,OAAO,EAAE,OAAO;EAChBC,GAAG,EAAE,SAAS;EACdC,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE,SAAS;EACfC,IAAI,EAAE,SAAS;EACfC,SAAS,EAAE,SAAS;EACpBC,QAAQ,EAAE;AACZ,CAAC;AAACC,OAAA,CAAAT,MAAA,GAAAA,MAAA"}
|
|
@@ -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
|
|
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,11 +1,13 @@
|
|
|
1
1
|
/* eslint-disable react-native/no-inline-styles */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Pressable, Text, StyleSheet, Image, View } from 'react-native';
|
|
4
|
+
import { colors } from '../../styles/colors';
|
|
4
5
|
import { CHECKBOX_SIZE } from '../../constants';
|
|
5
6
|
const CheckBox = _ref => {
|
|
6
7
|
let {
|
|
7
8
|
label,
|
|
8
9
|
value,
|
|
10
|
+
disabled,
|
|
9
11
|
primaryColor,
|
|
10
12
|
checkboxSize,
|
|
11
13
|
checkboxStyle,
|
|
@@ -13,11 +15,13 @@ const CheckBox = _ref => {
|
|
|
13
15
|
onChange
|
|
14
16
|
} = _ref;
|
|
15
17
|
const fillColor = {
|
|
16
|
-
backgroundColor: value ? primaryColor || 'green' : 'white'
|
|
18
|
+
backgroundColor: disabled ? '#d3d3d3' : value ? (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.backgroundColor) || primaryColor || 'green' : 'white',
|
|
19
|
+
borderColor: disabled ? colors.disabled : styles.checkbox.borderColor
|
|
17
20
|
};
|
|
18
21
|
return /*#__PURE__*/React.createElement(Pressable, {
|
|
19
22
|
onPress: onChange ? () => onChange(!value) : () => {},
|
|
20
|
-
style: [styles.checkboxContainer]
|
|
23
|
+
style: [styles.checkboxContainer],
|
|
24
|
+
disabled: disabled
|
|
21
25
|
}, /*#__PURE__*/React.createElement(View, {
|
|
22
26
|
style: [styles.checkbox, checkboxStyle, fillColor]
|
|
23
27
|
}, /*#__PURE__*/React.createElement(Image, {
|