react-native-input-select 1.1.2 → 1.1.4
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 +56 -41
- package/lib/commonjs/components/CheckBox/index.js +3 -2
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CheckBox/types.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js +5 -2
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +4 -2
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js +4 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/commonjs/index.js +12 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/module/components/CheckBox/index.js +3 -2
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CheckBox/types.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownFlatList.js +5 -2
- package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +4 -2
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js +4 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/module/index.js +12 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/typescript/components/CheckBox/index.d.ts +1 -1
- package/lib/typescript/components/CheckBox/types.d.ts +2 -0
- 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/types/index.types.d.ts +7 -0
- package/package.json +2 -2
- package/src/components/CheckBox/index.tsx +25 -16
- package/src/components/CheckBox/types.ts +2 -0
- package/src/components/Dropdown/DropdownFlatList.tsx +3 -0
- package/src/components/Dropdown/DropdownListItem.tsx +2 -0
- package/src/components/Dropdown/DropdownSectionList.tsx +3 -0
- package/src/index.tsx +23 -1
- package/src/types/index.types.ts +8 -1
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
[](https://nodei.co/npm/react-native-input-select/)
|
|
2
|
+
|
|
1
3
|
[](https://github.com/azeezat/react-native-select/actions/workflows/codeql.yml) [](https://github.com/azeezat/react-native-select/actions/workflows/release-and-publish-to-npm.yml)
|
|
4
|
+
|
|
2
5
|
# react-native-input-select
|
|
3
6
|
|
|
4
7
|
A fully customizable dropdown selection package for react-native android and iOS with multiple select and search capabilities.
|
|
@@ -17,6 +20,10 @@ With yarn
|
|
|
17
20
|
yarn add react-native-input-select
|
|
18
21
|
```
|
|
19
22
|
|
|
23
|
+
## Sandbox
|
|
24
|
+
|
|
25
|
+
[Sandbox](https://azeezat.github.io/react-native-select/)
|
|
26
|
+
|
|
20
27
|
## Basic Usage
|
|
21
28
|
|
|
22
29
|
```js
|
|
@@ -58,51 +65,18 @@ export default function App() {
|
|
|
58
65
|
return (
|
|
59
66
|
<Dropdown
|
|
60
67
|
label="Customized components in list"
|
|
61
|
-
placeholder="Select multiple
|
|
62
|
-
options={
|
|
63
|
-
{ name: 'Albania', code: 'AL' },
|
|
64
|
-
{ name: 'Nigeria', code: 'NG' },
|
|
65
|
-
{ name: 'Algeria', code: 'DZ' },
|
|
66
|
-
{ name: 'American Samoa', code: 'AS' },
|
|
67
|
-
{ name: 'Andorra', code: 'AD' },
|
|
68
|
-
{ name: 'Angola', code: 'AO' },
|
|
69
|
-
{ name: 'Anguilla', code: 'AI' },
|
|
70
|
-
{ name: 'Antarctica', code: 'AQ' },
|
|
71
|
-
{ name: 'Antigua and Barbuda', code: 'AG' },
|
|
72
|
-
]}
|
|
68
|
+
placeholder="Select multiple countries..."
|
|
69
|
+
options={countries.slice(0, 30)}
|
|
73
70
|
optionLabel={'name'}
|
|
74
71
|
optionValue={'code'}
|
|
75
72
|
selectedValue={country}
|
|
76
73
|
onValueChange={(itemValue: any) => setCountry(itemValue)}
|
|
77
74
|
isMultiple
|
|
75
|
+
isSearchable
|
|
78
76
|
primaryColor={'orange'}
|
|
79
77
|
dropdownStyle={{
|
|
80
78
|
borderWidth: 0, // To remove border, set borderWidth to 0
|
|
81
79
|
}}
|
|
82
|
-
placeholderStyle={{
|
|
83
|
-
color: 'purple',
|
|
84
|
-
fontSize: 15,
|
|
85
|
-
fontWeight: '500',
|
|
86
|
-
}}
|
|
87
|
-
labelStyle={{ color: 'teal', fontSize: 15, fontWeight: '500' }}
|
|
88
|
-
dropdownHelperTextStyle={{
|
|
89
|
-
color: 'green',
|
|
90
|
-
fontWeight: '900',
|
|
91
|
-
}}
|
|
92
|
-
modalBackgroundStyle={{
|
|
93
|
-
backgroundColor: 'rgba(196, 198, 246, 0.5)',
|
|
94
|
-
}}
|
|
95
|
-
helperText="The placeholder has been styled"
|
|
96
|
-
checkboxComponentStyles={{
|
|
97
|
-
checkboxSize: 20,
|
|
98
|
-
checkboxStyle: {
|
|
99
|
-
backgroundColor: 'purple',
|
|
100
|
-
borderRadius: 30, // To get a circle - add the checkboxSize and the padding size
|
|
101
|
-
padding: 10,
|
|
102
|
-
borderColor: 'blue',
|
|
103
|
-
},
|
|
104
|
-
checkboxLabelStyle: { color: 'red', fontSize: 20 },
|
|
105
|
-
}}
|
|
106
80
|
dropdownIcon={
|
|
107
81
|
<Image
|
|
108
82
|
style={styles.tinyLogo}
|
|
@@ -135,7 +109,41 @@ export default function App() {
|
|
|
135
109
|
<Text>You can add any component to the bottom of this list</Text>
|
|
136
110
|
</View>
|
|
137
111
|
}
|
|
138
|
-
modalOptionsContainerStyle={{
|
|
112
|
+
modalOptionsContainerStyle={{
|
|
113
|
+
padding: 10,
|
|
114
|
+
backgroundColor: 'cyan',
|
|
115
|
+
}}
|
|
116
|
+
modalProps={{
|
|
117
|
+
supportedOrientations: [
|
|
118
|
+
'portrait',
|
|
119
|
+
'portrait-upside-down',
|
|
120
|
+
'landscape',
|
|
121
|
+
'landscape-left',
|
|
122
|
+
'landscape-right',
|
|
123
|
+
],
|
|
124
|
+
transparent: false,
|
|
125
|
+
}}
|
|
126
|
+
listComponentStyles={{
|
|
127
|
+
listEmptyComponentStyle: {
|
|
128
|
+
color: 'red',
|
|
129
|
+
},
|
|
130
|
+
itemSeparatorStyle: {
|
|
131
|
+
opacity: 0,
|
|
132
|
+
borderColor: 'white',
|
|
133
|
+
borderWidth: 2,
|
|
134
|
+
backgroundColor: 'cyan',
|
|
135
|
+
},
|
|
136
|
+
sectionHeaderStyle: {
|
|
137
|
+
padding: 10,
|
|
138
|
+
backgroundColor: 'cyan',
|
|
139
|
+
},
|
|
140
|
+
}}
|
|
141
|
+
selectAllControls={{
|
|
142
|
+
selectAllText: 'Choose everything',
|
|
143
|
+
unselectAllText: 'Remove everything',
|
|
144
|
+
selectAllCallback: () => Alert.alert('You selected everything'),
|
|
145
|
+
unselectAllCallback: () => Alert.alert('You removed everything'),
|
|
146
|
+
}}
|
|
139
147
|
/>
|
|
140
148
|
);
|
|
141
149
|
}
|
|
@@ -156,6 +164,13 @@ const styles = StyleSheet.create({
|
|
|
156
164
|
width: 20,
|
|
157
165
|
height: 20,
|
|
158
166
|
},
|
|
167
|
+
radioButton: {
|
|
168
|
+
width: 20,
|
|
169
|
+
height: 20,
|
|
170
|
+
borderRadius: 20 / 2,
|
|
171
|
+
borderWidth: 3,
|
|
172
|
+
borderColor: 'white',
|
|
173
|
+
},
|
|
159
174
|
});
|
|
160
175
|
```
|
|
161
176
|
|
|
@@ -222,11 +237,10 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
|
|
|
222
237
|
| <img width="456" alt="Screenshot 2023-05-16 at 6 17 09 AM" src="https://github.com/azeezat/react-native-select/assets/9849221/d695657f-d840-4368-b841-42af479d6543"> | <img width="456" alt="Screenshot 2023-03-23 at 5 26 58 PM" src="https://user-images.githubusercontent.com/9849221/227393548-28796d7b-9760-43a9-8ed3-fb1618cd1b7d.png"> | <img width="456" alt="Screenshot 2023-03-23 at 5 28 49 PM" src="https://user-images.githubusercontent.com/9849221/227393554-91ed1a92-d229-4814-84d8-5f9095e8d048.png"> |
|
|
223
238
|
|
|
224
239
|
## Props
|
|
225
|
-
|
|
226
240
|
| Proptypes | Datatype | Example |
|
|
227
241
|
| -------------------------- | ------------------------ | -------------------------------------------------------------------- |
|
|
228
|
-
| label | `string` |
|
|
229
|
-
| placeholder | `string` |
|
|
242
|
+
| label | `string` | Countries |
|
|
243
|
+
| placeholder | `string` | Select a country |
|
|
230
244
|
| options | `Array` | `[{ name: 'Nigeria', code: 'NG' }, { name: 'Albania', code: 'AL' }]` |
|
|
231
245
|
| optionLabel | `string` | `name` |
|
|
232
246
|
| optionValue | `string` | `code` |
|
|
@@ -258,7 +272,8 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
|
|
|
258
272
|
| hideModal | `Boolean` | Use this to hide the modal as needed |
|
|
259
273
|
| listComponentStyles | `Object` | `{listEmptyComponentStyle: ViewStyle, itemSeparatorStyle: ViewStyle, sectionHeaderStyle: TextStyle}` |
|
|
260
274
|
| checkboxComponentStyles | `Object` | `{checkboxSize?: number, checkboxStyle?: ViewStyle, checkboxLabelStyle: TextStyle}` |
|
|
261
|
-
|
|
275
|
+
| checkboxComponent | `React Component` | `<View style={styles.radioButton} />` |
|
|
276
|
+
| selectAllControls | `Object` | `{ selectAllText: 'Choose all', unselectAllText: 'Remove all', selectAllCallback?: () => {}, unselectAllCallback?: () => {}}` |
|
|
262
277
|
|
|
263
278
|
## Deprecation Notice
|
|
264
279
|
|
|
@@ -38,6 +38,7 @@ const CheckBox = _ref => {
|
|
|
38
38
|
checkboxStyle,
|
|
39
39
|
checkboxLabelStyle,
|
|
40
40
|
checkboxComponentStyles,
|
|
41
|
+
checkboxComponent,
|
|
41
42
|
onChange
|
|
42
43
|
} = _ref;
|
|
43
44
|
// const { checkboxSize, checkboxStyle, checkboxLabelStyle } =
|
|
@@ -51,8 +52,8 @@ const CheckBox = _ref => {
|
|
|
51
52
|
style: [styles.checkboxContainer],
|
|
52
53
|
disabled: disabled
|
|
53
54
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
54
|
-
style: [styles.checkbox, checkboxStyle, fillColor]
|
|
55
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
55
|
+
style: [styles.checkbox, (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxStyle) || checkboxStyle, fillColor]
|
|
56
|
+
}, checkboxComponent || /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
56
57
|
source: require('../../asset/check.png'),
|
|
57
58
|
style: [{
|
|
58
59
|
height: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize || _constants.CHECKBOX_SIZE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_constants","obj","__esModule","default","CheckBox","_ref","_checkboxComponentSty","_checkboxComponentSty2","label","value","disabled","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","onChange","fillColor","backgroundColor","borderColor","colors","styles","checkbox","createElement","Pressable","onPress","style","checkboxContainer","View","Image","source","height","CHECKBOX_SIZE","width","Text","labelStyle","StyleSheet","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","marginLeft","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import 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\n/**\n * Individual props `checkboxSize`, `checkboxStyle`, `checkboxLabelStyle` would be replaced in future releases\n * and replaced with a single object `checkboxComponentStyles` e.g\n\n```js\nconst checkboxComponentStyles = {\n checkboxSize: 20,\n checkboxStyle: {\n backgroundColor: 'purple',\n borderRadius: 30,\n padding: 10,\n borderColor: 'red',\n },\n checkboxLabelStyle: { color: 'red', fontSize: 20 },\n};\n```\n */\n\nconst CheckBox = ({\n label,\n value,\n disabled,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n onChange,\n}: CheckboxProps) => {\n // const { checkboxSize, checkboxStyle, checkboxLabelStyle } =\n // checkboxComponentStyles || undefined;\n const fillColor = {\n backgroundColor: disabled\n ? '#d3d3d3'\n : value\n ? checkboxComponentStyles?.checkboxStyle?.backgroundColor ||\n checkboxStyle?.backgroundColor ||\n primaryColor ||\n 'green'\n : 'white',\n borderColor: disabled\n ? colors.disabled\n : checkboxComponentStyles?.checkboxStyle?.borderColor ||\n checkboxStyle?.borderColor ||\n styles.checkbox.borderColor,\n };\n\n return (\n <Pressable\n onPress={onChange ? () => onChange(!value) : null}\n style={[styles.checkboxContainer]}\n disabled={disabled}\n >\n <View
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_constants","obj","__esModule","default","CheckBox","_ref","_checkboxComponentSty","_checkboxComponentSty2","label","value","disabled","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","onChange","fillColor","backgroundColor","borderColor","colors","styles","checkbox","createElement","Pressable","onPress","style","checkboxContainer","View","Image","source","height","CHECKBOX_SIZE","width","Text","labelStyle","StyleSheet","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","marginLeft","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import 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\n/**\n * Individual props `checkboxSize`, `checkboxStyle`, `checkboxLabelStyle` would be replaced in future releases\n * and replaced with a single object `checkboxComponentStyles` e.g\n\n```js\nconst checkboxComponentStyles = {\n checkboxSize: 20,\n checkboxStyle: {\n backgroundColor: 'purple',\n borderRadius: 30,\n padding: 10,\n borderColor: 'red',\n },\n checkboxLabelStyle: { color: 'red', fontSize: 20 },\n};\n```\n */\n\nconst CheckBox = ({\n label,\n value,\n disabled,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n onChange,\n}: CheckboxProps) => {\n // const { checkboxSize, checkboxStyle, checkboxLabelStyle } =\n // checkboxComponentStyles || undefined;\n const fillColor = {\n backgroundColor: disabled\n ? '#d3d3d3'\n : value\n ? checkboxComponentStyles?.checkboxStyle?.backgroundColor ||\n checkboxStyle?.backgroundColor ||\n primaryColor ||\n 'green'\n : 'white',\n borderColor: disabled\n ? colors.disabled\n : checkboxComponentStyles?.checkboxStyle?.borderColor ||\n checkboxStyle?.borderColor ||\n styles.checkbox.borderColor,\n };\n\n return (\n <Pressable\n onPress={onChange ? () => onChange(!value) : null}\n style={[styles.checkboxContainer]}\n disabled={disabled}\n >\n <View\n style={[\n styles.checkbox,\n checkboxComponentStyles?.checkboxStyle || checkboxStyle,\n fillColor,\n ]}\n >\n {checkboxComponent || (\n <Image\n source={require('../../asset/check.png')}\n style={[\n {\n height:\n checkboxComponentStyles?.checkboxSize ||\n checkboxSize ||\n CHECKBOX_SIZE,\n width:\n checkboxComponentStyles?.checkboxSize ||\n checkboxSize ||\n CHECKBOX_SIZE,\n },\n ]}\n />\n )}\n </View>\n {label && (\n <Text\n style={[\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle,\n styles.labelStyle,\n ]}\n >\n {label}\n </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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAgD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMG,QAAQ,GAAGC,IAAA,IAWI;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAXH;IAChBC,KAAK;IACLC,KAAK;IACLC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC,uBAAuB;IACvBC,iBAAiB;IACjBC;EACa,CAAC,GAAAZ,IAAA;EACd;EACA;EACA,MAAMa,SAAS,GAAG;IAChBC,eAAe,EAAET,QAAQ,GACrB,SAAS,GACTD,KAAK,GACL,CAAAM,uBAAuB,aAAvBA,uBAAuB,gBAAAT,qBAAA,GAAvBS,uBAAuB,CAAEF,aAAa,cAAAP,qBAAA,uBAAtCA,qBAAA,CAAwCa,eAAe,MACvDN,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEM,eAAe,KAC9BR,YAAY,IACZ,OAAO,GACP,OAAO;IACXS,WAAW,EAAEV,QAAQ,GACjBW,cAAM,CAACX,QAAQ,GACf,CAAAK,uBAAuB,aAAvBA,uBAAuB,gBAAAR,sBAAA,GAAvBQ,uBAAuB,CAAEF,aAAa,cAAAN,sBAAA,uBAAtCA,sBAAA,CAAwCa,WAAW,MACnDP,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEO,WAAW,KAC1BE,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IACjBW,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACDlB,QAAQ,EAAE;IACRmB,OAAO,EAAE,CAAC;IACVC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,YAAY,EAAE,CAAC;IACfzB,WAAW,EAAE;EACf,CAAC;EACDgB,UAAU,EAAE;IAAEU,UAAU,EAAE;EAAG;AAC/B,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY3C,QAAQ;AAAA4C,OAAA,CAAA7C,OAAA,GAAA4C,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue, ViewStyle, TextStyle } from 'react-native';\n\nexport type CheckboxProps = {\n label?: string;\n value?: boolean;\n disabled?: boolean;\n primaryColor?: ColorValue;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n checkboxComponentStyles?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n };\n onChange?: (value: boolean | string | number) => void;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import React from 'react';\nimport 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 checkboxComponentStyles?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n };\n checkboxComponent?: React.ReactNode;\n onChange?: (value: boolean | string | number) => void;\n};\n"],"mappings":""}
|
|
@@ -31,6 +31,7 @@ const DropdownFlatList = _ref => {
|
|
|
31
31
|
checkboxLabelStyle,
|
|
32
32
|
// kept for backwards compatibility to be removed in future release
|
|
33
33
|
checkboxComponentStyles,
|
|
34
|
+
checkboxComponent,
|
|
34
35
|
listComponentStyles,
|
|
35
36
|
listIndex,
|
|
36
37
|
...rest
|
|
@@ -73,7 +74,8 @@ const DropdownFlatList = _ref => {
|
|
|
73
74
|
// kept for backwards compatibility
|
|
74
75
|
checkboxLabelStyle,
|
|
75
76
|
// kept for backwards compatibility
|
|
76
|
-
checkboxComponentStyles
|
|
77
|
+
checkboxComponentStyles,
|
|
78
|
+
checkboxComponent
|
|
77
79
|
}),
|
|
78
80
|
keyExtractor: (_item, index) => `Options${index}`,
|
|
79
81
|
ref: flatlistRef,
|
|
@@ -103,7 +105,8 @@ const _renderItem = (_ref3, props) => {
|
|
|
103
105
|
checkboxStyle: props.checkboxStyle,
|
|
104
106
|
checkboxLabelStyle: props.checkboxLabelStyle,
|
|
105
107
|
scrollToItem: props.scrollToItem,
|
|
106
|
-
checkboxComponentStyles: props.checkboxComponentStyles
|
|
108
|
+
checkboxComponentStyles: props.checkboxComponentStyles,
|
|
109
|
+
checkboxComponent: props.checkboxComponent
|
|
107
110
|
});
|
|
108
111
|
};
|
|
109
112
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DropdownListItem","_interopRequireDefault","_Others","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownFlatList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","listIndex","rest","flatlistRef","useRef","scrollToItem","index","_flatlistRef$current","current","scrollToIndex","animated","useEffect","itemIndex","createElement","FlatList","data","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","ref","onScrollToIndexFailed","_ref2","setTimeout","_ref3","props","StyleSheet","create","_default","exports"],"sources":["DropdownFlatList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useRef } from 'react';\nimport { FlatList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport { ItemSeparatorComponent, ListEmptyComponent } from '../Others';\nimport { TFlatList } from 'src/types/index.types';\n\nconst DropdownFlatList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility to be removed in future release\n checkboxStyle, // kept for backwards compatibility to be removed in future release\n checkboxLabelStyle, // kept for backwards compatibility to be removed in future release\n checkboxComponentStyles,\n listComponentStyles,\n listIndex,\n ...rest\n}: any) => {\n const flatlistRef = useRef<FlatList<TFlatList>>(null);\n\n const scrollToItem = (index: number) => {\n flatlistRef.current?.scrollToIndex({\n index,\n animated: true,\n });\n };\n\n useEffect(() => {\n scrollToItem(listIndex.itemIndex);\n }, [listIndex]);\n\n return (\n <FlatList\n data={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n scrollToItem,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n })\n }\n keyExtractor={(_item, index) => `Options${index}`}\n ref={flatlistRef}\n onScrollToIndexFailed={({ index }) => {\n setTimeout(() => {\n scrollToItem(index);\n }, 500);\n }}\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 scrollToItem={props.scrollToItem}\n checkboxComponentStyles={props.checkboxComponentStyles}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownFlatList;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAAuE,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAV,wBAAAM,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAA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gBAAgB,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DropdownListItem","_interopRequireDefault","_Others","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownFlatList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listComponentStyles","listIndex","rest","flatlistRef","useRef","scrollToItem","index","_flatlistRef$current","current","scrollToIndex","animated","useEffect","itemIndex","createElement","FlatList","data","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","ref","onScrollToIndexFailed","_ref2","setTimeout","_ref3","props","StyleSheet","create","_default","exports"],"sources":["DropdownFlatList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useRef } from 'react';\nimport { FlatList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport { ItemSeparatorComponent, ListEmptyComponent } from '../Others';\nimport { TFlatList } from 'src/types/index.types';\n\nconst DropdownFlatList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility to be removed in future release\n checkboxStyle, // kept for backwards compatibility to be removed in future release\n checkboxLabelStyle, // kept for backwards compatibility to be removed in future release\n checkboxComponentStyles,\n checkboxComponent,\n listComponentStyles,\n listIndex,\n ...rest\n}: any) => {\n const flatlistRef = useRef<FlatList<TFlatList>>(null);\n\n const scrollToItem = (index: number) => {\n flatlistRef.current?.scrollToIndex({\n index,\n animated: true,\n });\n };\n\n useEffect(() => {\n scrollToItem(listIndex.itemIndex);\n }, [listIndex]);\n\n return (\n <FlatList\n data={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n scrollToItem,\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 })\n }\n keyExtractor={(_item, index) => `Options${index}`}\n ref={flatlistRef}\n onScrollToIndexFailed={({ index }) => {\n setTimeout(() => {\n scrollToItem(index);\n }, 500);\n }}\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 scrollToItem={props.scrollToItem}\n checkboxComponentStyles={props.checkboxComponentStyles}\n checkboxComponent={props.checkboxComponent}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownFlatList;\n"],"mappings":";;;;;;AACA,IAAA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,
|
|
25
|
-
checkboxComponentStyles
|
|
25
|
+
checkboxComponentStyles,
|
|
26
|
+
checkboxComponent
|
|
26
27
|
} = _ref;
|
|
27
28
|
return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
28
29
|
style: styles.listItemContainerStyle,
|
|
@@ -35,7 +36,8 @@ const DropdownListItem = _ref => {
|
|
|
35
36
|
checkboxSize: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize,
|
|
36
37
|
checkboxStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxStyle) || checkboxStyle,
|
|
37
38
|
checkboxLabelStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxLabelStyle) || checkboxLabelStyle,
|
|
38
|
-
disabled: item.disabled
|
|
39
|
+
disabled: item.disabled,
|
|
40
|
+
checkboxComponent: checkboxComponent
|
|
39
41
|
}));
|
|
40
42
|
};
|
|
41
43
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CheckBox","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","createElement","TouchableOpacity","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","_default","memo","exports"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n}: any) => {\n return (\n <TouchableOpacity\n style={styles.listItemContainerStyle}\n onPress={\n item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[optionValue])\n : [selectedOption].includes(item[optionValue])\n }\n label={item[optionLabel]}\n onChange={() => onChange(item[optionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxComponentStyles?.checkboxSize || checkboxSize}\n checkboxStyle={checkboxComponentStyles?.checkboxStyle || checkboxStyle}\n checkboxLabelStyle={\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle\n }\n disabled={item.disabled}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAK,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAf,GAAA,EAAAgB,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAhB,GAAA,CAAAgB,GAAA,SAAAL,MAAA,CAAAT,OAAA,GAAAF,GAAA,MAAAQ,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAArB,GAAA,EAAAW,MAAA,YAAAA,MAAA;AAEnC,MAAMW,gBAAgB,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CheckBox","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","createElement","TouchableOpacity","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","_default","memo","exports"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n}: any) => {\n return (\n <TouchableOpacity\n style={styles.listItemContainerStyle}\n onPress={\n item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[optionValue])\n : [selectedOption].includes(item[optionValue])\n }\n label={item[optionLabel]}\n onChange={() => onChange(item[optionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxComponentStyles?.checkboxSize || checkboxSize}\n checkboxStyle={checkboxComponentStyles?.checkboxStyle || checkboxStyle}\n checkboxLabelStyle={\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle\n }\n disabled={item.disabled}\n checkboxComponent={checkboxComponent}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,w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,QAAA,gBAEY,IAAAC,WAAI,EAAC/B,gBAAgB,CAAC;AAAAgC,OAAA,CAAApD,OAAA,GAAAkD,QAAA"}
|
|
@@ -29,6 +29,7 @@ const DropdownSectionList = _ref => {
|
|
|
29
29
|
checkboxStyle,
|
|
30
30
|
checkboxLabelStyle,
|
|
31
31
|
checkboxComponentStyles,
|
|
32
|
+
checkboxComponent,
|
|
32
33
|
listComponentStyles,
|
|
33
34
|
listIndex,
|
|
34
35
|
...rest
|
|
@@ -102,6 +103,7 @@ const DropdownSectionList = _ref => {
|
|
|
102
103
|
checkboxLabelStyle,
|
|
103
104
|
// kept for backwards compatibility
|
|
104
105
|
checkboxComponentStyles,
|
|
106
|
+
checkboxComponent,
|
|
105
107
|
expandedSections
|
|
106
108
|
}),
|
|
107
109
|
renderSectionHeader: _ref2 => {
|
|
@@ -150,7 +152,8 @@ const _renderItem = (_ref3, props) => {
|
|
|
150
152
|
checkboxSize: props.checkboxSize,
|
|
151
153
|
checkboxStyle: props.checkboxStyle,
|
|
152
154
|
checkboxLabelStyle: props.checkboxLabelStyle,
|
|
153
|
-
checkboxComponentStyles: props.checkboxComponentStyles
|
|
155
|
+
checkboxComponentStyles: props.checkboxComponentStyles,
|
|
156
|
+
checkboxComponent: props.checkboxComponent
|
|
154
157
|
});
|
|
155
158
|
};
|
|
156
159
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DropdownListItem","_interopRequireDefault","_Others","_utils","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","listIndex","rest","expandedSections","setExpandedSections","useState","Set","useEffect","initialState","extractPropertyFromArray","handleToggleListExpansion","title","expandedSectionsState","next","delete","add","sectionlistRef","useRef","scrollToLocation","_sectionlistRef$curre","current","sectionIndex","animated","itemIndex","createElement","SectionList","sections","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","data","SectionHeaderTitle","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","ref","onScrollToIndexFailed","setTimeout","_ref3","props","StyleSheet","create","_default","exports"],"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 listComponentStyles,\n listIndex,\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 scrollToLocation(listIndex);\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 />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n expandedSections,\n })\n }\n renderSectionHeader={({ section: { title, data } }) =>\n data.length > 0 && (\n <SectionHeaderTitle\n title={title}\n sectionHeaderStyle={listComponentStyles?.sectionHeaderStyle}\n onPress={() => handleToggleListExpansion(title)}\n isExpanded={expandedSections.has(title)}\n />\n )\n }\n keyExtractor={(_item, index) => `Options${index}`}\n stickySectionHeadersEnabled={false}\n 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 />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownSectionList;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAuD,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAX,wBAAAO,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH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KAAK,CAAC5D,aAAc;IACnCC,kBAAkB,EAAE2D,KAAK,CAAC3D,kBAAmB;IAC7CC,uBAAuB,EAAE0D,KAAK,CAAC1D;EAAwB,CACxD,CAAC;AAEN,CAAC;AAED,MAAMkC,MAAM,GAAGyB,uBAAU,CAACC,MAAM,CAAC;EAC/B5B,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAAC,IAAA4B,QAAA,GAEY5E,mBAAmB;AAAA6E,OAAA,CAAA1G,OAAA,GAAAyG,QAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DropdownListItem","_interopRequireDefault","_Others","_utils","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listComponentStyles","listIndex","rest","expandedSections","setExpandedSections","useState","Set","useEffect","initialState","extractPropertyFromArray","handleToggleListExpansion","title","expandedSectionsState","next","delete","add","sectionlistRef","useRef","scrollToLocation","_sectionlistRef$curre","current","sectionIndex","animated","itemIndex","createElement","SectionList","sections","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","data","SectionHeaderTitle","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","ref","onScrollToIndexFailed","setTimeout","_ref3","props","StyleSheet","create","_default","exports"],"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 ...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 scrollToLocation(listIndex);\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 />\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, data } }) =>\n data.length > 0 && (\n <SectionHeaderTitle\n title={title}\n sectionHeaderStyle={listComponentStyles?.sectionHeaderStyle}\n onPress={() => handleToggleListExpansion(title)}\n isExpanded={expandedSections.has(title)}\n />\n )\n }\n keyExtractor={(_item, index) => `Options${index}`}\n stickySectionHeadersEnabled={false}\n 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":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MA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 @@ const DropdownSelect = _ref => {
|
|
|
55
55
|
checkboxLabelStyle,
|
|
56
56
|
// kept for backwards compatibility
|
|
57
57
|
checkboxComponentStyles,
|
|
58
|
+
checkboxComponent,
|
|
58
59
|
listHeaderComponent,
|
|
59
60
|
listFooterComponent,
|
|
60
61
|
listComponentStyles,
|
|
61
62
|
modalProps,
|
|
62
63
|
hideModal = false,
|
|
64
|
+
selectAllControls,
|
|
63
65
|
...rest
|
|
64
66
|
} = _ref;
|
|
65
67
|
const [newOptions, setNewOptions] = (0, _react.useState)([]);
|
|
@@ -137,6 +139,12 @@ const DropdownSelect = _ref => {
|
|
|
137
139
|
onValueChange(selectedValues); //send value to parent
|
|
138
140
|
return !prevVal;
|
|
139
141
|
});
|
|
142
|
+
if (typeof (selectAllControls === null || selectAllControls === void 0 ? void 0 : selectAllControls.selectAllCallback) === 'function' && !selectAll) {
|
|
143
|
+
selectAllControls.selectAllCallback();
|
|
144
|
+
}
|
|
145
|
+
if (typeof (selectAllControls === null || selectAllControls === void 0 ? void 0 : selectAllControls.unselectAllCallback) === 'function' && selectAll) {
|
|
146
|
+
selectAllControls.unselectAllCallback();
|
|
147
|
+
}
|
|
140
148
|
};
|
|
141
149
|
|
|
142
150
|
/*===========================================
|
|
@@ -297,13 +305,14 @@ const DropdownSelect = _ref => {
|
|
|
297
305
|
onPress: () => {}
|
|
298
306
|
}, /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
299
307
|
value: selectAll,
|
|
300
|
-
label: selectAll ? 'Clear all' : 'Select all',
|
|
308
|
+
label: selectAll ? (selectAllControls === null || selectAllControls === void 0 ? void 0 : selectAllControls.unselectAllText) || 'Clear all' : (selectAllControls === null || selectAllControls === void 0 ? void 0 : selectAllControls.selectAllText) || 'Select all',
|
|
301
309
|
onChange: () => handleSelectAll(),
|
|
302
310
|
primaryColor: primary,
|
|
303
311
|
checkboxSize: checkboxSize,
|
|
304
312
|
checkboxStyle: checkboxStyle,
|
|
305
313
|
checkboxLabelStyle: checkboxLabelStyle,
|
|
306
|
-
checkboxComponentStyles: checkboxComponentStyles
|
|
314
|
+
checkboxComponentStyles: checkboxComponentStyles,
|
|
315
|
+
checkboxComponent: checkboxComponent
|
|
307
316
|
})))),
|
|
308
317
|
ListFooterComponent: listFooterComponent,
|
|
309
318
|
listComponentStyles: listComponentStyles,
|
|
@@ -321,6 +330,7 @@ const DropdownSelect = _ref => {
|
|
|
321
330
|
checkboxStyle: checkboxStyle,
|
|
322
331
|
checkboxLabelStyle: checkboxLabelStyle,
|
|
323
332
|
checkboxComponentStyles: checkboxComponentStyles,
|
|
333
|
+
checkboxComponent: checkboxComponent,
|
|
324
334
|
listIndex: listIndex
|
|
325
335
|
})));
|
|
326
336
|
};
|