react-native-input-select 0.21.0 → 0.23.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 +19 -8
- package/lib/commonjs/components/CheckBox/index.js +1 -7
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CheckBox/types.js.map +1 -1
- package/lib/commonjs/components/CustomModal/index.js +0 -7
- package/lib/commonjs/components/CustomModal/index.js.map +1 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js +0 -9
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownList.js +0 -9
- package/lib/commonjs/components/Dropdown/DropdownList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +2 -13
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/SelectedItemsView.js +7 -12
- package/lib/commonjs/components/Dropdown/SelectedItemsView.js.map +1 -1
- package/lib/commonjs/components/Input/index.js +1 -10
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/index.js +9 -33
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/styles/colors.js.map +1 -1
- package/lib/commonjs/styles/input.js +0 -4
- package/lib/commonjs/styles/input.js.map +1 -1
- package/lib/commonjs/styles/typography.js +0 -3
- package/lib/commonjs/styles/typography.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/module/components/CheckBox/index.js +0 -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/CustomModal/index.js +0 -2
- package/lib/module/components/CustomModal/index.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +0 -2
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownList.js +0 -3
- package/lib/module/components/Dropdown/DropdownList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +2 -4
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/SelectedItemsView.js +7 -6
- package/lib/module/components/Dropdown/SelectedItemsView.js.map +1 -1
- package/lib/module/components/Input/index.js +1 -2
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/index.js +9 -21
- package/lib/module/index.js.map +1 -1
- package/lib/module/styles/colors.js.map +1 -1
- package/lib/module/styles/input.js.map +1 -1
- package/lib/module/styles/typography.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/typescript/components/CheckBox/types.d.ts +1 -1
- package/lib/typescript/types/index.types.d.ts +1 -1
- package/package.json +1 -1
package/lib/commonjs/index.js
CHANGED
|
@@ -4,29 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.DropdownSelect = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _Dropdown = _interopRequireDefault(require("./components/Dropdown/Dropdown"));
|
|
11
|
-
|
|
12
9
|
var _DropdownList = _interopRequireDefault(require("./components/Dropdown/DropdownList"));
|
|
13
|
-
|
|
14
10
|
var _CustomModal = _interopRequireDefault(require("./components/CustomModal"));
|
|
15
|
-
|
|
16
11
|
var _constants = require("./constants");
|
|
17
|
-
|
|
18
12
|
var _Input = require("./components/Input");
|
|
19
|
-
|
|
20
13
|
var _colors = require("./styles/colors");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
|
-
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
30
18
|
const DropdownSelect = _ref => {
|
|
31
19
|
let {
|
|
32
20
|
placeholder,
|
|
@@ -61,84 +49,73 @@ const DropdownSelect = _ref => {
|
|
|
61
49
|
const [newOptions, setNewOptions] = (0, _react.useState)(options ? options : []);
|
|
62
50
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
63
51
|
const [selectedItem, setSelectedItem] = (0, _react.useState)(selectedValue); //for single selection
|
|
64
|
-
|
|
65
52
|
const [selectedItems, setSelectedItems] = (0, _react.useState)(Array.isArray(selectedValue) ? selectedValue : selectedValue === '' || selectedValue === undefined ? [] : [selectedValue]); //for multiple selection
|
|
66
|
-
|
|
67
53
|
const [searchValue, setSearchValue] = (0, _react.useState)('');
|
|
54
|
+
|
|
68
55
|
/*===========================================
|
|
69
56
|
* Selection handlers
|
|
70
57
|
*==========================================*/
|
|
71
|
-
|
|
72
58
|
const handleSingleSelection = value => {
|
|
73
59
|
if (selectedItem === value) {
|
|
74
60
|
setSelectedItem(null);
|
|
75
61
|
} else {
|
|
76
62
|
setSelectedItem(value);
|
|
77
63
|
onValueChange(value); //send value to parent
|
|
78
|
-
|
|
79
64
|
setOpen(false); //close modal upon selection
|
|
80
65
|
}
|
|
81
66
|
};
|
|
82
67
|
|
|
83
68
|
const handleMultipleSelections = value => {
|
|
84
69
|
let selectedValues = [...selectedItems];
|
|
85
|
-
|
|
86
70
|
if (selectedValues.includes(value)) {
|
|
87
71
|
selectedValues = selectedValues.filter(item => item !== value);
|
|
88
72
|
} else {
|
|
89
73
|
selectedValues.push(value);
|
|
90
74
|
}
|
|
91
|
-
|
|
92
75
|
setSelectedItems(selectedValues);
|
|
93
76
|
onValueChange(selectedValues); //send value to parent
|
|
94
77
|
};
|
|
78
|
+
|
|
95
79
|
/*===========================================
|
|
96
80
|
* Get label handler
|
|
97
81
|
*==========================================*/
|
|
98
|
-
|
|
99
|
-
|
|
100
82
|
const getSelectedItemsLabel = () => {
|
|
101
83
|
if (isMultiple) {
|
|
102
84
|
let selectedLabels = [];
|
|
103
85
|
selectedItems && selectedItems.forEach(element => {
|
|
104
86
|
var _options$find;
|
|
105
|
-
|
|
106
|
-
let selectedItemLabel = options && ((_options$find = options.find(item => item[optionValue !== null && optionValue !== void 0 ? optionValue : _constants.DEFAULT_OPTION_VALUE] === element)) === null || _options$find === void 0 ? void 0 : _options$find[optionLabel]);
|
|
87
|
+
let selectedItemLabel = options && ((_options$find = options.find(item => item[optionValue ?? _constants.DEFAULT_OPTION_VALUE] === element)) === null || _options$find === void 0 ? void 0 : _options$find[optionLabel]);
|
|
107
88
|
selectedLabels.push(selectedItemLabel);
|
|
108
89
|
});
|
|
109
90
|
return selectedLabels;
|
|
110
91
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return selectedItemLabel === null || selectedItemLabel === void 0 ? void 0 : selectedItemLabel[optionLabel !== null && optionLabel !== void 0 ? optionLabel : _constants.DEFAULT_OPTION_LABEL];
|
|
92
|
+
let selectedItemLabel = options && options.find(item => item[optionValue ?? _constants.DEFAULT_OPTION_VALUE] === selectedItem);
|
|
93
|
+
return selectedItemLabel === null || selectedItemLabel === void 0 ? void 0 : selectedItemLabel[optionLabel ?? _constants.DEFAULT_OPTION_LABEL];
|
|
114
94
|
};
|
|
95
|
+
|
|
115
96
|
/*===========================================
|
|
116
97
|
* Search
|
|
117
98
|
*==========================================*/
|
|
118
|
-
|
|
119
|
-
|
|
120
99
|
const onSearch = value => {
|
|
121
100
|
setSearchValue(value);
|
|
122
101
|
let searchText = value.toString().toLocaleLowerCase().trim();
|
|
123
102
|
const regexFilter = new RegExp(searchText, 'i');
|
|
124
103
|
const searchResults = options.filter(item => {
|
|
125
|
-
if (item[optionLabel
|
|
104
|
+
if (item[optionLabel ?? _constants.DEFAULT_OPTION_LABEL].toString().toLowerCase().search(regexFilter) !== -1 || item[optionValue ?? _constants.DEFAULT_OPTION_VALUE].toString(regexFilter).toLowerCase().search(regexFilter) !== -1) {
|
|
126
105
|
return item;
|
|
127
106
|
}
|
|
128
107
|
});
|
|
129
108
|
setNewOptions(searchResults);
|
|
130
109
|
};
|
|
110
|
+
|
|
131
111
|
/*===========================================
|
|
132
112
|
* Modal
|
|
133
113
|
*==========================================*/
|
|
134
|
-
|
|
135
|
-
|
|
136
114
|
const handleToggleModal = () => {
|
|
137
115
|
setOpen(!open);
|
|
138
116
|
setSearchValue('');
|
|
139
117
|
setNewOptions(options);
|
|
140
118
|
};
|
|
141
|
-
|
|
142
119
|
let primary = primaryColor || _colors.colors.gray;
|
|
143
120
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({
|
|
144
121
|
label: label,
|
|
@@ -186,7 +163,6 @@ const DropdownSelect = _ref => {
|
|
|
186
163
|
checkboxLabelStyle: checkboxLabelStyle
|
|
187
164
|
})));
|
|
188
165
|
};
|
|
189
|
-
|
|
190
166
|
exports.DropdownSelect = DropdownSelect;
|
|
191
167
|
var _default = DropdownSelect;
|
|
192
168
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["DropdownSelect","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","labelStyle","dropdownStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainer","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","rest","newOptions","setNewOptions","open","setOpen","selectedItem","setSelectedItem","selectedItems","setSelectedItems","Array","isArray","undefined","searchValue","setSearchValue","handleSingleSelection","value","handleMultipleSelections","selectedValues","includes","filter","item","push","getSelectedItemsLabel","selectedLabels","forEach","element","selectedItemLabel","find","DEFAULT_OPTION_VALUE","DEFAULT_OPTION_LABEL","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","toLowerCase","search","handleToggleModal","primary","colors","gray","text"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEO,MAAMA,cAAc,GAAG,QA6BT;AAAA,MA7BU;AAC7BC,IAAAA,WAD6B;AAE7BC,IAAAA,KAF6B;AAG7BC,IAAAA,KAH6B;AAI7BC,IAAAA,UAJ6B;AAK7BC,IAAAA,OAL6B;AAM7BC,IAAAA,WAN6B;AAO7BC,IAAAA,WAP6B;AAQ7BC,IAAAA,aAR6B;AAS7BC,IAAAA,aAT6B;AAU7BC,IAAAA,UAV6B;AAW7BC,IAAAA,YAX6B;AAY7BC,I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,IAAA,kBAAkB,EAAEC;AAZtB,IAfF,CAvBF,CADF;AAwDD,CA7LM;;;eA+LQ3B,c","sourcesContent":["import React, { useState } from 'react';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownList from './components/Dropdown/DropdownList';\nimport CustomModal from './components/CustomModal';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type { DropdownProps } from './types/index.types';\nimport { Input } from './components/Input';\nimport { colors } from './styles/colors';\n\nexport const DropdownSelect = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainer,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n ...rest\n}: DropdownProps) => {\n const [newOptions, setNewOptions] = useState(options ? options : []);\n const [open, setOpen] = useState(false);\n const [selectedItem, setSelectedItem] = useState(selectedValue); //for single selection\n const [selectedItems, setSelectedItems] = useState(\n Array.isArray(selectedValue)\n ? selectedValue\n : selectedValue === '' || selectedValue === undefined\n ? []\n : [selectedValue]\n ); //for multiple selection\n const [searchValue, setSearchValue] = useState('');\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: any) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: any) => {\n let selectedValues = [...selectedItems];\n\n if (selectedValues.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n };\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple) {\n let selectedLabels: Array<string> = [];\n selectedItems &&\n selectedItems.forEach((element) => {\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === element\n )?.[optionLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === selectedItem\n );\n return selectedItemLabel?.[optionLabel ?? DEFAULT_OPTION_LABEL];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n const searchResults = options.filter((item: any) => {\n if (\n item[optionLabel ?? DEFAULT_OPTION_LABEL]\n .toString()\n .toLowerCase()\n .search(regexFilter) !== -1 ||\n item[optionValue ?? DEFAULT_OPTION_VALUE]\n .toString(regexFilter)\n .toLowerCase()\n .search(regexFilter) !== -1\n ) {\n return item;\n }\n });\n\n setNewOptions(searchResults);\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n };\n\n let primary = primaryColor || colors.gray;\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownStyle={dropdownStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainer={modalOptionsContainer}\n onRequestClose={() => {}}\n >\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n <DropdownList\n options={newOptions}\n optionLabel={optionLabel}\n optionValue={optionValue}\n isMultiple={isMultiple}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </CustomModal>\n </>\n );\n};\n\nexport default DropdownSelect;\n"]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_Dropdown","_interopRequireDefault","_DropdownList","_CustomModal","_constants","_Input","_colors","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownSelect","_ref","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","labelStyle","dropdownStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainer","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","rest","newOptions","setNewOptions","useState","open","setOpen","selectedItem","setSelectedItem","selectedItems","setSelectedItems","Array","isArray","undefined","searchValue","setSearchValue","handleSingleSelection","value","handleMultipleSelections","selectedValues","includes","filter","item","push","getSelectedItemsLabel","selectedLabels","forEach","element","_options$find","selectedItemLabel","find","DEFAULT_OPTION_VALUE","DEFAULT_OPTION_LABEL","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","toLowerCase","search","handleToggleModal","primary","colors","gray","createElement","Fragment","onRequestClose","Input","onChangeText","text","style","exports","_default"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownList from './components/Dropdown/DropdownList';\nimport CustomModal from './components/CustomModal';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type { DropdownProps } from './types/index.types';\nimport { Input } from './components/Input';\nimport { colors } from './styles/colors';\n\nexport const DropdownSelect = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainer,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n ...rest\n}: DropdownProps) => {\n const [newOptions, setNewOptions] = useState(options ? options : []);\n const [open, setOpen] = useState(false);\n const [selectedItem, setSelectedItem] = useState(selectedValue); //for single selection\n const [selectedItems, setSelectedItems] = useState(\n Array.isArray(selectedValue)\n ? selectedValue\n : selectedValue === '' || selectedValue === undefined\n ? []\n : [selectedValue]\n ); //for multiple selection\n const [searchValue, setSearchValue] = useState('');\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: any) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: any) => {\n let selectedValues = [...selectedItems];\n\n if (selectedValues.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n };\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple) {\n let selectedLabels: Array<string> = [];\n selectedItems &&\n selectedItems.forEach((element) => {\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === element\n )?.[optionLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel =\n options &&\n options.find(\n (item: any) =>\n item[optionValue ?? DEFAULT_OPTION_VALUE] === selectedItem\n );\n return selectedItemLabel?.[optionLabel ?? DEFAULT_OPTION_LABEL];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n const searchResults = options.filter((item: any) => {\n if (\n item[optionLabel ?? DEFAULT_OPTION_LABEL]\n .toString()\n .toLowerCase()\n .search(regexFilter) !== -1 ||\n item[optionValue ?? DEFAULT_OPTION_VALUE]\n .toString(regexFilter)\n .toLowerCase()\n .search(regexFilter) !== -1\n ) {\n return item;\n }\n });\n\n setNewOptions(searchResults);\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n };\n\n let primary = primaryColor || colors.gray;\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownStyle={dropdownStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainer={modalOptionsContainer}\n onRequestClose={() => {}}\n >\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n <DropdownList\n options={newOptions}\n optionLabel={optionLabel}\n optionValue={optionValue}\n isMultiple={isMultiple}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </CustomModal>\n </>\n );\n};\n\nexport default DropdownSelect;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,YAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAAyC,SAAAE,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAb,wBAAAS,GAAA,EAAAI,WAAA,SAAAA,WAAA,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AC3BW,wBAAwB,EAAEA,wBAAyB;IACnDF,qBAAqB,EAAEA,qBAAsB;IAC7CpB,YAAY,EAAEgD,OAAQ;IACtB9C,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACU,CACb;AAEP,CAAC;AAACsD,OAAA,CAAAlF,cAAA,GAAAA,cAAA;AAAA,IAAAmF,QAAA,GAEanF,cAAc;AAAAkF,OAAA,CAAA/G,OAAA,GAAAgH,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["colors","primary","red","black","white","dark","gray","lightGray","exports"],"sources":["colors.ts"],"sourcesContent":["export const colors: any = {\n primary: '#EF8031',\n red: '#FA4169',\n black: '#000000',\n white: '#FFFFFF',\n dark: '#11142D',\n gray: '#808191',\n lightGray: '#F7F7F7',\n};\n"],"mappings":";;;;;;AAAO,MAAMA,MAAW,GAAG;EACzBC,OAAO,EAAE,SAAS;EAClBC,GAAG,EAAE,SAAS;EACdC,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE,SAAS;EACfC,IAAI,EAAE,SAAS;EACfC,SAAS,EAAE;AACb,CAAC;AAACC,OAAA,CAAAR,MAAA,GAAAA,MAAA"}
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.inputStyles = void 0;
|
|
7
|
-
|
|
8
7
|
var _reactNative = require("react-native");
|
|
9
|
-
|
|
10
8
|
var _colors = require("./colors");
|
|
11
|
-
|
|
12
9
|
const inputStyles = _reactNative.StyleSheet.create({
|
|
13
10
|
input: {
|
|
14
11
|
paddingVertical: 18,
|
|
@@ -32,6 +29,5 @@ const inputStyles = _reactNative.StyleSheet.create({
|
|
|
32
29
|
borderColor: _colors.colors.primary
|
|
33
30
|
}
|
|
34
31
|
});
|
|
35
|
-
|
|
36
32
|
exports.inputStyles = inputStyles;
|
|
37
33
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_colors","inputStyles","StyleSheet","create","input","paddingVertical","paddingHorizontal","backgroundColor","colors","lightGray","borderRadius","borderColor","dark","borderWidth","color","width","minHeight","inputFocusErrorState","borderStyle","red","inputFocusState","primary","exports"],"sources":["input.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport { colors } from './colors';\n\nexport const inputStyles: any = StyleSheet.create({\n input: {\n paddingVertical: 18,\n paddingHorizontal: 23,\n backgroundColor: colors.lightGray,\n borderRadius: 8,\n borderColor: colors.dark,\n borderWidth: 1,\n color: colors.dark,\n width: '100%',\n minHeight: 64,\n },\n inputFocusErrorState: {\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: colors.red,\n },\n inputFocusState: {\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: colors.primary,\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEO,MAAME,WAAgB,GAAGC,uBAAU,CAACC,MAAM,CAAC;EAChDC,KAAK,EAAE;IACLC,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAEC,cAAM,CAACC,SAAS;IACjCC,YAAY,EAAE,CAAC;IACfC,WAAW,EAAEH,cAAM,CAACI,IAAI;IACxBC,WAAW,EAAE,CAAC;IACdC,KAAK,EAAEN,cAAM,CAACI,IAAI;IAClBG,KAAK,EAAE,MAAM;IACbC,SAAS,EAAE;EACb,CAAC;EACDC,oBAAoB,EAAE;IACpBJ,WAAW,EAAE,CAAC;IACdK,WAAW,EAAE,OAAO;IACpBP,WAAW,EAAEH,cAAM,CAACW;EACtB,CAAC;EACDC,eAAe,EAAE;IACfP,WAAW,EAAE,CAAC;IACdK,WAAW,EAAE,OAAO;IACpBP,WAAW,EAAEH,cAAM,CAACa;EACtB;AACF,CAAC,CAAC;AAACC,OAAA,CAAArB,WAAA,GAAAA,WAAA"}
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.typography = void 0;
|
|
7
|
-
|
|
8
7
|
var _reactNative = require("react-native");
|
|
9
|
-
|
|
10
8
|
const typography = _reactNative.StyleSheet.create({
|
|
11
9
|
caption: {
|
|
12
10
|
fontStyle: 'normal',
|
|
@@ -15,6 +13,5 @@ const typography = _reactNative.StyleSheet.create({
|
|
|
15
13
|
lineHeight: 15
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
|
-
|
|
19
16
|
exports.typography = typography;
|
|
20
17
|
//# sourceMappingURL=typography.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","typography","StyleSheet","create","caption","fontStyle","fontWeight","fontSize","lineHeight","exports"],"sources":["typography.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const typography: any = StyleSheet.create({\n caption: {\n fontStyle: 'normal',\n fontWeight: 'normal',\n fontSize: 12,\n lineHeight: 15,\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,UAAe,GAAGC,uBAAU,CAACC,MAAM,CAAC;EAC/CC,OAAO,EAAE;IACPC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE,QAAQ;IACpBC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAACC,OAAA,CAAAR,UAAA,GAAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type { ViewStyle, ColorValue, TextStyle } from 'react-native';\n\nexport type DropdownProps = {\n placeholder?: string;\n label?: string;\n error?: string;\n helperText?: string;\n options: any[];\n optionLabel: string;\n optionValue?: string;\n onValueChange: Function;\n selectedValue?: string | any[] | null;\n isMultiple?: boolean;\n isSearchable?: boolean;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: ViewStyle;\n multipleSelectedItemStyle?: ViewStyle;\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainer?: ViewStyle;\n searchInputStyle?: ViewStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n};\n"],"mappings":""}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Pressable, Text, StyleSheet, Image, View } from 'react-native';
|
|
4
4
|
import { CHECKBOX_SIZE } from '../../constants';
|
|
5
|
-
|
|
6
5
|
const CheckBox = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
label,
|
|
@@ -31,7 +30,6 @@ const CheckBox = _ref => {
|
|
|
31
30
|
style: [checkboxLabelStyle, styles.labelStyle]
|
|
32
31
|
}, label));
|
|
33
32
|
};
|
|
34
|
-
|
|
35
33
|
const styles = StyleSheet.create({
|
|
36
34
|
checkboxContainer: {
|
|
37
35
|
flexDirection: 'row',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","Pressable","Text","StyleSheet","Image","View","CHECKBOX_SIZE","CheckBox","_ref","label","value","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","onChange","fillColor","backgroundColor","createElement","onPress","style","styles","checkboxContainer","checkbox","source","require","height","width","labelStyle","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","borderColor","marginLeft"],"sources":["index.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React from 'react';\nimport { Pressable, Text, StyleSheet, Image, View } from 'react-native';\nimport { CHECKBOX_SIZE } from '../../constants';\nimport type { CheckboxProps } from './types';\n\nconst CheckBox = ({\n label,\n value,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n onChange,\n}: CheckboxProps) => {\n const fillColor = {\n backgroundColor: value ? primaryColor || 'green' : 'white',\n };\n return (\n <Pressable\n onPress={onChange ? () => onChange(!value) : () => {}}\n style={[styles.checkboxContainer]}\n >\n <View style={[styles.checkbox, checkboxStyle, fillColor]}>\n <Image\n source={require('../../asset/check.png')}\n style={[\n {\n height: checkboxSize || CHECKBOX_SIZE,\n width: checkboxSize || CHECKBOX_SIZE,\n },\n ]}\n />\n </View>\n {label && (\n <Text style={[checkboxLabelStyle, styles.labelStyle]}>{label}</Text>\n )}\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n checkboxContainer: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n },\n checkbox: {\n padding: 4,\n borderWidth: 1,\n borderStyle: 'solid',\n borderRadius: 4,\n borderColor: 'black',\n },\n labelStyle: { marginLeft: 10 },\n});\n\nexport default CheckBox;\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,IAAI,QAAQ,cAAc;AACvE,SAASC,aAAa,QAAQ,iBAAiB;AAG/C,MAAMC,QAAQ,GAAGC,IAAA,IAQI;EAAA,IARH;IAChBC,KAAK;IACLC,KAAK;IACLC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC;EACa,CAAC,GAAAP,IAAA;EACd,MAAMQ,SAAS,GAAG;IAChBC,eAAe,EAAEP,KAAK,GAAGC,YAAY,IAAI,OAAO,GAAG;EACrD,CAAC;EACD,oBACEX,KAAA,CAAAkB,aAAA,CAACjB,SAAS;IACRkB,OAAO,EAAEJ,QAAQ,GAAG,MAAMA,QAAQ,CAAC,CAACL,KAAK,CAAC,GAAG,MAAM,CAAC,CAAE;IACtDU,KAAK,EAAE,CAACC,MAAM,CAACC,iBAAiB;EAAE,gBAElCtB,KAAA,CAAAkB,aAAA,CAACb,IAAI;IAACe,KAAK,EAAE,CAACC,MAAM,CAACE,QAAQ,EAAEV,aAAa,EAAEG,SAAS;EAAE,gBACvDhB,KAAA,CAAAkB,aAAA,CAACd,KAAK;IACJoB,MAAM,EAAEC,OAAO,CAAC,uBAAuB,CAAE;IACzCL,KAAK,EAAE,CACL;MACEM,MAAM,EAAEd,YAAY,IAAIN,aAAa;MACrCqB,KAAK,EAAEf,YAAY,IAAIN;IACzB,CAAC;EACD,EACF,CACG,EACNG,KAAK,iBACJT,KAAA,CAAAkB,aAAA,CAAChB,IAAI;IAACkB,KAAK,EAAE,CAACN,kBAAkB,EAAEO,MAAM,CAACO,UAAU;EAAE,GAAEnB,KAAK,CAC7D,CACS;AAEhB,CAAC;AAED,MAAMY,MAAM,GAAGlB,UAAU,CAAC0B,MAAM,CAAC;EAC/BP,iBAAiB,EAAE;IACjBQ,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACDT,QAAQ,EAAE;IACRU,OAAO,EAAE,CAAC;IACVC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE;EACf,CAAC;EACDT,UAAU,EAAE;IAAEU,UAAU,EAAE;EAAG;AAC/B,CAAC,CAAC;AAEF,eAAe/B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue, ViewStyle, TextStyle } from 'react-native';\n\nexport type CheckboxProps = {\n label?: string;\n value?: boolean;\n primaryColor?: ColorValue;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n onChange?: (value: boolean | string | number) => void;\n};\n"],"mappings":""}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Modal, TouchableOpacity, SafeAreaView, StyleSheet } from 'react-native';
|
|
3
3
|
import { colors } from '../../styles/colors';
|
|
4
|
-
|
|
5
4
|
const CustomModal = _ref => {
|
|
6
5
|
let {
|
|
7
6
|
open,
|
|
@@ -23,7 +22,6 @@ const CustomModal = _ref => {
|
|
|
23
22
|
style: [styles.modalOptionsContainer, modalOptionsContainerStyle]
|
|
24
23
|
}, children)));
|
|
25
24
|
};
|
|
26
|
-
|
|
27
25
|
const styles = StyleSheet.create({
|
|
28
26
|
modalContainer: {
|
|
29
27
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","Modal","TouchableOpacity","SafeAreaView","StyleSheet","colors","CustomModal","_ref","open","handleToggleModal","onRequestClose","modalBackgroundStyle","modalOptionsContainerStyle","children","createElement","transparent","visible","animationType","onPress","style","styles","modalContainer","modalOptionsContainer","create","flex","justifyContent","backgroundColor","maxHeight","white","borderTopLeftRadius","borderTopRightRadius"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Modal,\n TouchableOpacity,\n SafeAreaView,\n StyleSheet,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\n\nconst CustomModal = ({\n open,\n handleToggleModal,\n onRequestClose,\n modalBackgroundStyle,\n modalOptionsContainerStyle,\n children,\n}: any) => {\n return (\n <Modal\n transparent={true}\n visible={open}\n onRequestClose={() => onRequestClose()}\n animationType=\"fade\"\n >\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n style={[\n styles.modalContainer,\n styles.modalBackgroundStyle,\n modalBackgroundStyle,\n ]}\n >\n <SafeAreaView\n style={[styles.modalOptionsContainer, modalOptionsContainerStyle]}\n >\n {children}\n </SafeAreaView>\n </TouchableOpacity>\n </Modal>\n );\n};\n\nconst styles = StyleSheet.create({\n modalContainer: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n modalBackgroundStyle: { backgroundColor: 'rgba(0, 0, 0, 0.5)' },\n modalOptionsContainer: {\n maxHeight: '50%',\n backgroundColor: colors.white,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n },\n});\n\nexport default CustomModal;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,KAAK,EACLC,gBAAgB,EAChBC,YAAY,EACZC,UAAU,QACL,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,MAAMC,WAAW,GAAGC,IAAA,IAOT;EAAA,IAPU;IACnBC,IAAI;IACJC,iBAAiB;IACjBC,cAAc;IACdC,oBAAoB;IACpBC,0BAA0B;IAC1BC;EACG,CAAC,GAAAN,IAAA;EACJ,oBACEP,KAAA,CAAAc,aAAA,CAACb,KAAK;IACJc,WAAW,EAAE,IAAK;IAClBC,OAAO,EAAER,IAAK;IACdE,cAAc,EAAEA,CAAA,KAAMA,cAAc,EAAG;IACvCO,aAAa,EAAC;EAAM,gBAEpBjB,KAAA,CAAAc,aAAA,CAACZ,gBAAgB;IACfgB,OAAO,EAAEA,CAAA,KAAMT,iBAAiB,EAAG;IACnCU,KAAK,EAAE,CACLC,MAAM,CAACC,cAAc,EACrBD,MAAM,CAACT,oBAAoB,EAC3BA,oBAAoB;EACpB,gBAEFX,KAAA,CAAAc,aAAA,CAACX,YAAY;IACXgB,KAAK,EAAE,CAACC,MAAM,CAACE,qBAAqB,EAAEV,0BAA0B;EAAE,GAEjEC,QAAQ,CACI,CACE,CACb;AAEZ,CAAC;AAED,MAAMO,MAAM,GAAGhB,UAAU,CAACmB,MAAM,CAAC;EAC/BF,cAAc,EAAE;IACdG,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB,CAAC;EACDd,oBAAoB,EAAE;IAAEe,eAAe,EAAE;EAAqB,CAAC;EAC/DJ,qBAAqB,EAAE;IACrBK,SAAS,EAAE,KAAK;IAChBD,eAAe,EAAErB,MAAM,CAACuB,KAAK;IAC7BC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE;EACxB;AACF,CAAC,CAAC;AAEF,eAAexB,WAAW"}
|
|
@@ -3,7 +3,6 @@ import { View, Text, StyleSheet } from 'react-native';
|
|
|
3
3
|
import SelectedItemsView from './SelectedItemsView';
|
|
4
4
|
import { colors } from '../../styles/colors';
|
|
5
5
|
import { typography } from '../../styles/typography';
|
|
6
|
-
|
|
7
6
|
const Dropdown = _ref => {
|
|
8
7
|
let {
|
|
9
8
|
label,
|
|
@@ -50,7 +49,6 @@ const Dropdown = _ref => {
|
|
|
50
49
|
style: [styles.helper, dropdownHelperTextStyle]
|
|
51
50
|
}, helperText));
|
|
52
51
|
};
|
|
53
|
-
|
|
54
52
|
const styles = StyleSheet.create({
|
|
55
53
|
label: {
|
|
56
54
|
marginBottom: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","View","Text","StyleSheet","SelectedItemsView","colors","typography","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","labelStyle","dropdownStyle","dropdownContainerStyle","selectedItemStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","createElement","style","styles","dropdownInputContainer","helper","create","marginBottom","color","gray","caption","inputFocusErrorState","borderWidth","borderStyle","borderColor","red","marginTop","primary","width","blackText","black"],"sources":["Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, StyleSheet } from 'react-native';\nimport SelectedItemsView from './SelectedItemsView';\nimport { colors } from '../../styles/colors';\nimport { typography } from '../../styles/typography';\n\nconst Dropdown = ({\n label,\n placeholder,\n helperText,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n labelStyle,\n dropdownStyle,\n dropdownContainerStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n primaryColor,\n disabled,\n}: any) => {\n return (\n <View style={[styles.dropdownInputContainer, dropdownContainerStyle]}>\n {label && label !== '' && (\n <Text style={[styles.label, labelStyle]}>{label}</Text>\n )}\n <SelectedItemsView\n placeholder={placeholder}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n handleToggleModal={handleToggleModal}\n isMultiple={isMultiple}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n dropdownStyle={dropdownStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n primaryColor={primaryColor}\n disabled={disabled}\n />\n\n {error && error !== '' && (\n <Text style={[styles.error, dropdownErrorTextStyle]}>{error}</Text>\n )}\n\n {helperText && helperText !== '' && !error && (\n <Text style={[styles.helper, dropdownHelperTextStyle]}>\n {helperText}\n </Text>\n )}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n label: { marginBottom: 16, color: colors.gray, ...typography.caption },\n inputFocusErrorState: {\n borderWidth: 2,\n borderStyle: 'solid',\n borderColor: colors.red,\n },\n error: { color: colors.red, marginTop: 8, ...typography.caption },\n helper: { marginTop: 8, color: colors.primary, ...typography.caption },\n dropdownInputContainer: { marginBottom: 23, width: '100%' },\n blackText: { color: colors.black },\n});\n\nexport default Dropdown;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,MAAMC,QAAQ,GAAGC,IAAA,IAoBN;EAAA,IApBO;IAChBC,KAAK;IACLC,WAAW;IACXC,UAAU;I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E,CAACC,MAAM,CAACE,MAAM,EAAEP,uBAAuB;EAAE,GACnDd,UAAU,CAEd,CACI;AAEX,CAAC;AAED,MAAMmB,MAAM,GAAG3B,UAAU,CAAC8B,MAAM,CAAC;EAC/BxB,KAAK,EAAE;IAAEyB,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAE9B,MAAM,CAAC+B,IAAI;IAAE,GAAG9B,UAAU,CAAC+B;EAAQ,CAAC;EACtEC,oBAAoB,EAAE;IACpBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,WAAW,EAAEpC,MAAM,CAACqC;EACtB,CAAC;EACD9B,KAAK,EAAE;IAAEuB,KAAK,EAAE9B,MAAM,CAACqC,GAAG;IAAEC,SAAS,EAAE,CAAC;IAAE,GAAGrC,UAAU,CAAC+B;EAAQ,CAAC;EACjEL,MAAM,EAAE;IAAEW,SAAS,EAAE,CAAC;IAAER,KAAK,EAAE9B,MAAM,CAACuC,OAAO;IAAE,GAAGtC,UAAU,CAAC+B;EAAQ,CAAC;EACtEN,sBAAsB,EAAE;IAAEG,YAAY,EAAE,EAAE;IAAEW,KAAK,EAAE;EAAO,CAAC;EAC3DC,SAAS,EAAE;IAAEX,KAAK,EAAE9B,MAAM,CAAC0C;EAAM;AACnC,CAAC,CAAC;AAEF,eAAexC,QAAQ"}
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { View, FlatList, StyleSheet, Text } from 'react-native';
|
|
3
3
|
import DropdownListItem from './DropdownListItem';
|
|
4
4
|
import { colors } from '../../styles/colors';
|
|
5
|
-
|
|
6
5
|
const DropdownList = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
options,
|
|
@@ -42,7 +41,6 @@ const DropdownList = _ref => {
|
|
|
42
41
|
keyExtractor: (_item, index) => `Options${index}`
|
|
43
42
|
});
|
|
44
43
|
};
|
|
45
|
-
|
|
46
44
|
const _renderItem = (_ref2, props) => {
|
|
47
45
|
let {
|
|
48
46
|
item
|
|
@@ -60,7 +58,6 @@ const _renderItem = (_ref2, props) => {
|
|
|
60
58
|
checkboxLabelStyle: props.checkboxLabelStyle
|
|
61
59
|
});
|
|
62
60
|
};
|
|
63
|
-
|
|
64
61
|
const styles = StyleSheet.create({
|
|
65
62
|
modalContainer: {
|
|
66
63
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","View","FlatList","StyleSheet","Text","DropdownListItem","colors","DropdownList","_ref","options","optionLabel","optionValue","isMultiple","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","createElement","data","extraData","initialNumToRender","ListEmptyComponent","style","styles","emptyListStyle","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","index","_ref2","props","create","modalContainer","flex","justifyContent","modalBackgroundStyle","backgroundColor","modalOptionsContainer","maxHeight","white","borderTopLeftRadius","borderTopRightRadius","gray","height","opacity","alignItems","width","marginVertical"],"sources":["DropdownList.tsx"],"sourcesContent":["import React from 'react';\nimport { View, FlatList, StyleSheet, Text } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport { colors } from '../../styles/colors';\n\nconst DropdownList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n}: any) => {\n return (\n <FlatList\n data={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <View style={styles.emptyListStyle}>\n <Text>No options available</Text>\n </View>\n }\n ItemSeparatorComponent={() => <View style={styles.itemSeparatorStyle} />}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n })\n }\n keyExtractor={(_item, index) => `Options${index}`}\n />\n );\n};\n\nconst _renderItem = ({ item }: any, props: any) => {\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n modalContainer: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n modalBackgroundStyle: { backgroundColor: 'rgba(0, 0, 0, 0.5)' },\n modalOptionsContainer: {\n maxHeight: '50%',\n backgroundColor: colors.white,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n },\n itemSeparatorStyle: {\n backgroundColor: colors.gray,\n height: 1,\n opacity: 0.15,\n },\n emptyListStyle: { alignItems: 'center', width: '100%', marginVertical: 20 },\n});\n\nexport default DropdownList;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,MAAMC,YAAY,GAAGC,IAAA,IAaV;EAAA,IAbW;IACpBC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,aAAa;IACbC,YAAY;IACZC,wBAAwB;IACxBC,qBAAqB;IACrBC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC;EACG,CAAC,GAAAZ,IAAA;EACJ,oBACER,KAAA,CAAAqB,aAAA,CAACnB,QAAQ;IACPoB,IAAI,EAAEb,OAAQ;IACdc,SAAS,EAAEX,UAAU,GAAGC,aAAa,GAAGC,YAAa;IACrDU,kBAAkB,EAAE,CAA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,MAAM,GAAGxB,UAAU,CAACsC,MAAM,CAAC;EAC/BC,cAAc,EAAE;IACdC,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB,CAAC;EACDC,oBAAoB,EAAE;IAAEC,eAAe,EAAE;EAAqB,CAAC;EAC/DC,qBAAqB,EAAE;IACrBC,SAAS,EAAE,KAAK;IAChBF,eAAe,EAAExC,MAAM,CAAC2C,KAAK;IAC7BC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE;EACxB,CAAC;EACDrB,kBAAkB,EAAE;IAClBgB,eAAe,EAAExC,MAAM,CAAC8C,IAAI;IAC5BC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE;EACX,CAAC;EACD1B,cAAc,EAAE;IAAE2B,UAAU,EAAE,QAAQ;IAAEC,KAAK,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAG;AAC5E,CAAC,CAAC;AAEF,eAAelD,YAAY"}
|
|
@@ -2,7 +2,6 @@ import React, { memo } from 'react';
|
|
|
2
2
|
import { TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
3
|
import CheckBox from '../CheckBox';
|
|
4
4
|
import { colors } from '../../styles/colors';
|
|
5
|
-
|
|
6
5
|
const DropdownListItem = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
item,
|
|
@@ -16,13 +15,13 @@ const DropdownListItem = _ref => {
|
|
|
16
15
|
checkboxStyle,
|
|
17
16
|
checkboxLabelStyle
|
|
18
17
|
} = _ref;
|
|
19
|
-
const selectedOptionValue = optionValue
|
|
18
|
+
const selectedOptionValue = optionValue ?? 'value';
|
|
20
19
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
21
20
|
style: styles.modalOptions,
|
|
22
21
|
onPress: () => onChange(item[selectedOptionValue])
|
|
23
22
|
}, /*#__PURE__*/React.createElement(CheckBox, {
|
|
24
23
|
value: isMultiple ? selectedOption.includes(item[selectedOptionValue]) : [selectedOption].includes(item[selectedOptionValue]),
|
|
25
|
-
label: item[optionLabel
|
|
24
|
+
label: item[optionLabel ?? ''],
|
|
26
25
|
onChange: () => onChange(item[selectedOptionValue]),
|
|
27
26
|
primaryColor: primaryColor || colors.primary,
|
|
28
27
|
checkboxSize: checkboxSize,
|
|
@@ -30,7 +29,6 @@ const DropdownListItem = _ref => {
|
|
|
30
29
|
checkboxLabelStyle: checkboxLabelStyle
|
|
31
30
|
}));
|
|
32
31
|
};
|
|
33
|
-
|
|
34
32
|
const styles = StyleSheet.create({
|
|
35
33
|
modalOptions: {
|
|
36
34
|
paddingHorizontal: 20,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","memo","TouchableOpacity","StyleSheet","CheckBox","colors","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","selectedOptionValue","createElement","style","styles","modalOptions","onPress","value","includes","label","primary","create","paddingHorizontal","paddingVertical","flexDirection","alignItems"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\nimport { colors } from '../../styles/colors';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n}: any) => {\n const selectedOptionValue = optionValue ?? 'value';\n return (\n <TouchableOpacity\n style={styles.modalOptions}\n onPress={() => onChange(item[selectedOptionValue])}\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[selectedOptionValue])\n : [selectedOption].includes(item[selectedOptionValue])\n }\n label={item[optionLabel ?? '']}\n onChange={() => onChange(item[selectedOptionValue])}\n primaryColor={primaryColor || colors.primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n modalOptions: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AAC3D,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,MAAM,QAAQ,qBAAqB;AAE5C,MAAMC,gBAAgB,GAAGC,IAAA,IAWd;EAAA,IAXe;IACxBC,IAAI;IACJC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,cAAc;IACdC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC;EACG,CAAC,GAAAV,IAAA;EACJ,MAAMW,mBAAmB,GAAGR,WAAW,IAAI,OAAO;EAClD,oBACEV,KAAA,CAAAmB,aAAA,CAACjB,gBAAgB;IACfkB,KAAK,EAAEC,MAAM,CAACC,YAAa;IAC3BC,OAAO,EAAEA,CAAA,KAAMV,QAAQ,CAACL,IAAI,CAACU,mBAAmB,CAAC;EAAE,gBAEnDlB,KAAA,CAAAmB,aAAA,CAACf,QAAQ;IACPoB,KAAK,EACHb,UAAU,GACNC,cAAc,CAACa,QAAQ,CAACjB,IAAI,CAACU,mBAAmB,CAAC,CAAC,GAClD,CAACN,cAAc,CAAC,CAACa,QAAQ,CAACjB,IAAI,CAACU,mBAAmB,CAAC,CACxD;IACDQ,KAAK,EAAElB,IAAI,CAACC,WAAW,IAAI,EAAE,CAAE;IAC/BI,QAAQ,EAAEA,CAAA,KAAMA,QAAQ,CAACL,IAAI,CAACU,mBAAmB,CAAC,CAAE;IACpDJ,YAAY,EAAEA,YAAY,IAAIT,MAAM,CAACsB,OAAQ;IAC7CZ,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA;EAAmB,EACvC,CACe;AAEvB,CAAC;AAED,MAAMI,MAAM,GAAGlB,UAAU,CAACyB,MAAM,CAAC;EAC/BN,YAAY,EAAE;IACZO,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,4BAAe/B,IAAI,CAACK,gBAAgB,CAAC"}
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { View, Text, Pressable, ScrollView, StyleSheet, Image, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { colors } from '../../styles/colors';
|
|
4
4
|
import { inputStyles } from '../../styles/input';
|
|
5
|
-
|
|
6
5
|
const SelectedItemsView = _ref => {
|
|
7
6
|
let {
|
|
8
7
|
placeholder,
|
|
@@ -25,10 +24,13 @@ const SelectedItemsView = _ref => {
|
|
|
25
24
|
let {
|
|
26
25
|
pressed
|
|
27
26
|
} = _ref2;
|
|
28
|
-
return [pressed && {
|
|
27
|
+
return [pressed && {
|
|
28
|
+
...inputStyles.inputFocusState,
|
|
29
29
|
borderColor: primaryColor
|
|
30
|
-
}, inputStyles.input, dropdownStyle, error &&
|
|
31
|
-
|
|
30
|
+
}, inputStyles.input, dropdownStyle, error &&
|
|
31
|
+
//this must be last
|
|
32
|
+
error !== '' && !pressed && {
|
|
33
|
+
...inputStyles.inputFocusErrorState,
|
|
32
34
|
...dropdownErrorStyle
|
|
33
35
|
}];
|
|
34
36
|
},
|
|
@@ -55,13 +57,12 @@ const SelectedItemsView = _ref => {
|
|
|
55
57
|
style: [styles.blackText, selectedItemStyle]
|
|
56
58
|
}, getSelectedItemsLabel()))), !selectedItem && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) === 0 && /*#__PURE__*/React.createElement(Text, {
|
|
57
59
|
style: styles.blackText
|
|
58
|
-
}, placeholder
|
|
60
|
+
}, placeholder ?? 'Select an option')), /*#__PURE__*/React.createElement(View, {
|
|
59
61
|
style: styles.iconStyle
|
|
60
62
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
61
63
|
source: require('../../asset/arrow-down.png')
|
|
62
64
|
})));
|
|
63
65
|
};
|
|
64
|
-
|
|
65
66
|
const styles = StyleSheet.create({
|
|
66
67
|
iconStyle: {
|
|
67
68
|
position: 'absolute',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","View","Text","Pressable","ScrollView","StyleSheet","Image","TouchableOpacity","colors","inputStyles","SelectedItemsView","_ref","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownStyle","selectedItemStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","createElement","onPress","style","_ref2","pressed","inputFocusState","borderColor","input","inputFocusErrorState","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","styles","selectedItemsContainer","onStartShouldSetResponder","map","item","i","key","Math","random","backgroundColor","blackText","length","iconStyle","source","require","create","position","right","top","flexDirection","flexWrap","color","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","black"],"sources":["SelectedItemsView.tsx"],"sourcesContent":["import React from 'react';\nimport {\n View,\n Text,\n Pressable,\n ScrollView,\n StyleSheet,\n Image,\n TouchableOpacity,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\nimport { inputStyles } from '../../styles/input';\n\nconst SelectedItemsView = ({\n placeholder,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n dropdownStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n primaryColor,\n disabled,\n}: any) => {\n return (\n <Pressable\n onPress={() => handleToggleModal()}\n style={({ pressed }) => [\n pressed && {\n ...inputStyles.inputFocusState,\n borderColor: primaryColor,\n },\n inputStyles.input,\n dropdownStyle,\n error && //this must be last\n error !== '' &&\n !pressed && {\n ...inputStyles.inputFocusErrorState,\n ...dropdownErrorStyle,\n },\n ]}\n disabled={disabled}\n >\n <ScrollView\n horizontal\n alwaysBounceHorizontal\n showsHorizontalScrollIndicator={false}\n >\n <View\n style={styles.selectedItemsContainer}\n onStartShouldSetResponder={() => true}\n >\n {isMultiple ? (\n getSelectedItemsLabel().map((item: any, i: Number) => (\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n key={`react-native-input-select-${Math.random()}-${i}`}\n disabled={disabled}\n >\n <Text\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n >\n {item}\n </Text>\n </TouchableOpacity>\n ))\n ) : (\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n disabled={disabled}\n >\n <Text style={[styles.blackText, selectedItemStyle]}>\n {getSelectedItemsLabel()}\n </Text>\n </TouchableOpacity>\n )}\n </View>\n\n {!selectedItem && selectedItems?.length === 0 && (\n <Text style={styles.blackText}>\n {placeholder ?? 'Select an option'}\n </Text>\n )}\n </ScrollView>\n <View style={styles.iconStyle}>\n <Image source={require('../../asset/arrow-down.png')} />\n </View>\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: { flexDirection: 'row', flexWrap: 'nowrap' },\n selectedItems: {\n color: colors.white,\n paddingHorizontal: 10,\n paddingVertical: 5,\n borderRadius: 10,\n backgroundColor: colors.primary,\n marginRight: 10,\n },\n blackText: { color: colors.black },\n});\n\nexport default SelectedItemsView;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,IAAI,EACJC,IAAI,EACJC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,gBAAgB,QACX,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,MAAMC,iBAAiB,GAAGC,IAAA,IAcf;EAAA,IAdgB;IACzBC,WAAW;IACXC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,aAAa;IACbC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,eAAevD,iBAAiB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
import React, { useState } from 'react';
|
|
4
3
|
import { TextInput, StyleSheet, View } from 'react-native';
|
|
5
4
|
import { inputStyles } from '../../styles/input';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["React","useState","TextInput","StyleSheet","View","inputStyles","Input","_ref","placeholder","value","onChangeText","style","primaryColor","rest","isFocused","setFocus","createElement","styles","container","_extends","input","inputFocusState","borderColor","onFocus","onBlur","create","margin"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TextInput, StyleSheet, View } from 'react-native';\nimport { inputStyles } from '../../styles/input';\n\nexport const Input = ({\n placeholder,\n value,\n onChangeText,\n style,\n primaryColor,\n ...rest\n}: any) => {\n const [isFocused, setFocus] = useState(false);\n\n return (\n <View style={styles.container}>\n <TextInput\n placeholder={placeholder}\n style={[\n inputStyles.input,\n isFocused &&\n inputStyles.inputFocusState && { borderColor: primaryColor },\n style,\n ]}\n onFocus={() => {\n setFocus(true);\n }}\n onBlur={() => setFocus(false)}\n value={value}\n onChangeText={onChangeText}\n {...rest}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { margin: 23 },\n});\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC1D,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,OAAO,MAAMC,KAAK,GAAGC,IAAA,IAOV;EAAA,IAPW;IACpBC,WAAW;IACXC,KAAK;IACLC,YAAY;IACZC,KAAK;IACLC,YAAY;IACZ,GAAGC;EACA,CAAC,GAAAN,IAAA;EACJ,MAAM,CAACO,SAAS,EAAEC,QAAQ,CAAC,GAAGd,QAAQ,CAAC,KAAK,CAAC;EAE7C,oBACED,KAAA,CAAAgB,aAAA,CAACZ,IAAI;IAACO,KAAK,EAAEM,MAAM,CAACC;EAAU,gBAC5BlB,KAAA,CAAAgB,aAAA,CAACd,SAAS,EAAAiB,QAAA;IACRX,WAAW,EAAEA,WAAY;IACzBG,KAAK,EAAE,CACLN,WAAW,CAACe,KAAK,EACjBN,SAAS,IACPT,WAAW,CAACgB,eAAe,IAAI;MAAEC,WAAW,EAAEV;IAAa,CAAC,EAC9DD,KAAK,CACL;IACFY,OAAO,EAAEA,CAAA,KAAM;MACbR,QAAQ,CAAC,IAAI,CAAC;IAChB,CAAE;IACFS,MAAM,EAAEA,CAAA,KAAMT,QAAQ,CAAC,KAAK,CAAE;IAC9BN,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA;EAAa,GACvBG,IAAI,EACR,CACG;AAEX,CAAC;AAED,MAAMI,MAAM,GAAGd,UAAU,CAACsB,MAAM,CAAC;EAC/BP,SAAS,EAAE;IAAEQ,MAAM,EAAE;EAAG;AAC1B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","CHECKBOX_SIZE"],"sources":["index.ts"],"sourcesContent":["export const DEFAULT_OPTION_LABEL = 'label';\nexport const DEFAULT_OPTION_VALUE = 'value';\nexport const CHECKBOX_SIZE = 14;\n"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG,OAAO;AAC3C,OAAO,MAAMC,oBAAoB,GAAG,OAAO;AAC3C,OAAO,MAAMC,aAAa,GAAG,EAAE"}
|