react-native-input-select 1.3.3 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -53
- package/lib/commonjs/components/CheckBox/{types.js → checkbox.types.js} +1 -1
- package/lib/commonjs/components/CheckBox/checkbox.types.js.map +1 -0
- package/lib/commonjs/components/CheckBox/index.js +9 -28
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CustomModal/index.js +11 -7
- package/lib/commonjs/components/CustomModal/index.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js +7 -2
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +3 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js +7 -2
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/commonjs/components/Others/index.js.map +1 -1
- package/lib/commonjs/index.js +16 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/CheckBox/checkbox.types.js +2 -0
- package/lib/module/components/CheckBox/checkbox.types.js.map +1 -0
- package/lib/module/components/CheckBox/index.js +9 -28
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CustomModal/index.js +11 -7
- package/lib/module/components/CustomModal/index.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownFlatList.js +7 -2
- package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +3 -1
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js +7 -2
- package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/module/components/Others/index.js.map +1 -1
- package/lib/module/index.js +16 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/components/CheckBox/checkbox.types.d.ts +9 -0
- package/lib/typescript/components/CheckBox/index.d.ts +2 -19
- package/lib/typescript/components/CustomModal/index.d.ts +3 -1
- package/lib/typescript/components/Dropdown/DropdownFlatList.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownListItem.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownSectionList.d.ts +1 -1
- package/lib/typescript/components/Others/index.d.ts +3 -1
- package/lib/typescript/types/index.types.d.ts +46 -15
- package/lib/typescript/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/CheckBox/checkbox.types.ts +10 -0
- package/src/components/CheckBox/index.tsx +15 -26
- package/src/components/CustomModal/index.tsx +19 -11
- package/src/components/Dropdown/DropdownFlatList.tsx +5 -2
- package/src/components/Dropdown/DropdownListItem.tsx +2 -0
- package/src/components/Dropdown/DropdownSectionList.tsx +6 -3
- package/src/components/Others/index.tsx +5 -1
- package/src/index.tsx +14 -9
- package/src/types/index.types.ts +56 -15
- package/src/utils/index.ts +1 -1
- package/lib/commonjs/components/CheckBox/types.js.map +0 -1
- package/lib/module/components/CheckBox/types.js +0 -2
- package/lib/module/components/CheckBox/types.js.map +0 -1
- package/lib/typescript/components/CheckBox/types.d.ts +0 -18
- package/src/components/CheckBox/types.ts +0 -19
|
@@ -22,6 +22,7 @@ const DropdownSectionList = _ref => {
|
|
|
22
22
|
checkboxLabelStyle,
|
|
23
23
|
checkboxComponentStyles,
|
|
24
24
|
checkboxComponent,
|
|
25
|
+
checkboxControls,
|
|
25
26
|
listComponentStyles,
|
|
26
27
|
listIndex,
|
|
27
28
|
emptyListMessage,
|
|
@@ -60,7 +61,7 @@ const DropdownSectionList = _ref => {
|
|
|
60
61
|
const sectionlistRef = useRef(null);
|
|
61
62
|
const scrollToLocation = listIndex => {
|
|
62
63
|
var _sectionlistRef$curre;
|
|
63
|
-
(_sectionlistRef$curre = sectionlistRef.current) === null || _sectionlistRef$curre === void 0 ? void 0 : _sectionlistRef$curre.scrollToLocation({
|
|
64
|
+
sectionlistRef === null || sectionlistRef === void 0 || (_sectionlistRef$curre = sectionlistRef.current) === null || _sectionlistRef$curre === void 0 ? void 0 : _sectionlistRef$curre.scrollToLocation({
|
|
64
65
|
sectionIndex: listIndex.sectionIndex,
|
|
65
66
|
animated: true,
|
|
66
67
|
itemIndex: listIndex.itemIndex
|
|
@@ -99,7 +100,10 @@ const DropdownSectionList = _ref => {
|
|
|
99
100
|
checkboxLabelStyle,
|
|
100
101
|
// kept for backwards compatibility
|
|
101
102
|
checkboxComponentStyles,
|
|
103
|
+
// kept for backwards compatibility
|
|
102
104
|
checkboxComponent,
|
|
105
|
+
// kept for backwards compatibility
|
|
106
|
+
checkboxControls,
|
|
103
107
|
expandedSections
|
|
104
108
|
}),
|
|
105
109
|
renderSectionHeader: _ref2 => {
|
|
@@ -148,7 +152,8 @@ const _renderItem = (_ref3, props) => {
|
|
|
148
152
|
checkboxStyle: props.checkboxStyle,
|
|
149
153
|
checkboxLabelStyle: props.checkboxLabelStyle,
|
|
150
154
|
checkboxComponentStyles: props.checkboxComponentStyles,
|
|
151
|
-
checkboxComponent: props.checkboxComponent
|
|
155
|
+
checkboxComponent: props.checkboxComponent,
|
|
156
|
+
checkboxControls: props.checkboxControls
|
|
152
157
|
});
|
|
153
158
|
};
|
|
154
159
|
const styles = StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","useRef","SectionList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","SectionHeaderTitle","extractPropertyFromArray","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listComponentStyles","listIndex","emptyListMessage","rest","expandedSections","setExpandedSections","Set","initialState","handleToggleListExpansion","title","expandedSectionsState","next","has","delete","add","sectionlistRef","scrollToLocation","_sectionlistRef$curre","current","sectionIndex","animated","itemIndex","createElement","_extends","sections","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","ref","onScrollToIndexFailed","setTimeout","_ref3","props","create"],"sources":["DropdownSectionList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useState, useRef } from 'react';\nimport { SectionList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport {\n ItemSeparatorComponent,\n ListEmptyComponent,\n SectionHeaderTitle,\n} from '../Others';\nimport { extractPropertyFromArray } from '../../utils';\nimport { TSectionList } from 'src/types/index.types';\n\nconst DropdownSectionList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n listComponentStyles,\n listIndex,\n emptyListMessage,\n ...rest\n}: any) => {\n const [expandedSections, setExpandedSections] = useState(new Set());\n\n /**\n * Expand all sections\n */\n useEffect(() => {\n let initialState = new Set(extractPropertyFromArray(options, 'title'));\n setExpandedSections(initialState);\n }, [options]);\n\n /**\n * @param title\n */\n const handleToggleListExpansion = (title: string) => {\n setExpandedSections((expandedSectionsState) => {\n // Using Set here but you can use an array too\n const next = new Set(expandedSectionsState);\n if (next.has(title)) {\n next.delete(title);\n } else {\n next.add(title);\n }\n return next;\n });\n };\n\n /**\n * @description Scroll to item location\n */\n\n const sectionlistRef = useRef<SectionList<TSectionList>>(null);\n\n const scrollToLocation = (listIndex: any) => {\n sectionlistRef.current?.scrollToLocation({\n sectionIndex: listIndex.sectionIndex,\n animated: true,\n itemIndex: listIndex.itemIndex,\n });\n };\n\n useEffect(() => {\n if (listIndex.itemIndex >= 0 && listIndex.sectionIndex >= 0) {\n scrollToLocation(listIndex);\n }\n }, [listIndex]);\n\n return (\n <SectionList\n sections={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n emptyListMessage={emptyListMessage}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n checkboxComponent,\n expandedSections,\n })\n }\n renderSectionHeader={({ section: { title } }) => (\n <SectionHeaderTitle\n title={title}\n sectionHeaderStyle={listComponentStyles?.sectionHeaderStyle}\n onPress={() => handleToggleListExpansion(title)}\n isExpanded={expandedSections.has(title)}\n />\n )}\n keyExtractor={(_item, index) => `Options${index}`}\n stickySectionHeadersEnabled={false}\n ref={sectionlistRef}\n onScrollToIndexFailed={() => {\n setTimeout(() => {\n scrollToLocation(listIndex);\n }, 500);\n }}\n {...rest}\n />\n );\n};\n\nconst _renderItem = ({ section: { title }, item }: any, props: any) => {\n const isExpanded = props?.expandedSections.has(title);\n\n //return null if it is not expanded\n if (!isExpanded) return null;\n\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n checkboxComponentStyles={props.checkboxComponentStyles}\n checkboxComponent={props.checkboxComponent}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownSectionList;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SAASC,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,kBAAkB,QACb,WAAW;AAClB,SAASC,wBAAwB,QAAQ,aAAa;AAGtD,MAAMC,mBAAmB,GAAGC,IAAA,IAoBjB;EAAA,IApBkB;IAC3BC,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;IAClBC,uBAAuB;IACvBC,iBAAiB;IACjBC,mBAAmB;IACnBC,SAAS;IACTC,gBAAgB;IAChB,GAAGC;EACA,CAAC,GAAAnB,IAAA;EACJ,MAAM,CAACoB,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG/B,QAAQ,CAAC,IAAIgC,GAAG,CAAC,CAAC,CAAC;;EAEnE;AACF;AACA;EACEjC,SAAS,CAAC,MAAM;IACd,IAAIkC,YAAY,GAAG,IAAID,GAAG,CAACxB,wBAAwB,CAACG,OAAO,EAAE,OAAO,CAAC,CAAC;IACtEoB,mBAAmB,CAACE,YAAY,CAAC;EACnC,CAAC,EAAE,CAACtB,OAAO,CAAC,CAAC;;EAEb;AACF;AACA;EACE,MAAMuB,yBAAyB,GAAIC,KAA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MAAM;QACfjC,gBAAgB,CAACf,SAAS,CAAC;MAC7B,CAAC,EAAE,GAAG,CAAC;IACT;EAAE,GACEE,IAAI,CACT,CAAC;AAEN,CAAC;AAED,MAAM+B,WAAW,GAAGA,CAAAgB,KAAA,EAAoCC,KAAU,KAAK;EAAA,IAAlD;IAAEZ,OAAO,EAAE;MAAE9B;IAAM,CAAC;IAAEwB;EAAU,CAAC,GAAAiB,KAAA;EACpD,MAAMR,UAAU,GAAGS,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE/C,gBAAgB,CAACQ,GAAG,CAACH,KAAK,CAAC;;EAErD;EACA,IAAI,CAACiC,UAAU,EAAE,OAAO,IAAI;EAE5B,oBACEtE,KAAA,CAAAkD,aAAA,CAAC5C,gBAAgB;IACfuD,IAAI,EAAEA,IAAK;IACX/C,WAAW,EAAEiE,KAAK,CAACjE,WAAY;IAC/BC,WAAW,EAAEgE,KAAK,CAAChE,WAAY;IAC/BC,UAAU,EAAE+D,KAAK,CAAC/D,UAAW;IAC7B+C,cAAc,EAAEgB,KAAK,CAAChB,cAAe;IACrCC,QAAQ,EAAEe,KAAK,CAACf,QAAS;IACzB1C,YAAY,EAAEyD,KAAK,CAACzD,YAAa;IACjCC,YAAY,EAAEwD,KAAK,CAACxD,YAAa;IACjCC,aAAa,EAAEuD,KAAK,CAACvD,aAAc;IACnCC,kBAAkB,EAAEsD,KAAK,CAACtD,kBAAmB;IAC7CC,uBAAuB,EAAEqD,KAAK,CAACrD,uBAAwB;IACvDC,iBAAiB,EAAEoD,KAAK,CAACpD;EAAkB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAM+B,MAAM,GAAGrD,UAAU,CAAC2E,MAAM,CAAC;EAC/BxB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAEF,eAAe9C,mBAAmB"}
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","useRef","SectionList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","SectionHeaderTitle","extractPropertyFromArray","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","checkboxControls","listComponentStyles","listIndex","emptyListMessage","rest","expandedSections","setExpandedSections","Set","initialState","handleToggleListExpansion","title","expandedSectionsState","next","has","delete","add","sectionlistRef","scrollToLocation","_sectionlistRef$curre","current","sectionIndex","animated","itemIndex","createElement","_extends","sections","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","ref","onScrollToIndexFailed","setTimeout","_ref3","props","create"],"sources":["DropdownSectionList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useState, useRef } from 'react';\nimport { SectionList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport {\n ItemSeparatorComponent,\n ListEmptyComponent,\n SectionHeaderTitle,\n} from '../Others';\nimport { extractPropertyFromArray } from '../../utils';\nimport { TSectionList } from 'src/types/index.types';\n\nconst DropdownSectionList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n checkboxControls,\n listComponentStyles,\n listIndex,\n emptyListMessage,\n ...rest\n}: any) => {\n const [expandedSections, setExpandedSections] = useState(new Set());\n\n /**\n * Expand all sections\n */\n useEffect(() => {\n let initialState = new Set(extractPropertyFromArray(options, 'title'));\n setExpandedSections(initialState);\n }, [options]);\n\n /**\n * @param title\n */\n const handleToggleListExpansion = (title: string) => {\n setExpandedSections((expandedSectionsState) => {\n // Using Set here but you can use an array too\n const next = new Set(expandedSectionsState);\n if (next.has(title)) {\n next.delete(title);\n } else {\n next.add(title);\n }\n return next;\n });\n };\n\n /**\n * @description Scroll to item location\n */\n\n const sectionlistRef = useRef<SectionList<TSectionList>>(null);\n\n const scrollToLocation = (listIndex: any) => {\n sectionlistRef?.current?.scrollToLocation({\n sectionIndex: listIndex.sectionIndex,\n animated: true,\n itemIndex: listIndex.itemIndex,\n });\n };\n\n useEffect(() => {\n if (listIndex.itemIndex >= 0 && listIndex.sectionIndex >= 0) {\n scrollToLocation(listIndex);\n }\n }, [listIndex]);\n\n return (\n <SectionList\n sections={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n emptyListMessage={emptyListMessage}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles, // kept for backwards compatibility\n checkboxComponent, // kept for backwards compatibility\n checkboxControls,\n expandedSections,\n })\n }\n renderSectionHeader={({ section: { title } }) => (\n <SectionHeaderTitle\n title={title}\n sectionHeaderStyle={listComponentStyles?.sectionHeaderStyle}\n onPress={() => handleToggleListExpansion(title)}\n isExpanded={expandedSections.has(title)}\n />\n )}\n keyExtractor={(_item, index) => `Options${index}`}\n stickySectionHeadersEnabled={false}\n ref={sectionlistRef}\n onScrollToIndexFailed={() => {\n setTimeout(() => {\n scrollToLocation(listIndex);\n }, 500);\n }}\n {...rest}\n />\n );\n};\n\nconst _renderItem = ({ section: { title }, item }: any, props: any) => {\n const isExpanded = props?.expandedSections.has(title);\n\n //return null if it is not expanded\n if (!isExpanded) return null;\n\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n checkboxComponentStyles={props.checkboxComponentStyles}\n checkboxComponent={props.checkboxComponent}\n checkboxControls={props.checkboxControls}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownSectionList;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SAASC,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,kBAAkB,QACb,WAAW;AAClB,SAASC,wBAAwB,QAAQ,aAAa;AAGtD,MAAMC,mBAAmB,GAAGC,IAAA,IAqBjB;EAAA,IArBkB;IAC3BC,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;IAClBC,uBAAuB;IACvBC,iBAAiB;IACjBC,gBAAgB;IAChBC,mBAAmB;IACnBC,SAAS;IACTC,gBAAgB;IAChB,GAAGC;EACA,CAAC,GAAApB,IAAA;EACJ,MAAM,CAACqB,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGhC,QAAQ,CAAC,I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AuB,EAAEsD,KAAK,CAACtD,uBAAwB;IACvDC,iBAAiB,EAAEqD,KAAK,CAACrD,iBAAkB;IAC3CC,gBAAgB,EAAEoD,KAAK,CAACpD;EAAiB,CAC1C,CAAC;AAEN,CAAC;AAED,MAAM+B,MAAM,GAAGtD,UAAU,CAAC4E,MAAM,CAAC;EAC/BxB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAEF,eAAe/C,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","StyleSheet","TouchableOpacity","Image","colors","ListEmptyComponent","_ref","listEmptyComponentStyle","emptyListMessage","createElement","style","styles","ItemSeparatorComponent","_ref2","itemSeparatorStyle","ListItemContainer","_ref3","children","listItemContainerStyle","SectionHeaderTitle","_ref4","title","sectionHeaderStyle","onPress","isExpanded","accordionStyle","rotatedIcon90","source","require","create","alignItems","width","marginVertical","backgroundColor","gray","height","opacity","paddingHorizontal","paddingVertical","flexDirection","fontWeight","flexWrap","justifyContent","alignContent","transform","rotate"],"sources":["index.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport {\n View,\n Text,\n StyleSheet,\n TouchableOpacity,\n TextStyle,\n Image,\n ViewStyle,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\n\nexport const ListEmptyComponent = ({\n listEmptyComponentStyle,\n emptyListMessage,\n}: any) => {\n return (\n <View style={styles.listEmptyComponentStyle}>\n <Text style={listEmptyComponentStyle}>\n {emptyListMessage || 'No options available'}\n </Text>\n </View>\n );\n};\n\nexport const ItemSeparatorComponent = ({ itemSeparatorStyle }
|
|
1
|
+
{"version":3,"names":["React","View","Text","StyleSheet","TouchableOpacity","Image","colors","ListEmptyComponent","_ref","listEmptyComponentStyle","emptyListMessage","createElement","style","styles","ItemSeparatorComponent","_ref2","itemSeparatorStyle","ListItemContainer","_ref3","children","listItemContainerStyle","SectionHeaderTitle","_ref4","title","sectionHeaderStyle","onPress","isExpanded","accordionStyle","rotatedIcon90","source","require","create","alignItems","width","marginVertical","backgroundColor","gray","height","opacity","paddingHorizontal","paddingVertical","flexDirection","fontWeight","flexWrap","justifyContent","alignContent","transform","rotate"],"sources":["index.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport {\n View,\n Text,\n StyleSheet,\n TouchableOpacity,\n TextStyle,\n Image,\n ViewStyle,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\n\nexport const ListEmptyComponent = ({\n listEmptyComponentStyle,\n emptyListMessage,\n}: any) => {\n return (\n <View style={styles.listEmptyComponentStyle}>\n <Text style={listEmptyComponentStyle}>\n {emptyListMessage || 'No options available'}\n </Text>\n </View>\n );\n};\n\nexport const ItemSeparatorComponent = ({\n itemSeparatorStyle,\n}: {\n itemSeparatorStyle: ViewStyle;\n}) => {\n return <View style={[styles.itemSeparatorStyle, itemSeparatorStyle]} />;\n};\n\nexport const ListItemContainer = ({\n children,\n listItemContainerStyle,\n}: {\n children: ReactNode;\n listItemContainerStyle: ViewStyle;\n}) => {\n return (\n <View style={[styles.listItemContainerStyle, listItemContainerStyle]}>\n {children}\n </View>\n );\n};\n\nexport const SectionHeaderTitle = ({\n title,\n sectionHeaderStyle,\n onPress,\n isExpanded,\n}: {\n title: string;\n sectionHeaderStyle?: TextStyle;\n onPress?: () => void;\n isExpanded: Boolean;\n}) => {\n return (\n <TouchableOpacity onPress={onPress}>\n <ListItemContainer listItemContainerStyle={styles.accordionStyle}>\n <Text style={[styles.sectionHeaderStyle, sectionHeaderStyle]}>\n {title}\n </Text>\n <View style={isExpanded ? null : styles.rotatedIcon90}>\n <Image source={require('../../asset/arrow-down.png')} />\n </View>\n </ListItemContainer>\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listEmptyComponentStyle: {\n alignItems: 'center',\n width: '100%',\n marginVertical: 20,\n },\n itemSeparatorStyle: {\n backgroundColor: colors.gray,\n height: 1,\n opacity: 0.15,\n },\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n sectionHeaderStyle: { fontWeight: '500' },\n accordionStyle: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n justifyContent: 'space-between',\n alignContent: 'center',\n },\n rotatedIcon90: {\n transform: [{ rotate: '-90deg' }],\n },\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAqB,OAAO;AACxC,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAEhBC,KAAK,QAEA,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,OAAO,MAAMC,kBAAkB,GAAGC,IAAA,IAGvB;EAAA,IAHwB;IACjCC,uBAAuB;IACvBC;EACG,CAAC,GAAAF,IAAA;EACJ,oBACER,KAAA,CAAAW,aAAA,CAACV,IAAI;IAACW,KAAK,EAAEC,MAAM,CAACJ;EAAwB,gBAC1CT,KAAA,CAAAW,aAAA,CAACT,IAAI;IAACU,KAAK,EAAEH;EAAwB,GAClCC,gBAAgB,IAAI,sBACjB,CACF,CAAC;AAEX,CAAC;AAED,OAAO,MAAMI,sBAAsB,GAAGC,KAAA,IAIhC;EAAA,IAJiC;IACrCC;EAGF,CAAC,GAAAD,KAAA;EACC,oBAAOf,KAAA,CAAAW,aAAA,CAACV,IAAI;IAACW,KAAK,EAAE,CAACC,MAAM,CAACG,kBAAkB,EAAEA,kBAAkB;EAAE,CAAE,CAAC;AACzE,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAGC,KAAA,IAM3B;EAAA,IAN4B;IAChCC,QAAQ;IACRC;EAIF,CAAC,GAAAF,KAAA;EACC,oBACElB,KAAA,CAAAW,aAAA,CAACV,IAAI;IAACW,KAAK,EAAE,CAACC,MAAM,CAACO,sBAAsB,EAAEA,sBAAsB;EAAE,GAClED,QACG,CAAC;AAEX,CAAC;AAED,OAAO,MAAME,kBAAkB,GAAGC,KAAA,IAU5B;EAAA,IAV6B;IACjCC,KAAK;IACLC,kBAAk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EAClC;AACF,CAAC,CAAC"}
|
package/lib/module/index.js
CHANGED
|
@@ -36,7 +36,9 @@ export const DropdownSelect = _ref => {
|
|
|
36
36
|
selectedItemStyle,
|
|
37
37
|
multipleSelectedItemStyle,
|
|
38
38
|
modalBackgroundStyle,
|
|
39
|
+
// kept for backwards compatibility
|
|
39
40
|
modalOptionsContainerStyle,
|
|
41
|
+
// kept for backwards compatibility
|
|
40
42
|
searchInputStyle,
|
|
41
43
|
// kept for backwards compatibility
|
|
42
44
|
primaryColor,
|
|
@@ -48,14 +50,19 @@ export const DropdownSelect = _ref => {
|
|
|
48
50
|
checkboxLabelStyle,
|
|
49
51
|
// kept for backwards compatibility
|
|
50
52
|
checkboxComponentStyles,
|
|
53
|
+
// kept for backwards compatibility
|
|
51
54
|
checkboxComponent,
|
|
55
|
+
// kept for backwards compatibility
|
|
52
56
|
listHeaderComponent,
|
|
53
57
|
listFooterComponent,
|
|
54
58
|
listComponentStyles,
|
|
55
59
|
modalProps,
|
|
60
|
+
// kept for backwards compatibility
|
|
56
61
|
hideModal = false,
|
|
57
62
|
listControls,
|
|
58
63
|
searchControls,
|
|
64
|
+
modalControls,
|
|
65
|
+
checkboxControls,
|
|
59
66
|
...rest
|
|
60
67
|
} = _ref;
|
|
61
68
|
const [newOptions, setNewOptions] = useState([]);
|
|
@@ -295,11 +302,14 @@ export const DropdownSelect = _ref => {
|
|
|
295
302
|
placeholderStyle: placeholderStyle,
|
|
296
303
|
setIndexOfSelectedItem: setIndexOfSelectedItem
|
|
297
304
|
}, rest)), /*#__PURE__*/React.createElement(CustomModal, {
|
|
298
|
-
|
|
299
|
-
modalBackgroundStyle: modalBackgroundStyle
|
|
300
|
-
|
|
305
|
+
visible: open,
|
|
306
|
+
modalBackgroundStyle: modalBackgroundStyle // kept for backwards compatibility
|
|
307
|
+
,
|
|
308
|
+
modalOptionsContainerStyle: modalOptionsContainerStyle // kept for backwards compatibility
|
|
309
|
+
,
|
|
301
310
|
onRequestClose: () => handleToggleModal(),
|
|
302
|
-
|
|
311
|
+
modalControls: modalControls,
|
|
312
|
+
modalProps: modalProps // kept for backwards compatibility
|
|
303
313
|
}, /*#__PURE__*/React.createElement(ListTypeComponent, {
|
|
304
314
|
ListHeaderComponent: /*#__PURE__*/React.createElement(React.Fragment, null, isSearchable && /*#__PURE__*/React.createElement(Input, _extends({
|
|
305
315
|
value: searchValue,
|
|
@@ -317,6 +327,7 @@ export const DropdownSelect = _ref => {
|
|
|
317
327
|
label: selectAll ? (listControls === null || listControls === void 0 ? void 0 : listControls.unselectAllText) || 'Clear all' : (listControls === null || listControls === void 0 ? void 0 : listControls.selectAllText) || 'Select all',
|
|
318
328
|
onChange: () => handleSelectAll(),
|
|
319
329
|
primaryColor: primary,
|
|
330
|
+
checkboxControls: checkboxControls,
|
|
320
331
|
checkboxSize: checkboxSize,
|
|
321
332
|
checkboxStyle: checkboxStyle,
|
|
322
333
|
checkboxLabelStyle: checkboxLabelStyle,
|
|
@@ -340,6 +351,7 @@ export const DropdownSelect = _ref => {
|
|
|
340
351
|
checkboxLabelStyle: checkboxLabelStyle,
|
|
341
352
|
checkboxComponentStyles: checkboxComponentStyles,
|
|
342
353
|
checkboxComponent: checkboxComponent,
|
|
354
|
+
checkboxControls: checkboxControls,
|
|
343
355
|
listIndex: listIndex,
|
|
344
356
|
emptyListMessage: listControls === null || listControls === void 0 ? void 0 : listControls.emptyListMessage
|
|
345
357
|
})));
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useEffect","useCallback","TouchableOpacity","StyleSheet","View","Input","CheckBox","Dropdown","DropdownFlatList","DropdownSectionList","CustomModal","colors","DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","escapeRegExp","extractPropertyFromArray","DropdownSelect","_ref","_extractPropertyFromA","_searchControls$textI","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","dropdownIcon","labelStyle","placeholderStyle","dropdownStyle","dropdownIconStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainerStyle","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listHeaderComponent","listFooterComponent","listComponentStyles","modalProps","hideModal","listControls","searchControls","rest","newOptions","setNewOptions","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","searchValue","setSearchValue","listIndex","setListIndex","itemIndex","sectionIndex","Array","isArray","isSectionList","some","item","title","data","ListTypeComponent","modifiedSectionData","flat","modifiedOptions","optLabel","optValue","handleSingleSelection","value","handleMultipleSelections","prevVal","_selectedValues","selectedValues","includes","filter","push","removeDisabledItems","items","handleSelectAll","filteredOptions","i","length","selectAllCallback","unselectAllCallback","checkSelectAll","_removeDisabledItems","getSelectedItemsLabel","selectedLabels","forEach","element","_modifiedOptions$find","selectedItemLabel","find","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","searchSectionList","searchFlatList","flatList","toLowerCase","search","sectionList","map","listItem","filteredData","handleToggleModal","primary","gray","setIndexOfSelectedItem","selectedLabel","_item$data","dataItem","createElement","Fragment","_extends","onRequestClose","ListHeaderComponent","onChangeText","text","style","textInputStyle","textInputContainerStyle","textInputProps","hideSelectAll","styles","optionsContainerStyle","onPress","unselectAllText","selectAllText","onChange","ListFooterComponent","emptyListMessage","create","paddingHorizontal","paddingVertical","flexDirection"],"sources":["index.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Input from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownFlatList from './components/Dropdown/DropdownFlatList';\nimport DropdownSectionList from './components/Dropdown/DropdownSectionList';\nimport CustomModal from './components/CustomModal';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type {\n DropdownProps,\n TFlatList,\n TFlatListItem,\n TSectionList,\n TSectionListItem,\n} from './types/index.types';\nimport { escapeRegExp, extractPropertyFromArray } from './utils';\n\nexport const DropdownSelect: React.FC<DropdownProps> = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n dropdownIcon,\n labelStyle,\n placeholderStyle,\n dropdownStyle,\n dropdownIconStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainerStyle,\n searchInputStyle, // kept for backwards compatibility\n primaryColor,\n disabled,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n checkboxComponent,\n listHeaderComponent,\n listFooterComponent,\n listComponentStyles,\n modalProps,\n hideModal = false,\n listControls,\n searchControls,\n ...rest\n}) => {\n const [newOptions, setNewOptions] = useState<TFlatList | TSectionList>([]);\n const [open, setOpen] = useState<boolean>(false);\n const [selectAll, setSelectAll] = useState<boolean>(false);\n const [selectedItem, setSelectedItem] = useState<any>(''); // for single selection\n const [selectedItems, setSelectedItems] = useState<any[]>([]); // for multiple selection\n const [searchValue, setSearchValue] = useState<string>('');\n const [listIndex, setListIndex] = useState<{\n sectionIndex?: number;\n itemIndex: number;\n }>({ itemIndex: -1, sectionIndex: -1 }); // for scrollToIndex in Sectionlist and Flatlist\n\n useEffect(() => {\n setNewOptions(options);\n return () => {};\n }, [options]);\n\n useEffect(() => {\n isMultiple\n ? setSelectedItems(Array.isArray(selectedValue) ? selectedValue : [])\n : setSelectedItem(selectedValue);\n\n return () => {};\n }, [selectedValue, isMultiple, onValueChange]);\n\n /*===========================================\n * List type\n *==========================================*/\n\n // check the structure of the new options array to determine if it is a section list or a\n const isSectionList = newOptions?.some(\n (item) => item.title && item.data && Array.isArray(item.data)\n );\n\n const ListTypeComponent = isSectionList\n ? DropdownSectionList\n : DropdownFlatList;\n const modifiedSectionData = extractPropertyFromArray(\n newOptions,\n 'data'\n )?.flat();\n\n /**\n * `options` is the original array, it never changes. (Do not use except you really need the original array) .\n * `newOptions` is a copy of options but can be mutated by `setNewOptions`, as a result, the value many change.\n * `modifiedOptions` should only be used for computations. It has the same structure for both `FlatList` and `SectionList`\n */\n const modifiedOptions = isSectionList ? modifiedSectionData : newOptions;\n\n const optLabel = optionLabel || DEFAULT_OPTION_LABEL;\n const optValue = optionValue || DEFAULT_OPTION_VALUE;\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: string | number) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n onValueChange(null); // send value to parent\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: string[] | number[]) => {\n setSelectedItems((prevVal) => {\n let selectedValues = [...prevVal];\n\n if (selectedValues?.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n onValueChange(selectedValues); // send value to parent\n return selectedValues;\n });\n };\n\n const removeDisabledItems = (items: TFlatList) => {\n return items?.filter((item: TFlatListItem) => !item.disabled);\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n\n // don't select disabled items\n const filteredOptions = removeDisabledItems(\n isSectionList\n ? extractPropertyFromArray(options, 'data').flat()\n : options\n );\n\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); // send value to parent\n return !prevVal;\n });\n\n if (typeof listControls?.selectAllCallback === 'function' && !selectAll) {\n listControls.selectAllCallback();\n }\n\n if (typeof listControls?.unselectAllCallback === 'function' && selectAll) {\n listControls.unselectAllCallback();\n }\n };\n\n /*===========================================\n * Handle side effects\n *==========================================*/\n const checkSelectAll = useCallback(\n (selectedValues: any[]) => {\n //if the list contains disabled values, those values will not be selected\n if (\n removeDisabledItems(modifiedOptions)?.length === selectedValues?.length\n ) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n },\n [modifiedOptions]\n );\n\n // anytime the selected items change, check if it is time to set `selectAll` to true\n useEffect(() => {\n if (isMultiple) {\n checkSelectAll(selectedItems);\n }\n return () => {};\n }, [checkSelectAll, isMultiple, selectedItems]);\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple && Array.isArray(selectedItems)) {\n let selectedLabels: Array<string> = [];\n\n selectedItems?.forEach((element: number | string) => {\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === element\n )?.[optLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === selectedItem\n );\n return selectedItemLabel?.[optLabel];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = escapeRegExp(value).toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n // Because the options array will be mutated while searching, we have to search with the original array\n const searchResults = isSectionList\n ? searchSectionList(options as TSectionList, regexFilter)\n : searchFlatList(options as TFlatList, regexFilter);\n\n setNewOptions(searchResults);\n };\n\n const searchFlatList = (flatList: TFlatList, regexFilter: RegExp) => {\n const searchResults = flatList.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return true;\n }\n return false;\n });\n return searchResults;\n };\n\n const searchSectionList = (\n sectionList: TSectionList,\n regexFilter: RegExp\n ) => {\n const searchResults = sectionList.map((listItem: TSectionListItem) => {\n const filteredData = listItem.data.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return true;\n }\n return false;\n });\n\n return { ...listItem, data: filteredData };\n });\n\n return searchResults;\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n if (disabled) {\n // protecting any toggleModal invocation when Dropdown is disabled by not activating state\n return;\n }\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n setListIndex({ itemIndex: -1, sectionIndex: -1 });\n };\n\n useEffect(() => {\n if (hideModal) {\n setOpen(false);\n }\n return () => {};\n }, [hideModal]);\n\n let primary = primaryColor || colors.gray;\n\n /*===========================================\n * setIndexOfSelectedItem - For ScrollToIndex\n *==========================================*/\n const setIndexOfSelectedItem = (selectedLabel: string) => {\n isSectionList\n ? (options as TSectionListItem[] | undefined)?.map(\n (item: TSectionListItem, sectionIndex: number) => {\n item?.data?.find((dataItem: TFlatListItem, itemIndex: number) => {\n if (dataItem[optLabel] === selectedLabel) {\n setListIndex({ sectionIndex, itemIndex });\n }\n });\n }\n )\n : (options as TFlatListItem[] | undefined)?.find(\n (item: TFlatListItem, itemIndex: number) => {\n if (item[optLabel] === selectedLabel) {\n setListIndex({ itemIndex });\n }\n }\n );\n };\n\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 dropdownIcon={dropdownIcon}\n dropdownStyle={dropdownStyle}\n dropdownIconStyle={dropdownIconStyle}\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 setIndexOfSelectedItem={setIndexOfSelectedItem}\n {...rest}\n />\n <CustomModal\n open={open}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainerStyle={modalOptionsContainerStyle}\n onRequestClose={() => handleToggleModal()}\n modalProps={modalProps}\n >\n <ListTypeComponent\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchControls?.textInputStyle || searchInputStyle}\n primaryColor={primary}\n textInputContainerStyle={\n searchControls?.textInputContainerStyle\n }\n placeholder={\n searchControls?.textInputProps?.placeholder || 'Search'\n }\n {...searchControls?.textInputProps}\n />\n )}\n {listHeaderComponent}\n {!listControls?.hideSelectAll &&\n isMultiple &&\n modifiedOptions?.length > 1 && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={\n selectAll\n ? listControls?.unselectAllText || 'Clear all'\n : listControls?.selectAllText || 'Select all'\n }\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n checkboxComponentStyles={checkboxComponentStyles}\n checkboxComponent={checkboxComponent}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n ListFooterComponent={listFooterComponent}\n listComponentStyles={listComponentStyles}\n options={newOptions}\n optionLabel={optLabel}\n optionValue={optValue}\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 checkboxComponentStyles={checkboxComponentStyles}\n checkboxComponent={checkboxComponent}\n listIndex={listIndex}\n emptyListMessage={listControls?.emptyListMessage}\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,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,QAAQ,MAAM,gCAAgC;AACrD,OAAOC,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,mBAAmB,MAAM,2CAA2C;AAC3E,OAAOC,WAAW,MAAM,0BAA0B;AAClD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,aAAa;AAQxE,SAASC,YAAY,EAAEC,wBAAwB,QAAQ,SAAS;AAEhE,OAAO,MAAMC,cAAuC,GAAGC,IAAA,IAyCjD;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAzCkD;IACtDC,WAAW;IACXC,KAAK;IACLC,KAAK;IACLC,UAAU;IACVC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,aAAa;IACbC,aAAa;IACbC,UAAU;IACVC,YAAY;IACZC,YAAY;IACZC,UAAU;IACVC,gBAAgB;IAChBC,aAAa;IACbC,iBAAiB;IACjBC,sBAAsB;IACtBC,kBAAkB;IAClBC,sBAAsB;IACtBC,uBAAuB;IACvBC,iBAAiB;IACjBC,yBAAyB;IACzBC,oBAAoB;IACpBC,0BAA0B;IAC1BC,gBAAgB;IAAE;IAClBC,YAAY;IACZC,QAAQ;IACRC,YAAY;IAAE;IACdC,aAAa;IAAE;IACfC,kBAAkB;IAAE;IACpBC,uBA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,EAAEA,kBAAmB;IACvCC,uBAAuB,EAAEA,uBAAwB;IACjDC,iBAAiB,EAAEA,iBAAkB;IACrCqB,SAAS,EAAEA,SAAU;IACrBsF,gBAAgB,EAAErG,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEqG;EAAiB,CAClD,CACU,CACb,CAAC;AAEP,CAAC;AAED,MAAMP,MAAM,GAAGpJ,UAAU,CAAC4J,MAAM,CAAC;EAC/BP,qBAAqB,EAAE;IACrBQ,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAelJ,cAAc"}
|
|
1
|
+
{"version":3,"names":["React","useState","useEffect","useCallback","TouchableOpacity","StyleSheet","View","Input","CheckBox","Dropdown","DropdownFlatList","DropdownSectionList","CustomModal","colors","DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","escapeRegExp","extractPropertyFromArray","DropdownSelect","_ref","_extractPropertyFromA","_searchControls$textI","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","dropdownIcon","labelStyle","placeholderStyle","dropdownStyle","dropdownIconStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainerStyle","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listHeaderComponent","listFooterComponent","listComponentStyles","modalProps","hideModal","listControls","searchControls","modalControls","checkboxControls","rest","newOptions","setNewOptions","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","searchValue","setSearchValue","listIndex","setListIndex","itemIndex","sectionIndex","Array","isArray","isSectionList","some","item","title","data","ListTypeComponent","modifiedSectionData","flat","modifiedOptions","optLabel","optValue","handleSingleSelection","value","handleMultipleSelections","prevVal","_selectedValues","selectedValues","includes","filter","push","removeDisabledItems","items","handleSelectAll","filteredOptions","i","length","selectAllCallback","unselectAllCallback","checkSelectAll","_removeDisabledItems","getSelectedItemsLabel","selectedLabels","forEach","element","_modifiedOptions$find","selectedItemLabel","find","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","searchSectionList","searchFlatList","flatList","toLowerCase","search","sectionList","map","listItem","filteredData","handleToggleModal","primary","gray","setIndexOfSelectedItem","selectedLabel","_item$data","dataItem","createElement","Fragment","_extends","visible","onRequestClose","ListHeaderComponent","onChangeText","text","style","textInputStyle","textInputContainerStyle","textInputProps","hideSelectAll","styles","optionsContainerStyle","onPress","unselectAllText","selectAllText","onChange","ListFooterComponent","emptyListMessage","create","paddingHorizontal","paddingVertical","flexDirection"],"sources":["index.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Input from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownFlatList from './components/Dropdown/DropdownFlatList';\nimport DropdownSectionList from './components/Dropdown/DropdownSectionList';\nimport CustomModal from './components/CustomModal';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type {\n DropdownProps,\n TFlatList,\n TFlatListItem,\n TSectionList,\n TSectionListItem,\n} from './types/index.types';\nimport { escapeRegExp, extractPropertyFromArray } from './utils';\n\nexport const DropdownSelect: React.FC<DropdownProps> = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n dropdownIcon,\n labelStyle,\n placeholderStyle,\n dropdownStyle,\n dropdownIconStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle, // kept for backwards compatibility\n modalOptionsContainerStyle, // kept for backwards compatibility\n searchInputStyle, // kept for backwards compatibility\n primaryColor,\n disabled,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles, // kept for backwards compatibility\n checkboxComponent, // kept for backwards compatibility\n listHeaderComponent,\n listFooterComponent,\n listComponentStyles,\n modalProps, // kept for backwards compatibility\n hideModal = false,\n listControls,\n searchControls,\n modalControls,\n checkboxControls,\n ...rest\n}) => {\n const [newOptions, setNewOptions] = useState<TFlatList | TSectionList>([]);\n const [open, setOpen] = useState<boolean>(false);\n const [selectAll, setSelectAll] = useState<boolean>(false);\n const [selectedItem, setSelectedItem] = useState<any>(''); // for single selection\n const [selectedItems, setSelectedItems] = useState<any[]>([]); // for multiple selection\n const [searchValue, setSearchValue] = useState<string>('');\n const [listIndex, setListIndex] = useState<{\n sectionIndex?: number;\n itemIndex: number;\n }>({ itemIndex: -1, sectionIndex: -1 }); // for scrollToIndex in Sectionlist and Flatlist\n\n useEffect(() => {\n setNewOptions(options);\n return () => {};\n }, [options]);\n\n useEffect(() => {\n isMultiple\n ? setSelectedItems(Array.isArray(selectedValue) ? selectedValue : [])\n : setSelectedItem(selectedValue);\n\n return () => {};\n }, [selectedValue, isMultiple, onValueChange]);\n\n /*===========================================\n * List type\n *==========================================*/\n\n // check the structure of the new options array to determine if it is a section list or a\n const isSectionList = newOptions?.some(\n (item) => item.title && item.data && Array.isArray(item.data)\n );\n\n const ListTypeComponent = isSectionList\n ? DropdownSectionList\n : DropdownFlatList;\n const modifiedSectionData = extractPropertyFromArray(\n newOptions,\n 'data'\n )?.flat();\n\n /**\n * `options` is the original array, it never changes. (Do not use except you really need the original array) .\n * `newOptions` is a copy of options but can be mutated by `setNewOptions`, as a result, the value many change.\n * `modifiedOptions` should only be used for computations. It has the same structure for both `FlatList` and `SectionList`\n */\n const modifiedOptions = isSectionList ? modifiedSectionData : newOptions;\n\n const optLabel = optionLabel || DEFAULT_OPTION_LABEL;\n const optValue = optionValue || DEFAULT_OPTION_VALUE;\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: string | number) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n onValueChange(null); // send value to parent\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: string[] | number[]) => {\n setSelectedItems((prevVal) => {\n let selectedValues = [...prevVal];\n\n if (selectedValues?.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n onValueChange(selectedValues); // send value to parent\n return selectedValues;\n });\n };\n\n const removeDisabledItems = (items: TFlatList) => {\n return items?.filter((item: TFlatListItem) => !item.disabled);\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n\n // don't select disabled items\n const filteredOptions = removeDisabledItems(\n isSectionList\n ? extractPropertyFromArray(options, 'data').flat()\n : options\n );\n\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); // send value to parent\n return !prevVal;\n });\n\n if (typeof listControls?.selectAllCallback === 'function' && !selectAll) {\n listControls.selectAllCallback();\n }\n\n if (typeof listControls?.unselectAllCallback === 'function' && selectAll) {\n listControls.unselectAllCallback();\n }\n };\n\n /*===========================================\n * Handle side effects\n *==========================================*/\n const checkSelectAll = useCallback(\n (selectedValues: any[]) => {\n //if the list contains disabled values, those values will not be selected\n if (\n removeDisabledItems(modifiedOptions)?.length === selectedValues?.length\n ) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n },\n [modifiedOptions]\n );\n\n // anytime the selected items change, check if it is time to set `selectAll` to true\n useEffect(() => {\n if (isMultiple) {\n checkSelectAll(selectedItems);\n }\n return () => {};\n }, [checkSelectAll, isMultiple, selectedItems]);\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple && Array.isArray(selectedItems)) {\n let selectedLabels: Array<string> = [];\n\n selectedItems?.forEach((element: number | string) => {\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === element\n )?.[optLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === selectedItem\n );\n return selectedItemLabel?.[optLabel];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = escapeRegExp(value).toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n // Because the options array will be mutated while searching, we have to search with the original array\n const searchResults = isSectionList\n ? searchSectionList(options as TSectionList, regexFilter)\n : searchFlatList(options as TFlatList, regexFilter);\n\n setNewOptions(searchResults);\n };\n\n const searchFlatList = (flatList: TFlatList, regexFilter: RegExp) => {\n const searchResults = flatList.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return true;\n }\n return false;\n });\n return searchResults;\n };\n\n const searchSectionList = (\n sectionList: TSectionList,\n regexFilter: RegExp\n ) => {\n const searchResults = sectionList.map((listItem: TSectionListItem) => {\n const filteredData = listItem.data.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return true;\n }\n return false;\n });\n\n return { ...listItem, data: filteredData };\n });\n\n return searchResults;\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n if (disabled) {\n // protecting any toggleModal invocation when Dropdown is disabled by not activating state\n return;\n }\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n setListIndex({ itemIndex: -1, sectionIndex: -1 });\n };\n\n useEffect(() => {\n if (hideModal) {\n setOpen(false);\n }\n return () => {};\n }, [hideModal]);\n\n let primary = primaryColor || colors.gray;\n\n /*===========================================\n * setIndexOfSelectedItem - For ScrollToIndex\n *==========================================*/\n const setIndexOfSelectedItem = (selectedLabel: string) => {\n isSectionList\n ? (options as TSectionListItem[] | undefined)?.map(\n (item: TSectionListItem, sectionIndex: number) => {\n item?.data?.find((dataItem: TFlatListItem, itemIndex: number) => {\n if (dataItem[optLabel] === selectedLabel) {\n setListIndex({ sectionIndex, itemIndex });\n }\n });\n }\n )\n : (options as TFlatListItem[] | undefined)?.find(\n (item: TFlatListItem, itemIndex: number) => {\n if (item[optLabel] === selectedLabel) {\n setListIndex({ itemIndex });\n }\n }\n );\n };\n\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 dropdownIcon={dropdownIcon}\n dropdownStyle={dropdownStyle}\n dropdownIconStyle={dropdownIconStyle}\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 setIndexOfSelectedItem={setIndexOfSelectedItem}\n {...rest}\n />\n <CustomModal\n visible={open}\n modalBackgroundStyle={modalBackgroundStyle} // kept for backwards compatibility\n modalOptionsContainerStyle={modalOptionsContainerStyle} // kept for backwards compatibility\n onRequestClose={() => handleToggleModal()}\n modalControls={modalControls}\n modalProps={modalProps} // kept for backwards compatibility\n >\n <ListTypeComponent\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchControls?.textInputStyle || searchInputStyle}\n primaryColor={primary}\n textInputContainerStyle={\n searchControls?.textInputContainerStyle\n }\n placeholder={\n searchControls?.textInputProps?.placeholder || 'Search'\n }\n {...searchControls?.textInputProps}\n />\n )}\n {listHeaderComponent}\n {!listControls?.hideSelectAll &&\n isMultiple &&\n modifiedOptions?.length > 1 && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={\n selectAll\n ? listControls?.unselectAllText || 'Clear all'\n : listControls?.selectAllText || 'Select all'\n }\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxControls={checkboxControls}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n checkboxComponentStyles={checkboxComponentStyles}\n checkboxComponent={checkboxComponent}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n ListFooterComponent={listFooterComponent}\n listComponentStyles={listComponentStyles}\n options={newOptions}\n optionLabel={optLabel}\n optionValue={optValue}\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 checkboxComponentStyles={checkboxComponentStyles}\n checkboxComponent={checkboxComponent}\n checkboxControls={checkboxControls}\n listIndex={listIndex}\n emptyListMessage={listControls?.emptyListMessage}\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,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,SAASC,gBAAgB,EAAEC,UA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aAAZA,YAAY,uBAAZA,YAAY,CAAEwG;EAAiB,CAClD,CACU,CACb,CAAC;AAEP,CAAC;AAED,MAAMP,MAAM,GAAGvJ,UAAU,CAAC+J,MAAM,CAAC;EAC/BP,qBAAqB,EAAE;IACrBQ,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAerJ,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type {\n ViewStyle,\n ColorValue,\n TextStyle,\n ModalProps,\n TextInputProps,\n} from 'react-native';\n\nexport type DropdownProps =
|
|
1
|
+
{"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type {\n ViewStyle,\n ColorValue,\n TextStyle,\n ModalProps,\n TextInputProps,\n} from 'react-native';\n\nexport type DropdownProps = CommonDropdownProps &\n TDropdownInputProps &\n TSearchControls &\n TCheckboxControls &\n TCustomModalControls &\n TListControls;\n\nexport type CommonDropdownProps = {\n label?: string;\n options: TFlatList | TSectionList;\n optionLabel?: string;\n optionValue?: string;\n onValueChange: Function;\n selectedValue?:\n | string\n | boolean\n | number\n | string[]\n | boolean[]\n | number[]\n | null;\n};\n\nexport type TDropdownInputProps = {\n placeholder?: string;\n error?: string;\n helperText?: string;\n isMultiple?: boolean;\n isSearchable?: boolean;\n dropdownIcon?: React.ReactNode;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownIconStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: TextStyle;\n multipleSelectedItemStyle?: TextStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n placeholderStyle?: TextStyle;\n hideModal?: boolean;\n};\n\nexport type TSearchControls = {\n /** @deprecated Use `searchControls = {{textInputStyle: ViewStyle | TextStyle }}` instead.*/\n searchInputStyle?: ViewStyle;\n searchControls?: {\n textInputStyle?: ViewStyle | TextStyle;\n textInputContainerStyle?: ViewStyle;\n textInputProps?: TextInputProps;\n };\n};\nexport type TCheckboxControls = {\n /** @deprecated Use `checkboxControls = {{checkboxSize: number }}` instead.*/\n checkboxSize?: number;\n /** @deprecated Use `checkboxControls = {{checkboxStyle: ViewStyle }}` instead.*/\n checkboxStyle?: ViewStyle;\n /** @deprecated Use `checkboxControls = {{checkboxLabelStyle: TextStyle }}` instead.*/\n checkboxLabelStyle?: TextStyle;\n /** @deprecated Use `checkboxControls` instead.*/\n checkboxComponentStyles?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n };\n /** @deprecated Use `checkboxControls = {{checkboxComponent: <View></View> }}` instead.*/\n checkboxComponent?: React.ReactNode;\n checkboxControls?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n checkboxComponent?: React.ReactNode;\n };\n};\n\nexport type TCustomModalControls = {\n /** @deprecated Use `modalControls = {{modalBackgroundStyle: ViewStyle}} instead.*/\n modalBackgroundStyle?: ViewStyle;\n /** @deprecated Use `modalControls = {{ modalOptionsContainerStyle: ViewStyle}} instead.*/\n modalOptionsContainerStyle?: ViewStyle;\n /** @deprecated Use `modalControls = {{modalProps: ModalProps }}` instead.*/\n modalProps?: ModalProps;\n modalControls?: {\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainerStyle?: ViewStyle;\n modalProps?: ModalProps;\n };\n};\n\nexport type TListControls = {\n listHeaderComponent?: React.ReactNode;\n listFooterComponent?: React.ReactNode;\n listComponentStyles?: {\n listEmptyComponentStyle?: TextStyle;\n itemSeparatorStyle?: ViewStyle;\n sectionHeaderStyle?: TextStyle;\n };\n listControls?: {\n selectAllText?: string;\n unselectAllText?: string;\n selectAllCallback?: () => void;\n unselectAllCallback?: () => void;\n hideSelectAll?: boolean;\n emptyListMessage?: string;\n };\n};\n\nexport type TFlatList = TFlatListItem[];\nexport type TFlatListItem = {\n [key: string]: string | number | boolean;\n};\n\nexport type TSectionList = TSectionListItem[];\nexport type TSectionListItem = { title: string; data: TFlatList };\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["extractPropertyFromArray","arr","property","extractedValue","map","item","escapeRegExp","text","replace"],"sources":["index.ts"],"sourcesContent":["/**\n * Extract property from array\n */\n\nexport const extractPropertyFromArray = (arr: any, property: string) => {\n let extractedValue = arr?.map((item: any) => item[property]);\n\n return extractedValue;\n};\n\nexport const escapeRegExp = (text: string) => {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAO,MAAMA,wBAAwB,GAAGA,CAACC,
|
|
1
|
+
{"version":3,"names":["extractPropertyFromArray","arr","property","extractedValue","map","item","escapeRegExp","text","replace"],"sources":["index.ts"],"sourcesContent":["/**\n * Extract property from array\n */\n\nexport const extractPropertyFromArray = (arr: any[], property: string) => {\n let extractedValue = arr?.map((item: any) => item[property]);\n\n return extractedValue;\n};\n\nexport const escapeRegExp = (text: string) => {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAO,MAAMA,wBAAwB,GAAGA,CAACC,GAAU,EAAEC,QAAgB,KAAK;EACxE,IAAIC,cAAc,GAAGF,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEG,GAAG,CAAEC,IAAS,IAAKA,IAAI,CAACH,QAAQ,CAAC,CAAC;EAE5D,OAAOC,cAAc;AACvB,CAAC;AAED,OAAO,MAAMG,YAAY,GAAIC,IAAY,IAAK;EAC5C,OAAOA,IAAI,CAACC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import { TCheckboxControls } from 'src/types/index.types';
|
|
3
|
+
export type CheckboxProps = {
|
|
4
|
+
label?: string;
|
|
5
|
+
value?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
primaryColor?: ColorValue;
|
|
8
|
+
onChange?: (value: boolean | string | number) => void;
|
|
9
|
+
} & TCheckboxControls;
|
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { CheckboxProps } from './types';
|
|
3
|
-
|
|
4
|
-
* Individual props `checkboxSize`, `checkboxStyle`, `checkboxLabelStyle` would be replaced in future releases
|
|
5
|
-
* and replaced with a single object `checkboxComponentStyles` e.g
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
const checkboxComponentStyles = {
|
|
9
|
-
checkboxSize: 20,
|
|
10
|
-
checkboxStyle: {
|
|
11
|
-
backgroundColor: 'purple',
|
|
12
|
-
borderRadius: 30,
|
|
13
|
-
padding: 10,
|
|
14
|
-
borderColor: 'red',
|
|
15
|
-
},
|
|
16
|
-
checkboxLabelStyle: { color: 'red', fontSize: 20 },
|
|
17
|
-
};
|
|
18
|
-
```
|
|
19
|
-
*/
|
|
20
|
-
declare const CheckBox: ({ label, value, disabled, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, onChange, }: CheckboxProps) => JSX.Element;
|
|
2
|
+
import type { CheckboxProps } from './checkbox.types';
|
|
3
|
+
declare const CheckBox: ({ label, value, disabled, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, checkboxControls, onChange, }: CheckboxProps) => JSX.Element;
|
|
21
4
|
export default CheckBox;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { ModalProps } from 'react-native';
|
|
3
|
+
import { TCustomModalControls } from 'src/types/index.types';
|
|
4
|
+
declare const CustomModal: ({ visible, onRequestClose, modalBackgroundStyle, modalOptionsContainerStyle, modalControls, modalProps, children, }: TCustomModalControls & ModalProps) => JSX.Element;
|
|
3
5
|
export default CustomModal;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const DropdownFlatList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, listComponentStyles, listIndex, emptyListMessage, ...rest }: any) => JSX.Element;
|
|
2
|
+
declare const DropdownFlatList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, checkboxControls, listComponentStyles, listIndex, emptyListMessage, ...rest }: any) => JSX.Element;
|
|
3
3
|
export default DropdownFlatList;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, }: any) => JSX.Element>;
|
|
2
|
+
declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, checkboxControls, }: any) => JSX.Element>;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const DropdownSectionList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, listComponentStyles, listIndex, emptyListMessage, ...rest }: any) => JSX.Element;
|
|
2
|
+
declare const DropdownSectionList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, checkboxControls, listComponentStyles, listIndex, emptyListMessage, ...rest }: any) => JSX.Element;
|
|
3
3
|
export default DropdownSectionList;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
export declare const ListEmptyComponent: ({ listEmptyComponentStyle, emptyListMessage, }: any) => JSX.Element;
|
|
4
|
-
export declare const ItemSeparatorComponent: ({ itemSeparatorStyle }:
|
|
4
|
+
export declare const ItemSeparatorComponent: ({ itemSeparatorStyle, }: {
|
|
5
|
+
itemSeparatorStyle: ViewStyle;
|
|
6
|
+
}) => JSX.Element;
|
|
5
7
|
export declare const ListItemContainer: ({ children, listItemContainerStyle, }: {
|
|
6
8
|
children: ReactNode;
|
|
7
9
|
listItemContainerStyle: ViewStyle;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ViewStyle, ColorValue, TextStyle, ModalProps, TextInputProps } from 'react-native';
|
|
3
|
-
export type DropdownProps =
|
|
4
|
-
|
|
3
|
+
export type DropdownProps = CommonDropdownProps & TDropdownInputProps & TSearchControls & TCheckboxControls & TCustomModalControls & TListControls;
|
|
4
|
+
export type CommonDropdownProps = {
|
|
5
5
|
label?: string;
|
|
6
|
-
error?: string;
|
|
7
|
-
helperText?: string;
|
|
8
6
|
options: TFlatList | TSectionList;
|
|
9
7
|
optionLabel?: string;
|
|
10
8
|
optionValue?: string;
|
|
11
9
|
onValueChange: Function;
|
|
12
10
|
selectedValue?: string | boolean | number | string[] | boolean[] | number[] | null;
|
|
11
|
+
};
|
|
12
|
+
export type TDropdownInputProps = {
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
helperText?: string;
|
|
13
16
|
isMultiple?: boolean;
|
|
14
17
|
isSearchable?: boolean;
|
|
15
18
|
dropdownIcon?: React.ReactNode;
|
|
@@ -22,25 +25,58 @@ export type DropdownProps = {
|
|
|
22
25
|
dropdownHelperTextStyle?: TextStyle;
|
|
23
26
|
selectedItemStyle?: TextStyle;
|
|
24
27
|
multipleSelectedItemStyle?: TextStyle;
|
|
25
|
-
modalBackgroundStyle?: ViewStyle;
|
|
26
|
-
modalOptionsContainerStyle?: ViewStyle;
|
|
27
|
-
searchInputStyle?: ViewStyle;
|
|
28
28
|
primaryColor?: ColorValue;
|
|
29
29
|
disabled?: boolean;
|
|
30
|
+
placeholderStyle?: TextStyle;
|
|
31
|
+
hideModal?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type TSearchControls = {
|
|
34
|
+
/** @deprecated Use `searchControls = {{textInputStyle: ViewStyle | TextStyle }}` instead.*/
|
|
35
|
+
searchInputStyle?: ViewStyle;
|
|
36
|
+
searchControls?: {
|
|
37
|
+
textInputStyle?: ViewStyle | TextStyle;
|
|
38
|
+
textInputContainerStyle?: ViewStyle;
|
|
39
|
+
textInputProps?: TextInputProps;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type TCheckboxControls = {
|
|
43
|
+
/** @deprecated Use `checkboxControls = {{checkboxSize: number }}` instead.*/
|
|
30
44
|
checkboxSize?: number;
|
|
45
|
+
/** @deprecated Use `checkboxControls = {{checkboxStyle: ViewStyle }}` instead.*/
|
|
31
46
|
checkboxStyle?: ViewStyle;
|
|
47
|
+
/** @deprecated Use `checkboxControls = {{checkboxLabelStyle: TextStyle }}` instead.*/
|
|
32
48
|
checkboxLabelStyle?: TextStyle;
|
|
49
|
+
/** @deprecated Use `checkboxControls` instead.*/
|
|
33
50
|
checkboxComponentStyles?: {
|
|
34
51
|
checkboxSize?: number;
|
|
35
52
|
checkboxStyle?: ViewStyle;
|
|
36
53
|
checkboxLabelStyle?: TextStyle;
|
|
37
54
|
};
|
|
55
|
+
/** @deprecated Use `checkboxControls = {{checkboxComponent: <View></View> }}` instead.*/
|
|
38
56
|
checkboxComponent?: React.ReactNode;
|
|
39
|
-
|
|
57
|
+
checkboxControls?: {
|
|
58
|
+
checkboxSize?: number;
|
|
59
|
+
checkboxStyle?: ViewStyle;
|
|
60
|
+
checkboxLabelStyle?: TextStyle;
|
|
61
|
+
checkboxComponent?: React.ReactNode;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type TCustomModalControls = {
|
|
65
|
+
/** @deprecated Use `modalControls = {{modalBackgroundStyle: ViewStyle}} instead.*/
|
|
66
|
+
modalBackgroundStyle?: ViewStyle;
|
|
67
|
+
/** @deprecated Use `modalControls = {{ modalOptionsContainerStyle: ViewStyle}} instead.*/
|
|
68
|
+
modalOptionsContainerStyle?: ViewStyle;
|
|
69
|
+
/** @deprecated Use `modalControls = {{modalProps: ModalProps }}` instead.*/
|
|
70
|
+
modalProps?: ModalProps;
|
|
71
|
+
modalControls?: {
|
|
72
|
+
modalBackgroundStyle?: ViewStyle;
|
|
73
|
+
modalOptionsContainerStyle?: ViewStyle;
|
|
74
|
+
modalProps?: ModalProps;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export type TListControls = {
|
|
40
78
|
listHeaderComponent?: React.ReactNode;
|
|
41
79
|
listFooterComponent?: React.ReactNode;
|
|
42
|
-
hideModal?: boolean;
|
|
43
|
-
modalProps?: ModalProps;
|
|
44
80
|
listComponentStyles?: {
|
|
45
81
|
listEmptyComponentStyle?: TextStyle;
|
|
46
82
|
itemSeparatorStyle?: ViewStyle;
|
|
@@ -54,11 +90,6 @@ export type DropdownProps = {
|
|
|
54
90
|
hideSelectAll?: boolean;
|
|
55
91
|
emptyListMessage?: string;
|
|
56
92
|
};
|
|
57
|
-
searchControls?: {
|
|
58
|
-
textInputStyle?: ViewStyle | TextStyle;
|
|
59
|
-
textInputContainerStyle?: ViewStyle;
|
|
60
|
-
textInputProps?: TextInputProps;
|
|
61
|
-
};
|
|
62
93
|
};
|
|
63
94
|
export type TFlatList = TFlatListItem[];
|
|
64
95
|
export type TFlatListItem = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Extract property from array
|
|
3
3
|
*/
|
|
4
|
-
export declare const extractPropertyFromArray: (arr: any, property: string) => any;
|
|
4
|
+
export declare const extractPropertyFromArray: (arr: any[], property: string) => any[];
|
|
5
5
|
export declare const escapeRegExp: (text: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-input-select",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
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",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"react-native": "0.63.4",
|
|
74
74
|
"react-native-builder-bob": "^0.18.2",
|
|
75
75
|
"release-it": "^14.14.3",
|
|
76
|
-
"typescript": "^
|
|
76
|
+
"typescript": "^5.3.3"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "*",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import { TCheckboxControls } from 'src/types/index.types';
|
|
3
|
+
|
|
4
|
+
export type CheckboxProps = {
|
|
5
|
+
label?: string;
|
|
6
|
+
value?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
primaryColor?: ColorValue;
|
|
9
|
+
onChange?: (value: boolean | string | number) => void;
|
|
10
|
+
} & TCheckboxControls;
|