react-native-input-select 0.24.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.
Files changed (50) hide show
  1. package/README.md +9 -7
  2. package/lib/commonjs/components/CheckBox/index.js +6 -2
  3. package/lib/commonjs/components/CheckBox/index.js.map +1 -1
  4. package/lib/commonjs/components/CheckBox/types.js.map +1 -1
  5. package/lib/commonjs/components/Dropdown/Dropdown.js +3 -1
  6. package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
  7. package/lib/commonjs/components/Dropdown/DropdownList.js +12 -3
  8. package/lib/commonjs/components/Dropdown/DropdownList.js.map +1 -1
  9. package/lib/commonjs/components/Dropdown/DropdownListItem.js +3 -2
  10. package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
  11. package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +2 -1
  12. package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
  13. package/lib/commonjs/index.js +27 -22
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/styles/colors.js +2 -1
  16. package/lib/commonjs/styles/colors.js.map +1 -1
  17. package/lib/commonjs/types/index.types.js.map +1 -1
  18. package/lib/module/components/CheckBox/index.js +6 -2
  19. package/lib/module/components/CheckBox/index.js.map +1 -1
  20. package/lib/module/components/CheckBox/types.js.map +1 -1
  21. package/lib/module/components/Dropdown/Dropdown.js +3 -1
  22. package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
  23. package/lib/module/components/Dropdown/DropdownList.js +13 -3
  24. package/lib/module/components/Dropdown/DropdownList.js.map +1 -1
  25. package/lib/module/components/Dropdown/DropdownListItem.js +3 -2
  26. package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
  27. package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +2 -1
  28. package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
  29. package/lib/module/index.js +27 -22
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/styles/colors.js +2 -1
  32. package/lib/module/styles/colors.js.map +1 -1
  33. package/lib/module/types/index.types.js.map +1 -1
  34. package/lib/typescript/components/CheckBox/index.d.ts +1 -1
  35. package/lib/typescript/components/CheckBox/types.d.ts +1 -0
  36. package/lib/typescript/components/Dropdown/Dropdown.d.ts +1 -1
  37. package/lib/typescript/components/Dropdown/DropdownList.d.ts +1 -1
  38. package/lib/typescript/components/Dropdown/DropdownSelectedItemsView.d.ts +1 -1
  39. package/lib/typescript/index.d.ts +1 -1
  40. package/lib/typescript/types/index.types.d.ts +1 -0
  41. package/package.json +1 -1
  42. package/src/components/CheckBox/index.tsx +8 -1
  43. package/src/components/CheckBox/types.ts +1 -0
  44. package/src/components/Dropdown/Dropdown.tsx +2 -0
  45. package/src/components/Dropdown/DropdownList.tsx +8 -0
  46. package/src/components/Dropdown/DropdownListItem.tsx +4 -1
  47. package/src/components/Dropdown/DropdownSelectedItemsView.tsx +2 -1
  48. package/src/index.tsx +34 -27
  49. package/src/styles/colors.ts +1 -0
  50. package/src/types/index.types.ts +1 -0
@@ -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 ? (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.backgroundColor) || 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, {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Pressable","Text","StyleSheet","Image","View","CHECKBOX_SIZE","CheckBox","_ref","label","value","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","onChange","fillColor","backgroundColor","createElement","onPress","style","styles","checkboxContainer","checkbox","source","require","height","width","labelStyle","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","borderColor","marginLeft"],"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 { CHECKBOX_SIZE } from '../../constants';\nimport type { CheckboxProps } from './types';\n\nconst CheckBox = ({\n label,\n value,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n onChange,\n}: CheckboxProps) => {\n const fillColor = {\n backgroundColor: value\n ? checkboxStyle?.backgroundColor || primaryColor || 'green'\n : 'white',\n };\n return (\n <Pressable\n onPress={onChange ? () => onChange(!value) : () => {}}\n style={[styles.checkboxContainer]}\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":"AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,IAAI,QAAQ,cAAc;AACvE,SAASC,aAAa,QAAQ,iBAAiB;AAG/C,MAAMC,QAAQ,GAAGC,IAAA,IAQI;EAAA,IARH;IAChBC,KAAK;IACLC,KAAK;IACLC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC;EACa,CAAC,GAAAP,IAAA;EACd,MAAMQ,SAAS,GAAG;IAChBC,eAAe,EAAEP,KAAK,GAClB,CAAAG,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,eAAe,KAAIN,YAAY,IAAI,OAAO,GACzD;EACN,CAAC;EACD,oBACEX,KAAA,CAAAkB,aAAA,CAACjB,SAAS;IACRkB,OAAO,EAAEJ,QAAQ,GAAG,MAAMA,QAAQ,CAAC,CAACL,KAAK,CAAC,GAAG,MAAM,CAAC,CAAE;IACtDU,KAAK,EAAE,CAACC,MAAM,CAACC,iBAAiB;EAAE,gBAElCtB,KAAA,CAAAkB,aAAA,CAACb,IAAI;IAACe,KAAK,EAAE,CAACC,MAAM,CAACE,QAAQ,EAAEV,aAAa,EAAEG,SAAS;EAAE,gBACvDhB,KAAA,CAAAkB,aAAA,CAACd,KAAK;IACJoB,MAAM,EAAEC,OAAO,CAAC,uBAAuB,CAAE;IACzCL,KAAK,EAAE,CACL;MACEM,MAAM,EAAEd,YAAY,IAAIN,aAAa;MACrCqB,KAAK,EAAEf,YAAY,IAAIN;IACzB,CAAC;EACD,EACF,CACG,EACNG,KAAK,iBACJT,KAAA,CAAAkB,aAAA,CAAChB,IAAI;IAACkB,KAAK,EAAE,CAACN,kBAAkB,EAAEO,MAAM,CAACO,UAAU;EAAE,GAAEnB,KAAK,CAC7D,CACS;AAEhB,CAAC;AAED,MAAMY,MAAM,GAAGlB,UAAU,CAAC0B,MAAM,CAAC;EAC/BP,iBAAiB,EAAE;IACjBQ,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACDT,QAAQ,EAAE;IACRU,OAAO,EAAE,CAAC;IACVC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE;EACf,CAAC;EACDT,UAAU,EAAE;IAAEU,UAAU,EAAE;EAAG;AAC/B,CAAC,CAAC;AAEF,eAAe/B,QAAQ"}
1
+ {"version":3,"names":["React","Pressable","Text","StyleSheet","Image","View","colors","CHECKBOX_SIZE","CheckBox","_ref","label","value","disabled","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","onChange","fillColor","backgroundColor","borderColor","styles","checkbox","createElement","onPress","style","checkboxContainer","source","require","height","width","labelStyle","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","marginLeft"],"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":"AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,IAAI,QAAQ,cAAc;AACvE,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,aAAa,QAAQ,iBAAiB;AAG/C,MAAMC,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,CAAAI,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEI,eAAe,KAAIN,YAAY,IAAI,OAAO,GACzD,OAAO;IACXO,WAAW,EAAER,QAAQ,GAAGN,MAAM,CAACM,QAAQ,GAAGS,MAAM,CAACC,QAAQ,CAACF;EAC5D,CAAC;EAED,oBACEpB,KAAA,CAAAuB,aAAA,CAACtB,SAAS;IACRuB,OAAO,EAAEP,QAAQ,GAAG,MAAMA,QAAQ,CAAC,CAACN,KAAK,CAAC,GAAG,MAAM,CAAC,CAAE;IACtDc,KAAK,EAAE,CAACJ,MAAM,CAACK,iBAAiB,CAAE;IAClCd,QAAQ,EAAEA;EAAS,gBAEnBZ,KAAA,CAAAuB,aAAA,CAAClB,IAAI;IAACoB,KAAK,EAAE,CAACJ,MAAM,CAACC,QAAQ,EAAEP,aAAa,EAAEG,SAAS;EAAE,gBACvDlB,KAAA,CAAAuB,aAAA,CAACnB,KAAK;IACJuB,MAAM,EAAEC,OAAO,CAAC,uBAAuB,CAAE;IACzCH,KAAK,EAAE,CACL;MACEI,MAAM,EAAEf,YAAY,IAAIP,aAAa;MACrCuB,KAAK,EAAEhB,YAAY,IAAIP;IACzB,CAAC;EACD,EACF,CACG,EACNG,KAAK,iBACJV,KAAA,CAAAuB,aAAA,CAACrB,IAAI;IAACuB,KAAK,EAAE,CAACT,kBAAkB,EAAEK,MAAM,CAACU,UAAU;EAAE,GAAErB,KAAK,CAC7D,CACS;AAEhB,CAAC;AAED,MAAMW,MAAM,GAAGlB,UAAU,CAAC6B,MAAM,CAAC;EAC/BN,iBAAiB,EAAE;IACjBO,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACDb,QAAQ,EAAE;IACRc,OAAO,EAAE,CAAC;IACVC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,YAAY,EAAE,CAAC;IACfnB,WAAW,EAAE;EACf,CAAC;EACDW,UAAU,EAAE;IAAES,UAAU,EAAE;EAAG;AAC/B,CAAC,CAAC;AAEF,eAAehC,QAAQ"}
@@ -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":""}
@@ -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,IAoBN;EAAA,I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A4B,aAAA,CAAC1B,IAAI;IAAC2B,KAAK,EAAE,CAACC,MAAM,CAACE,MAAM,EAAEP,uBAAuB;EAAE,GACnDd,UAAU,CAEd,CACI;AAEX,CAAC;AAED,MAAMmB,MAAM,GAAG3B,UAAU,CAAC8B,MAAM,CAAC;EAC/BxB,KAAK,EAAE;IAAEyB,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAE9B,MAAM,CAAC+B,IAAI;IAAE,GAAG9B,UAAU,CAAC+B;EAAQ,CAAC;EACtEC,oBAAoB,EAAE;IACpBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,WAAW,EAAEpC,MAAM,CAACqC;EACtB,CAAC;EACD9B,KAAK,EAAE;IAAEuB,KAAK,EAAE9B,MAAM,CAACqC,GAAG;IAAEC,SAAS,EAAE,CAAC;IAAE,GAAGrC,UAAU,CAAC+B;EAAQ,CAAC;EACjEL,MAAM,EAAE;IAAEW,SAAS,EAAE,CAAC;IAAER,KAAK,EAAE9B,MAAM,CAACuC,OAAO;IAAE,GAAGtC,UAAU,CAAC+B;EAAQ,CAAC;EACtEN,sBAAsB,EAAE;IAAEG,YAAY,EAAE,EAAE;IAAEW,KAAK,EAAE;EAAO,CAAC;EAC3DC,SAAS,EAAE;IAAEX,KAAK,EAAE9B,MAAM,CAAC0C;EAAM;AACnC,CAAC,CAAC;AAEF,eAAexC,QAAQ"}
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":"A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AS;IACnBN,gBAAgB,EAAEA;EAAiB,EACnC,EAEDV,KAAK,IAAIA,KAAK,KAAK,EAAE,iBACpBZ,KAAA,CAAA6B,aAAA,CAAC3B,IAAI;IAAC4B,KAAK,EAAE,CAACC,MAAM,CAACnB,KAAK,EAAEa,sBAAsB;EAAE,GAAEb,KAAK,CAC5D,EAEAD,UAAU,IAAIA,UAAU,KAAK,EAAE,IAAI,CAACC,KAAK,iBACxCZ,KAAA,CAAA6B,aAAA,CAAC3B,IAAI;IAAC4B,KAAK,EAAE,CAACC,MAAM,CAACE,MAAM,EAAEP,uBAAuB;EAAE,GACnDf,UAAU,CAEd,CACI;AAEX,CAAC;AAED,MAAMoB,MAAM,GAAG5B,UAAU,CAAC+B,MAAM,CAAC;EAC/BzB,KAAK,EAAE;IAAE0B,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAE/B,MAAM,CAACgC,IAAI;IAAE,GAAG/B,UAAU,CAACgC;EAAQ,CAAC;EACtEC,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"}
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ /* eslint-disable react-native/no-inline-styles */
1
3
  import React from 'react';
2
4
  import { View, FlatList, StyleSheet, Text } from 'react-native';
3
5
  import DropdownListItem from './DropdownListItem';
@@ -8,6 +10,7 @@ const DropdownList = _ref => {
8
10
  optionLabel,
9
11
  optionValue,
10
12
  isMultiple,
13
+ isSearchable,
11
14
  selectedItems,
12
15
  selectedItem,
13
16
  handleMultipleSelections,
@@ -15,15 +18,19 @@ const DropdownList = _ref => {
15
18
  primaryColor,
16
19
  checkboxSize,
17
20
  checkboxStyle,
18
- checkboxLabelStyle
21
+ checkboxLabelStyle,
22
+ ...rest
19
23
  } = _ref;
20
- return /*#__PURE__*/React.createElement(FlatList, {
24
+ return /*#__PURE__*/React.createElement(FlatList, _extends({
21
25
  data: options,
22
26
  extraData: isMultiple ? selectedItems : selectedItem,
23
27
  initialNumToRender: 5,
24
28
  ListEmptyComponent: /*#__PURE__*/React.createElement(View, {
25
29
  style: styles.emptyListStyle
26
30
  }, /*#__PURE__*/React.createElement(Text, null, "No options available")),
31
+ contentContainerStyle: [isSearchable ? {
32
+ paddingTop: 0
33
+ } : styles.contentContainerStyle],
27
34
  ItemSeparatorComponent: () => /*#__PURE__*/React.createElement(View, {
28
35
  style: styles.itemSeparatorStyle
29
36
  }),
@@ -39,7 +46,7 @@ const DropdownList = _ref => {
39
46
  checkboxLabelStyle
40
47
  }),
41
48
  keyExtractor: (_item, index) => `Options${index}`
42
- });
49
+ }, rest));
43
50
  };
44
51
  const _renderItem = (_ref2, props) => {
45
52
  let {
@@ -68,6 +75,9 @@ const styles = StyleSheet.create({
68
75
  alignItems: 'center',
69
76
  width: '100%',
70
77
  marginVertical: 20
78
+ },
79
+ contentContainerStyle: {
80
+ paddingTop: 20
71
81
  }
72
82
  });
73
83
  export default DropdownList;
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","FlatList","StyleSheet","Text","DropdownListItem","colors","DropdownList","_ref","options","optionLabel","optionValue","isMultiple","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","createElement","data","extraData","initialNumToRender","ListEmptyComponent","style","styles","emptyListStyle","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","index","_ref2","props","create","backgroundColor","gray","height","opacity","alignItems","width","marginVertical"],"sources":["DropdownList.tsx"],"sourcesContent":["import 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 selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\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 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 />\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});\n\nexport default DropdownList;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,MAAMC,YAAY,GAAGC,IAAA,IAaV;EAAA,IAbW;IACpBC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,aAAa;IACbC,YAAY;IACZC,wBAAwB;IACxBC,qBAAqB;IACrBC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC;EACG,CAAC,GAAAZ,IAAA;EACJ,oBACER,KAAA,CAAAqB,aAAA,CAACnB,QAAQ;IACPoB,IAAI,EAAEb,OAAQ;IACdc,SAAS,EAAEX,UAAU,GAAGC,aAAa,GAAGC,YAAa;IACrDU,kBAAkB,EAAE,CAAE;IACtBC,kBAAkB,eAChBzB,KAAA,CAAAqB,aAAA,CAACpB,IAAI;MAACyB,KAAK,EAAEC,MAAM,CAACC;IAAe,gBACjC5B,KAAA,CAAAqB,aAAA,CAACjB,IAAI,QAAC,sBAAoB,CAAO,CAEpC;IACDyB,sBAAsB,EAAEA,CAAA,kBAAM7B,KAAA,CAAAqB,aAAA,CAACpB,IAAI;MAACyB,KAAK,EAAEC,MAAM,CAACG;IAAmB,EAAI;IACzEC,UAAU,EAAGC,IAAI,IACfC,WAAW,CAACD,IAAI,EAAE;MAChBtB,WAAW;MACXC,WAAW;MACXC,UAAU;MACVsB,cAAc,EAAEtB,UAAU,GAAGC,aAAa,GAAGC,YAAY;MACzDqB,QAAQ,EAAEvB,UAAU,GAChBG,wBAAwB,GACxBC,qBAAqB;MACzBC,YAAY;MACZC,YAAY;MACZC,aAAa;MACbC;IACF,CAAC,CACF;IACDgB,YAAY,EAAEA,CAACC,KAAK,EAAEC,KAAK,KAAM,UAASA,KAAM;EAAE,EAClD;AAEN,CAAC;AAED,MAAML,WAAW,GAAGA,CAAAM,KAAA,EAAgBC,KAAU,KAAK;EAAA,IAA9B;IAAER;EAAU,CAAC,GAAAO,KAAA;EAChC,oBACEvC,KAAA,CAAAqB,aAAA,CAAChB,gBAAgB;IACf2B,IAAI,EAAEA,IAAK;IACXtB,WAAW,EAAE8B,KAAK,CAAC9B,WAAY;IAC/BC,WAAW,EAAE6B,KAAK,CAAC7B,WAAY;IAC/BC,UAAU,EAAE4B,KAAK,CAAC5B,UAAW;IAC7BsB,cAAc,EAAEM,KAAK,CAACN,cAAe;IACrCC,QAAQ,EAAEK,KAAK,CAACL,QAAS;IACzBlB,YAAY,EAAEuB,KAAK,CAACvB,YAAa;IACjCC,YAAY,EAAEsB,KAAK,CAACtB,YAAa;IACjCC,aAAa,EAAEqB,KAAK,CAACrB,aAAc;IACnCC,kBAAkB,EAAEoB,KAAK,CAACpB;EAAmB,EAC7C;AAEN,CAAC;AAED,MAAMO,MAAM,GAAGxB,UAAU,CAACsC,MAAM,CAAC;EAC/BX,kBAAkB,EAAE;IAClBY,eAAe,EAAEpC,MAAM,CAACqC,IAAI;IAC5BC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE;EACX,CAAC;EACDjB,cAAc,EAAE;IAAEkB,UAAU,EAAE,QAAQ;IAAEC,KAAK,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAG;AAC5E,CAAC,CAAC;AAEF,eAAezC,YAAY"}
1
+ {"version":3,"names":["React","View","FlatList","StyleSheet","Text","DropdownListItem","colors","DropdownList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","rest","createElement","_extends","data","extraData","initialNumToRender","ListEmptyComponent","style","styles","emptyListStyle","contentContainerStyle","paddingTop","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","index","_ref2","props","create","backgroundColor","gray","height","opacity","alignItems","width","marginVertical"],"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":";AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,MAAMC,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,oBACER,KAAA,CAAAuB,aAAA,CAACrB,QAAQ,EAAAsB,QAAA;IACPC,IAAI,EAAEhB,OAAQ;IACdiB,SAAS,EAAEd,UAAU,GAAGE,aAAa,GAAGC,YAAa;IACrDY,kBAAkB,EAAE,CAAE;IACtBC,kBAAkB,eAChB5B,KAAA,CAAAuB,aAAA,CAACtB,IAAI;MAAC4B,KAAK,EAAEC,MAAM,CAACC;IAAe,gBACjC/B,KAAA,CAAAuB,aAAA,CAACnB,IAAI,QAAC,sBAAoB,CAAO,CAEpC;IACD4B,qBAAqB,EAAE,CACrBnB,YAAY,GAAG;MAAEoB,UAAU,EAAE;IAAE,CAAC,GAAGH,MAAM,CAACE,qBAAqB,CAC/D;IACFE,sBAAsB,EAAEA,CAAA,kBAAMlC,KAAA,CAAAuB,aAAA,CAACtB,IAAI;MAAC4B,KAAK,EAAEC,MAAM,CAACK;IAAmB,EAAI;IACzEC,UAAU,EAAGC,IAAI,IACfC,WAAW,CAACD,IAAI,EAAE;MAChB3B,WAAW;MACXC,WAAW;MACXC,UAAU;MACV2B,cAA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DropdownListItem = _ref => {
17
17
  const selectedOptionValue = optionValue ?? 'value';
18
18
  return /*#__PURE__*/React.createElement(TouchableOpacity, {
19
19
  style: styles.dropdownModalOptions,
20
- onPress: () => onChange(item[selectedOptionValue])
20
+ onPress: item.disabled ? () => {} : () => onChange(item[selectedOptionValue]) // intentionally didn't use the disable property
21
21
  }, /*#__PURE__*/React.createElement(CheckBox, {
22
22
  value: isMultiple ? selectedOption.includes(item[selectedOptionValue]) : [selectedOption].includes(item[selectedOptionValue]),
23
23
  label: item[optionLabel ?? ''],
@@ -25,7 +25,8 @@ const DropdownListItem = _ref => {
25
25
  primaryColor: primaryColor,
26
26
  checkboxSize: checkboxSize,
27
27
  checkboxStyle: checkboxStyle,
28
- checkboxLabelStyle: checkboxLabelStyle
28
+ checkboxLabelStyle: checkboxLabelStyle,
29
+ disabled: item.disabled
29
30
  }));
30
31
  };
31
32
  const styles = StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"names":["React","memo","TouchableOpacity","StyleSheet","CheckBox","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","selectedOptionValue","createElement","style","styles","dropdownModalOptions","onPress","value","includes","label","create","paddingHorizontal","paddingVertical","flexDirection","alignItems"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n}: any) => {\n const selectedOptionValue = optionValue ?? 'value';\n return (\n <TouchableOpacity\n style={styles.dropdownModalOptions}\n onPress={() => onChange(item[selectedOptionValue])}\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 />\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,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AAC3D,OAAOC,QAAQ,MAAM,aAAa;AAElC,MAAMC,gBAAgB,GAAGC,IAAA,IAWd;EAAA,IAXe;IACxBC,IAAI;IACJC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,cAAc;IACdC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC;EACG,CAAC,GAAAV,IAAA;EACJ,MAAMW,mBAAmB,GAAGR,WAAW,IAAI,OAAO;EAClD,oBACET,KAAA,CAAAkB,aAAA,CAAChB,gBAAgB;IACfiB,KAAK,EAAEC,MAAM,CAACC,oBAAqB;IACnCC,OAAO,EAAEA,CAAA,KAAMV,QAAQ,CAACL,IAAI,CAACU,mBAAmB,CAAC;EAAE,gBAEnDjB,KAAA,CAAAkB,aAAA,CAACd,QAAQ;IACPmB,KAAK,EACHb,UAAU,GACNC,cAAc,CAACa,QAAQ,CAACjB,IAAI,CAACU,mBAAmB,CAAC,CAAC,GAClD,CAACN,cAAc,CAAC,CAACa,QAAQ,CAACjB,IAAI,CAACU,mBAAmB,CAAC,CACxD;IACDQ,KAAK,EAAElB,IAAI,CAACC,WAAW,IAAI,EAAE,CAAE;IAC/BI,QAAQ,EAAEA,CAAA,KAAMA,QAAQ,CAACL,IAAI,CAACU,mBAAmB,CAAC,CAAE;IACpDJ,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACe;AAEvB,CAAC;AAED,MAAMI,MAAM,GAAGjB,UAAU,CAACuB,MAAM,CAAC;EAC/BL,oBAAoB,EAAE;IACpBM,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,4BAAe7B,IAAI,CAACI,gBAAgB,CAAC"}
1
+ {"version":3,"names":["React","memo","TouchableOpacity","StyleSheet","CheckBox","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","selectedOptionValue","createElement","style","styles","dropdownModalOptions","onPress","disabled","value","includes","label","create","paddingHorizontal","paddingVertical","flexDirection","alignItems"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n}: 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 fl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CAAC;EAC/BN,oBAAoB,EAAE;IACpBO,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,4BAAe9B,IAAI,CAACI,gBAAgB,CAAC"}
@@ -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,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,oBACEX,KAAA,CAAAyB,aAAA,CAACtB,SAAS;IACRuB,OAAO,EAAEA,CAAA,KAAMX,iBAAiB,EAAG;IACnCY,KAAK,EAAEC,KAAA;MAAA,IAAC;QAAEC;MAAQ,CAAC,GAAAD,KAAA;MAAA,OAAK,CACtBC,OAAO,IAAI;QACT,GAAGpB,WAAW,CAACqB,eAAe;QAC9BC,WAAW,EAAER;MACf,CAAC,EACDd,WAAW,CAACuB,KAAK,EACjBb,aAAa,EACbN,KAAK;MAAI;MACPA,KAAK,KAAK,EAAE,IACZ,CAACgB,OAAO,IAAI;QACV,GAAGpB,WAAW,CAACwB,oBAAoB;QACnC,GAAGX;MACL,CAAC,CACJ;IAAA,CAAC;IACFE,QAAQ,EAAEA;EAAS,gBAEnBxB,KAAA,CAAAyB,aAAA,CAACrB,UAAU;IACT8B,UAAU;IACVC,sBAAsB;IACtBC,8BAA8B,EAAE;EAAM,gBAEt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B;EAAE,EAAG,CACnD,CACG;AAEhB,CAAC;AAED,MAAMd,MAAM,GAAGhC,UAAU,CAAC+C,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;EACpEvC,aAAa,EAAE;IACbwC,KAAK,EAAElD,MAAM,CAACmD,KAAK;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE,EAAE;IAChBhB,eAAe,EAAEtC,MAAM,CAACuD,OAAO;IAC/BC,WAAW,EAAE,EAAE;IACfC,QAAQ,EAAE;EACZ,CAAC;EACDlB,SAAS,EAAE;IAAEW,KAAK,EAAElD,MAAM,CAAC0D;EAAM;AACnC,CAAC,CAAC;AAEF,eAAexD,yBAAyB"}
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,KAAK,EAAE,IACZ,CAACiB,OAAO,IAAI;QACV,GAAGrB,WAAW,CAACyB,oBAAoB;QACnC,GAAGX;MACL,CAAC,CACJ;IAAA,CAAC;IACFE,QAAQ,EAAEA;EAAS,gBAEnBzB,KAAA,CAAA0B,aAAA,CAACtB,UAAU;IACT+B,UAAU;IACVC,sBAAsB;IACtBC,8BAA8B,EAAE;EAAM,gBAEtCrC,KAAA,CAAA0B,aAAA,CAACzB,IAAI;IACH2B,KAAK,EAAEU,MAAM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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"}
@@ -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 : []);
@@ -69,7 +70,7 @@ export const DropdownSelect = _ref => {
69
70
  setSelectedItems(selectedValues);
70
71
  onValueChange(selectedValues); //send value to parent
71
72
 
72
- if (newOptions.length === selectedValues.length) {
73
+ if (options.length === selectedValues.length) {
73
74
  setSelectAll(true);
74
75
  } else {
75
76
  setSelectAll(false);
@@ -78,9 +79,10 @@ export const DropdownSelect = _ref => {
78
79
  const handleSelectAll = () => {
79
80
  setSelectAll(prevVal => {
80
81
  const selectedValues = [];
82
+ const filteredOptions = newOptions.filter(item => !item.disabled); //don't select disabled items
81
83
  if (!prevVal) {
82
- for (let i = 0; i < newOptions.length; i++) {
83
- selectedValues.push(newOptions[i][optionValue]);
84
+ for (let i = 0; i < filteredOptions.length; i++) {
85
+ selectedValues.push(filteredOptions[i][optionValue]);
84
86
  }
85
87
  }
86
88
  setSelectedItems(selectedValues);
@@ -149,35 +151,38 @@ export const DropdownSelect = _ref => {
149
151
  multipleSelectedItemStyle: multipleSelectedItemStyle,
150
152
  isMultiple: isMultiple,
151
153
  primaryColor: primary,
152
- disabled: disabled
154
+ disabled: disabled,
155
+ placeholderStyle: placeholderStyle
153
156
  }, rest)), /*#__PURE__*/React.createElement(CustomModal, {
154
157
  open: open,
155
158
  handleToggleModal: handleToggleModal,
156
159
  modalBackgroundStyle: modalBackgroundStyle,
157
160
  modalOptionsContainer: modalOptionsContainer,
158
161
  onRequestClose: () => {}
159
- }, isSearchable && /*#__PURE__*/React.createElement(Input, {
160
- value: searchValue,
161
- onChangeText: text => onSearch(text),
162
- style: searchInputStyle,
163
- primaryColor: primary
164
- }), isMultiple && newOptions.length > 1 && /*#__PURE__*/React.createElement(View, {
165
- style: styles.optionsContainerStyle
166
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
167
- onPress: () => {}
168
- }, /*#__PURE__*/React.createElement(CheckBox, {
169
- value: selectAll,
170
- label: selectAll ? 'Clear all' : 'Select all',
171
- onChange: () => handleSelectAll(),
172
- primaryColor: primary,
173
- checkboxSize: checkboxSize,
174
- checkboxStyle: checkboxStyle,
175
- checkboxLabelStyle: checkboxLabelStyle
176
- }))), /*#__PURE__*/React.createElement(DropdownList, {
162
+ }, /*#__PURE__*/React.createElement(DropdownList, {
163
+ ListHeaderComponent: /*#__PURE__*/React.createElement(React.Fragment, null, isSearchable && /*#__PURE__*/React.createElement(Input, {
164
+ value: searchValue,
165
+ onChangeText: text => onSearch(text),
166
+ style: searchInputStyle,
167
+ primaryColor: primary
168
+ }), isMultiple && newOptions.length > 1 && /*#__PURE__*/React.createElement(View, {
169
+ style: styles.optionsContainerStyle
170
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
171
+ onPress: () => {}
172
+ }, /*#__PURE__*/React.createElement(CheckBox, {
173
+ value: selectAll,
174
+ label: selectAll ? 'Clear all' : 'Select all',
175
+ onChange: () => handleSelectAll(),
176
+ primaryColor: primary,
177
+ checkboxSize: checkboxSize,
178
+ checkboxStyle: checkboxStyle,
179
+ checkboxLabelStyle: checkboxLabelStyle
180
+ })))),
177
181
  options: newOptions,
178
182
  optionLabel: optionLabel,
179
183
  optionValue: optionValue,
180
184
  isMultiple: isMultiple,
185
+ isSearchable: isSearchable,
181
186
  selectedItems: selectedItems,
182
187
  selectedItem: selectedItem,
183
188
  handleMultipleSelections: handleMultipleSelections,
@@ -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","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","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 (newOptions.length === selectedValues.length) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n\n if (!prevVal) {\n for (let i = 0; i < newOptions.length; i++) {\n selectedValues.push(newOptions[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 {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 <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\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,QAA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7CrB,YAAY,EAAEmD,OAAQ;IACtBjD,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACU,CACb;AAEP,CAAC;AAED,MAAMwD,MAAM,GAAG9F,UAAU,CAACkG,MAAM,CAAC;EAC/BH,qBAAqB,EAAE;IACrBI,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAe3F,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,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AAA,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"}
@@ -5,6 +5,7 @@ export const colors = {
5
5
  white: '#FFFFFF',
6
6
  dark: '#11142D',
7
7
  gray: '#808191',
8
- lightGray: '#F7F7F7'
8
+ lightGray: '#F7F7F7',
9
+ disabled: '#d3d3d3'
9
10
  };
10
11
  //# sourceMappingURL=colors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["colors","primary","red","black","white","dark","gray","lightGray"],"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};\n"],"mappings":"AAAA,OAAO,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;AACb,CAAC"}
1
+ {"version":3,"names":["colors","primary","red","black","white","dark","gray","lightGray","disabled"],"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":"AAAA,OAAO,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"}
@@ -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,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { CheckboxProps } from './types';
3
- declare const CheckBox: ({ label, value, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, onChange, }: CheckboxProps) => JSX.Element;
3
+ declare const CheckBox: ({ label, value, disabled, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, onChange, }: CheckboxProps) => JSX.Element;
4
4
  export default CheckBox;
@@ -2,6 +2,7 @@ import type { ColorValue, ViewStyle, TextStyle } from 'react-native';
2
2
  export type CheckboxProps = {
3
3
  label?: string;
4
4
  value?: boolean;
5
+ disabled?: boolean;
5
6
  primaryColor?: ColorValue;
6
7
  checkboxSize?: number;
7
8
  checkboxStyle?: ViewStyle;
@@ -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 DropdownList: ({ options, optionLabel, optionValue, isMultiple, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, }: any) => JSX.Element;
2
+ declare const DropdownList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, ...rest }: any) => JSX.Element;
3
3
  export default DropdownList;
@@ -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;
@@ -27,4 +27,5 @@ export type DropdownProps = {
27
27
  checkboxSize?: number;
28
28
  checkboxStyle?: ViewStyle;
29
29
  checkboxLabelStyle?: TextStyle;
30
+ placeholderStyle?: TextStyle;
30
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-input-select",
3
- "version": "0.24.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",
@@ -1,12 +1,14 @@
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
  import type { CheckboxProps } from './types';
6
7
 
7
8
  const CheckBox = ({
8
9
  label,
9
10
  value,
11
+ disabled,
10
12
  primaryColor,
11
13
  checkboxSize,
12
14
  checkboxStyle,
@@ -14,14 +16,19 @@ const CheckBox = ({
14
16
  onChange,
15
17
  }: CheckboxProps) => {
16
18
  const fillColor = {
17
- backgroundColor: value
19
+ backgroundColor: disabled
20
+ ? '#d3d3d3'
21
+ : value
18
22
  ? checkboxStyle?.backgroundColor || primaryColor || 'green'
19
23
  : 'white',
24
+ borderColor: disabled ? colors.disabled : styles.checkbox.borderColor,
20
25
  };
26
+
21
27
  return (
22
28
  <Pressable
23
29
  onPress={onChange ? () => onChange(!value) : () => {}}
24
30
  style={[styles.checkboxContainer]}
31
+ disabled={disabled}
25
32
  >
26
33
  <View style={[styles.checkbox, checkboxStyle, fillColor]}>
27
34
  <Image
@@ -3,6 +3,7 @@ import type { ColorValue, ViewStyle, TextStyle } from 'react-native';
3
3
  export type CheckboxProps = {
4
4
  label?: string;
5
5
  value?: boolean;
6
+ disabled?: boolean;
6
7
  primaryColor?: ColorValue;
7
8
  checkboxSize?: number;
8
9
  checkboxStyle?: ViewStyle;