react-native-input-select 1.3.18 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -95
- package/lib/commonjs/components/CheckBox/index.js +19 -13
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CustomModal/index.js +12 -16
- package/lib/commonjs/components/CustomModal/index.js.map +1 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js +3 -2
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +2 -11
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +14 -14
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/components/{Dropdown → List}/DropdownFlatList.js +7 -28
- package/lib/commonjs/components/List/DropdownFlatList.js.map +1 -0
- package/lib/commonjs/components/{Dropdown → List}/DropdownSectionList.js +6 -24
- package/lib/commonjs/components/List/DropdownSectionList.js.map +1 -0
- package/lib/commonjs/hooks/index.js +61 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/use-index-of-selected-item.js +49 -0
- package/lib/commonjs/hooks/use-index-of-selected-item.js.map +1 -0
- package/lib/commonjs/hooks/use-modal.js +37 -0
- package/lib/commonjs/hooks/use-modal.js.map +1 -0
- package/lib/commonjs/hooks/use-search.js +58 -0
- package/lib/commonjs/hooks/use-search.js.map +1 -0
- package/lib/commonjs/hooks/use-select-all.js +70 -0
- package/lib/commonjs/hooks/use-select-all.js.map +1 -0
- package/lib/commonjs/hooks/use-selection-handler.js +62 -0
- package/lib/commonjs/hooks/use-selection-handler.js.map +1 -0
- package/lib/commonjs/index.js +120 -260
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +40 -5
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/CheckBox/index.js +19 -13
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CustomModal/index.js +12 -15
- package/lib/module/components/CustomModal/index.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +3 -2
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +2 -11
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +14 -14
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/{Dropdown → List}/DropdownFlatList.js +7 -28
- package/lib/module/components/List/DropdownFlatList.js.map +1 -0
- package/lib/module/components/{Dropdown → List}/DropdownSectionList.js +6 -24
- package/lib/module/components/List/DropdownSectionList.js.map +1 -0
- package/lib/module/hooks/index.js +6 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/use-index-of-selected-item.js +42 -0
- package/lib/module/hooks/use-index-of-selected-item.js.map +1 -0
- package/lib/module/hooks/use-modal.js +30 -0
- package/lib/module/hooks/use-modal.js.map +1 -0
- package/lib/module/hooks/use-search.js +51 -0
- package/lib/module/hooks/use-search.js.map +1 -0
- package/lib/module/hooks/use-select-all.js +63 -0
- package/lib/module/hooks/use-select-all.js.map +1 -0
- package/lib/module/hooks/use-selection-handler.js +55 -0
- package/lib/module/hooks/use-selection-handler.js.map +1 -0
- package/lib/module/index.js +123 -262
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/index.js +36 -4
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/src/components/CheckBox/checkbox.types.d.ts +4 -2
- package/lib/typescript/src/components/CheckBox/checkbox.types.d.ts.map +1 -1
- package/lib/typescript/src/components/CheckBox/index.d.ts +2 -2
- package/lib/typescript/src/components/CheckBox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomModal/index.d.ts +3 -1
- package/lib/typescript/src/components/CustomModal/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/typescript/src/components/Dropdown/DropdownListItem.d.ts +1 -1
- package/lib/typescript/src/components/Dropdown/DropdownListItem.d.ts.map +1 -1
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsView.d.ts +1 -1
- package/lib/typescript/src/components/Input/index.d.ts +5 -1
- package/lib/typescript/src/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/src/components/List/DropdownFlatList.d.ts +6 -0
- package/lib/typescript/src/components/List/DropdownFlatList.d.ts.map +1 -0
- package/lib/typescript/src/components/List/DropdownSectionList.d.ts +4 -0
- package/lib/typescript/src/components/List/DropdownSectionList.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +6 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-index-of-selected-item.d.ts +23 -0
- package/lib/typescript/src/hooks/use-index-of-selected-item.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-modal.d.ts +13 -0
- package/lib/typescript/src/hooks/use-modal.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-search.d.ts +16 -0
- package/lib/typescript/src/hooks/use-search.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-select-all.d.ts +18 -0
- package/lib/typescript/src/hooks/use-select-all.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-selection-handler.d.ts +19 -0
- package/lib/typescript/src/hooks/use-selection-handler.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +19 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/index.types.d.ts +33 -53
- package/lib/typescript/src/types/index.types.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +17 -3
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/package.json +21 -7
- package/src/components/CheckBox/checkbox.types.ts +2 -2
- package/src/components/CheckBox/index.tsx +23 -47
- package/src/components/CustomModal/index.tsx +15 -23
- package/src/components/Dropdown/Dropdown.tsx +3 -2
- package/src/components/Dropdown/DropdownListItem.tsx +1 -14
- package/src/components/Dropdown/DropdownSelectedItemsView.tsx +13 -13
- package/src/components/Input/index.tsx +13 -2
- package/src/components/{Dropdown → List}/DropdownFlatList.tsx +11 -23
- package/src/components/{Dropdown → List}/DropdownSectionList.tsx +10 -22
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-index-of-selected-item.ts +49 -0
- package/src/hooks/use-modal.ts +40 -0
- package/src/hooks/use-search.ts +95 -0
- package/src/hooks/use-select-all.ts +79 -0
- package/src/hooks/use-selection-handler.ts +81 -0
- package/src/index.tsx +277 -443
- package/src/types/index.types.ts +41 -56
- package/src/utils/index.ts +60 -3
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +0 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +0 -1
- package/lib/module/components/Dropdown/DropdownFlatList.js.map +0 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js.map +0 -1
- package/lib/typescript/src/components/Dropdown/DropdownFlatList.d.ts +0 -6
- package/lib/typescript/src/components/Dropdown/DropdownFlatList.d.ts.map +0 -1
- package/lib/typescript/src/components/Dropdown/DropdownSectionList.d.ts +0 -4
- package/lib/typescript/src/components/Dropdown/DropdownSectionList.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const Dropdown: ({ testID, label, placeholder, helperText, error,
|
|
2
|
+
declare const Dropdown: ({ testID, label, placeholder, helperText, error, labelsOfSelectedItems, openModal, closeModal, isMultiple, selectedItem, selectedItems, dropdownIcon, labelStyle, dropdownStyle, dropdownIconStyle, dropdownContainerStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => React.JSX.Element;
|
|
3
3
|
export default Dropdown;
|
|
4
4
|
//# sourceMappingURL=Dropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,QAAA,MAAM,QAAQ,uZA0BX,GAAG,
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,QAAA,MAAM,QAAQ,uZA0BX,GAAG,sBA4CL,CAAC;AAUF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor,
|
|
2
|
+
declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor, checkboxControls, }: any) => React.JSX.Element>;
|
|
3
3
|
export default _default;
|
|
4
4
|
//# sourceMappingURL=DropdownListItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownListItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/DropdownListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownListItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/DropdownListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;8JAajC,GAAG;AA+BN,wBAAsC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const DropdownSelectedItemsView: ({ placeholder, error,
|
|
2
|
+
declare const DropdownSelectedItemsView: ({ placeholder, error, labelsOfSelectedItems, openModal, isMultiple, selectedItem, selectedItems, dropdownIcon, dropdownStyle, dropdownIconStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => React.JSX.Element;
|
|
3
3
|
export default DropdownSelectedItemsView;
|
|
4
4
|
//# sourceMappingURL=DropdownSelectedItemsView.d.ts.map
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { TextInputProps, ViewStyle, ColorValue } from 'react-native';
|
|
3
|
+
export declare const Input: ({ placeholder, value, onChangeText, style, primaryColor, textInputContainerStyle, ...rest }: {
|
|
4
|
+
primaryColor?: ColorValue;
|
|
5
|
+
textInputContainerStyle?: ViewStyle;
|
|
6
|
+
} & TextInputProps) => React.JSX.Element;
|
|
3
7
|
export default Input;
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAKL,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,KAAK,gGAQf;IACD,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,uBAAuB,CAAC,EAAE,SAAS,CAAC;CACrC,GAAG,cAAc,sBA4BjB,CAAC;AAMF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlatListProps } from 'react-native';
|
|
3
|
+
import { TFlatList } from '../../types/index.types';
|
|
4
|
+
declare const DropdownFlatList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxControls, listComponentStyles, listIndex, emptyListMessage, listEmptyComponent, ...rest }: any & FlatListProps<TFlatList>) => React.JSX.Element;
|
|
5
|
+
export default DropdownFlatList;
|
|
6
|
+
//# sourceMappingURL=DropdownFlatList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownFlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/DropdownFlatList.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAY,aAAa,EAAc,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,QAAA,MAAM,gBAAgB,iQAiBnB,GAAG,GAAG,aAAa,CAAC,SAAS,CAAC,sBAkEhC,CAAC;AAsBF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const DropdownSectionList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxControls, listComponentStyles, listIndex, emptyListMessage, listEmptyComponent, ...rest }: any) => React.JSX.Element;
|
|
3
|
+
export default DropdownSectionList;
|
|
4
|
+
//# sourceMappingURL=DropdownSectionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownSectionList.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/DropdownSectionList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAW3D,QAAA,MAAM,mBAAmB,iQAiBtB,GAAG,sBA0GL,CAAC;AA0BF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TFlatListItem, TSectionListItem } from '../types/index.types';
|
|
2
|
+
interface UseIndexOfSelectedItemProps {
|
|
3
|
+
options: (TFlatListItem | TSectionListItem)[];
|
|
4
|
+
optionLabel: string;
|
|
5
|
+
isSectionList: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @description for scrollToIndex in Sectionlist and Flatlist
|
|
10
|
+
*/
|
|
11
|
+
export declare const useIndexOfSelectedItem: ({ options, optionLabel, isSectionList, }: UseIndexOfSelectedItemProps) => {
|
|
12
|
+
listIndex: {
|
|
13
|
+
sectionIndex?: number;
|
|
14
|
+
itemIndex: number;
|
|
15
|
+
};
|
|
16
|
+
setListIndex: import("react").Dispatch<import("react").SetStateAction<{
|
|
17
|
+
sectionIndex?: number;
|
|
18
|
+
itemIndex: number;
|
|
19
|
+
}>>;
|
|
20
|
+
setIndexOfSelectedItem: (selectedLabel: string) => void;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=use-index-of-selected-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-index-of-selected-item.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-index-of-selected-item.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,UAAU,2BAA2B;IACnC,OAAO,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AAEH,eAAO,MAAM,sBAAsB,6CAIhC,2BAA2B;;uBAEX,MAAM;mBACV,MAAM;;;uBADF,MAAM;mBACV,MAAM;;4CAID,MAAM;CAuBzB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TCustomModalControls } from '../types/index.types';
|
|
2
|
+
interface UseModalProps {
|
|
3
|
+
resetOptionsRelatedState: () => void;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modalControls?: TCustomModalControls;
|
|
6
|
+
}
|
|
7
|
+
export declare const useModal: ({ resetOptionsRelatedState, disabled, modalControls, }: UseModalProps) => {
|
|
8
|
+
isVisible: boolean;
|
|
9
|
+
openModal: () => void;
|
|
10
|
+
closeModal: () => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=use-modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-modal.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-modal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,UAAU,aAAa;IACrB,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,eAAO,MAAM,QAAQ,2DAIlB,aAAa;;;;CAyBf,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TFlatList, TSectionList } from '../types/index.types';
|
|
2
|
+
interface UseSearchProps {
|
|
3
|
+
initialOptions: TFlatList | TSectionList;
|
|
4
|
+
optionLabel: string;
|
|
5
|
+
optionValue: string;
|
|
6
|
+
searchCallback: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useSearch: ({ initialOptions, optionLabel, optionValue, searchCallback, }: UseSearchProps) => {
|
|
9
|
+
searchValue: string;
|
|
10
|
+
setSearchValue: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
11
|
+
filteredOptions: TFlatList | TSectionList;
|
|
12
|
+
setFilteredOptions: import("react").Dispatch<import("react").SetStateAction<TFlatList | TSectionList>>;
|
|
13
|
+
isSectionList: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=use-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EAGb,MAAM,sBAAsB,CAAC;AAG9B,UAAU,cAAc;IACtB,cAAc,EAAE,SAAS,GAAG,YAAY,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,SAAS,kEAKnB,cAAc;;;;;;CAyEhB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TFlatListItem, TSelectedItem } from '../types/index.types';
|
|
2
|
+
interface UseCheckSelectAllProps {
|
|
3
|
+
options: TFlatListItem[];
|
|
4
|
+
selectedItems: TSelectedItem[];
|
|
5
|
+
isMultiple: boolean;
|
|
6
|
+
onValueChange: (selectedValues: TSelectedItem[]) => void;
|
|
7
|
+
listControls?: {
|
|
8
|
+
selectAllCallback?: () => void;
|
|
9
|
+
unselectAllCallback?: () => void;
|
|
10
|
+
};
|
|
11
|
+
optionValue: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const useSelectAll: ({ options, selectedItems, isMultiple, onValueChange, listControls, optionValue, }: UseCheckSelectAllProps) => {
|
|
14
|
+
selectAll: boolean;
|
|
15
|
+
handleSelectAll: () => void;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=use-select-all.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-select-all.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-select-all.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGpE,UAAU,sBAAsB;IAC9B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACzD,YAAY,CAAC,EAAE;QACb,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;QAC/B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;KAClC,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,sFAOtB,sBAAsB;;;CAuDxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TSelectedItem } from '../types/index.types';
|
|
2
|
+
interface UseSelectionHandlerProps {
|
|
3
|
+
initialSelectedValue: TSelectedItem | TSelectedItem[];
|
|
4
|
+
isMultiple: boolean;
|
|
5
|
+
maxSelectableItems?: number;
|
|
6
|
+
onValueChange: (selectedItems: TSelectedItem | TSelectedItem[]) => void;
|
|
7
|
+
closeModal: () => void;
|
|
8
|
+
autoCloseOnSelect: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const useSelectionHandler: ({ initialSelectedValue, isMultiple, maxSelectableItems, onValueChange, closeModal, autoCloseOnSelect, }: UseSelectionHandlerProps) => {
|
|
11
|
+
selectedItem: TSelectedItem;
|
|
12
|
+
selectedItems: TSelectedItem[];
|
|
13
|
+
handleSingleSelection: (value: TSelectedItem) => void;
|
|
14
|
+
handleMultipleSelections: (value: TSelectedItem) => void;
|
|
15
|
+
setSelectedItems: import("react").Dispatch<import("react").SetStateAction<TSelectedItem[]>>;
|
|
16
|
+
setSelectedItem: import("react").Dispatch<import("react").SetStateAction<TSelectedItem>>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=use-selection-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-selection-handler.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-selection-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,UAAU,wBAAwB;IAChC,oBAAoB,EAAE,aAAa,GAAG,aAAa,EAAE,CAAC;IACtD,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,EAAE,KAAK,IAAI,CAAC;IACxE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,mBAAmB,4GAO7B,wBAAwB;;;mCAUf,aAAa;sCAiBb,aAAa;;;CAkCxB,CAAC"}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const DropdownSelect: React.
|
|
2
|
+
import type { DropdownSelectHandle } from './types/index.types';
|
|
3
|
+
export declare const DropdownSelect: React.ForwardRefExoticComponent<import("./types/index.types").CommonDropdownProps & import("./types/index.types").TDropdownInputProps & {
|
|
4
|
+
searchControls?: {
|
|
5
|
+
textInputStyle?: import("react-native").ViewStyle | import("react-native").TextStyle;
|
|
6
|
+
textInputContainerStyle?: import("react-native").ViewStyle;
|
|
7
|
+
textInputProps?: import("react-native").TextInputProps;
|
|
8
|
+
searchCallback?: (value: string) => void;
|
|
9
|
+
};
|
|
10
|
+
checkboxControls?: import("./types/index.types").TCheckboxControls;
|
|
11
|
+
modalControls?: import("./types/index.types").TCustomModalControls;
|
|
12
|
+
listControls?: {
|
|
13
|
+
selectAllText?: string;
|
|
14
|
+
unselectAllText?: string;
|
|
15
|
+
selectAllCallback?: () => void;
|
|
16
|
+
unselectAllCallback?: () => void;
|
|
17
|
+
hideSelectAll?: boolean;
|
|
18
|
+
emptyListMessage?: string;
|
|
19
|
+
};
|
|
20
|
+
} & import("./types/index.types").TListProps & React.RefAttributes<DropdownSelectHandle>>;
|
|
4
21
|
export default DropdownSelect;
|
|
5
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAEV,oBAAoB,EAErB,MAAM,qBAAqB,CAAC;AAU7B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;yFA6Q1B,CAAC;AASF,eAAe,cAAc,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewStyle, ColorValue, TextStyle, ModalProps, TextInputProps } from 'react-native';
|
|
3
|
-
export type DropdownProps = CommonDropdownProps & TDropdownInputProps &
|
|
3
|
+
export type DropdownProps = CommonDropdownProps & TDropdownInputProps & TControls & TListProps;
|
|
4
4
|
export type CommonDropdownProps = {
|
|
5
5
|
testID?: string;
|
|
6
6
|
label?: string;
|
|
7
7
|
options: TFlatList | TSectionList;
|
|
8
8
|
optionLabel?: string;
|
|
9
9
|
optionValue?: string;
|
|
10
|
-
onValueChange:
|
|
11
|
-
selectedValue
|
|
10
|
+
onValueChange: (selectedItems: TSelectedItem | TSelectedItem[]) => void;
|
|
11
|
+
selectedValue: TSelectedItem | TSelectedItem[];
|
|
12
12
|
autoCloseOnSelect?: boolean;
|
|
13
|
+
maxSelectableItems?: number;
|
|
13
14
|
};
|
|
14
15
|
export type TDropdownInputProps = {
|
|
15
16
|
placeholder?: string;
|
|
@@ -30,59 +31,33 @@ export type TDropdownInputProps = {
|
|
|
30
31
|
primaryColor?: ColorValue;
|
|
31
32
|
disabled?: boolean;
|
|
32
33
|
placeholderStyle?: TextStyle;
|
|
33
|
-
hideModal?: boolean;
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
type TControls = {
|
|
36
|
+
searchControls?: TSearchControls;
|
|
37
|
+
checkboxControls?: TCheckboxControls;
|
|
38
|
+
modalControls?: TCustomModalControls;
|
|
39
|
+
listControls?: TListControls;
|
|
40
|
+
};
|
|
41
|
+
type TSearchControls = {
|
|
42
|
+
textInputStyle?: ViewStyle | TextStyle;
|
|
43
|
+
textInputContainerStyle?: ViewStyle;
|
|
44
|
+
textInputProps?: TextInputProps;
|
|
45
|
+
searchCallback?: (value: string) => void;
|
|
44
46
|
};
|
|
45
47
|
export type TCheckboxControls = {
|
|
46
|
-
/** @deprecated Use `checkboxControls = {{checkboxSize: number }}` instead.*/
|
|
47
48
|
checkboxSize?: number;
|
|
48
|
-
/** @deprecated Use `checkboxControls = {{checkboxStyle: ViewStyle }}` instead.*/
|
|
49
49
|
checkboxStyle?: ViewStyle;
|
|
50
|
-
/** @deprecated Use `checkboxControls = {{checkboxLabelStyle: TextStyle }}` instead.*/
|
|
51
50
|
checkboxLabelStyle?: TextStyle;
|
|
52
|
-
/** @deprecated Use `checkboxControls` instead.*/
|
|
53
|
-
checkboxComponentStyles?: {
|
|
54
|
-
checkboxSize?: number;
|
|
55
|
-
checkboxStyle?: ViewStyle;
|
|
56
|
-
checkboxLabelStyle?: TextStyle;
|
|
57
|
-
};
|
|
58
|
-
/** @deprecated Use `checkboxControls = {{checkboxComponent: <View></View> }}` instead.*/
|
|
59
51
|
checkboxComponent?: React.ReactNode;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
checkboxStyle?: ViewStyle;
|
|
63
|
-
checkboxLabelStyle?: TextStyle;
|
|
64
|
-
checkboxComponent?: React.ReactNode;
|
|
65
|
-
checkboxDisabledStyle?: ViewStyle;
|
|
66
|
-
checkboxUnselectedColor?: ColorValue;
|
|
67
|
-
};
|
|
52
|
+
checkboxDisabledStyle?: ViewStyle;
|
|
53
|
+
checkboxUnselectedColor?: ColorValue;
|
|
68
54
|
};
|
|
69
55
|
export type TCustomModalControls = {
|
|
70
|
-
/** @deprecated Use `modalControls = {{modalBackgroundStyle: ViewStyle}} instead.*/
|
|
71
56
|
modalBackgroundStyle?: ViewStyle;
|
|
72
|
-
/** @deprecated Use `modalControls = {{ modalOptionsContainerStyle: ViewStyle}} instead.*/
|
|
73
57
|
modalOptionsContainerStyle?: ViewStyle;
|
|
74
|
-
/** @deprecated Use `modalControls = {{modalProps: ModalProps }}` instead.*/
|
|
75
58
|
modalProps?: ModalProps;
|
|
76
|
-
modalControls?: {
|
|
77
|
-
modalBackgroundStyle?: ViewStyle;
|
|
78
|
-
modalOptionsContainerStyle?: ViewStyle;
|
|
79
|
-
modalProps?: ModalProps & TCloseModal;
|
|
80
|
-
};
|
|
81
|
-
} & TCloseModal;
|
|
82
|
-
type TCloseModal = {
|
|
83
|
-
closeModal?: () => void;
|
|
84
59
|
};
|
|
85
|
-
export type
|
|
60
|
+
export type TListProps = {
|
|
86
61
|
listHeaderComponent?: React.ReactNode;
|
|
87
62
|
listFooterComponent?: React.ReactNode;
|
|
88
63
|
listComponentStyles?: {
|
|
@@ -91,24 +66,29 @@ export type TListControls = {
|
|
|
91
66
|
sectionHeaderStyle?: TextStyle;
|
|
92
67
|
};
|
|
93
68
|
listEmptyComponent?: React.ReactNode;
|
|
94
|
-
listControls?: {
|
|
95
|
-
selectAllText?: string;
|
|
96
|
-
unselectAllText?: string;
|
|
97
|
-
selectAllCallback?: () => void;
|
|
98
|
-
unselectAllCallback?: () => void;
|
|
99
|
-
hideSelectAll?: boolean;
|
|
100
|
-
emptyListMessage?: string;
|
|
101
|
-
};
|
|
102
69
|
};
|
|
103
|
-
|
|
70
|
+
type TListControls = {
|
|
71
|
+
selectAllText?: string;
|
|
72
|
+
unselectAllText?: string;
|
|
73
|
+
selectAllCallback?: () => void;
|
|
74
|
+
unselectAllCallback?: () => void;
|
|
75
|
+
hideSelectAll?: boolean;
|
|
76
|
+
emptyListMessage?: string;
|
|
77
|
+
};
|
|
78
|
+
export type TSelectedItem = string | number | boolean | undefined;
|
|
79
|
+
export type TSelectedItemWithReactComponent = TSelectedItem | React.ReactElement;
|
|
104
80
|
export type TFlatList = TFlatListItem[];
|
|
105
81
|
export type TFlatListItem = {
|
|
106
|
-
[key: string]:
|
|
82
|
+
[key: string]: TSelectedItemWithReactComponent;
|
|
107
83
|
};
|
|
108
84
|
export type TSectionList = TSectionListItem[];
|
|
109
85
|
export type TSectionListItem = {
|
|
110
86
|
title: string;
|
|
111
87
|
data: TFlatList;
|
|
112
88
|
};
|
|
89
|
+
export interface DropdownSelectHandle {
|
|
90
|
+
open: () => void;
|
|
91
|
+
close: () => void;
|
|
92
|
+
}
|
|
113
93
|
export {};
|
|
114
94
|
//# sourceMappingURL=index.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../../../src/types/index.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAC7C,mBAAmB,GACnB,
|
|
1
|
+
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../../../src/types/index.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
1
|
+
import { TSelectedItem } from '../types/index.types';
|
|
2
|
+
import { TFlatList, TFlatListItem, TSectionList, TSelectedItemWithReactComponent } from '../types/index.types';
|
|
4
3
|
export declare const extractPropertyFromArray: (arr: any[], property: string) => any[];
|
|
5
4
|
export declare const escapeRegExp: (text: string) => string;
|
|
5
|
+
export declare const removeDisabledItems: (items: TFlatList) => TFlatListItem[];
|
|
6
|
+
export declare const isSectionList: (options: TFlatList | TSectionList) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @description get the labels of the items that were selected from the options array for either multiple or single selections
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare const getLabelsOfSelectedItems: ({ isMultiple, optionLabel, optionValue, selectedItem, selectedItems, modifiedOptions, }: {
|
|
13
|
+
isMultiple: boolean;
|
|
14
|
+
optionLabel: string;
|
|
15
|
+
optionValue: string;
|
|
16
|
+
selectedItem: TSelectedItem;
|
|
17
|
+
selectedItems: TSelectedItem[];
|
|
18
|
+
modifiedOptions: TFlatList;
|
|
19
|
+
}) => TSelectedItemWithReactComponent | TSelectedItemWithReactComponent[];
|
|
6
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,wBAAwB,QAAS,GAAG,EAAE,YAAY,MAAM,UAIpE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,WAExC,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAAW,SAAS,oBAEnD,CAAC;AAEF,eAAO,MAAM,aAAa,YAAa,SAAS,GAAG,YAAY,KAAG,OAIjE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,4FAOlC;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,eAAe,EAAE,SAAS,CAAC;CAC5B,wEAsBA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-input-select",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A customizable dropdown selection package for react-native for android and iOS with multiple select and search capabilities.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"@types/react": "18.3.2",
|
|
69
69
|
"@types/react-native": "^0.73.0",
|
|
70
70
|
"commitlint": "^19.3.0",
|
|
71
|
-
"eslint": "^
|
|
72
|
-
"eslint-config-prettier": "^
|
|
73
|
-
"eslint-plugin-prettier": "^
|
|
71
|
+
"eslint": "^7.2.0",
|
|
72
|
+
"eslint-config-prettier": "^7.0.0",
|
|
73
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
74
74
|
"husky": "^9.0.11",
|
|
75
75
|
"jest": "^29.7.0",
|
|
76
76
|
"metro-react-native-babel-preset": "^0.77.0",
|
|
77
77
|
"pod-install": "^0.2.2",
|
|
78
|
-
"prettier": "^
|
|
78
|
+
"prettier": "^2.0.5",
|
|
79
79
|
"react": "^18.3.1",
|
|
80
80
|
"react-native": "^0.74.1",
|
|
81
81
|
"react-native-builder-bob": "^0.23.2",
|
|
@@ -92,7 +92,19 @@
|
|
|
92
92
|
"modulePathIgnorePatterns": [
|
|
93
93
|
"<rootDir>/example/node_modules",
|
|
94
94
|
"<rootDir>/lib/"
|
|
95
|
-
]
|
|
95
|
+
],
|
|
96
|
+
"coverageReporters": [
|
|
97
|
+
"html",
|
|
98
|
+
"text"
|
|
99
|
+
],
|
|
100
|
+
"coverageThreshold": {
|
|
101
|
+
"global": {
|
|
102
|
+
"branches": 94,
|
|
103
|
+
"functions": 94,
|
|
104
|
+
"lines": 94,
|
|
105
|
+
"statements": 94
|
|
106
|
+
}
|
|
107
|
+
}
|
|
96
108
|
},
|
|
97
109
|
"commitlint": {
|
|
98
110
|
"extends": [
|
|
@@ -120,7 +132,9 @@
|
|
|
120
132
|
},
|
|
121
133
|
"eslintIgnore": [
|
|
122
134
|
"node_modules/",
|
|
123
|
-
"lib/"
|
|
135
|
+
"lib/",
|
|
136
|
+
"coverage/",
|
|
137
|
+
"src/__tests__/**"
|
|
124
138
|
],
|
|
125
139
|
"prettier": {
|
|
126
140
|
"quoteProps": "consistent",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorValue } from 'react-native';
|
|
2
|
-
import { TCheckboxControls } from '
|
|
2
|
+
import { TCheckboxControls } from '../../types/index.types';
|
|
3
3
|
|
|
4
4
|
export type CheckboxProps = {
|
|
5
5
|
label?: string;
|
|
@@ -7,4 +7,4 @@ export type CheckboxProps = {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
primaryColor?: ColorValue;
|
|
9
9
|
onChange?: (value: boolean | string | number) => void;
|
|
10
|
-
} & TCheckboxControls;
|
|
10
|
+
} & { checkboxControls?: TCheckboxControls };
|
|
@@ -2,85 +2,61 @@ import React from 'react';
|
|
|
2
2
|
import { Pressable, Text, StyleSheet, Image, View } from 'react-native';
|
|
3
3
|
import { colors } from '../../styles/colors';
|
|
4
4
|
import { CHECKBOX_SIZE } from '../../constants';
|
|
5
|
-
import
|
|
5
|
+
import { CheckboxProps } from './checkbox.types';
|
|
6
6
|
|
|
7
7
|
const CheckBox = ({
|
|
8
8
|
label,
|
|
9
9
|
value,
|
|
10
10
|
disabled,
|
|
11
11
|
primaryColor,
|
|
12
|
-
checkboxSize,
|
|
13
|
-
checkboxStyle,
|
|
14
|
-
checkboxLabelStyle,
|
|
15
|
-
checkboxComponentStyles,
|
|
16
|
-
checkboxComponent,
|
|
17
12
|
checkboxControls,
|
|
18
13
|
onChange,
|
|
19
14
|
}: CheckboxProps) => {
|
|
15
|
+
const {
|
|
16
|
+
checkboxSize,
|
|
17
|
+
checkboxComponent,
|
|
18
|
+
checkboxDisabledStyle,
|
|
19
|
+
checkboxStyle,
|
|
20
|
+
checkboxUnselectedColor,
|
|
21
|
+
checkboxLabelStyle,
|
|
22
|
+
} = checkboxControls ?? {};
|
|
23
|
+
|
|
20
24
|
const fillColor = {
|
|
21
25
|
backgroundColor: disabled
|
|
22
|
-
?
|
|
23
|
-
colors.disabled
|
|
26
|
+
? checkboxDisabledStyle?.backgroundColor || colors.disabled
|
|
24
27
|
: value
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
checkboxStyle?.backgroundColor ||
|
|
28
|
-
primaryColor
|
|
29
|
-
: checkboxControls?.checkboxUnselectedColor || 'white',
|
|
28
|
+
? checkboxStyle?.backgroundColor || primaryColor
|
|
29
|
+
: checkboxUnselectedColor || 'white',
|
|
30
30
|
borderColor: disabled
|
|
31
|
-
?
|
|
32
|
-
:
|
|
33
|
-
checkboxComponentStyles?.checkboxStyle?.borderColor ||
|
|
34
|
-
checkboxStyle?.borderColor ||
|
|
35
|
-
styles.checkbox.borderColor,
|
|
31
|
+
? checkboxDisabledStyle?.borderColor || colors.disabled
|
|
32
|
+
: checkboxStyle?.borderColor || styles.checkbox.borderColor,
|
|
36
33
|
};
|
|
37
|
-
|
|
34
|
+
label = typeof label === 'object' ? label : String(label);
|
|
38
35
|
return (
|
|
39
36
|
<Pressable
|
|
40
37
|
onPress={onChange ? () => onChange(!value) : null}
|
|
41
38
|
style={[styles.checkboxContainer]}
|
|
42
39
|
disabled={disabled}
|
|
40
|
+
aria-label={typeof label === 'string' ? label : ''}
|
|
43
41
|
>
|
|
44
42
|
<View
|
|
45
|
-
style={[
|
|
46
|
-
|
|
47
|
-
checkboxControls?.checkboxStyle ||
|
|
48
|
-
checkboxComponentStyles?.checkboxStyle ||
|
|
49
|
-
checkboxStyle,
|
|
50
|
-
fillColor,
|
|
51
|
-
]}
|
|
43
|
+
style={[styles.checkbox, checkboxStyle, fillColor]}
|
|
44
|
+
aria-checked={value}
|
|
52
45
|
>
|
|
53
|
-
{
|
|
46
|
+
{checkboxComponent || (
|
|
54
47
|
<Image
|
|
55
48
|
source={require('../../asset/check.png')}
|
|
56
49
|
style={[
|
|
57
50
|
{
|
|
58
|
-
height:
|
|
59
|
-
|
|
60
|
-
checkboxComponentStyles?.checkboxSize ||
|
|
61
|
-
checkboxSize ||
|
|
62
|
-
CHECKBOX_SIZE,
|
|
63
|
-
width:
|
|
64
|
-
checkboxControls?.checkboxSize ||
|
|
65
|
-
checkboxComponentStyles?.checkboxSize ||
|
|
66
|
-
checkboxSize ||
|
|
67
|
-
CHECKBOX_SIZE,
|
|
51
|
+
height: checkboxSize || CHECKBOX_SIZE,
|
|
52
|
+
width: checkboxSize || CHECKBOX_SIZE,
|
|
68
53
|
},
|
|
69
54
|
]}
|
|
70
55
|
/>
|
|
71
56
|
)}
|
|
72
57
|
</View>
|
|
73
58
|
{label && label !== '' && (
|
|
74
|
-
<Text
|
|
75
|
-
style={[
|
|
76
|
-
checkboxControls?.checkboxLabelStyle ||
|
|
77
|
-
checkboxComponentStyles?.checkboxLabelStyle ||
|
|
78
|
-
checkboxLabelStyle,
|
|
79
|
-
styles.labelStyle,
|
|
80
|
-
]}
|
|
81
|
-
>
|
|
82
|
-
{label}
|
|
83
|
-
</Text>
|
|
59
|
+
<Text style={[checkboxLabelStyle, styles.labelStyle]}>{label}</Text>
|
|
84
60
|
)}
|
|
85
61
|
</Pressable>
|
|
86
62
|
);
|